From 0514d155fa59341374406b9d1ed365b0a60310c8 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Fri, 15 Sep 2023 11:55:43 +0800 Subject: [PATCH 01/28] Validate new email addresses #9866 --- library/Zend/Validate/Hostname.php | 682 +++++++++++++++++++-------- tests/Zend/Validate/HostnameTest.php | 2 +- 2 files changed, 494 insertions(+), 190 deletions(-) diff --git a/library/Zend/Validate/Hostname.php b/library/Zend/Validate/Hostname.php index bde0a3dd..32bc24fe 100644 --- a/library/Zend/Validate/Hostname.php +++ b/library/Zend/Validate/Hostname.php @@ -115,16 +115,20 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract */ protected $_validTlds = [ 'aaa', + 'aarp', 'abb', 'abbott', + 'abbvie', + 'abc', + 'able', 'abogado', + 'abudhabi', 'ac', 'academy', 'accenture', 'accountant', 'accountants', 'aco', - 'active', 'actor', 'ad', 'ads', @@ -132,67 +136,109 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'ae', 'aeg', 'aero', + 'aetna', 'af', 'afl', + 'africa', 'ag', + 'agakhan', 'agency', 'ai', 'aig', + 'airbus', 'airforce', 'airtel', + 'akdn', 'al', + 'alibaba', + 'alipay', 'allfinanz', + 'allstate', + 'ally', 'alsace', + 'alstom', 'am', + 'amazon', + 'americanexpress', + 'americanfamily', + 'amex', + 'amfam', 'amica', 'amsterdam', + 'analytics', 'android', + 'anquan', + 'anz', 'ao', + 'aol', 'apartments', 'app', + 'apple', 'aq', 'aquarelle', 'ar', + 'arab', 'aramco', 'archi', 'army', 'arpa', + 'art', 'arte', 'as', + 'asda', 'asia', 'associates', 'at', + 'athleta', 'attorney', 'au', 'auction', + 'audi', + 'audible', 'audio', + 'auspost', + 'author', 'auto', 'autos', + 'avianca', 'aw', + 'aws', 'ax', 'axa', 'az', 'azure', 'ba', + 'baby', + 'baidu', + 'banamex', + 'bananarepublic', 'band', 'bank', 'bar', 'barcelona', 'barclaycard', 'barclays', + 'barefoot', 'bargains', + 'baseball', + 'basketball', 'bauhaus', 'bayern', 'bb', 'bbc', + 'bbt', 'bbva', + 'bcg', 'bcn', 'bd', 'be', + 'beats', + 'beauty', 'beer', 'bentley', 'berlin', 'best', + 'bestbuy', 'bet', 'bf', 'bg', @@ -209,33 +255,43 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'bj', 'black', 'blackfriday', + 'blockbuster', + 'blog', 'bloomberg', 'blue', 'bm', 'bms', 'bmw', 'bn', - 'bnl', 'bnpparibas', 'bo', 'boats', + 'boehringer', + 'bofa', 'bom', 'bond', 'boo', - 'boots', + 'book', + 'booking', + 'bosch', + 'bostik', + 'boston', + 'bot', 'boutique', + 'box', 'br', 'bradesco', 'bridgestone', + 'broadway', 'broker', 'brother', 'brussels', 'bs', 'bt', - 'budapest', 'build', 'builders', 'business', + 'buy', 'buzz', 'bv', 'bw', @@ -246,12 +302,15 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'cab', 'cafe', 'cal', + 'call', + 'calvinklein', + 'cam', 'camera', 'camp', - 'cancerresearch', 'canon', 'capetown', 'capital', + 'capitalone', 'car', 'caravan', 'cards', @@ -259,17 +318,19 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'career', 'careers', 'cars', - 'cartier', 'casa', + 'case', 'cash', 'casino', 'cat', 'catering', + 'catholic', 'cba', 'cbn', + 'cbre', + 'cbs', 'cc', 'cd', - 'ceb', 'center', 'ceo', 'cern', @@ -280,23 +341,30 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'ch', 'chanel', 'channel', + 'charity', + 'chase', 'chat', 'cheap', - 'chloe', + 'chintai', 'christmas', 'chrome', 'church', 'ci', 'cipriani', + 'circle', 'cisco', + 'citadel', + 'citi', 'citic', 'city', + 'cityeats', 'ck', 'cl', 'claims', 'cleaning', 'click', 'clinic', + 'clinique', 'clothing', 'cloud', 'club', @@ -310,29 +378,36 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'college', 'cologne', 'com', + 'comcast', 'commbank', 'community', 'company', + 'compare', 'computer', + 'comsec', 'condos', 'construction', 'consulting', + 'contact', 'contractors', 'cooking', 'cool', 'coop', 'corsica', 'country', + 'coupon', 'coupons', 'courses', + 'cpa', 'cr', 'credit', 'creditcard', + 'creditunion', 'cricket', 'crown', 'crs', + 'cruise', 'cruises', - 'csc', 'cu', 'cuisinella', 'cv', @@ -345,16 +420,21 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'dabur', 'dad', 'dance', + 'data', 'date', 'dating', 'datsun', 'day', 'dclk', + 'dds', 'de', + 'deal', + 'dealer', 'deals', 'degree', 'delivery', 'dell', + 'deloitte', 'delta', 'democrat', 'dental', @@ -362,30 +442,41 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'desi', 'design', 'dev', + 'dhl', 'diamonds', 'diet', 'digital', 'direct', 'directory', 'discount', + 'discover', + 'dish', + 'diy', 'dj', 'dk', 'dm', 'dnp', 'do', 'docs', + 'doctor', 'dog', - 'doha', 'domains', - 'doosan', + 'dot', 'download', 'drive', + 'dtv', + 'dubai', + 'dunlop', + 'dupont', 'durban', 'dvag', + 'dvr', 'dz', 'earth', 'eat', 'ec', + 'eco', + 'edeka', 'edu', 'education', 'ee', @@ -399,34 +490,46 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'epson', 'equipment', 'er', + 'ericsson', 'erni', 'es', 'esq', 'estate', 'et', + 'etisalat', 'eu', 'eurovision', 'eus', 'events', - 'everbank', 'exchange', 'expert', 'exposed', 'express', + 'extraspace', 'fage', 'fail', + 'fairwinds', 'faith', 'family', 'fan', 'fans', 'farm', + 'farmers', 'fashion', + 'fast', + 'fedex', 'feedback', + 'ferrari', + 'ferrero', 'fi', + 'fidelity', + 'fido', 'film', 'final', 'finance', 'financial', + 'fire', + 'firestone', 'firmdale', 'fish', 'fishing', @@ -434,22 +537,33 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'fitness', 'fj', 'fk', + 'flickr', 'flights', + 'flir', 'florist', 'flowers', - 'flsmidth', 'fly', 'fm', 'fo', 'foo', + 'food', 'football', + 'ford', 'forex', 'forsale', 'forum', 'foundation', + 'fox', 'fr', + 'free', + 'fresenius', 'frl', 'frogans', + 'frontdoor', + 'frontier', + 'ftr', + 'fujitsu', + 'fun', 'fund', 'furniture', 'futbol', @@ -457,8 +571,13 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'ga', 'gal', 'gallery', + 'gallo', + 'gallup', 'game', + 'games', + 'gap', 'garden', + 'gay', 'gb', 'gbiz', 'gd', @@ -467,6 +586,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'gea', 'gent', 'genting', + 'george', 'gf', 'gg', 'ggee', @@ -483,28 +603,35 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'globo', 'gm', 'gmail', + 'gmbh', 'gmo', 'gmx', 'gn', + 'godaddy', 'gold', 'goldpoint', 'golf', 'goo', + 'goodyear', 'goog', 'google', 'gop', + 'got', 'gov', 'gp', 'gq', 'gr', + 'grainger', 'graphics', 'gratis', 'green', 'gripe', + 'grocery', 'group', 'gs', 'gt', 'gu', + 'guardian', 'gucci', 'guge', 'guide', @@ -512,29 +639,41 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'guru', 'gw', 'gy', + 'hair', 'hamburg', 'hangout', 'haus', + 'hbo', + 'hdfc', + 'hdfcbank', + 'health', 'healthcare', 'help', + 'helsinki', 'here', 'hermes', 'hiphop', + 'hisamitsu', 'hitachi', 'hiv', 'hk', + 'hkt', 'hm', 'hn', 'hockey', 'holdings', 'holiday', 'homedepot', + 'homegoods', 'homes', + 'homesense', 'honda', 'horse', + 'hospital', 'host', 'hosting', - 'hoteles', + 'hot', + 'hotels', 'hotmail', 'house', 'how', @@ -542,6 +681,8 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'hsbc', 'ht', 'hu', + 'hughes', + 'hyatt', 'hyundai', 'ibm', 'icbc', @@ -549,22 +690,28 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'icu', 'id', 'ie', + 'ieee', 'ifm', - 'iinet', + 'ikano', 'il', 'im', + 'imamat', + 'imdb', 'immo', 'immobilien', 'in', + 'inc', 'industries', 'infiniti', 'info', 'ing', 'ink', 'institute', + 'insurance', 'insure', 'int', 'international', + 'intuit', 'investments', 'io', 'ipiranga', @@ -572,56 +719,78 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'ir', 'irish', 'is', + 'ismaili', 'ist', 'istanbul', 'it', 'itau', - 'iwc', + 'itv', 'jaguar', 'java', 'jcb', 'je', + 'jeep', 'jetzt', 'jewelry', - 'jlc', + 'jio', 'jll', 'jm', + 'jmp', + 'jnj', 'jo', 'jobs', 'joburg', + 'jot', + 'joy', 'jp', + 'jpmorgan', 'jprs', 'juegos', + 'juniper', 'kaufen', 'kddi', 'ke', + 'kerryhotels', + 'kerrylogistics', + 'kerryproperties', + 'kfh', 'kg', 'kh', 'ki', 'kia', + 'kids', 'kim', 'kinder', + 'kindle', 'kitchen', 'kiwi', 'km', 'kn', 'koeln', 'komatsu', + 'kosher', 'kp', + 'kpmg', + 'kpn', 'kr', 'krd', 'kred', + 'kuokgroup', 'kw', 'ky', 'kyoto', 'kz', 'la', 'lacaixa', + 'lamborghini', + 'lamer', 'lancaster', 'land', 'landrover', + 'lanxess', 'lasalle', 'lat', + 'latino', 'latrobe', 'law', 'lawyer', @@ -630,35 +799,47 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'lds', 'lease', 'leclerc', + 'lefrak', 'legal', + 'lego', 'lexus', 'lgbt', 'li', - 'liaison', 'lidl', 'life', + 'lifeinsurance', + 'lifestyle', 'lighting', + 'like', + 'lilly', 'limited', 'limo', - 'linde', + 'lincoln', 'link', + 'lipsy', 'live', - 'lixil', + 'living', 'lk', + 'llc', + 'llp', 'loan', 'loans', + 'locker', + 'locus', 'lol', 'london', 'lotte', 'lotto', 'love', + 'lpl', + 'lplfinancial', 'lr', 'ls', 'lt', 'ltd', 'ltda', 'lu', - 'lupin', + 'lundbeck', 'luxe', 'luxury', 'lv', @@ -667,17 +848,23 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'madrid', 'maif', 'maison', + 'makeup', 'man', 'management', 'mango', + 'map', 'market', 'marketing', 'markets', 'marriott', + 'marshalls', + 'mattel', 'mba', 'mc', + 'mckinsey', 'md', 'me', + 'med', 'media', 'meet', 'melbourne', @@ -685,75 +872,95 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'memorial', 'men', 'menu', + 'merckmsd', 'mg', 'mh', 'miami', 'microsoft', 'mil', 'mini', + 'mint', + 'mit', + 'mitsubishi', 'mk', 'ml', + 'mlb', + 'mls', 'mm', 'mma', 'mn', 'mo', 'mobi', + 'mobile', 'moda', 'moe', 'moi', 'mom', 'monash', 'money', - 'montblanc', + 'monster', 'mormon', 'mortgage', 'moscow', + 'moto', 'motorcycles', 'mov', 'movie', - 'movistar', 'mp', 'mq', 'mr', 'ms', + 'msd', 'mt', 'mtn', - 'mtpc', 'mtr', 'mu', 'museum', - 'mutuelle', + 'music', 'mv', 'mw', 'mx', 'my', 'mz', 'na', - 'nadex', + 'nab', 'nagoya', 'name', + 'natura', 'navy', + 'nba', 'nc', 'ne', 'nec', 'net', 'netbank', + 'netflix', 'network', 'neustar', 'new', 'news', + 'next', + 'nextdirect', 'nexus', 'nf', + 'nfl', 'ng', 'ngo', 'nhk', 'ni', 'nico', + 'nike', + 'nikon', 'ninja', 'nissan', + 'nissay', 'nl', 'no', 'nokia', + 'norton', + 'now', + 'nowruz', + 'nowtv', 'np', 'nr', 'nra', @@ -763,8 +970,13 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'nyc', 'nz', 'obi', + 'observer', 'office', 'okinawa', + 'olayan', + 'olayangroup', + 'oldnavy', + 'ollo', 'om', 'omega', 'one', @@ -772,78 +984,106 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'onl', 'online', 'ooo', + 'open', 'oracle', 'orange', 'org', 'organic', + 'origins', 'osaka', 'otsuka', + 'ott', 'ovh', 'pa', 'page', - 'panerai', + 'panasonic', 'paris', + 'pars', 'partners', 'parts', 'party', + 'pay', + 'pccw', 'pe', 'pet', 'pf', + 'pfizer', 'pg', 'ph', 'pharmacy', + 'phd', 'philips', + 'phone', 'photo', 'photography', 'photos', 'physio', - 'piaget', 'pics', 'pictet', 'pictures', + 'pid', + 'pin', + 'ping', 'pink', + 'pioneer', 'pizza', 'pk', 'pl', 'place', 'play', + 'playstation', 'plumbing', 'plus', 'pm', 'pn', + 'pnc', 'pohl', 'poker', + 'politie', 'porn', 'post', 'pr', + 'pramerica', 'praxi', 'press', + 'prime', 'pro', 'prod', 'productions', 'prof', + 'progressive', + 'promo', 'properties', 'property', 'protection', + 'pru', + 'prudential', 'ps', 'pt', 'pub', 'pw', + 'pwc', 'py', 'qa', 'qpon', 'quebec', + 'quest', 'racing', + 'radio', 're', + 'read', + 'realestate', 'realtor', 'realty', 'recipes', 'red', 'redstone', + 'redumbrella', 'rehab', 'reise', 'reisen', 'reit', + 'reliance', 'ren', 'rent', 'rentals', @@ -854,16 +1094,23 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'restaurant', 'review', 'reviews', + 'rexroth', 'rich', + 'richardli', 'ricoh', + 'ril', 'rio', 'rip', 'ro', + 'rocher', 'rocks', 'rodeo', + 'rogers', + 'room', 'rs', 'rsvp', 'ru', + 'rugby', 'ruhr', 'run', 'rw', @@ -871,77 +1118,112 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'ryukyu', 'sa', 'saarland', + 'safe', + 'safety', 'sakura', 'sale', + 'salon', + 'samsclub', 'samsung', 'sandvik', 'sandvikcoromant', 'sanofi', 'sap', 'sarl', + 'sas', + 'save', 'saxo', 'sb', + 'sbi', + 'sbs', 'sc', 'sca', 'scb', + 'schaeffler', 'schmidt', 'scholarships', 'school', 'schule', 'schwarz', 'science', - 'scor', 'scot', 'sd', 'se', + 'search', 'seat', + 'secure', 'security', 'seek', + 'select', 'sener', 'services', 'seven', 'sew', 'sex', 'sexy', + 'sfr', 'sg', 'sh', + 'shangrila', + 'sharp', + 'shaw', + 'shell', + 'shia', 'shiksha', 'shoes', + 'shop', + 'shopping', + 'shouji', 'show', - 'shriram', + 'showtime', 'si', + 'silk', + 'sina', 'singles', 'site', 'sj', 'sk', 'ski', + 'skin', 'sky', 'skype', 'sl', + 'sling', 'sm', + 'smart', + 'smile', 'sn', 'sncf', 'so', 'soccer', 'social', + 'softbank', 'software', 'sohu', 'solar', 'solutions', + 'song', 'sony', 'soy', + 'spa', 'space', - 'spiegel', - 'spreadbetting', + 'sport', + 'spot', 'sr', 'srl', + 'ss', 'st', 'stada', - 'starhub', - 'statoil', + 'staples', + 'star', + 'statebank', + 'statefarm', 'stc', 'stcgroup', 'stockholm', + 'storage', + 'store', + 'stream', 'studio', 'study', 'style', @@ -961,36 +1243,47 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'sydney', 'systems', 'sz', + 'tab', 'taipei', + 'talk', + 'taobao', + 'target', 'tatamotors', 'tatar', 'tattoo', 'tax', 'taxi', 'tc', + 'tci', 'td', + 'tdk', 'team', 'tech', 'technology', 'tel', - 'telefonica', 'temasek', 'tennis', + 'teva', 'tf', 'tg', 'th', 'thd', 'theater', 'theatre', + 'tiaa', 'tickets', 'tienda', 'tips', 'tires', 'tirol', 'tj', + 'tjmaxx', + 'tjx', 'tk', + 'tkmaxx', 'tl', 'tm', + 'tmall', 'tn', 'to', 'today', @@ -999,6 +1292,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'top', 'toray', 'toshiba', + 'total', 'tours', 'town', 'toyota', @@ -1008,57 +1302,82 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'trading', 'training', 'travel', + 'travelers', + 'travelersinsurance', 'trust', + 'trv', 'tt', + 'tube', 'tui', + 'tunes', + 'tushu', 'tv', + 'tvs', 'tw', 'tz', 'ua', + 'ubank', 'ubs', 'ug', 'uk', + 'unicom', 'university', 'uno', 'uol', + 'ups', 'us', 'uy', 'uz', 'va', 'vacations', + 'vana', + 'vanguard', 'vc', 've', 'vegas', 'ventures', + 'verisign', 'versicherung', 'vet', 'vg', 'vi', 'viajes', 'video', + 'vig', + 'viking', 'villas', 'vin', + 'vip', 'virgin', + 'visa', 'vision', - 'vista', - 'vistaprint', 'viva', + 'vivo', 'vlaanderen', 'vn', 'vodka', + 'volkswagen', + 'volvo', 'vote', 'voting', 'voto', 'voyage', 'vu', 'wales', + 'walmart', 'walter', 'wang', + 'wanggou', 'watch', + 'watches', + 'weather', + 'weatherchannel', 'webcam', + 'weber', 'website', 'wed', 'wedding', + 'weibo', 'weir', 'wf', 'whoswho', @@ -1068,222 +1387,165 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'win', 'windows', 'wine', + 'winners', 'wme', + 'wolterskluwer', + 'woodside', 'work', 'works', 'world', + 'wow', 'ws', 'wtc', 'wtf', 'xbox', 'xerox', + 'xfinity', + 'xihuan', 'xin', - 'xn--11b4c3d', - 'xn--1qqw23a', - 'xn--30rr7y', - 'xn--3bst00m', - 'xn--3ds443g', - 'xn--3e0b707e', - 'xn--3pxu8k', - 'xn--42c2d9a', - 'xn--45brj9c', - 'xn--45q11c', - 'xn--4gbrim', - 'xn--55qw42g', - 'xn--55qx5d', - 'xn--6frz82g', - 'xn--6qq986b3xl', - 'xn--80adxhks', - 'xn--80ao21a', - 'xn--80asehdb', - 'xn--80aswg', - 'xn--90a3ac', - 'xn--90ais', - 'xn--9dbq2a', - 'xn--9et52u', - 'xn--b4w605ferd', - 'xn--c1avg', - 'xn--c2br7g', - 'xn--cg4bki', - 'xn--clchc0ea0b2g2a9gcd', - 'xn--czr694b', - 'xn--czrs0t', - 'xn--czru2d', - 'xn--d1acj3b', - 'xn--d1alf', - 'xn--efvy88h', - 'xn--estv75g', - 'xn--fhbei', - 'xn--fiq228c5hs', - 'xn--fiq64b', - 'xn--fiqs8s', - 'xn--fiqz9s', - 'xn--fjq720a', - 'xn--flw351e', - 'xn--fpcrj9c3d', - 'xn--fzc2c9e2c', - 'xn--gecrj9c', - 'xn--h2brj9c', - 'xn--hxt814e', - 'xn--i1b6b1a6a2e', - 'xn--imr513n', - 'xn--io0a7i', - 'xn--j1aef', - 'xn--j1amh', - 'xn--j6w193g', - 'xn--kcrx77d1x4a', - 'xn--kprw13d', - 'xn--kpry57d', - 'xn--kput3i', - 'xn--l1acc', - 'xn--lgbbat1ad8j', - 'xn--mgb9awbf', - 'xn--mgba3a3ejt', - 'xn--mgba3a4f16a', - 'xn--mgbaam7a8h', - 'xn--mgbab2bd', - 'xn--mgbayh7gpa', - 'xn--mgbbh1a71e', - 'xn--mgbc0a9azcg', - 'xn--mgberp4a5d4ar', - 'xn--mgbpl2fh', - 'xn--mgbx4cd0ab', - 'xn--mk1bu44c', - 'xn--mxtq1m', - 'xn--ngbc5azd', - 'xn--node', - 'xn--nqv7f', - 'xn--nqv7fs00ema', - 'xn--nyqy26a', - 'xn--o3cw4h', - 'xn--ogbpf8fl', - 'xn--p1acf', - 'xn--p1ai', - 'xn--pgbs0dh', - 'xn--pssy2u', - 'xn--q9jyb4c', - 'xn--qcka1pmc', - 'xn--rhqv96g', - 'xn--s9brj9c', - 'xn--ses554g', - 'xn--t60b56a', - 'xn--tckwe', - 'xn--unup4y', - 'xn--vermgensberater-ctb', - 'xn--vermgensberatung-pwb', - 'xn--vhquv', - 'xn--vuq861b', - 'xn--wgbh1c', - 'xn--wgbl6a', - 'xn--xhq521b', - 'xn--xkc2al3hye2a', - 'xn--xkc2dl3a5ee0h', - 'xn--y9a3aq', - 'xn--yfro4i67o', - 'xn--ygbi2ammx', - 'xn--zfr164b', - 'xperia', - 'xxx', - 'xyz', - 'yachts', - 'yamaxun', - 'yandex', - 'ye', - 'yodobashi', - 'yoga', - 'yokohama', - 'youtube', - 'yt', - 'za', - 'zara', - 'zip', - 'zm', - 'zone', - 'zuerich', - 'zw', - '测试', - 'परीक्षा', + 'कॉम', + 'セール', '佛山', + 'ಭಾರತ', + '慈善', '集团', '在线', '한국', + 'ଭାରତ', + '点看', + 'คอม', + 'ভাৰত', 'ভারত', '八卦', + 'ישראל', 'موقع', 'বাংলা', '公益', '公司', + '香格里拉', + '网站', '移动', '我爱你', 'москва', - 'испытание', 'қаз', + 'католик', 'онлайн', 'сайт', + '联通', 'срб', + 'бг', 'бел', - '테스트', + 'קום', + '时尚', + '微博', + '淡马锡', + 'ファッション', 'орг', + 'नेट', + 'ストア', + 'アマゾン', '삼성', 'சிங்கப்பூர்', '商标', + '商店', '商城', 'дети', 'мкд', - 'טעסט', + 'ею', + 'ポイント', + '新闻', + '家電', + 'كوم', '中文网', '中信', '中国', '中國', + '娱乐', '谷歌', 'భారత్', 'ලංකා', - '測試', + '電訊盈科', + '购物', + 'クラウド', 'ભારત', + '通販', + 'भारतम्', 'भारत', - 'آزمایشی', - 'பரிட்சை', + 'भारोत', + '网店', 'संगठन', + '餐厅', '网络', + 'ком', 'укр', '香港', - 'δοκιμή', - 'إختبار', + '亚马逊', + '食品', + '飞利浦', '台湾', '台灣', '手机', 'мон', 'الجزائر', 'عمان', + 'ارامكو', 'ایران', + 'العليان', + 'اتصالات', 'امارات', 'بازار', + 'موريتانيا', 'پاکستان', 'الاردن', + 'بارت', 'بھارت', 'المغرب', + 'ابوظبي', + 'البحرين', 'السعودية', + 'ڀارت', + 'كاثوليك', 'سودان', + 'همراه', 'عراق', 'مليسيا', + '澳門', + '닷컴', + '政府', 'شبكة', + 'بيتك', + 'عرب', 'გე', '机构', '组织机构', + '健康', 'ไทย', 'سورية', + '招聘', 'рус', 'рф', 'تونس', + '大拿', + 'ລາວ', 'みんな', 'グーグル', + 'ευ', + 'ελ', '世界', + '書籍', + 'ഭാരതം', 'ਭਾਰਤ', '网址', + '닷넷', + 'コム', + '天主教', '游戏', 'vermögensberater', 'vermögensberatung', '企业', + '信息', + '嘉里大酒店', + '嘉里', 'مصر', 'قطر', '广东', @@ -1292,8 +1554,30 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'հայ', '新加坡', 'فلسطين', - 'テスト', '政务', + 'xxx', + 'xyz', + 'yachts', + 'yahoo', + 'yamaxun', + 'yandex', + 'ye', + 'yodobashi', + 'yoga', + 'yokohama', + 'you', + 'youtube', + 'yt', + 'yun', + 'za', + 'zappos', + 'zara', + 'zero', + 'zip', + 'zm', + 'zone', + 'zuerich', + 'zw', ]; /** @@ -1363,35 +1647,42 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'BIZ' => 'Hostname/Biz.php', 'BR' => [1 => '/^[\x{002d}0-9a-zà-ãçéíó-õúü]{1,63}$/iu'], 'BV' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], - 'CA' => [1 => '/^[\x{002d}0-9a-zàâæçéèêëîïôœùûüÿ\x{00E0}\x{00E2}\x{00E7}\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{00EE}\x{00EF}\x{00F4}\x{00F9}\x{00FB}\x{00FC}\x{00E6}\x{0153}\x{00FF}]{1,63}$/iu'], 'CAT' => [1 => '/^[\x{002d}0-9a-z·àç-éíïòóúü]{1,63}$/iu'], 'CH' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'], 'CL' => [1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'], 'CN' => 'Hostname/Cn.php', 'COM' => 'Hostname/Com.php', - 'DE' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťßţŧŭůűũųūŵŷźžż]{1,63}$/iu'], - 'DK' => [1 => '/^[\x{002d}0-9a-zäéöüæøå]{1,63}$/iu'], + 'DE' => [1 => '/^[\x{002d}0-9a-záàăâåäãąāæćĉčċçďđéèĕêěëėęēğĝġģĥħíìĭîïĩįīıĵķĺľļłńňñņŋóòŏôöőõøōœĸŕřŗśŝšşßťţŧúùŭûůüűũųūŵýŷÿźžżðþ]{1,63}$/iu'], + 'DK' => [1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu'], + 'EE' => [1 => '/^[\x{002d}0-9a-zäõöüšž]{1,63}$/iu'], 'ES' => [1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'], - 'EU' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', + 'EU' => [ + 1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', 4 => '/^[\x{002d}0-9a-zΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ]{1,63}$/iu', 5 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]{1,63}$/iu', - 6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ὼώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ῒΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu', ], + 6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ὼώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ῒΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu', + ], 'FI' => [1 => '/^[\x{002d}0-9a-zäåö]{1,63}$/iu'], 'GR' => [1 => '/^[\x{002d}0-9a-zΆΈΉΊΌΎ-ΡΣ-ώἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼῂῃῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲῳῴῶ-ῼ]{1,63}$/iu'], 'HK' => 'Hostname/Cn.php', + 'HR' => [1 => '/^[\x{002d}0-9a-zžćčđš]{1,63}$/iu'], 'HU' => [1 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu'], - 'IL' => [1 => '/^[\x{002d}0-9\x{05D0}-\x{05EA}]{1,63}$/iu', - 2 => '/^[\x{002d}0-9a-z]{1,63}$/i', ], - 'INFO' => [1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu', + 'IL' => [ + 1 => '/^[\x{002d}0-9\x{05D0}-\x{05EA}]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-z]{1,63}$/i', + ], + 'INFO' => [ + 1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-záæéíðóöúýþ]{1,63}$/iu', 4 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu', 5 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', 6 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu', 7 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', - 8 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', ], + 8 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', + ], 'IO' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'], 'IS' => [1 => '/^[\x{002d}0-9a-záéýúíóþæöð]{1,63}$/iu'], 'IT' => [1 => '/^[\x{002d}0-9a-zàâäèéêëìîïòôöùûüæœçÿß-]{1,63}$/iu'], @@ -1404,15 +1695,18 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'NET' => 'Hostname/Com.php', 'NO' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], 'NU' => 'Hostname/Com.php', - 'ORG' => [1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', + 'ORG' => [ + 1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu', 4 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu', 5 => '/^[\x{002d}0-9a-ząčėęįšūųž]{1,63}$/iu', 6 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu', - 7 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', ], + 7 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', + ], 'PE' => [1 => '/^[\x{002d}0-9a-zñáéíóúü]{1,63}$/iu'], - 'PL' => [1 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', + 'PL' => [ + 1 => '/^[\x{002d}0-9a-zāčēģīķļņōŗšūž]{1,63}$/iu', 2 => '/^[\x{002d}а-ик-ш\x{0450}ѓѕјљњќџ]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-zâîăşţ]{1,63}$/iu', 4 => '/^[\x{002d}0-9а-яё\x{04C2}]{1,63}$/iu', @@ -1444,10 +1738,11 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 30 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu', 31 => '/^[\x{002d}0-9a-zàâæçèéêëîïñôùûüÿœ]{1,63}$/iu', 32 => '/^[\x{002d}0-9а-щъыьэюяёєіїґ]{1,63}$/iu', - 33 => '/^[\x{002d}0-9א-ת]{1,63}$/iu', ], + 33 => '/^[\x{002d}0-9א-ת]{1,63}$/iu', + ], 'PR' => [1 => '/^[\x{002d}0-9a-záéíóúñäëïüöâêîôûàèùæçœãõ]{1,63}$/iu'], 'PT' => [1 => '/^[\x{002d}0-9a-záàâãçéêíóôõú]{1,63}$/iu'], - 'RS' => [1 => '/^[\x{002D}\x{0030}-\x{0039}\x{0061}-\x{007A}\x{0107}\x{010D}\x{0111}\x{0161}\x{017E}]{1,63}$/iu)'], + 'RS' => [1 => '/^[\x{002d}0-9a-zßáâäçéëíîóôöúüýăąćčďđęěĺľłńňőŕřśşšţťůűźżž]{1,63}$/iu'], 'RU' => [1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'], 'SA' => [1 => '/^[\x{002d}.0-9\x{0621}-\x{063A}\x{0641}-\x{064A}\x{0660}-\x{0669}]{1,63}$/iu'], 'SE' => [1 => '/^[\x{002d}0-9a-zäåéöü]{1,63}$/iu'], @@ -1455,7 +1750,8 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'SI' => [ 1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu', - 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', ], + 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', + ], 'SJ' => [1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'], 'TH' => [1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'], 'TM' => [1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu'], @@ -1496,10 +1792,18 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'NET' => [3 => 17, 5 => 20], 'ORG' => [6 => 17], 'TW' => [1 => 20], - 'ایران' => [1 => 30], + 'امارات' => [1 => 30], + 'الاردن' => [1 => 30], + 'السعودية' => [1 => 30], + 'تونس' => [1 => 30], + 'مصر' => [1 => 30], + 'فلسطين' => [1 => 30], + 'شبكة' => [1 => 30], '中国' => [1 => 20], - '公司' => [1 => 20], - '网络' => [1 => 20], + '中國' => [1 => 20], + '香港' => [1 => 20], + '台湾' => [1 => 20], + '台灣' => [1 => 20], ]; protected $_options = [ diff --git a/tests/Zend/Validate/HostnameTest.php b/tests/Zend/Validate/HostnameTest.php index 56eeef77..5cb1e358 100644 --- a/tests/Zend/Validate/HostnameTest.php +++ b/tests/Zend/Validate/HostnameTest.php @@ -467,7 +467,7 @@ public function testIDNCA() $validator = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL); $this->assertTrue($validator->isValid('Test123.ca')); - $this->assertTrue($validator->isValid('tàr.ca')); + $this->assertFalse($validator->isValid('tàr.ca')); $this->assertFalse($validator->isValid('țest123.ca')); $this->assertFalse($validator->isValid('tĕst123.ca')); $this->assertFalse($validator->isValid('رات.ca')); From 06de5c10a6c10c7baf64fd94442476bd055fe5df Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Thu, 21 Sep 2023 12:43:57 +0800 Subject: [PATCH 02/28] Leverage autoload for exceptions --- library/Zend/Acl.php | 42 +--- library/Zend/Acl/Exception.php | 2 - library/Zend/Acl/Role/Registry.php | 24 --- library/Zend/Acl/Role/Registry/Exception.php | 2 - .../Zend/Application/Bootstrap/Exception.php | 2 - library/Zend/Application/Exception.php | 2 - .../Zend/Application/Resource/Exception.php | 2 - .../Application/Resource/Frontcontroller.php | 4 - library/Zend/Cache.php | 2 - library/Zend/Cache/Exception.php | 2 - library/Zend/Cache/Manager.php | 6 - library/Zend/Captcha/Exception.php | 2 - library/Zend/Captcha/Image.php | 10 - library/Zend/Config.php | 9 - library/Zend/Config/Exception.php | 2 - library/Zend/Config/Ini.php | 35 --- library/Zend/Config/Xml.php | 24 --- library/Zend/Console/Getopt.php | 22 -- library/Zend/Console/Getopt/Exception.php | 2 - library/Zend/Controller/Action.php | 7 - library/Zend/Controller/Action/Exception.php | 2 - .../Controller/Action/Helper/ActionStack.php | 10 - .../Action/Helper/AutoComplete/Abstract.php | 5 - .../Zend/Controller/Action/Helper/Cache.php | 2 - .../Action/Helper/ContextSwitch.php | 68 ------ .../Controller/Action/Helper/Redirector.php | 4 - .../Controller/Action/Helper/ViewRenderer.php | 10 - .../Zend/Controller/Action/HelperBroker.php | 10 - .../Action/HelperBroker/PriorityStack.php | 6 - .../Zend/Controller/Dispatcher/Abstract.php | 6 - .../Zend/Controller/Dispatcher/Exception.php | 2 - .../Zend/Controller/Dispatcher/Standard.php | 12 -- library/Zend/Controller/Exception.php | 2 - library/Zend/Controller/Front.php | 10 - .../Zend/Controller/Plugin/ActionStack.php | 2 - library/Zend/Controller/Plugin/Broker.php | 6 - library/Zend/Controller/Request/Exception.php | 2 - library/Zend/Controller/Request/Http.php | 10 - .../Zend/Controller/Request/HttpTestCase.php | 2 - library/Zend/Controller/Response/Abstract.php | 12 -- .../Zend/Controller/Response/Exception.php | 2 - library/Zend/Controller/Router/Exception.php | 2 - library/Zend/Controller/Router/Rewrite.php | 18 -- library/Zend/Controller/Router/Route.php | 6 +- .../Zend/Controller/Router/Route/Hostname.php | 2 - .../Zend/Controller/Router/Route/Regex.php | 4 - library/Zend/Date.php | 204 ------------------ library/Zend/Date/Cities.php | 1 - library/Zend/Date/DateObject.php | 4 - library/Zend/Date/Exception.php | 2 - library/Zend/File/Transfer.php | 4 - .../Zend/File/Transfer/Adapter/Abstract.php | 44 ---- library/Zend/File/Transfer/Adapter/Http.php | 10 - library/Zend/File/Transfer/Exception.php | 2 - library/Zend/Filter.php | 1 - library/Zend/Filter/Boolean.php | 6 - library/Zend/Filter/Callback.php | 4 - library/Zend/Filter/Compress.php | 6 - library/Zend/Filter/Compress/Bz2.php | 12 -- library/Zend/Filter/Compress/Gz.php | 14 -- library/Zend/Filter/Compress/Lzf.php | 6 - library/Zend/Filter/Compress/Rar.php | 16 -- library/Zend/Filter/Compress/Tar.php | 18 -- library/Zend/Filter/Compress/Zip.php | 22 -- library/Zend/Filter/Exception.php | 2 - library/Zend/Filter/File/LowerCase.php | 8 - library/Zend/Filter/File/Rename.php | 8 - library/Zend/Filter/File/UpperCase.php | 8 - library/Zend/Filter/HtmlEntities.php | 4 - library/Zend/Filter/Inflector.php | 4 - library/Zend/Filter/Input.php | 16 -- library/Zend/Filter/Null.php | 2 - library/Zend/Filter/PregReplace.php | 2 - library/Zend/Filter/StringToLower.php | 4 - library/Zend/Filter/StringToUpper.php | 4 - .../Zend/Filter/Word/Separator/Abstract.php | 2 - .../Zend/Filter/Word/SeparatorToSeparator.php | 2 - library/Zend/Form.php | 40 ---- library/Zend/Form/Decorator/Abstract.php | 4 - library/Zend/Form/Decorator/Callback.php | 2 - library/Zend/Form/Decorator/Exception.php | 2 - library/Zend/Form/Decorator/Label.php | 6 - library/Zend/Form/Decorator/ViewHelper.php | 2 - library/Zend/Form/Decorator/ViewScript.php | 2 - library/Zend/Form/DisplayGroup.php | 16 -- library/Zend/Form/Element.php | 38 ---- library/Zend/Form/Element/Exception.php | 2 - library/Zend/Form/Element/File.php | 4 - library/Zend/Form/Exception.php | 2 - library/Zend/Http/Client.php | 52 ----- library/Zend/Http/Client/Adapter/Curl.php | 20 -- .../Zend/Http/Client/Adapter/Exception.php | 2 - library/Zend/Http/Client/Adapter/Proxy.php | 14 -- library/Zend/Http/Client/Adapter/Socket.php | 22 -- library/Zend/Http/Client/Adapter/Test.php | 5 - library/Zend/Http/Client/Exception.php | 2 - library/Zend/Http/Cookie.php | 16 -- library/Zend/Http/CookieJar.php | 10 - library/Zend/Http/Exception.php | 2 - .../Exception/InvalidArgumentException.php | 2 - .../Header/Exception/RuntimeException.php | 2 - library/Zend/Http/Header/HeaderValue.php | 2 - library/Zend/Http/Header/SetCookie.php | 4 - library/Zend/Http/Response.php | 14 -- library/Zend/Http/UserAgent.php | 22 -- .../Zend/Http/UserAgent/AbstractDevice.php | 6 - library/Zend/Http/UserAgent/Exception.php | 2 - .../UserAgent/Features/Adapter/Browscap.php | 2 - .../Features/Adapter/DeviceAtlas.php | 6 - .../UserAgent/Features/Adapter/TeraWurfl.php | 4 - .../Http/UserAgent/Features/Exception.php | 2 - .../Zend/Http/UserAgent/Storage/Exception.php | 2 - .../Zend/Http/UserAgent/Storage/Session.php | 2 - library/Zend/Json.php | 7 - library/Zend/Json/Decoder.php | 20 -- library/Zend/Json/Encoder.php | 3 - library/Zend/Json/Exception.php | 2 - library/Zend/Layout.php | 6 - .../Controller/Action/Helper/Layout.php | 2 - library/Zend/Layout/Exception.php | 2 - library/Zend/Loader.php | 8 - library/Zend/Loader/Autoloader/Resource.php | 22 -- library/Zend/Loader/Exception.php | 2 - library/Zend/Loader/PluginLoader.php | 13 -- .../Zend/Loader/PluginLoader/Exception.php | 2 - library/Zend/Locale.php | 10 - library/Zend/Locale/Data.php | 8 - library/Zend/Locale/Exception.php | 2 - library/Zend/Locale/Format.php | 35 +-- library/Zend/Locale/Math/Exception.php | 2 - library/Zend/Locale/Math/PhpMath.php | 16 -- library/Zend/Navigation.php | 2 - library/Zend/Navigation/Container.php | 9 - library/Zend/Navigation/Exception.php | 2 - library/Zend/Navigation/Page.php | 44 ---- library/Zend/Navigation/Page/Mvc.php | 10 - library/Zend/Navigation/Page/Uri.php | 2 - library/Zend/Paginator.php | 32 +-- library/Zend/Paginator/Adapter/Iterator.php | 5 - library/Zend/Paginator/Exception.php | 2 - library/Zend/ProgressBar.php | 2 - library/Zend/Registry.php | 8 - library/Zend/Rest/Client.php | 2 - library/Zend/Rest/Client/Exception.php | 2 - library/Zend/Rest/Client/Result.php | 1 - library/Zend/Rest/Client/Result/Exception.php | 2 - library/Zend/Rest/Exception.php | 2 - library/Zend/Service/Exception.php | 2 - library/Zend/Session.php | 34 --- library/Zend/Session/Abstract.php | 15 -- library/Zend/Session/Exception.php | 2 - library/Zend/Session/Namespace.php | 80 ------- library/Zend/Session/Validator/Exception.php | 2 - .../Zend/Test/PHPUnit/ControllerTestCase.php | 2 - library/Zend/Text/Exception.php | 2 - library/Zend/Text/Figlet.php | 12 +- library/Zend/Text/Figlet/Exception.php | 2 - library/Zend/Translate.php | 3 - library/Zend/Translate/Adapter.php | 12 -- library/Zend/Translate/Adapter/Array.php | 2 - library/Zend/Translate/Exception.php | 2 - library/Zend/Translate/Plural.php | 2 - library/Zend/Uri.php | 10 - library/Zend/Uri/Exception.php | 2 - library/Zend/Uri/Http.php | 36 ---- library/Zend/Validate.php | 4 +- library/Zend/Validate/Abstract.php | 10 - library/Zend/Validate/Barcode.php | 4 - library/Zend/Validate/Between.php | 2 - library/Zend/Validate/Callback.php | 4 - library/Zend/Validate/CreditCard.php | 2 - library/Zend/Validate/Db/Abstract.php | 8 - library/Zend/Validate/EmailAddress.php | 2 - library/Zend/Validate/Exception.php | 2 - library/Zend/Validate/File/Count.php | 14 +- library/Zend/Validate/File/Crc32.php | 2 - library/Zend/Validate/File/Exists.php | 4 - library/Zend/Validate/File/FilesSize.php | 2 - library/Zend/Validate/File/Hash.php | 6 - library/Zend/Validate/File/ImageSize.php | 10 - library/Zend/Validate/File/Md5.php | 2 - library/Zend/Validate/File/MimeType.php | 9 - library/Zend/Validate/File/Sha1.php | 2 - library/Zend/Validate/File/Size.php | 14 +- library/Zend/Validate/File/Upload.php | 2 - library/Zend/Validate/GreaterThan.php | 2 - library/Zend/Validate/Iban.php | 2 - library/Zend/Validate/InArray.php | 2 - library/Zend/Validate/Ip.php | 2 - library/Zend/Validate/Isbn.php | 15 -- library/Zend/Validate/LessThan.php | 2 - library/Zend/Validate/NotEmpty.php | 2 - library/Zend/Validate/PostCode.php | 8 - library/Zend/Validate/Regex.php | 4 - library/Zend/Validate/StringLength.php | 16 +- library/Zend/View/Abstract.php | 15 +- library/Zend/View/Exception.php | 2 - library/Zend/View/Helper/Action.php | 2 - library/Zend/View/Helper/Doctype.php | 1 - library/Zend/View/Helper/FormElement.php | 1 - library/Zend/View/Helper/Gravatar.php | 2 - library/Zend/View/Helper/HeadLink.php | 6 - library/Zend/View/Helper/HeadMeta.php | 10 - library/Zend/View/Helper/HeadScript.php | 7 - library/Zend/View/Helper/HeadStyle.php | 6 - library/Zend/View/Helper/HeadTitle.php | 3 - library/Zend/View/Helper/HtmlList.php | 1 - library/Zend/View/Helper/Navigation.php | 1 - .../View/Helper/Navigation/Breadcrumbs.php | 2 - .../View/Helper/Navigation/HelperAbstract.php | 3 - library/Zend/View/Helper/Navigation/Links.php | 2 - library/Zend/View/Helper/Navigation/Menu.php | 2 - .../Zend/View/Helper/Navigation/Sitemap.php | 3 - .../Zend/View/Helper/PaginationControl.php | 4 - library/Zend/View/Helper/Partial.php | 1 - .../Zend/View/Helper/Partial/Exception.php | 2 - library/Zend/View/Helper/PartialLoop.php | 1 - .../Helper/Placeholder/Container/Abstract.php | 1 - .../Placeholder/Container/Exception.php | 2 - .../Placeholder/Container/Standalone.php | 1 - .../Zend/View/Helper/Placeholder/Registry.php | 1 - .../Helper/Placeholder/Registry/Exception.php | 2 - library/Zend/View/Helper/Translate.php | 3 - library/Zend/Xml/Exception.php | 2 - library/ZendX/Exception.php | 2 - library/ZendX/JQuery/Exception.php | 2 - .../Form/Decorator/UiWidgetContainer.php | 2 - .../JQuery/Form/Decorator/UiWidgetElement.php | 2 - .../JQuery/Form/Decorator/UiWidgetPane.php | 6 - .../ZendX/JQuery/Form/Element/UiWidget.php | 2 - library/ZendX/JQuery/Form/Exception.php | 2 - library/ZendX/JQuery/View/Exception.php | 2 - .../ZendX/JQuery/View/Helper/AutoComplete.php | 2 - .../ZendX/JQuery/View/Helper/DatePicker.php | 2 - library/ZendX/JQuery/View/Helper/JQuery.php | 2 - .../JQuery/View/Helper/JQuery/Container.php | 4 - .../ZendX/JQuery/View/Helper/UiWidgetPane.php | 4 - tests/Zend/Captcha/ImageTest.php | 2 - .../Action/Helper/FlashMessengerTest.php | 1 - .../Controller/Plugin/ErrorHandlerTest.php | 3 - tests/Zend/Controller/Response/HttpTest.php | 2 - tests/Zend/ExceptionTest.php | 2 - tests/Zend/Validate/File/MimeTypeTest.php | 2 - tests/Zend/Xml/MultibyteTest.php | 2 - tests/Zend/Xml/SecurityTest.php | 2 - 245 files changed, 17 insertions(+), 1992 deletions(-) diff --git a/library/Zend/Acl.php b/library/Zend/Acl.php index 8d5539d1..056a11b1 100644 --- a/library/Zend/Acl.php +++ b/library/Zend/Acl.php @@ -144,8 +144,6 @@ public function addRole($role, $parents = null) } if (!$role instanceof Zend_Acl_Role_Interface) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('addRole() expects $role to be of type Zend_Acl_Role_Interface'); } @@ -288,16 +286,12 @@ public function addResource($resource, $parent = null) } if (!$resource instanceof Zend_Acl_Resource_Interface) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('addResource() expects $resource to be of type Zend_Acl_Resource_Interface'); } $resourceId = $resource->getResourceId(); if ($this->has($resourceId)) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Resource id '$resourceId' already exists in the ACL"); } @@ -312,8 +306,6 @@ public function addResource($resource, $parent = null) } $resourceParent = $this->get($resourceParentId); } catch (Zend_Acl_Exception $e) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Parent Resource id '$resourceParentId' does not exist", 0, $e); } $this->_resources[$resourceParentId]['children'][$resourceId] = $resource; @@ -364,8 +356,6 @@ public function get($resource) } if (!$this->has($resource)) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Resource '$resourceId' not found"); } @@ -413,8 +403,6 @@ public function inherits($resource, $inherit, $onlyParent = false) $resourceId = $this->get($resource)->getResourceId(); $inheritId = $this->get($inherit)->getResourceId(); } catch (Zend_Acl_Exception $e) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e); } @@ -454,8 +442,6 @@ public function remove($resource) try { $resourceId = $this->get($resource)->getResourceId(); } catch (Zend_Acl_Exception $e) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e); } @@ -623,10 +609,8 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr // ensure that the rule type is valid; normalize input to uppercase $type = strtoupper($type); if (self::TYPE_ALLOW !== $type && self::TYPE_DENY !== $type) { - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Unsupported rule type; must be either '" . self::TYPE_ALLOW . "' or '" - . self::TYPE_DENY . "'"); + . self::TYPE_DENY . "'"); } // ensure that all specified Roles exist; normalize input to array of Role objects or null @@ -803,10 +787,8 @@ public function setRule($operation, $type, $roles = null, $resources = null, $pr break; default: - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception("Unsupported operation; must be either '" . self::OP_ADD . "' or '" - . self::OP_REMOVE . "'"); + . self::OP_REMOVE . "'"); } return $this; @@ -977,11 +959,6 @@ protected function _roleDFSVisitAllPrivileges(Zend_Acl_Role_Interface $role, ?Ze &$dfs = null) { if (null === $dfs) { - /** - * @see Zend_Acl_Exception - */ - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('$dfs parameter may not be null'); } @@ -1019,11 +996,6 @@ protected function _roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, ?Zend_Acl $privilege = null) { if (null === $privilege) { - /** - * @see Zend_Acl_Exception - */ - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('$privilege parameter may not be null'); } @@ -1064,20 +1036,10 @@ protected function _roleDFSVisitOnePrivilege(Zend_Acl_Role_Interface $role, ?Zen $privilege = null, &$dfs = null) { if (null === $privilege) { - /** - * @see Zend_Acl_Exception - */ - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('$privilege parameter may not be null'); } if (null === $dfs) { - /** - * @see Zend_Acl_Exception - */ - require_once 'Zend/Acl/Exception.php'; - throw new Zend_Acl_Exception('$dfs parameter may not be null'); } diff --git a/library/Zend/Acl/Exception.php b/library/Zend/Acl/Exception.php index be492b5c..346091d2 100644 --- a/library/Zend/Acl/Exception.php +++ b/library/Zend/Acl/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Acl/Role/Registry.php b/library/Zend/Acl/Role/Registry.php index b95dad55..3ba90eb2 100644 --- a/library/Zend/Acl/Role/Registry.php +++ b/library/Zend/Acl/Role/Registry.php @@ -58,11 +58,6 @@ public function add(Zend_Acl_Role_Interface $role, $parents = null) $roleId = $role->getRoleId(); if ($this->has($roleId)) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; - throw new Zend_Acl_Role_Registry_Exception("Role id '$roleId' already exists in the registry"); } @@ -72,10 +67,6 @@ public function add(Zend_Acl_Role_Interface $role, $parents = null) if (!is_array($parents)) { $parents = [$parents]; } - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; foreach ($parents as $parent) { try { if ($parent instanceof Zend_Acl_Role_Interface) { @@ -119,11 +110,6 @@ public function get($role) } if (!$this->has($role)) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; - throw new Zend_Acl_Role_Registry_Exception("Role '$roleId' not found"); } @@ -190,11 +176,6 @@ public function getParents($role) */ public function inherits($role, $inherit, $onlyParents = false) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; - try { $roleId = $this->get($role)->getRoleId(); $inheritId = $this->get($inherit)->getRoleId(); @@ -228,11 +209,6 @@ public function inherits($role, $inherit, $onlyParents = false) */ public function remove($role) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - require_once 'Zend/Acl/Role/Registry/Exception.php'; - try { $roleId = $this->get($role)->getRoleId(); } catch (Zend_Acl_Role_Registry_Exception $e) { diff --git a/library/Zend/Acl/Role/Registry/Exception.php b/library/Zend/Acl/Role/Registry/Exception.php index b2d405dd..98cfbcc5 100644 --- a/library/Zend/Acl/Role/Registry/Exception.php +++ b/library/Zend/Acl/Role/Registry/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Acl_Exception */ -require_once 'Zend/Acl/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Application/Bootstrap/Exception.php b/library/Zend/Application/Bootstrap/Exception.php index baf06310..9271cf8d 100644 --- a/library/Zend/Application/Bootstrap/Exception.php +++ b/library/Zend/Application/Bootstrap/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Application_Exception */ -require_once 'Zend/Application/Exception.php'; - /** * Exception class for Zend_Application. * diff --git a/library/Zend/Application/Exception.php b/library/Zend/Application/Exception.php index 0643f561..ec7dad09 100644 --- a/library/Zend/Application/Exception.php +++ b/library/Zend/Application/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * Exception class for Zend_Application. * diff --git a/library/Zend/Application/Resource/Exception.php b/library/Zend/Application/Resource/Exception.php index a97bc395..729e8bc9 100644 --- a/library/Zend/Application/Resource/Exception.php +++ b/library/Zend/Application/Resource/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Application_Exception */ -require_once 'Zend/Application/Exception.php'; - /** * Exception class for Zend_Application. * diff --git a/library/Zend/Application/Resource/Frontcontroller.php b/library/Zend/Application/Resource/Frontcontroller.php index d629fcd8..f3555bb4 100644 --- a/library/Zend/Application/Resource/Frontcontroller.php +++ b/library/Zend/Application/Resource/Frontcontroller.php @@ -141,8 +141,6 @@ public function init() case 'dispatcher': if (!isset($value['class'])) { - require_once 'Zend/Application/Exception.php'; - throw new Zend_Application_Exception('You must specify both '); } if (!isset($value['params'])) { @@ -151,8 +149,6 @@ public function init() $dispatchClass = $value['class']; if (!class_exists($dispatchClass)) { - require_once 'Zend/Application/Exception.php'; - throw new Zend_Application_Exception('Dispatcher class not found!'); } $front->setDispatcher(new $dispatchClass((array) $value['params'])); diff --git a/library/Zend/Cache.php b/library/Zend/Cache.php index 63eede1d..97424468 100644 --- a/library/Zend/Cache.php +++ b/library/Zend/Cache.php @@ -209,8 +209,6 @@ public static function _makeFrontend($frontend, $frontendOptions = [], $customFr 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); } diff --git a/library/Zend/Cache/Exception.php b/library/Zend/Cache/Exception.php index 67f021ae..f9a17d5c 100644 --- a/library/Zend/Cache/Exception.php +++ b/library/Zend/Cache/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Manager.php b/library/Zend/Cache/Manager.php index 6a3f32df..20a1b740 100644 --- a/library/Zend/Cache/Manager.php +++ b/library/Zend/Cache/Manager.php @@ -18,8 +18,6 @@ */ /** @see Zend_Cache_Exception */ -require_once 'Zend/Cache/Exception.php'; - /** @see Zend_Cache */ require_once 'Zend/Cache.php'; @@ -207,8 +205,6 @@ public function setCacheTemplate($name, $options) if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (!is_array($options)) { - require_once 'Zend/Cache/Exception.php'; - throw new Zend_Cache_Exception('Options passed must be in' . ' an associative array or instance of Zend_Config'); } @@ -262,8 +258,6 @@ public function setTemplateOptions($name, $options) if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (!is_array($options)) { - require_once 'Zend/Cache/Exception.php'; - throw new Zend_Cache_Exception('Options passed must be in' . ' an associative array or instance of Zend_Config'); } diff --git a/library/Zend/Captcha/Exception.php b/library/Zend/Captcha/Exception.php index bd93f5bb..a965a539 100755 --- a/library/Zend/Captcha/Exception.php +++ b/library/Zend/Captcha/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * Exception for Zend_Form component. * diff --git a/library/Zend/Captcha/Image.php b/library/Zend/Captcha/Image.php index 09d7f08d..3574d7ff 100644 --- a/library/Zend/Captcha/Image.php +++ b/library/Zend/Captcha/Image.php @@ -494,28 +494,20 @@ public function generate() protected function _generateImage($id, $word) { if (!extension_loaded('gd')) { - require_once 'Zend/Captcha/Exception.php'; - throw new Zend_Captcha_Exception('Image CAPTCHA requires GD extension'); } if (!function_exists('imagepng')) { - require_once 'Zend/Captcha/Exception.php'; - throw new Zend_Captcha_Exception('Image CAPTCHA requires PNG support'); } if (!function_exists('imageftbbox')) { - require_once 'Zend/Captcha/Exception.php'; - throw new Zend_Captcha_Exception('Image CAPTCHA requires FT fonts support'); } $font = $this->getFont(); if (empty($font)) { - require_once 'Zend/Captcha/Exception.php'; - throw new Zend_Captcha_Exception('Image CAPTCHA requires font'); } @@ -529,8 +521,6 @@ protected function _generateImage($id, $word) } else { $img = imagecreatefrompng($this->_startImage); if (!$img) { - require_once 'Zend/Captcha/Exception.php'; - throw new Zend_Captcha_Exception('Can not load start image'); } $w = imagesx($img); diff --git a/library/Zend/Config.php b/library/Zend/Config.php index 21f357fe..cc49caab 100644 --- a/library/Zend/Config.php +++ b/library/Zend/Config.php @@ -158,9 +158,6 @@ public function __set($name, $value) } $this->_count = count((array) $this->_data); } else { - /** @see Zend_Config_Exception */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception('Zend_Config is read only'); } } @@ -226,9 +223,6 @@ public function __unset($name) $this->_count = count((array) $this->_data); $this->_skipNextIteration = true; } else { - /** @see Zend_Config_Exception */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception('Zend_Config is read only'); } } @@ -406,9 +400,6 @@ protected function _assertValidExtend($extendingSection, $extendedSection) $extendedSectionCurrent = $extendedSection; while (array_key_exists($extendedSectionCurrent, $this->_extends)) { if ($this->_extends[$extendedSectionCurrent] == $extendingSection) { - /** @see Zend_Config_Exception */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception('Illegal circular inheritance detected'); } $extendedSectionCurrent = $this->_extends[$extendedSectionCurrent]; diff --git a/library/Zend/Config/Exception.php b/library/Zend/Config/Exception.php index e6ebf976..a6be5438 100644 --- a/library/Zend/Config/Exception.php +++ b/library/Zend/Config/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Config/Ini.php b/library/Zend/Config/Ini.php index e4feb38d..5c7f77bf 100644 --- a/library/Zend/Config/Ini.php +++ b/library/Zend/Config/Ini.php @@ -93,11 +93,6 @@ class Zend_Config_Ini extends Zend_Config public function __construct($filename, $section = null, $options = false) { if (empty($filename)) { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception('Filename is not set'); } @@ -137,11 +132,6 @@ public function __construct($filename, $section = null, $options = false) $dataArray = []; foreach ($section as $sectionName) { if (!isset($iniArray[$sectionName])) { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $filename"); } $dataArray = $this->_arrayMergeRecursive($this->_processSection($iniArray, $sectionName), $dataArray); @@ -168,11 +158,6 @@ protected function _parseIniFile($filename) // Check if there was a error while loading file if ($this->_loadFileErrorStr !== null) { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception($this->_loadFileErrorStr); } @@ -211,11 +196,6 @@ protected function _loadIniFile($filename) break; default: - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$thisSection' may not extend multiple sections in $filename"); } } @@ -247,11 +227,6 @@ protected function _processSection($iniArray, $section, $config = []) $config = $this->_processSection($iniArray, $value, $config); } } else { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Parent section '$section' cannot be found"); } } else { @@ -285,20 +260,10 @@ protected function _processKey($config, $key, $value) $config[$pieces[0]] = []; } } elseif (!is_array($config[$pieces[0]])) { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Cannot create sub-key for '{$pieces[0]}' as key already exists"); } $config[$pieces[0]] = $this->_processKey($config[$pieces[0]], $pieces[1], $value); } else { - /** - * @see Zend_Config_Exception - */ - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Invalid key '$key'"); } } else { diff --git a/library/Zend/Config/Xml.php b/library/Zend/Config/Xml.php index 176dd4cd..f37db56f 100644 --- a/library/Zend/Config/Xml.php +++ b/library/Zend/Config/Xml.php @@ -26,8 +26,6 @@ require_once 'Zend/Xml/Security.php'; /** @see Zend_Xml_Exception */ -require_once 'Zend/Xml/Exception.php'; - /** * XML Adapter for Zend_Config. * @@ -78,8 +76,6 @@ class Zend_Config_Xml extends Zend_Config public function __construct($xml, $section = null, $options = false) { if (empty($xml)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception('Filename is not set'); } @@ -101,15 +97,11 @@ public function __construct($xml, $section = null, $options = false) } else { try { if (!$config = Zend_Xml_Security::scanFile($xml)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception( "Error failed to load $xml file" ); } } catch (Zend_Xml_Exception $e) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception( $e->getMessage() ); @@ -119,8 +111,6 @@ public function __construct($xml, $section = null, $options = false) restore_error_handler(); // Check if there was a error while loading file if ($this->_loadFileErrorStr !== null) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception($this->_loadFileErrorStr); } @@ -135,8 +125,6 @@ public function __construct($xml, $section = null, $options = false) $dataArray = []; foreach ($section as $sectionName) { if (!isset($config->$sectionName)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $xml"); } @@ -146,8 +134,6 @@ public function __construct($xml, $section = null, $options = false) parent::__construct($dataArray, $allowModifications); } else { if (!isset($config->$section)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$section' cannot be found in $xml"); } @@ -176,8 +162,6 @@ public function __construct($xml, $section = null, $options = false) protected function _processExtends(SimpleXMLElement $element, $section, array $config = []) { if (!isset($element->$section)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Section '$section' cannot be found"); } @@ -235,8 +219,6 @@ protected function _toArray(SimpleXMLElement $xmlObject) // Search for local 'const' nodes and replace them if (count($xmlObject->children(self::XML_NAMESPACE)) > 0) { if (count($xmlObject->children()) > 0) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("A node with a 'const' childnode may not have any other children"); } @@ -255,16 +237,12 @@ protected function _toArray(SimpleXMLElement $xmlObject) switch ($node->localName) { case 'const': if (!$node->hasAttributeNS(self::XML_NAMESPACE, 'name')) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Misssing 'name' attribute in 'const' node"); } $constantName = $node->getAttributeNS(self::XML_NAMESPACE, 'name'); if (!defined($constantName)) { - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Constant with name '$constantName' was not defined"); } @@ -275,8 +253,6 @@ protected function _toArray(SimpleXMLElement $xmlObject) break; default: - require_once 'Zend/Config/Exception.php'; - throw new Zend_Config_Exception("Unknown node with name '$node->localName' found"); } } diff --git a/library/Zend/Console/Getopt.php b/library/Zend/Console/Getopt.php index 7e653f27..8f9780af 100644 --- a/library/Zend/Console/Getopt.php +++ b/library/Zend/Console/Getopt.php @@ -230,7 +230,6 @@ class Zend_Console_Getopt public function __construct($rules, $argv = null, $getoptConfig = []) { if (!isset($_SERVER['argv'])) { - require_once 'Zend/Console/Getopt/Exception.php'; if (ini_get('register_argc_argv') == false) { throw new Zend_Console_Getopt_Exception( "argv is not available, because ini option 'register_argc_argv' is set Off" @@ -340,8 +339,6 @@ public function __unset($key) public function addArguments($argv) { if (!is_array($argv)) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( 'Parameter #1 to addArguments should be an array'); } @@ -362,8 +359,6 @@ public function addArguments($argv) public function setArguments($argv) { if (!is_array($argv)) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( 'Parameter #1 to setArguments should be an array'); } @@ -667,7 +662,6 @@ public function setAliases($aliasMap) $flag = $this->_ruleMap[$flag]; if (isset($this->_rules[$alias]) || isset($this->_ruleMap[$alias])) { $o = (strlen($alias) == 1 ? '-' : '--') . $alias; - require_once 'Zend/Console/Getopt/Exception.php'; throw new Zend_Console_Getopt_Exception( "Option \"$o\" is being defined more than once."); @@ -758,8 +752,6 @@ public function checkRequiredArguments() $defined = $defined === true ? true : array_key_exists($alias, $this->_options); } if ($defined === false) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( 'Option "$alias" requires a parameter.', $this->getUsageMessage() @@ -815,8 +807,6 @@ protected function _parseSingleOption($flag, &$argv) $flag = strtolower($flag); } if (!isset($this->_ruleMap[$flag])) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"$flag\" is not recognized.", $this->getUsageMessage()); @@ -828,8 +818,6 @@ protected function _parseSingleOption($flag, &$argv) $param = array_shift($argv); $this->_checkParameterType($realFlag, $param); } else { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"$flag\" requires a parameter.", $this->getUsageMessage()); @@ -870,8 +858,6 @@ protected function _checkParameterType($flag, $param) switch ($type) { case 'word': if (preg_match('/\W/', $param)) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"$flag\" requires a single-word parameter, but was given \"$param\".", $this->getUsageMessage()); @@ -880,8 +866,6 @@ protected function _checkParameterType($flag, $param) break; case 'integer': if (preg_match('/\D/', $param)) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"$flag\" requires an integer parameter, but was given \"$param\".", $this->getUsageMessage()); @@ -956,15 +940,11 @@ protected function _addRulesModeZend($rules) $mainFlag = $flags[0]; foreach ($flags as $flag) { if (empty($flag)) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Blank flag not allowed in rule \"$ruleCode\"."); } if (strlen($flag) == 1) { if (isset($this->_ruleMap[$flag])) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"-$flag\" is being defined more than once."); } @@ -972,8 +952,6 @@ protected function _addRulesModeZend($rules) $rule['alias'][] = $flag; } else { if (isset($this->_rules[$flag]) || isset($this->_ruleMap[$flag])) { - require_once 'Zend/Console/Getopt/Exception.php'; - throw new Zend_Console_Getopt_Exception( "Option \"--$flag\" is being defined more than once."); } diff --git a/library/Zend/Console/Getopt/Exception.php b/library/Zend/Console/Getopt/Exception.php index 9e943aca..41d67300 100644 --- a/library/Zend/Console/Getopt/Exception.php +++ b/library/Zend/Console/Getopt/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Console_Getopt_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Action.php b/library/Zend/Controller/Action.php index cd204477..d6859adf 100644 --- a/library/Zend/Controller/Action.php +++ b/library/Zend/Controller/Action.php @@ -177,8 +177,6 @@ public function initView() } $baseDir = dirname($dirs[$module]) . DIRECTORY_SEPARATOR . 'views'; if (!file_exists($baseDir) || !is_dir($baseDir)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Missing base view directory ("' . $baseDir . '")'); } @@ -273,8 +271,6 @@ public function getViewScript($action = null, $noController = null) if (null === $action) { $action = $request->getActionName(); } elseif (!is_string($action)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid action specifier for view render'); } @@ -435,8 +431,6 @@ public function getFrontController() } // Throw exception in all other cases - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Front controller class has not been loaded'); } @@ -478,7 +472,6 @@ public function postDispatch() */ public function __call($methodName, $args) { - require_once 'Zend/Controller/Action/Exception.php'; if ('Action' == substr($methodName, -6)) { $action = substr($methodName, 0, strlen($methodName) - 6); diff --git a/library/Zend/Controller/Action/Exception.php b/library/Zend/Controller/Action/Exception.php index 7e792226..e72278b8 100644 --- a/library/Zend/Controller/Action/Exception.php +++ b/library/Zend/Controller/Action/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Controller_Exception */ -require_once 'Zend/Controller/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Action/Helper/ActionStack.php b/library/Zend/Controller/Action/Helper/ActionStack.php index 18cce84f..9fe41dda 100644 --- a/library/Zend/Controller/Action/Helper/ActionStack.php +++ b/library/Zend/Controller/Action/Helper/ActionStack.php @@ -84,22 +84,12 @@ public function actionToStack($action, $controller = null, $module = null, array return $this->pushStack($action); } if (!is_string($action)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('ActionStack requires either a request object or minimally a string action'); } $request = $this->getRequest(); if ($request instanceof Zend_Controller_Request_Abstract === false) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Request object not set yet'); } diff --git a/library/Zend/Controller/Action/Helper/AutoComplete/Abstract.php b/library/Zend/Controller/Action/Helper/AutoComplete/Abstract.php index ae73492f..065f32cd 100644 --- a/library/Zend/Controller/Action/Helper/AutoComplete/Abstract.php +++ b/library/Zend/Controller/Action/Helper/AutoComplete/Abstract.php @@ -92,11 +92,6 @@ public function encodeJson($data, $keepLayouts = false) return Zend_Controller_Action_HelperBroker::getStaticHelper('Json')->encodeJson($data, $keepLayouts); } - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid data passed for autocompletion'); } diff --git a/library/Zend/Controller/Action/Helper/Cache.php b/library/Zend/Controller/Action/Helper/Cache.php index bdfef34e..75ee8ea7 100644 --- a/library/Zend/Controller/Action/Helper/Cache.php +++ b/library/Zend/Controller/Action/Helper/Cache.php @@ -25,8 +25,6 @@ /** * @see Zend_Controller_Action_Exception */ -require_once 'Zend/Controller/Action/Exception.php'; - /** * @see Zend_Cache_Manager */ diff --git a/library/Zend/Controller/Action/Helper/ContextSwitch.php b/library/Zend/Controller/Action/Helper/ContextSwitch.php index 40c3b937..e6b345d6 100644 --- a/library/Zend/Controller/Action/Helper/ContextSwitch.php +++ b/library/Zend/Controller/Action/Helper/ContextSwitch.php @@ -301,11 +301,6 @@ public function initContext($format = null) } elseif (is_array($callback)) { call_user_func($callback); } else { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Invalid context callback registered for context "%s"', $context)); } } @@ -393,11 +388,6 @@ protected function _setSuffix(array $spec) $count = count($suffixInfo); switch (true) { case ($count < 2) && (null === $context): - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid suffix information provided in config'); case $count < 2: $suffix = array_shift($suffixInfo); @@ -445,11 +435,6 @@ protected function _setSuffix(array $spec) public function setSuffix($context, $suffix, $prependViewRendererSuffix = true) { if (!isset($this->_contexts[$context])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot set suffix; invalid context type "%s"', $context)); } @@ -493,11 +478,6 @@ public function setSuffix($context, $suffix, $prependViewRendererSuffix = true) public function getSuffix($type) { if (!isset($this->_contexts[$type])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot retrieve suffix; invalid context type "%s"', $type)); } @@ -536,11 +516,6 @@ public function hasContext($context, $throwException = false) } if ($throwException) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Context "%s" does not exist', $context)); } @@ -565,11 +540,6 @@ public function addHeader($context, $header, $content) $content = (string) $content; if (isset($this->_contexts[$context]['headers'][$header])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot add "%s" header to context "%s": already exists', $header, $context)); } @@ -744,11 +714,6 @@ protected function _validateTrigger($trigger) } if (!in_array($trigger, [self::TRIGGER_INIT, self::TRIGGER_POST])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Invalid trigger "%s"', $trigger)); } @@ -771,11 +736,6 @@ public function setCallback($context, $trigger, $callback) if (!is_string($callback)) { if (!is_array($callback) || (2 != count($callback))) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid callback specified'); } } @@ -930,11 +890,6 @@ public function getContextParam() public function setDefaultContext($type) { if (!isset($this->_contexts[$type])) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot set default context; invalid context type "%s"', $type)); } @@ -988,11 +943,6 @@ public function getAutoDisableLayout() public function addContext($context, array $spec) { if ($this->hasContext($context)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Cannot add context "%s"; already exists', $context)); } $context = (string) $context; @@ -1133,11 +1083,6 @@ public function postDispatch() } elseif (is_array($callback)) { call_user_func($callback); } else { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Invalid postDispatch context callback registered for context "%s"', $context)); } } @@ -1158,14 +1103,11 @@ public function postJsonContext() $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $view = $viewRenderer->view; if ($view instanceof Zend_View_Interface) { - // @see Zend_Json if (method_exists($view, 'getVars')) { require_once 'Zend/Json.php'; $vars = Zend_Json::encode($view->getVars()); $this->getResponse()->setBody($vars); } else { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('View does not implement the getVars() method needed to encode the view into JSON'); } } @@ -1298,11 +1240,6 @@ public function hasActionContext($action, $context) $allContexts = $controller->{$contextKey}; if (!is_array($allContexts)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid contexts found for controller'); } @@ -1317,11 +1254,6 @@ public function hasActionContext($action, $context) $contexts = $allContexts[$action]; if (!is_array($contexts)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf("Invalid contexts found for action '%s'", $action)); } diff --git a/library/Zend/Controller/Action/Helper/Redirector.php b/library/Zend/Controller/Action/Helper/Redirector.php index 3530738d..8ca9ee04 100644 --- a/library/Zend/Controller/Action/Helper/Redirector.php +++ b/library/Zend/Controller/Action/Helper/Redirector.php @@ -92,8 +92,6 @@ protected function _checkCode($code) { $code = (int) $code; if ((300 > $code) || (307 < $code) || (304 == $code) || (306 == $code)) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid redirect HTTP status code (' . $code . ')'); } @@ -520,8 +518,6 @@ public function __call($method, $args) return call_user_func_array([$this, 'gotoSimpleAndExit'], $args); } - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception(sprintf('Invalid method "%s" called on redirector', $method)); } } diff --git a/library/Zend/Controller/Action/Helper/ViewRenderer.php b/library/Zend/Controller/Action/Helper/ViewRenderer.php index 1f70dccf..67ab9f79 100644 --- a/library/Zend/Controller/Action/Helper/ViewRenderer.php +++ b/library/Zend/Controller/Action/Helper/ViewRenderer.php @@ -244,11 +244,6 @@ public function getModuleDirectory() $module = $this->getModule(); $moduleDir = $this->getFrontController()->getControllerDirectory($module); if ((null === $moduleDir) || is_array($moduleDir)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('ViewRenderer cannot locate module directory for module "' . $module . '"'); } $this->_moduleDir = dirname($moduleDir); @@ -469,11 +464,6 @@ public function initView($path = null, $prefix = null, array $options = []) if (empty($path)) { $path = $this->_getBasePath(); if (empty($path)) { - /** - * @see Zend_Controller_Action_Exception - */ - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('ViewRenderer initialization failed: retrieved view base path is empty'); } } diff --git a/library/Zend/Controller/Action/HelperBroker.php b/library/Zend/Controller/Action/HelperBroker.php index adb7987c..9b749921 100644 --- a/library/Zend/Controller/Action/HelperBroker.php +++ b/library/Zend/Controller/Action/HelperBroker.php @@ -60,8 +60,6 @@ class Zend_Controller_Action_HelperBroker public static function setPluginLoader($loader) { if ((null !== $loader) && (!$loader instanceof Zend_Loader_PluginLoader_Interface)) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Invalid plugin loader provided to HelperBroker'); } self::$_pluginLoader = $loader; @@ -167,8 +165,6 @@ public static function getExistingHelper($name) $stack = self::getStack(); if (!isset($stack->{$name})) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Action helper "' . $name . '" has not been registered with the helper broker'); } @@ -308,8 +304,6 @@ public function __call($method, $args) { $helper = $this->getHelper($method); if (!method_exists($helper, 'direct')) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Helper "' . $method . '" does not support overloading via direct()'); } @@ -354,16 +348,12 @@ protected static function _loadHelper($name) try { $class = self::getPluginLoader()->load($name); } catch (Zend_Loader_PluginLoader_Exception $e) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Action Helper by name ' . $name . ' not found', 0, $e); } $helper = new $class(); if (!$helper instanceof Zend_Controller_Action_Helper_Abstract) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('Helper name ' . $name . ' -> class ' . $class . ' is not of type Zend_Controller_Action_Helper_Abstract'); } diff --git a/library/Zend/Controller/Action/HelperBroker/PriorityStack.php b/library/Zend/Controller/Action/HelperBroker/PriorityStack.php index 35ba5006..b06a4678 100644 --- a/library/Zend/Controller/Action/HelperBroker/PriorityStack.php +++ b/library/Zend/Controller/Action/HelperBroker/PriorityStack.php @@ -117,8 +117,6 @@ public function offsetExists($priorityOrHelperName): bool public function offsetGet($priorityOrHelperName): mixed { if (!$this->offsetExists($priorityOrHelperName)) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('A helper with priority ' . $priorityOrHelperName . ' does not exist.'); } @@ -141,8 +139,6 @@ public function offsetSet($priority, $helper): Zend_Controller_Action_HelperBrok $priority = (int) $priority; if (!$helper instanceof Zend_Controller_Action_Helper_Abstract) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('$helper must extend Zend_Controller_Action_Helper_Abstract.'); } @@ -178,8 +174,6 @@ public function offsetSet($priority, $helper): Zend_Controller_Action_HelperBrok public function offsetUnset($priorityOrHelperName): Zend_Controller_Action_HelperBroker_PriorityStack { if (!$this->offsetExists($priorityOrHelperName)) { - require_once 'Zend/Controller/Action/Exception.php'; - throw new Zend_Controller_Action_Exception('A helper with priority or name ' . $priorityOrHelperName . ' does not exist.'); } diff --git a/library/Zend/Controller/Dispatcher/Abstract.php b/library/Zend/Controller/Dispatcher/Abstract.php index 6d4156b0..9d0e4a8b 100644 --- a/library/Zend/Controller/Dispatcher/Abstract.php +++ b/library/Zend/Controller/Dispatcher/Abstract.php @@ -149,16 +149,12 @@ public function _verifyDelimiter($spec) } if (!$allStrings) { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Word delimiter array must contain only strings'); } return $spec; } - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Invalid word delimiter'); } @@ -215,8 +211,6 @@ public function getPathDelimiter() public function setPathDelimiter($spec) { if (!is_string($spec)) { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Invalid path delimiter'); } $this->_pathDelimiter = $spec; diff --git a/library/Zend/Controller/Dispatcher/Exception.php b/library/Zend/Controller/Dispatcher/Exception.php index 366c9ac6..289816ae 100644 --- a/library/Zend/Controller/Dispatcher/Exception.php +++ b/library/Zend/Controller/Dispatcher/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Controller_Exception */ -require_once 'Zend/Controller/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Dispatcher/Standard.php b/library/Zend/Controller/Dispatcher/Standard.php index 4c80b960..b325c1c9 100644 --- a/library/Zend/Controller/Dispatcher/Standard.php +++ b/library/Zend/Controller/Dispatcher/Standard.php @@ -100,8 +100,6 @@ public function setControllerDirectory($directory, $module = null) $this->addControllerDirectory($path, $module); } } else { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Controller directory spec must be either a string or an array'); } @@ -242,8 +240,6 @@ public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Control if (!$this->isDispatchable($request)) { $controller = $request->getControllerName(); if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Invalid controller specified (' . $request->getControllerName() . ')'); } @@ -279,8 +275,6 @@ public function dispatch(Zend_Controller_Request_Abstract $request, Zend_Control $controller = new $moduleClassName($request, $this->getResponse(), $this->getParams()); if (!($controller instanceof Zend_Controller_Action_Interface) && !($controller instanceof Zend_Controller_Action)) { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception( 'Controller "' . $moduleClassName . '" is not an instance of Zend_Controller_Action_Interface' ); @@ -353,14 +347,10 @@ public function loadClass($className) if (Zend_Loader::isReadable($loadFile)) { include_once $loadFile; } else { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Cannot load controller class "' . $className . '" from file "' . $loadFile . "'"); } if (!class_exists($finalClass, false)) { - require_once 'Zend/Controller/Dispatcher/Exception.php'; - throw new Zend_Controller_Dispatcher_Exception('Invalid controller class ("' . $finalClass . '")'); } @@ -398,8 +388,6 @@ public function getControllerClass(Zend_Controller_Request_Abstract $request) $this->_curModule = $this->_defaultModule; $this->_curDirectory = $controllerDirs[$this->_defaultModule]; } else { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('No default module defined for this application'); } diff --git a/library/Zend/Controller/Exception.php b/library/Zend/Controller/Exception.php index c85fb9f3..d36f2844 100644 --- a/library/Zend/Controller/Exception.php +++ b/library/Zend/Controller/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Front.php b/library/Zend/Controller/Front.php index 9e92807a..c76316b2 100644 --- a/library/Zend/Controller/Front.php +++ b/library/Zend/Controller/Front.php @@ -296,8 +296,6 @@ public function addModuleDirectory($path) try { $dir = new DirectoryIterator($path); } catch (Exception $e) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception("Directory $path not readable", 0, $e); } foreach ($dir as $file) { @@ -467,8 +465,6 @@ public function setRequest($request) $request = new $request(); } if (!$request instanceof Zend_Controller_Request_Abstract) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid request class'); } @@ -511,8 +507,6 @@ public function setRouter($router) } if (!$router instanceof Zend_Controller_Router_Interface) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid router class'); } @@ -562,8 +556,6 @@ public function getRouter() public function setBaseUrl($base = null) { if (!is_string($base) && (null !== $base)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Rewrite base must be a string'); } @@ -643,8 +635,6 @@ public function setResponse($response) $response = new $response(); } if (!$response instanceof Zend_Controller_Response_Abstract) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid response class'); } diff --git a/library/Zend/Controller/Plugin/ActionStack.php b/library/Zend/Controller/Plugin/ActionStack.php index 44098f07..d1cdd83f 100644 --- a/library/Zend/Controller/Plugin/ActionStack.php +++ b/library/Zend/Controller/Plugin/ActionStack.php @@ -211,8 +211,6 @@ public function popStack() $this->_saveStack($stack); if (!$next instanceof Zend_Controller_Request_Abstract) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('ArrayStack should only contain request objects'); } $action = $next->getActionName(); diff --git a/library/Zend/Controller/Plugin/Broker.php b/library/Zend/Controller/Plugin/Broker.php index caceaf0c..39f2ab97 100644 --- a/library/Zend/Controller/Plugin/Broker.php +++ b/library/Zend/Controller/Plugin/Broker.php @@ -43,8 +43,6 @@ class Zend_Controller_Plugin_Broker extends Zend_Controller_Plugin_Abstract public function registerPlugin(Zend_Controller_Plugin_Abstract $plugin, $stackIndex = null) { if (false !== array_search($plugin, $this->_plugins, true)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Plugin already registered'); } @@ -52,8 +50,6 @@ public function registerPlugin(Zend_Controller_Plugin_Abstract $plugin, $stackIn if ($stackIndex) { if (isset($this->_plugins[$stackIndex])) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Plugin with stackIndex "' . $stackIndex . '" already registered'); } $this->_plugins[$stackIndex] = $plugin; @@ -92,8 +88,6 @@ public function unregisterPlugin($plugin) // Given a plugin object, find it in the array $key = array_search($plugin, $this->_plugins, true); if (false === $key) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Plugin never registered.'); } unset($this->_plugins[$key]); diff --git a/library/Zend/Controller/Request/Exception.php b/library/Zend/Controller/Request/Exception.php index dc13a4da..d3c10330 100644 --- a/library/Zend/Controller/Request/Exception.php +++ b/library/Zend/Controller/Request/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Controller_Exception */ -require_once 'Zend/Controller/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Request/Http.php b/library/Zend/Controller/Request/Http.php index c4d39080..dbe47368 100644 --- a/library/Zend/Controller/Request/Http.php +++ b/library/Zend/Controller/Request/Http.php @@ -122,8 +122,6 @@ public function __construct($uri = null) $this->setRequestUri($path); } else { - require_once 'Zend/Controller/Request/Exception.php'; - throw new Zend_Controller_Request_Exception('Invalid URI provided to constructor'); } } else { @@ -189,8 +187,6 @@ public function get($key) */ public function __set($key, $value) { - require_once 'Zend/Controller/Request/Exception.php'; - throw new Zend_Controller_Request_Exception('Setting values in superglobals not allowed; please use setParam()'); } @@ -255,8 +251,6 @@ public function has($key) public function setQuery($spec, $value = null) { if ((null === $value) && !is_array($spec)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid value passed to setQuery(); must be either array of values or key/value pair'); } if ((null === $value) && is_array($spec)) { @@ -303,8 +297,6 @@ public function getQuery($key = null, $default = null) public function setPost($spec, $value = null) { if ((null === $value) && !is_array($spec)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid value passed to setPost(); must be either array of values or key/value pair'); } if ((null === $value) && is_array($spec)) { @@ -1039,8 +1031,6 @@ public function getRawBody() public function getHeader($header) { if (empty($header)) { - require_once 'Zend/Controller/Request/Exception.php'; - throw new Zend_Controller_Request_Exception('An HTTP header name is required'); } diff --git a/library/Zend/Controller/Request/HttpTestCase.php b/library/Zend/Controller/Request/HttpTestCase.php index 11b6b4f6..d4d7d49a 100644 --- a/library/Zend/Controller/Request/HttpTestCase.php +++ b/library/Zend/Controller/Request/HttpTestCase.php @@ -178,8 +178,6 @@ public function setMethod($type) { $type = strtoupper(trim((string) $type)); if (!in_array($type, $this->_validMethodTypes)) { - require_once 'Zend/Controller/Exception.php'; - throw new Zend_Controller_Exception('Invalid request method specified'); } $this->_method = $type; diff --git a/library/Zend/Controller/Response/Abstract.php b/library/Zend/Controller/Response/Abstract.php index 38abfa84..2d971aa1 100644 --- a/library/Zend/Controller/Response/Abstract.php +++ b/library/Zend/Controller/Response/Abstract.php @@ -298,8 +298,6 @@ public function clearAllHeaders() public function setHttpResponseCode($code) { if (!is_int($code) || (100 > $code) || (599 < $code)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid HTTP response code'); } @@ -335,8 +333,6 @@ public function canSendHeaders($throw = false) { $ok = headers_sent($file, $line); if ($ok && $throw && $this->headersSentThrowsException) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); } @@ -512,8 +508,6 @@ public function getBody($spec = false) public function append($name, $content) { if (!is_string($name)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid body segment key ("' . gettype($name) . '")'); } @@ -537,8 +531,6 @@ public function append($name, $content) public function prepend($name, $content) { if (!is_string($name)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid body segment key ("' . gettype($name) . '")'); } @@ -566,14 +558,10 @@ public function prepend($name, $content) public function insert($name, $content, $parent = null, $before = false) { if (!is_string($name)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid body segment key ("' . gettype($name) . '")'); } if ((null !== $parent) && !is_string($parent)) { - require_once 'Zend/Controller/Response/Exception.php'; - throw new Zend_Controller_Response_Exception('Invalid body segment parent key ("' . gettype($parent) . '")'); } diff --git a/library/Zend/Controller/Response/Exception.php b/library/Zend/Controller/Response/Exception.php index 1059379b..e075672e 100644 --- a/library/Zend/Controller/Response/Exception.php +++ b/library/Zend/Controller/Response/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Controller_Exception */ -require_once 'Zend/Controller/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Router/Exception.php b/library/Zend/Controller/Router/Exception.php index 8675697b..5ebceea8 100644 --- a/library/Zend/Controller/Router/Exception.php +++ b/library/Zend/Controller/Router/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Controller_Exception */ -require_once 'Zend/Controller/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Router/Rewrite.php b/library/Zend/Controller/Router/Rewrite.php index d1753c84..c8bbb078 100644 --- a/library/Zend/Controller/Router/Rewrite.php +++ b/library/Zend/Controller/Router/Rewrite.php @@ -161,8 +161,6 @@ public function addConfig(Zend_Config $config, $section = null) { if ($section !== null) { if ($config->{$section} === null) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception("No route configuration in section '{$section}'"); } @@ -174,8 +172,6 @@ public function addConfig(Zend_Config $config, $section = null) if ($route instanceof Zend_Controller_Router_Route_Chain) { if (!isset($info->chain)) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('No chain defined'); } @@ -273,8 +269,6 @@ protected function _addChainRoutesFromConfig( public function removeRoute($name) { if (!isset($this->_routes[$name])) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception("Route $name is not defined"); } @@ -317,8 +311,6 @@ public function hasRoute($name) public function getRoute($name) { if (!isset($this->_routes[$name])) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception("Route $name is not defined"); } @@ -333,8 +325,6 @@ public function getRoute($name) public function getCurrentRoute() { if (!isset($this->_currentRoute)) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('Current route is not defined'); } @@ -349,8 +339,6 @@ public function getCurrentRoute() public function getCurrentRouteName() { if (!isset($this->_currentRoute)) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('Current route is not defined'); } @@ -376,8 +364,6 @@ public function getRoutes() public function route(Zend_Controller_Request_Abstract $request) { if (!$request instanceof Zend_Controller_Request_Http) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception( 'Zend_Controller_Router_Rewrite requires a Zend_Controller_Request_Http-based request object' ); @@ -413,8 +399,6 @@ public function route(Zend_Controller_Request_Abstract $request) } if (!$routeMatched) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('No route matched the request', 404); } @@ -466,8 +450,6 @@ protected function _setRequestParams($request, $params) public function assemble($userParams, $name = null, $reset = false, $encode = true) { if (!is_array($userParams)) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('userParams must be an array'); } diff --git a/library/Zend/Controller/Router/Route.php b/library/Zend/Controller/Router/Route.php index 16219df5..97905555 100644 --- a/library/Zend/Controller/Router/Route.php +++ b/library/Zend/Controller/Router/Route.php @@ -378,8 +378,6 @@ public function assemble($data = [], $reset = false, $encode = false, $partial = } elseif (array_key_exists($name, $this->_defaults)) { $value = $this->_defaults[$name]; } else { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception($name . ' is not specified'); } @@ -530,9 +528,7 @@ public function getTranslator() return $translator; } - require_once 'Zend/Controller/Router/Exception.php'; - - throw new Zend_Controller_Router_Exception('Could not find a translator'); + throw new Zend_Controller_Router_Exception('Could not find a translator'); } /** diff --git a/library/Zend/Controller/Router/Route/Hostname.php b/library/Zend/Controller/Router/Route/Hostname.php index e1b4b20a..5ae4c439 100644 --- a/library/Zend/Controller/Router/Route/Hostname.php +++ b/library/Zend/Controller/Router/Route/Hostname.php @@ -296,8 +296,6 @@ public function assemble($data = [], $reset = false, $encode = false, $partial = } elseif (isset($this->_defaults[$name])) { $host[$key] = $this->_defaults[$name]; } else { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception($name . ' is not specified'); } } else { diff --git a/library/Zend/Controller/Router/Route/Regex.php b/library/Zend/Controller/Router/Route/Regex.php index 11e78fd6..f9e9c430 100644 --- a/library/Zend/Controller/Router/Route/Regex.php +++ b/library/Zend/Controller/Router/Route/Regex.php @@ -213,8 +213,6 @@ protected function _getMappedValues($values, $reversed = false, $preserve = fals public function assemble($data = [], $reset = false, $encode = false, $partial = false) { if ($this->_reverse === null) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('Cannot assemble. Reversed route is not specified.'); } @@ -247,8 +245,6 @@ public function assemble($data = [], $reset = false, $encode = false, $partial = $return = $mergedData ? @vsprintf($this->_reverse, $mergedData) : $this->_reverse; if ($return === false) { - require_once 'Zend/Controller/Router/Exception.php'; - throw new Zend_Controller_Router_Exception('Cannot assemble. Too few arguments?'); } diff --git a/library/Zend/Date.php b/library/Zend/Date.php index c040dbdd..e0a163f3 100644 --- a/library/Zend/Date.php +++ b/library/Zend/Date.php @@ -249,24 +249,18 @@ public static function setOptions(array $options = []) switch ($name) { case 'format_type': if ((strtolower($value) != 'php') && (strtolower($value) != 'iso')) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("Unknown format type ($value) for dates, only 'iso' and 'php' supported", 0, null, $value); } break; case 'fix_dst': if (!is_bool($value)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("'fix_dst' has to be boolean", 0, null, $value); } break; case 'extend_month': if (!is_bool($value)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("'extend_month' has to be boolean", 0, null, $value); } @@ -276,8 +270,6 @@ public static function setOptions(array $options = []) parent::$_cache = null; } else { if (!$value instanceof Zend_Cache_Core) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('Instance of Zend_Cache expected'); } @@ -292,8 +284,6 @@ public static function setOptions(array $options = []) parent::$_defaultOffset = 0; } else { if (!$value instanceof Zend_TimeSync_Protocol) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('Instance of Zend_TimeSync expected'); } @@ -305,8 +295,6 @@ public static function setOptions(array $options = []) } self::$_options[$name] = $value; } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("Unknown option: $name = $value"); } } @@ -345,8 +333,6 @@ private function _timestamp($calc, $stamp) if (isset($stamp['timestamp']) === true) { $stamp = $stamp['timestamp']; } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('no timestamp given in array'); } } @@ -1138,8 +1124,6 @@ private function _getDigitFromName($name) return 12; default: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('Month ($name) is not a known month'); } } @@ -1415,8 +1399,6 @@ private function _calculate($calc, $date, $part, $locale) { $found = null; if ($date === null) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('parameter $date must be set, null is not allowed'); } @@ -1547,8 +1529,6 @@ private function _calculate($calc, $date, $part, $locale) break; default: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("datepart for part ($part) not found in array"); break; @@ -1593,8 +1573,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); break; @@ -1620,8 +1598,6 @@ private function _calculate($calc, $date, $part, $locale) } // Weekday not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); break; @@ -1632,8 +1608,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); break; @@ -1659,8 +1633,6 @@ private function _calculate($calc, $date, $part, $locale) } // Weekday not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); break; @@ -1673,15 +1645,11 @@ private function _calculate($calc, $date, $part, $locale) } // Weekday not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); break; case self::DAY_SUFFIX: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('day suffix not supported', 0, null, $date); break; @@ -1694,8 +1662,6 @@ private function _calculate($calc, $date, $part, $locale) } // Weekday not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); break; @@ -1712,8 +1678,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); break; @@ -1738,8 +1702,6 @@ private function _calculate($calc, $date, $part, $locale) } // Weekday not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); break; @@ -1764,8 +1726,6 @@ private function _calculate($calc, $date, $part, $locale) } // Weekday not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); break; @@ -1779,8 +1739,6 @@ private function _calculate($calc, $date, $part, $locale) parent::mktime(0, 0, 0, 1, 1 + ($week * 7), 1970, true), $hour); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, week expected", 0, null, $date); break; @@ -1827,8 +1785,6 @@ private function _calculate($calc, $date, $part, $locale) } // Monthname not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); break; @@ -1860,8 +1816,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); break; @@ -1907,8 +1861,6 @@ private function _calculate($calc, $date, $part, $locale) } // Monthname not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); break; @@ -1940,15 +1892,11 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); break; case self::MONTH_DAYS: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('month days not supported', 0, null, $date); break; @@ -1994,16 +1942,12 @@ private function _calculate($calc, $date, $part, $locale) } // Monthname not found - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); break; // year formats case self::LEAPYEAR: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('leap year not supported', 0, null, $date); break; @@ -2022,8 +1966,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, $month, $day, $year, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); break; @@ -2042,8 +1984,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, $month, $day, $year, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); break; @@ -2066,8 +2006,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, $month, $day, $year, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); break; @@ -2090,16 +2028,12 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, 0, $month, $day, $year, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); break; // time formats case self::MERIDIEM: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('meridiem not supported', 0, null, $date); break; @@ -2117,8 +2051,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime($hour, $minute, $second, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, swatchstamp expected", 0, null, $date); break; @@ -2129,8 +2061,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); break; @@ -2141,8 +2071,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); break; @@ -2153,8 +2081,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); break; @@ -2165,8 +2091,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); break; @@ -2177,8 +2101,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, $minute, 0, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, minute expected", 0, null, $date); break; @@ -2189,8 +2111,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, $second, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, second expected", 0, null, $date); break; @@ -2215,8 +2135,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->compareMillisecond($date); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, milliseconds expected", 0, null, $date); break; @@ -2227,8 +2145,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, $minute, 0, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, minute expected", 0, null, $date); break; @@ -2239,8 +2155,6 @@ private function _calculate($calc, $date, $part, $locale) $this->mktime(0, 0, $second, 1, 1, 1970, true), false); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, second expected", 0, null, $date); break; @@ -2250,23 +2164,17 @@ private function _calculate($calc, $date, $part, $locale) case self::TIMEZONE_NAME: case self::TIMEZONE: case self::TIMEZONE_SECS: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('timezone not supported', 0, null, $date); break; case self::DAYLIGHT: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('daylight not supported', 0, null, $date); break; case self::GMT_DIFF: case self::GMT_DIFF_SEP: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('gmtdiff not supported', 0, null, $date); break; @@ -2310,8 +2218,6 @@ private function _calculate($calc, $date, $part, $locale) preg_match('/[T,\s]{0,1}(\d{2})(\d{2})/', $tmpdate, $timematch); } if (empty($datematch) and empty($timematch)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date); } if (!empty($timematch)) { @@ -2357,8 +2263,6 @@ private function _calculate($calc, $date, $part, $locale) . '{1}\d{4}|\w{1,20})$/', $date, $match); if (!$result) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("no RFC 2822 format ($date)", 0, null, $date); } @@ -2383,8 +2287,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $date, $this->getUnixTimestamp()); } - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, timestamp expected", 0, null, $date); break; @@ -2393,8 +2295,6 @@ private function _calculate($calc, $date, $part, $locale) // break intentionally omitted case self::ERA: case self::ERA_NAME: - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('era not supported', 0, null, $date); break; @@ -2415,8 +2315,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2439,8 +2337,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2463,8 +2359,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2487,8 +2381,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2513,8 +2405,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2532,8 +2422,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2556,8 +2444,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2576,8 +2462,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2596,8 +2480,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2620,8 +2502,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2642,8 +2522,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2670,8 +2548,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2694,8 +2570,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2717,8 +2591,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2747,8 +2619,6 @@ private function _calculate($calc, $date, $part, $locale) return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } @@ -2759,8 +2629,6 @@ private function _calculate($calc, $date, $part, $locale) case self::RFC_3339: $result = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\d{0,4}([+-]{1}\d{2}:\d{2}|Z)$/', $date, $match); if (!$result) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, ATOM format expected", 0, null, $date); } @@ -2781,8 +2649,6 @@ private function _calculate($calc, $date, $part, $locale) case self::COOKIE: $result = preg_match("/^\w{6,9},\s(\d{2})-(\w{3})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})\s.{3,20}$/", $date, $match); if (!$result) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, COOKIE format expected", 0, null, $date); } $matchStartPos = iconv_strpos($match[0], ' ', 0, 'UTF-8') + 1; @@ -2813,8 +2679,6 @@ private function _calculate($calc, $date, $part, $locale) // new RFC 822 format, identical to RFC 1036 standard $result = preg_match('/^\w{0,3},{0,1}\s{0,1}(\d{1,2})\s(\w{3})\s(\d{2})\s(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]{1}\d{4}|\w{1,20})$/', $date, $match); if (!$result) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 822 date format expected", 0, null, $date); } @@ -2838,8 +2702,6 @@ private function _calculate($calc, $date, $part, $locale) case self::RFC_850: $result = preg_match('/^\w{6,9},\s(\d{2})-(\w{3})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})\s.{3,21}$/', $date, $match); if (!$result) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 850 date format expected", 0, null, $date); } @@ -2863,8 +2725,6 @@ private function _calculate($calc, $date, $part, $locale) case self::RFC_1123: $result = preg_match('/^\w{0,3},{0,1}\s{0,1}(\d{1,2})\s(\w{3})\s(\d{2,4})\s(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]{1}\d{4}|\w{1,20})$/', $date, $match); if (!$result) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 1123 date format expected", 0, null, $date); } @@ -2887,8 +2747,6 @@ private function _calculate($calc, $date, $part, $locale) case self::RSS: $result = preg_match('/^\w{3},\s(\d{2})\s(\w{3})\s(\d{2,4})\s(\d{1,2}):(\d{2}):(\d{2})\s.{1,21}$/', $date, $match); if (!$result) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, RSS date format expected", 0, null, $date); } @@ -2912,8 +2770,6 @@ private function _calculate($calc, $date, $part, $locale) case self::W3C: $result = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})[+-]{1}\d{2}:\d{2}$/', $date, $match); if (!$result) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid date ($date) operand, W3C date format expected", 0, null, $date); } @@ -2972,8 +2828,6 @@ private function _calculate($calc, $date, $part, $locale) false), $this->getUnixTimestamp(), false); } catch (Zend_Locale_Exception $e) { if (!is_numeric($date)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); } } @@ -3085,8 +2939,6 @@ public function getTime($locale = null) private function _time($calc, $time, $format, $locale) { if ($time === null) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('parameter $time must be set, null is not allowed'); } @@ -3099,8 +2951,6 @@ private function _time($calc, $time, $format, $locale) or (isset($time['second']) === true)) { $parsed = $time; } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('no hour, minute or second given in array'); } } else { @@ -3115,8 +2965,6 @@ private function _time($calc, $time, $format, $locale) $parsed = Zend_Locale_Format::getTime($time, ['date_format' => $format, 'locale' => $locale, 'format_type' => 'iso']); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e); } } @@ -3248,8 +3096,6 @@ public function getDate($locale = null) private function _date($calc, $date, $format, $locale) { if ($date === null) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('parameter $date must be set, null is not allowed'); } @@ -3262,8 +3108,6 @@ private function _date($calc, $date, $format, $locale) or (isset($date['day']) === true)) { $parsed = $date; } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('no day,month or year given in array'); } } else { @@ -3281,8 +3125,6 @@ private function _date($calc, $date, $format, $locale) $parsed['year'] = self::getFullYear($parsed['year']); } } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e); } } @@ -3555,18 +3397,12 @@ public function compareArpa($date, $locale = null) private function _checkLocation($location) { if (!isset($location['longitude']) or !isset($location['latitude'])) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('Location must include \'longitude\' and \'latitude\'', 0, null, $location); } if (($location['longitude'] > 180) or ($location['longitude'] < -180)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('Longitude must be between -180 and 180', 0, null, $location); } if (($location['latitude'] > 90) or ($location['latitude'] < -90)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('Latitude must be between -90 and 90', 0, null, $location); } @@ -3696,15 +3532,11 @@ public static function checkLeapYear($year) if (isset($year['year']) === true) { $year = $year['year']; } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('no year given in array'); } } if (!is_numeric($year)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("year ($year) has to be integer for checkLeapYear()", 0, null, $year); } @@ -3834,8 +3666,6 @@ private function _calcdetail($calc, $date, $type, $locale) private function _calcvalue($calc, $value, $type, $parameter, $locale) { if ($value === null) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("parameter $type must be set, null is not allowed"); } @@ -3847,8 +3677,6 @@ private function _calcvalue($calc, $value, $type, $parameter, $locale) // extract value from object $value = $value->toString($parameter, 'iso', $locale); } elseif (!is_array($value) && !is_numeric($value) && ($type != 'iso') && ($type != 'arpa')) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid $type ($value) operand", 0, null, $value); } @@ -3980,8 +3808,6 @@ private function _month($calc, $month, $locale) { $found = null; if ($month === null) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('parameter $month must be set, null is not allowed'); } @@ -3999,8 +3825,6 @@ private function _month($calc, $month, $locale) if (isset($month['month']) === true) { $month = $month['month']; } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('no month given in array'); } } else { @@ -4029,8 +3853,6 @@ private function _month($calc, $month, $locale) } } if ($found == 0) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("unknown month name ($month)", 0, null, $month); } } @@ -4137,8 +3959,6 @@ public function getDay($locale = null) private function _day($calc, $day, $locale) { if ($day === null) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('parameter $day must be set, null is not allowed'); } @@ -4157,8 +3977,6 @@ private function _day($calc, $day, $locale) $day = $day['day']; $type = self::WEEKDAY; } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('no day given in array'); } } else { @@ -4289,8 +4107,6 @@ public function getWeekday($locale = null) private function _weekday($calc, $weekday, $locale) { if ($weekday === null) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('parameter $weekday must be set, null is not allowed'); } @@ -4309,8 +4125,6 @@ private function _weekday($calc, $weekday, $locale) $weekday = $weekday['weekday']; $type = self::WEEKDAY; } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('no weekday given in array'); } } else { @@ -4753,8 +4567,6 @@ public function getFractionalPrecision() public function setFractionalPrecision($precision) { if (!intval($precision) or ($precision < 0) or ($precision > 9)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); } @@ -4794,8 +4606,6 @@ public function setMilliSecond($milli = null, $precision = null) $milli = intval($milli); $precision = 6; } elseif (!is_numeric($milli)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); } @@ -4804,8 +4614,6 @@ public function setMilliSecond($milli = null, $precision = null) } if (!is_int($precision) || $precision < 1 || $precision > 9) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); } @@ -4829,8 +4637,6 @@ public function addMilliSecond($milli = null, $precision = null) [$milli, $time] = explode(' ', microtime()); $milli = intval($milli); } elseif (!is_numeric($milli)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); } @@ -4843,8 +4649,6 @@ public function addMilliSecond($milli = null, $precision = null) } if (!is_int($precision) || $precision < 1 || $precision > 9) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception( "precision ($precision) must be a positive integer less than 10", 0, null, $precision ); @@ -4911,22 +4715,16 @@ public function compareMilliSecond($milli = null, $precision = null) [$milli, $time] = explode(' ', microtime()); $milli = intval($milli); } elseif (is_numeric($milli) === false) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); } if ($precision === null) { $precision = strlen($milli); } elseif (!is_int($precision) || $precision < 1 || $precision > 9) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); } if ($precision === 0) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('precision is 0'); } @@ -5047,8 +4845,6 @@ public function setLocale($locale = null) try { $this->_locale = Zend_Locale::findLocale($locale); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception($e->getMessage(), 0, $e); } diff --git a/library/Zend/Date/Cities.php b/library/Zend/Date/Cities.php index 7974c8c2..dd245bd3 100644 --- a/library/Zend/Date/Cities.php +++ b/library/Zend/Date/Cities.php @@ -302,7 +302,6 @@ public static function City($city, $horizon = false) return $return; } } - require_once 'Zend/Date/Exception.php'; throw new Zend_Date_Exception('unknown city'); } diff --git a/library/Zend/Date/DateObject.php b/library/Zend/Date/DateObject.php index 5219b68d..efa4870a 100644 --- a/library/Zend/Date/DateObject.php +++ b/library/Zend/Date/DateObject.php @@ -85,8 +85,6 @@ protected function setUnixTimestamp($timestamp = null) } elseif ($timestamp === null) { $this->_unixTimestamp = time(); } else { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception('\'' . $timestamp . '\' is not a valid UNIX timestamp', 0, null, $timestamp); } @@ -1064,8 +1062,6 @@ public function setTimezone($zone = null) // throw an error on false input, but only if the new date extension is available if (function_exists('timezone_open')) { if (!@timezone_open($zone)) { - require_once 'Zend/Date/Exception.php'; - throw new Zend_Date_Exception("timezone ($zone) is not a known timezone", 0, null, $zone); } } diff --git a/library/Zend/Date/Exception.php b/library/Zend/Date/Exception.php index 19034c4e..303456cd 100644 --- a/library/Zend/Date/Exception.php +++ b/library/Zend/Date/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/File/Transfer.php b/library/Zend/File/Transfer.php index a78bc380..59e2c1fb 100644 --- a/library/Zend/File/Transfer.php +++ b/library/Zend/File/Transfer.php @@ -69,8 +69,6 @@ public function setAdapter($adapter, $direction = false, $options = []) $direction = (integer) $direction; $this->_adapter[$direction] = new $adapter($options); if (!$this->_adapter[$direction] instanceof Zend_File_Transfer_Adapter_Abstract) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Adapter ' . $adapter . ' does not extend Zend_File_Transfer_Adapter_Abstract'); } @@ -117,8 +115,6 @@ public function __call($method, array $options) return call_user_func_array([$this->_adapter[$direction], $method], $options); } - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("Unknown method '" . $method . "' called!"); } } diff --git a/library/Zend/File/Transfer/Adapter/Abstract.php b/library/Zend/File/Transfer/Adapter/Abstract.php index e532d449..087b5bf3 100644 --- a/library/Zend/File/Transfer/Adapter/Abstract.php +++ b/library/Zend/File/Transfer/Adapter/Abstract.php @@ -175,8 +175,6 @@ abstract public function isFiltered($files = null); */ public static function getProgress() { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method must be implemented within the adapter'); } @@ -197,8 +195,6 @@ public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader, $typ return $this; default: - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('Invalid type "%s" provided to setPluginLoader()', $type)); } } @@ -239,8 +235,6 @@ public function getPluginLoader($type) return $this->_loaders[$type]; default: - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -284,8 +278,6 @@ public function addPrefixPath($prefix, $path, $type = null) return $this; default: - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -359,8 +351,6 @@ public function addValidator($validator, $breakChainOnFailure = false, $options unset($options['messages']); } } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Invalid validator provided to addValidator; must be string or Zend_Validate_Interface'); } @@ -447,8 +437,6 @@ public function addValidators(array $validators, $files = null) } } } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Invalid validator passed to addValidators()'); } } @@ -608,8 +596,6 @@ public function setOptions($options = [], $files = null) break; default: - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("Unknown option: $name = $value"); } } @@ -793,8 +779,6 @@ public function addFilter($filter, $options = null, $files = null) $class = $this->getPluginLoader(self::FILTER)->load($filter); $filter = new $class($options); } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Invalid filter specified'); } @@ -979,8 +963,6 @@ public function clearFilters() */ public function getFile() { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -1039,8 +1021,6 @@ public function getFileInfo($file = null) */ public function addFile($file, $validator = null, $filter = null) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -1051,8 +1031,6 @@ public function addFile($file, $validator = null, $filter = null) */ public function getType() { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -1067,8 +1045,6 @@ public function getType() */ public function addType($type, $validator = null, $filter = null) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -1087,16 +1063,12 @@ public function setDestination($destination, $files = null) $orig = $files; $destination = rtrim($destination, '/\\'); if (!is_dir($destination)) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception( 'The given destination is not a directory or does not exist' ); } if (!$this->_isPathWriteable($destination)) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception( 'The given destination is not writable' ); @@ -1136,8 +1108,6 @@ public function getDestination($files = null) if (isset($this->_files[$orig]['destination'])) { $destinations[$orig] = $this->_files[$orig]['destination']; } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('The file transfer adapter can not find "%s"', $orig)); } } @@ -1177,8 +1147,6 @@ public function setTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Invalid translator specified'); } @@ -1234,8 +1202,6 @@ public function translatorIsDisabled() public function getHash($hash = 'crc32', $files = null) { if (!in_array($hash, hash_algos())) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Unknown hash algorithm'); } @@ -1247,8 +1213,6 @@ public function getHash($hash = 'crc32', $files = null) } elseif (file_exists($value['tmp_name'])) { $result[$key] = hash_file($hash, $value['tmp_name']); } elseif (empty($value['options']['ignoreNoFile'])) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("The file '{$value['name']}' does not exist"); } } @@ -1279,8 +1243,6 @@ public function getFileSize($files = null) $result[$key] = $value['size']; } } elseif (empty($value['options']['ignoreNoFile'])) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("The file '{$value['name']}' does not exist"); } else { continue; @@ -1330,8 +1292,6 @@ public function getMimeType($files = null) if (file_exists($value['name']) || file_exists($value['tmp_name'])) { $result[$key] = $value['type']; } elseif (empty($value['options']['ignoreNoFile'])) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception("The file '{$value['name']}' does not exist"); } else { continue; @@ -1485,8 +1445,6 @@ protected function _getTmpDir() $this->_tmpDir = realpath(dirname($tempFile)); unlink($tempFile); } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Could not determine a temporary directory'); } } @@ -1575,8 +1533,6 @@ protected function _getFiles($files, $names = false, $noexception = false) return []; } - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception(sprintf('The file transfer adapter can not find "%s"', $find)); } diff --git a/library/Zend/File/Transfer/Adapter/Http.php b/library/Zend/File/Transfer/Adapter/Http.php index db43f646..493a0f7d 100644 --- a/library/Zend/File/Transfer/Adapter/Http.php +++ b/library/Zend/File/Transfer/Adapter/Http.php @@ -42,8 +42,6 @@ class Zend_File_Transfer_Adapter_Http extends Zend_File_Transfer_Adapter_Abstrac public function __construct($options = []) { if (ini_get('file_uploads') == false) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('File uploads are not allowed in your php config!'); } @@ -102,8 +100,6 @@ public function clearValidators() */ public function send($options = null) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -232,8 +228,6 @@ public function receive($files = null) */ public function isSent($files = null) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Method not implemented'); } @@ -317,8 +311,6 @@ public static function getProgress($id = null) { $call = null; if (!function_exists('apc_fetch') and !function_exists('uploadprogress_get_info')) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Neither APC nor uploadprogress extension installed'); } @@ -400,8 +392,6 @@ public static function getProgress($id = null) } if (!($adapter instanceof Zend_ProgressBar)) { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Unknown Adapter given'); } diff --git a/library/Zend/File/Transfer/Exception.php b/library/Zend/File/Transfer/Exception.php index 8aa0d640..b06a4f42 100644 --- a/library/Zend/File/Transfer/Exception.php +++ b/library/Zend/File/Transfer/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * Exception class for Zend_File_Transfer. * diff --git a/library/Zend/Filter.php b/library/Zend/Filter.php index 911589ea..37e12a69 100644 --- a/library/Zend/Filter.php +++ b/library/Zend/Filter.php @@ -228,7 +228,6 @@ public static function filterStatic($value, $classBaseName, array $args = [], $n return $object->filter($value); } } - require_once 'Zend/Filter/Exception.php'; throw new Zend_Filter_Exception("Filter class not found from basename '$classBaseName'"); } diff --git a/library/Zend/Filter/Boolean.php b/library/Zend/Filter/Boolean.php index 4601ff5b..3849d2ca 100644 --- a/library/Zend/Filter/Boolean.php +++ b/library/Zend/Filter/Boolean.php @@ -150,8 +150,6 @@ public function setType($type = null) } if (!is_int($type) || ($type < 0) || ($type > self::ALL)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Unknown type'); } @@ -184,16 +182,12 @@ public function setLocale($locale = null) } elseif ($locale instanceof Zend_Locale) { $locale = [$locale->toString()]; } elseif (!is_array($locale)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Locale has to be string, array or an instance of Zend_Locale'); } require_once 'Zend/Locale.php'; foreach ($locale as $single) { if (!Zend_Locale::isLocale($single)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Unknown locale '$single'"); } } diff --git a/library/Zend/Filter/Callback.php b/library/Zend/Filter/Callback.php index a309db3d..7485a0ed 100644 --- a/library/Zend/Filter/Callback.php +++ b/library/Zend/Filter/Callback.php @@ -63,8 +63,6 @@ public function __construct($options) } if (!array_key_exists('callback', $options)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Missing callback to use'); } @@ -95,8 +93,6 @@ public function getCallback() public function setCallback($callback, $options = null) { if (!is_callable($callback)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Callback can not be accessed'); } diff --git a/library/Zend/Filter/Compress.php b/library/Zend/Filter/Compress.php index 9ef30ccd..86288d3c 100644 --- a/library/Zend/Filter/Compress.php +++ b/library/Zend/Filter/Compress.php @@ -102,8 +102,6 @@ public function getAdapter() $this->_adapter = new $adapter($options); if (!$this->_adapter instanceof Zend_Filter_Compress_CompressInterface) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Compression adapter '" . $adapter . "' does not implement Zend_Filter_Compress_CompressInterface"); } @@ -135,8 +133,6 @@ public function setAdapter($adapter) return $this; } if (!is_string($adapter)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Invalid adapter provided; must be string or instance of Zend_Filter_Compress_CompressInterface'); } $this->_adapter = $adapter; @@ -174,8 +170,6 @@ public function __call($method, $options) { $adapter = $this->getAdapter(); if (!method_exists($adapter, $method)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Unknown method '{$method}'"); } diff --git a/library/Zend/Filter/Compress/Bz2.php b/library/Zend/Filter/Compress/Bz2.php index d159137b..46a17707 100644 --- a/library/Zend/Filter/Compress/Bz2.php +++ b/library/Zend/Filter/Compress/Bz2.php @@ -52,8 +52,6 @@ class Zend_Filter_Compress_Bz2 extends Zend_Filter_Compress_CompressAbstract public function __construct($options = null) { if (!extension_loaded('bz2')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('This filter needs the bz2 extension'); } parent::__construct($options); @@ -79,8 +77,6 @@ public function getBlocksize() public function setBlocksize($blocksize) { if (($blocksize < 0) || ($blocksize > 9)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Blocksize must be between 0 and 9'); } @@ -126,8 +122,6 @@ public function compress($content) if (!empty($archive)) { $file = bzopen($archive, 'w'); if (!$file) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Error opening the archive '" . $archive . "'"); } @@ -139,8 +133,6 @@ public function compress($content) } if (is_int($compressed)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error during compression'); } @@ -164,8 +156,6 @@ public function decompress($content) if (@file_exists($archive)) { $file = bzopen($archive, 'r'); if (!$file) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Error opening the archive '" . $content . "'"); } @@ -176,8 +166,6 @@ public function decompress($content) } if (is_int($compressed)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error during decompression'); } diff --git a/library/Zend/Filter/Compress/Gz.php b/library/Zend/Filter/Compress/Gz.php index fa042640..d1789e29 100644 --- a/library/Zend/Filter/Compress/Gz.php +++ b/library/Zend/Filter/Compress/Gz.php @@ -54,8 +54,6 @@ class Zend_Filter_Compress_Gz extends Zend_Filter_Compress_CompressAbstract public function __construct($options = null) { if (!extension_loaded('zlib')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('This filter needs the zlib extension'); } parent::__construct($options); @@ -81,8 +79,6 @@ public function getLevel() public function setLevel($level) { if (($level < 0) || ($level > 9)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Level must be between 0 and 9'); } @@ -109,8 +105,6 @@ public function getMode() public function setMode($mode) { if (($mode != 'compress') && ($mode != 'deflate')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Given compression mode not supported'); } @@ -156,8 +150,6 @@ public function compress($content) if (!empty($archive)) { $file = gzopen($archive, 'w' . $this->getLevel()); if (!$file) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Error opening the archive '" . $this->_options['archive'] . "'"); } @@ -171,8 +163,6 @@ public function compress($content) } if (!$compressed) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error during compression'); } @@ -197,8 +187,6 @@ public function decompress($content) if (@file_exists($archive)) { $handler = fopen($archive, 'rb'); if (!$handler) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Error opening the archive '" . $archive . "'"); } @@ -218,8 +206,6 @@ public function decompress($content) } if (!$compressed) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error during compression'); } diff --git a/library/Zend/Filter/Compress/Lzf.php b/library/Zend/Filter/Compress/Lzf.php index c3ee8466..c55e789a 100644 --- a/library/Zend/Filter/Compress/Lzf.php +++ b/library/Zend/Filter/Compress/Lzf.php @@ -36,8 +36,6 @@ class Zend_Filter_Compress_Lzf implements Zend_Filter_Compress_CompressInterface public function __construct() { if (!extension_loaded('lzf')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('This filter needs the lzf extension'); } } @@ -53,8 +51,6 @@ public function compress($content) { $compressed = lzf_compress($content); if (!$compressed) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error during compression'); } @@ -72,8 +68,6 @@ public function decompress($content) { $compressed = lzf_decompress($content); if (!$compressed) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error during compression'); } diff --git a/library/Zend/Filter/Compress/Rar.php b/library/Zend/Filter/Compress/Rar.php index cfb8d34c..874ecb86 100644 --- a/library/Zend/Filter/Compress/Rar.php +++ b/library/Zend/Filter/Compress/Rar.php @@ -56,8 +56,6 @@ class Zend_Filter_Compress_Rar extends Zend_Filter_Compress_CompressAbstract public function __construct($options = null) { if (!extension_loaded('rar')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('This filter needs the rar extension'); } parent::__construct($options); @@ -83,8 +81,6 @@ public function getCallback() public function setCallback($callback) { if (!is_callable($callback)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Callback can not be accessed'); } @@ -162,8 +158,6 @@ public function getTarget() public function setTarget($target) { if (!file_exists(dirname($target))) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("The directory '$target' does not exist"); } @@ -184,8 +178,6 @@ public function compress($content) { $callback = $this->getCallback(); if ($callback === null) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('No compression callback available'); } @@ -194,8 +186,6 @@ public function compress($content) $result = call_user_func($callback, $options, $content); if ($result !== true) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error compressing the RAR Archive'); } @@ -215,8 +205,6 @@ public function decompress($content) if (file_exists($content)) { $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); } elseif (empty($archive) || !file_exists($archive)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('RAR Archive not found'); } @@ -228,8 +216,6 @@ public function decompress($content) } if (!$archive) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error opening the RAR Archive'); } @@ -240,8 +226,6 @@ public function decompress($content) $filelist = rar_list($archive); if (!$filelist) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error reading the RAR Archive'); } diff --git a/library/Zend/Filter/Compress/Tar.php b/library/Zend/Filter/Compress/Tar.php index 7add64d9..90cbd11f 100644 --- a/library/Zend/Filter/Compress/Tar.php +++ b/library/Zend/Filter/Compress/Tar.php @@ -58,8 +58,6 @@ public function __construct($options = null) try { Zend_Loader::loadClass('Archive_Tar'); } catch (Zend_Exception $e) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('This filter needs PEARs Archive_Tar', 0, $e); } } @@ -112,8 +110,6 @@ public function getTarget() public function setTarget($target) { if (!file_exists(dirname($target))) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("The directory '$target' does not exist"); } @@ -141,20 +137,14 @@ public function setMode($mode) { $mode = ucfirst(strtolower($mode)); if (($mode != 'Bz2') && ($mode != 'Gz')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("The mode '$mode' is unknown"); } if (($mode == 'Bz2') && (!extension_loaded('bz2'))) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('This mode needs the bz2 extension'); } if (($mode == 'Gz') && (!extension_loaded('zlib'))) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('This mode needs the zlib extension'); } } @@ -177,8 +167,6 @@ public function compress($content) $result = file_put_contents($file, $content); if ($result === false) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error creating the temporary file'); } @@ -202,8 +190,6 @@ public function compress($content) $result = $archive->create($content); if ($result === false) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error creating the Tar archive'); } @@ -223,8 +209,6 @@ public function decompress($content) if (file_exists($content)) { $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); } elseif (empty($archive) || !file_exists($archive)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Tar Archive not found'); } @@ -236,8 +220,6 @@ public function decompress($content) $result = $archive->extract($target); if ($result === false) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Error while extracting the Tar archive'); } diff --git a/library/Zend/Filter/Compress/Zip.php b/library/Zend/Filter/Compress/Zip.php index 07824145..4c4a14f2 100644 --- a/library/Zend/Filter/Compress/Zip.php +++ b/library/Zend/Filter/Compress/Zip.php @@ -53,8 +53,6 @@ class Zend_Filter_Compress_Zip extends Zend_Filter_Compress_CompressAbstract public function __construct($options = null) { if (!extension_loaded('zip')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('This filter needs the zip extension'); } parent::__construct($options); @@ -105,8 +103,6 @@ public function getTarget() public function setTarget($target) { if (!file_exists(dirname($target))) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("The directory '$target' does not exist"); } @@ -129,8 +125,6 @@ public function compress($content) $res = $zip->open($this->getArchive(), ZipArchive::CREATE | ZipArchive::OVERWRITE); if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception($this->_errorString($res)); } @@ -166,8 +160,6 @@ public function compress($content) foreach ($files as $file) { $zip->addFile($current . $file, $local . $file); if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception($this->_errorString($res)); } } @@ -175,8 +167,6 @@ public function compress($content) } else { $res = $zip->addFile($content, $basename); if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception($this->_errorString($res)); } } @@ -190,8 +180,6 @@ public function compress($content) $res = $zip->addFromString($file, $content); if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception($this->_errorString($res)); } } @@ -214,8 +202,6 @@ public function decompress($content) if (file_exists($content)) { $archive = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, realpath($content)); } elseif (empty($archive) || !file_exists($archive)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('ZIP Archive not found'); } @@ -233,14 +219,10 @@ public function decompress($content) } if (empty($target) || !is_dir($target)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('No target for ZIP decompression set'); } if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception($this->_errorString($res)); } @@ -252,8 +234,6 @@ public function decompress($content) || (substr($currName, 0, 2) == '..') || (substr($currName, 0, 4) == './..') ) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Upward directory traversal was detected inside ' . $archive . ' please use PHP 5.2.8 or greater to take advantage of path resolution features of ' . 'the zip extension in this decompress() method.' @@ -264,8 +244,6 @@ public function decompress($content) $res = @$zip->extractTo($target); if ($res !== true) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception($this->_errorString($res)); } diff --git a/library/Zend/Filter/Exception.php b/library/Zend/Filter/Exception.php index 2b7c357b..78e39081 100644 --- a/library/Zend/Filter/Exception.php +++ b/library/Zend/Filter/Exception.php @@ -21,8 +21,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/File/LowerCase.php b/library/Zend/Filter/File/LowerCase.php index 45a30ec4..0c901761 100644 --- a/library/Zend/Filter/File/LowerCase.php +++ b/library/Zend/Filter/File/LowerCase.php @@ -52,21 +52,15 @@ public function __construct($options = null) public function filter($value) { if (!file_exists($value)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("File '$value' not found"); } if (!is_writable($value)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("File '$value' is not writable"); } $content = file_get_contents($value); if (!$content) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Problem while reading file '$value'"); } @@ -74,8 +68,6 @@ public function filter($value) $result = file_put_contents($value, $content); if (!$result) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Problem while writing file '$value'"); } diff --git a/library/Zend/Filter/File/Rename.php b/library/Zend/Filter/File/Rename.php index 7d4897f3..347d2ee8 100644 --- a/library/Zend/Filter/File/Rename.php +++ b/library/Zend/Filter/File/Rename.php @@ -51,8 +51,6 @@ public function __construct($options) } elseif (is_string($options)) { $options = ['target' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Invalid options argument provided to filter'); } @@ -118,8 +116,6 @@ public function addFile($options) if (is_string($options)) { $options = ['target' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Invalid options to rename filter provided'); } @@ -158,8 +154,6 @@ public function getNewName($value, $source = false) } if (file_exists($file['target'])) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception(sprintf("File '%s' could not be renamed. It already exists.", $value)); } @@ -193,8 +187,6 @@ public function filter($value) return $file['target']; } - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception(sprintf("File '%s' could not be renamed. An error occured while processing the file.", $value)); } diff --git a/library/Zend/Filter/File/UpperCase.php b/library/Zend/Filter/File/UpperCase.php index b64852fa..e444a7e7 100644 --- a/library/Zend/Filter/File/UpperCase.php +++ b/library/Zend/Filter/File/UpperCase.php @@ -52,21 +52,15 @@ public function __construct($options = null) public function filter($value) { if (!file_exists($value)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("File '$value' not found"); } if (!is_writable($value)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("File '$value' is not writable"); } $content = file_get_contents($value); if (!$content) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Problem while reading file '$value'"); } @@ -74,8 +68,6 @@ public function filter($value) $result = file_put_contents($value, $content); if (!$result) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Problem while writing file '$value'"); } diff --git a/library/Zend/Filter/HtmlEntities.php b/library/Zend/Filter/HtmlEntities.php index 53c74422..219455f1 100644 --- a/library/Zend/Filter/HtmlEntities.php +++ b/library/Zend/Filter/HtmlEntities.php @@ -202,16 +202,12 @@ public function filter($value) $filtered = htmlentities((string) $value, $this->getQuoteStyle(), $this->getEncoding(), $this->getDoubleQuote()); if (strlen((string) $value) && !strlen($filtered)) { if (!function_exists('iconv')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Encoding mismatch has resulted in htmlentities errors'); } $enc = $this->getEncoding(); $value = iconv('', $enc . '//IGNORE', (string) $value); $filtered = htmlentities($value, $this->getQuoteStyle(), $enc, $this->getDoubleQuote()); if (!strlen($filtered)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Encoding mismatch has resulted in htmlentities errors'); } } diff --git a/library/Zend/Filter/Inflector.php b/library/Zend/Filter/Inflector.php index cd409d51..b3fb15e1 100644 --- a/library/Zend/Filter/Inflector.php +++ b/library/Zend/Filter/Inflector.php @@ -503,8 +503,6 @@ public function filter($source) $inflectedTarget = preg_replace(array_keys($processedParts), array_values($processedParts), $this->_target); if ($this->_throwTargetExceptionsOn && (preg_match('#(?=' . $pregQuotedTargetReplacementIdentifier . '[A-Za-z]{1})#', $inflectedTarget) == true)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('A replacement identifier ' . $this->_targetReplacementIdentifier . ' was found inside the inflected target, perhaps a rule was not satisfied with a target source? Unsatisfied inflected target: ' . $inflectedTarget); } @@ -541,8 +539,6 @@ protected function _getRule($rule) $className = $this->getPluginLoader()->load($rule); $ruleObject = new $className(); if (!$ruleObject instanceof Zend_Filter_Interface) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('No class named ' . $rule . ' implementing Zend_Filter_Interface could be found'); } diff --git a/library/Zend/Filter/Input.php b/library/Zend/Filter/Input.php index faa70a2e..7c9d9595 100644 --- a/library/Zend/Filter/Input.php +++ b/library/Zend/Filter/Input.php @@ -244,8 +244,6 @@ public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader, $typ return $this; default: - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception(sprintf('Invalid type "%s" provided to setPluginLoader()', $type)); } @@ -282,8 +280,6 @@ public function getPluginLoader($type) break; default: - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } @@ -489,13 +485,9 @@ public function process() { $this->_process(); if ($this->hasInvalid()) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Input has invalid fields'); } if ($this->hasMissing()) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Input has missing fields'); } @@ -532,8 +524,6 @@ public function setDefaultEscapeFilter($escapeFilter) $escapeFilter = $this->_getFilter($escapeFilter); } if (!$escapeFilter instanceof Zend_Filter_Interface) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Escape filter specified does not implement Zend_Filter_Interface'); } $this->_defaultEscapeFilter = $escapeFilter; @@ -591,8 +581,6 @@ public function setOptions(array $options) break; default: - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Unknown option '$option'"); break; @@ -616,8 +604,6 @@ public function setTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid translator specified'); } @@ -1209,8 +1195,6 @@ protected function _getFilterOrValidator($type, $classBaseName) $class = new ReflectionClass($className); if (!$class->implementsInterface($interfaceName)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("Class '$className' based on basename '$classBaseName' must implement the '$interfaceName' interface"); } diff --git a/library/Zend/Filter/Null.php b/library/Zend/Filter/Null.php index baeba00d..b45aa010 100644 --- a/library/Zend/Filter/Null.php +++ b/library/Zend/Filter/Null.php @@ -113,8 +113,6 @@ public function setType($type = null) } if (!is_int($type) || ($type < 0) || ($type > self::ALL)) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('Unknown type'); } diff --git a/library/Zend/Filter/PregReplace.php b/library/Zend/Filter/PregReplace.php index 8d00be09..20e7e9bd 100644 --- a/library/Zend/Filter/PregReplace.php +++ b/library/Zend/Filter/PregReplace.php @@ -166,8 +166,6 @@ public function getReplacement() public function filter($value) { if ($this->_matchPattern == null) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception(get_class($this) . ' does not have a valid MatchPattern set.'); } diff --git a/library/Zend/Filter/StringToLower.php b/library/Zend/Filter/StringToLower.php index 769f81fa..2dc35934 100644 --- a/library/Zend/Filter/StringToLower.php +++ b/library/Zend/Filter/StringToLower.php @@ -83,15 +83,11 @@ public function setEncoding($encoding = null) { if ($encoding !== null) { if (!function_exists('mb_strtolower')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('mbstring is required for this feature'); } $encoding = (string) $encoding; if (!in_array(strtolower($encoding), array_map('strtolower', mb_list_encodings()))) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("The given encoding '$encoding' is not supported by mbstring"); } } diff --git a/library/Zend/Filter/StringToUpper.php b/library/Zend/Filter/StringToUpper.php index 1a46da41..a3f253ad 100644 --- a/library/Zend/Filter/StringToUpper.php +++ b/library/Zend/Filter/StringToUpper.php @@ -83,15 +83,11 @@ public function setEncoding($encoding = null) { if ($encoding !== null) { if (!function_exists('mb_strtoupper')) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('mbstring is required for this feature'); } $encoding = (string) $encoding; if (!in_array(strtolower($encoding), array_map('strtolower', mb_list_encodings()))) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception("The given encoding '$encoding' is not supported by mbstring"); } } diff --git a/library/Zend/Filter/Word/Separator/Abstract.php b/library/Zend/Filter/Word/Separator/Abstract.php index 777be122..7c214ee7 100644 --- a/library/Zend/Filter/Word/Separator/Abstract.php +++ b/library/Zend/Filter/Word/Separator/Abstract.php @@ -52,8 +52,6 @@ public function __construct($separator = ' ') public function setSeparator($separator) { if ($separator == null) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('"' . $separator . '" is not a valid separator.'); } $this->_separator = $separator; diff --git a/library/Zend/Filter/Word/SeparatorToSeparator.php b/library/Zend/Filter/Word/SeparatorToSeparator.php index eb2be3f2..5e67966f 100644 --- a/library/Zend/Filter/Word/SeparatorToSeparator.php +++ b/library/Zend/Filter/Word/SeparatorToSeparator.php @@ -118,8 +118,6 @@ public function filter($value) protected function _separatorToSeparatorFilter($value) { if ($this->_searchSeparator == null) { - require_once 'Zend/Filter/Exception.php'; - throw new Zend_Filter_Exception('You must provide a search separator for this filter to work.'); } diff --git a/library/Zend/Form.php b/library/Zend/Form.php index 145c7249..6cc47858 100644 --- a/library/Zend/Form.php +++ b/library/Zend/Form.php @@ -440,8 +440,6 @@ public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader, $typ return $this; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to setPluginLoader()', $type)); } } @@ -478,8 +476,6 @@ public function getPluginLoader($type = null) break; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } @@ -540,8 +536,6 @@ public function addPrefixPath($prefix, $path, $type = null) return $this; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -831,8 +825,6 @@ public function setMethod($method) { $method = strtolower($method); if (!in_array($method, $this->_methods)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('"%s" is an invalid form method', $method)); } $this->setAttrib('method', $method); @@ -913,8 +905,6 @@ public function setName($name) { $name = $this->filterName($name); if ('' === (string) $name) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid name provided; must contain only valid variable characters and be non-empty'); } @@ -1087,8 +1077,6 @@ public function addElement($element, $name = null, $options = null) { if (is_string($element)) { if (null === $name) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception( 'Elements specified by string must have an accompanying name' ); @@ -1115,8 +1103,6 @@ public function addElement($element, $name = null, $options = null) $this->_elements[$name] = $element; $this->_elements[$name]->addPrefixPaths($prefixPaths); } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception( 'Element must be specified by string or Zend_Form_Element instance' ); @@ -1146,14 +1132,10 @@ public function addElement($element, $name = null, $options = null) public function createElement($type, $name, $options = null) { if (!is_string($type)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Element type must be a string indicating type'); } if (!is_string($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Element name must be a string'); } @@ -1926,8 +1908,6 @@ public function addDisplayGroup(array $elements, $name, $options = null) } } if (empty($group)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('No valid elements specified for display group'); } @@ -1986,8 +1966,6 @@ protected function _addDisplayGroupObject(Zend_Form_DisplayGroup $group, $name = if (null === $name) { $name = $group->getName(); if ('' === (string) $name) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid display group added; requires name'); } } @@ -2371,8 +2349,6 @@ protected function _array_replace_recursive(array $into) public function isValid($data) { if (!is_array($data)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(__METHOD__ . ' expects an array'); } $translator = $this->getTranslator(); @@ -2858,8 +2834,6 @@ public function addDecorator($decorator, $options = null) break; } if (is_numeric($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { @@ -2871,8 +2845,6 @@ public function addDecorator($decorator, $options = null) $decorator = $spec; } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator provided to addDecorator; must be string or Zend_Form_Decorator_Interface'); } @@ -2922,8 +2894,6 @@ public function addDecorators(array $decorators) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator passed to addDecorators()'); } } @@ -3165,8 +3135,6 @@ public function setTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid translator specified'); } @@ -3187,8 +3155,6 @@ public static function setDefaultTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { self::$_translatorDefault = $translator->getAdapter(); } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid translator specified'); } } @@ -3324,7 +3290,6 @@ public function __set($name, $value) return; } - require_once 'Zend/Form/Exception.php'; if (is_object($value)) { $type = get_class($value); } else { @@ -3396,13 +3361,9 @@ public function __call($method, $args) return $decorator->render($seed); } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Decorator by name %s does not exist', $decoratorName)); } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Method %s does not exist', $method)); } @@ -3428,7 +3389,6 @@ public function current(): mixed if (isset($this->_displayGroups[$key])) { return $this->getDisplayGroup($key); } - require_once 'Zend/Form/Exception.php'; throw new Zend_Form_Exception(sprintf('Corruption detected in form; invalid key ("%s") found in internal iterator', (string) $key)); } diff --git a/library/Zend/Form/Decorator/Abstract.php b/library/Zend/Form/Decorator/Abstract.php index c5ae495f..4cd57252 100644 --- a/library/Zend/Form/Decorator/Abstract.php +++ b/library/Zend/Form/Decorator/Abstract.php @@ -178,8 +178,6 @@ public function setElement($element) if ((!$element instanceof Zend_Form_Element) && (!$element instanceof Zend_Form) && (!$element instanceof Zend_Form_DisplayGroup)) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('Invalid element type passed to decorator'); } @@ -252,8 +250,6 @@ public function getSeparator() */ public function render($content) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('render() not implemented'); } } diff --git a/library/Zend/Form/Decorator/Callback.php b/library/Zend/Form/Decorator/Callback.php index 3a8f1cba..4bb59122 100644 --- a/library/Zend/Form/Decorator/Callback.php +++ b/library/Zend/Form/Decorator/Callback.php @@ -61,8 +61,6 @@ class Zend_Form_Decorator_Callback extends Zend_Form_Decorator_Abstract public function setCallback($callback) { if (!is_callable($callback)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid callback provided to callback decorator'); } $this->_callback = $callback; diff --git a/library/Zend/Form/Decorator/Exception.php b/library/Zend/Form/Decorator/Exception.php index 98f3090f..200796e9 100644 --- a/library/Zend/Form/Decorator/Exception.php +++ b/library/Zend/Form/Decorator/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Form_Exception */ -require_once 'Zend/Form/Exception.php'; - /** * Exception for Zend_Form component. * diff --git a/library/Zend/Form/Decorator/Label.php b/library/Zend/Form/Decorator/Label.php index 585272ff..7c8675e2 100644 --- a/library/Zend/Form/Decorator/Label.php +++ b/library/Zend/Form/Decorator/Label.php @@ -261,16 +261,12 @@ public function __call($method, $args) break; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid method "%s" called in Label decorator, and detected as type %s', $method, $type)); } switch ($head) { case 'set': if (0 === count($args)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Method "%s" requires at least one argument; none provided', $method)); } $value = array_shift($args); @@ -291,8 +287,6 @@ public function __call($method, $args) } } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid method "%s" called in Label decorator', $method)); } diff --git a/library/Zend/Form/Decorator/ViewHelper.php b/library/Zend/Form/Decorator/ViewHelper.php index bc61a26a..f89268e8 100644 --- a/library/Zend/Form/Decorator/ViewHelper.php +++ b/library/Zend/Form/Decorator/ViewHelper.php @@ -224,8 +224,6 @@ public function render($content) $view = $element->getView(); if (null === $view) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('ViewHelper decorator cannot render without a registered view object'); } diff --git a/library/Zend/Form/Decorator/ViewScript.php b/library/Zend/Form/Decorator/ViewScript.php index 7f957c97..44bcf49c 100644 --- a/library/Zend/Form/Decorator/ViewScript.php +++ b/library/Zend/Form/Decorator/ViewScript.php @@ -162,8 +162,6 @@ public function render($content) $viewScript = $this->getViewScript(); if (empty($viewScript)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('No view script registered with ViewScript decorator'); } diff --git a/library/Zend/Form/DisplayGroup.php b/library/Zend/Form/DisplayGroup.php index c52cb6ab..49e13324 100644 --- a/library/Zend/Form/DisplayGroup.php +++ b/library/Zend/Form/DisplayGroup.php @@ -341,8 +341,6 @@ public function setName($name) { $name = $this->filtername($name); if (('0' !== $name) && empty($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid name provided; must contain only valid variable characters and be non-empty'); } @@ -501,8 +499,6 @@ public function addElements(array $elements) { foreach ($elements as $element) { if (!$element instanceof Zend_Form_Element) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('elements passed via array to addElements() must be Zend_Form_Elements only'); } $this->addElement($element); @@ -745,8 +741,6 @@ public function addDecorator($decorator, $options = null) break; } if (is_numeric($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { @@ -758,8 +752,6 @@ public function addDecorator($decorator, $options = null) $decorator = $spec; } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator provided to addDecorator; must be string or Zend_Form_Decorator_Interface'); } @@ -809,8 +801,6 @@ public function addDecorators(array $decorators) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator passed to addDecorators()'); } } @@ -996,8 +986,6 @@ public function setTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid translator specified'); } @@ -1082,13 +1070,9 @@ public function __call($method, $args) return $decorator->render($seed); } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Decorator by name %s does not exist', $decoratorName)); } - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Method %s does not exist', $method)); } diff --git a/library/Zend/Form/Element.php b/library/Zend/Form/Element.php index b2d9083f..493e59fc 100644 --- a/library/Zend/Form/Element.php +++ b/library/Zend/Form/Element.php @@ -282,8 +282,6 @@ public function __construct($spec, $options = null) } if (null === $this->getName()) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Zend_Form_Element requires each element to have a name'); } @@ -431,8 +429,6 @@ public function setTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid translator specified'); } @@ -522,8 +518,6 @@ public function setName($name) { $name = $this->filterName($name); if ('' === $name) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid name provided; must contain only valid variable characters and be non-empty'); } @@ -901,8 +895,6 @@ public function setAttrib($name, $value) { $name = (string) $name; if ('_' == $name[0]) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid attribute "%s"; must not contain a leading underscore', $name)); } @@ -1000,8 +992,6 @@ public function getConcatJustValuesInErrorMessage() public function __get($key) { if ('_' == $key[0]) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Cannot retrieve value for protected/private property "%s"', $key)); } @@ -1052,13 +1042,9 @@ public function __call($method, $args) return $decorator->render($seed); } - require_once 'Zend/Form/Element/Exception.php'; - throw new Zend_Form_Element_Exception(sprintf('Decorator by name %s does not exist', $decoratorName)); } - require_once 'Zend/Form/Element/Exception.php'; - throw new Zend_Form_Element_Exception(sprintf('Method %s does not exist', $method)); } @@ -1082,8 +1068,6 @@ public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader, $typ return $this; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to setPluginLoader()', $type)); } } @@ -1122,8 +1106,6 @@ public function getPluginLoader($type) return $this->_loaders[$type]; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -1169,8 +1151,6 @@ public function addPrefixPath($prefix, $path, $type = null) return $this; default: - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } } @@ -1246,8 +1226,6 @@ public function addValidator($validator, $breakChainOnFailure = false, $options 'options' => $options, ]; } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid validator provided to addValidator; must be string or Zend_Validate_Interface'); } @@ -1301,8 +1279,6 @@ public function addValidators(array $validators) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid validator passed to addValidators()'); } } @@ -1740,8 +1716,6 @@ public function addFilter($filter, $options = []) ]; $this->_filters[$name] = $filter; } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid filter provided to addFilter; must be string or Zend_Filter_Interface'); } @@ -1788,8 +1762,6 @@ public function addFilters(array $filters) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid filter passed to addFilters()'); } } @@ -1982,8 +1954,6 @@ public function addDecorator($decorator, $options = null) break; } if (is_numeric($name)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid alias provided to addDecorator; must be alphanumeric string'); } if (is_string($spec)) { @@ -1995,8 +1965,6 @@ public function addDecorator($decorator, $options = null) $decorator = $spec; } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator provided to addDecorator; must be string or Zend_Form_Decorator_Interface'); } @@ -2046,8 +2014,6 @@ public function addDecorators(array $decorators) } } } else { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception('Invalid decorator passed to addDecorators()'); } } @@ -2213,8 +2179,6 @@ protected function _loadFilter(array $filter) $name = $this->getPluginLoader(self::FILTER)->load($filter['filter']); if (array_key_exists($name, $this->_filters)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Filter instance already exists for filter "%s"', $origName)); } @@ -2265,8 +2229,6 @@ protected function _loadValidator(array $validator) $name = $this->getPluginLoader(self::VALIDATE)->load($validator['validator']); if (array_key_exists($name, $this->_validators)) { - require_once 'Zend/Form/Exception.php'; - throw new Zend_Form_Exception(sprintf('Validator instance already exists for validator "%s"', $origName)); } diff --git a/library/Zend/Form/Element/Exception.php b/library/Zend/Form/Element/Exception.php index 40a21647..ba23bc6b 100644 --- a/library/Zend/Form/Element/Exception.php +++ b/library/Zend/Form/Element/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Form_Exception */ -require_once 'Zend/Form/Exception.php'; - /** * Exception for Zend_Form component. * diff --git a/library/Zend/Form/Element/File.php b/library/Zend/Form/Element/File.php index 006df0a0..eea2a56a 100644 --- a/library/Zend/Form/Element/File.php +++ b/library/Zend/Form/Element/File.php @@ -185,8 +185,6 @@ public function setTransferAdapter($adapter) $class = $loader->load($adapter); $this->_adapter = new $class(); } else { - require_once 'Zend/Form/Element/Exception.php'; - throw new Zend_Form_Element_Exception('Invalid adapter specified'); } @@ -910,8 +908,6 @@ public function render(?Zend_View_Interface $view = null) } if (!$marker) { - require_once 'Zend/Form/Element/Exception.php'; - throw new Zend_Form_Element_Exception('No file decorator found... unable to render file element'); } diff --git a/library/Zend/Form/Exception.php b/library/Zend/Form/Exception.php index f028807b..172b0ce5 100644 --- a/library/Zend/Form/Exception.php +++ b/library/Zend/Form/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * Exception for Zend_Form component. * diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php index dee25f40..83e8b5e7 100644 --- a/library/Zend/Http/Client.php +++ b/library/Zend/Http/Client.php @@ -303,9 +303,6 @@ public function setUri($uri) } if (!$uri instanceof Zend_Uri_Http) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('Passed parameter is not a valid HTTP URI.'); } @@ -352,9 +349,6 @@ public function setConfig($config = []) if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('Array or Zend_Config object expected, got ' . gettype($config)); } @@ -384,8 +378,6 @@ public function setConfig($config = []) public function setMethod($method = self::GET) { if (!preg_match('/^[^\x00-\x1f\x7f-\xff\(\)<>@,;:\\\\"\/\[\]\?={}\s]+$/', $method)) { - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("'{$method}' is not a valid HTTP request method."); } @@ -446,8 +438,6 @@ public function setHeaders($name, $value = null) // Make sure the name is valid if we are in strict mode if ($this->config['strict'] && (!preg_match('/^[a-zA-Z0-9-]+$/', $name))) { - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("{$name} is not a valid HTTP header name"); } @@ -621,9 +611,6 @@ public function setAuth($user, $password = '', $type = self::AUTH_BASIC) } else { // Check we got a proper authentication type if (!defined('self::AUTH_' . strtoupper($type))) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '$type'"); } @@ -658,9 +645,6 @@ public function setCookieJar($cookiejar = true) } elseif (!$cookiejar) { $this->cookiejar = null; } else { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('Invalid parameter type passed as CookieJar'); } @@ -723,9 +707,6 @@ public function setCookie($cookie, $value = null) } if (preg_match("/[=,; \t\r\n\013\014]/", $cookie)) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("Cookie name cannot contain these characters: =,; \t\r\n\013\014 ({$cookie})"); } @@ -764,9 +745,6 @@ public function setFileUpload($filename, $formname, $data = null, $ctype = null) { if ($data === null) { if (($data = @file_get_contents($filename)) === false) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("Unable to read file '{$filename}' for upload"); } @@ -941,9 +919,6 @@ public function setAdapter($adapter) try { Zend_Loader::loadClass($adapter); } catch (Zend_Exception $e) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}", 0, $e); } @@ -951,9 +926,6 @@ public function setAdapter($adapter) } if (!$adapter instanceof Zend_Http_Client_Adapter_Interface) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('Passed adapter is not a HTTP connection adapter'); } @@ -1019,7 +991,6 @@ protected function _openTempStream() if ($this->adapter instanceof Zend_Http_Client_Adapter_Interface) { $this->adapter->close(); } - require_once 'Zend/Http/Client/Exception.php'; throw new Zend_Http_Client_Exception("Could not open temp file {$this->_stream_name}"); } @@ -1038,9 +1009,6 @@ public function request($method = null) { $stream = null; if (!$this->uri instanceof Zend_Uri_Http) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('No valid URI has been passed to the client'); } @@ -1086,9 +1054,6 @@ public function request($method = null) // check that adapter supports streaming before using it if (is_resource($body) && !($this->adapter instanceof Zend_Http_Client_Adapter_Stream)) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('Adapter does not support streaming'); } @@ -1101,9 +1066,6 @@ public function request($method = null) $stream = $this->_openTempStream(); $this->adapter->setOutputStream($stream); } else { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('Adapter does not support streaming'); } } @@ -1113,9 +1075,6 @@ public function request($method = null) $response = $this->adapter->read(); if (!$response) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('Unable to read response, or response is empty'); } @@ -1366,9 +1325,6 @@ protected function _prepareBody() mb_internal_encoding($mbIntEnc); } - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("Cannot handle content type '{$this->enctype}' automatically." . ' Please use Zend_Http_Client::setRawData to send this kind of content.'); @@ -1533,9 +1489,6 @@ public static function encodeAuthHeader($user, $password, $type = self::AUTH_BAS case self::AUTH_BASIC: // In basic authentication, the user name cannot contain ":" if (strpos($user, ':') !== false) { - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("The user name cannot contain ':' in 'Basic' HTTP authentication"); } @@ -1548,9 +1501,6 @@ public static function encodeAuthHeader($user, $password, $type = self::AUTH_BAS // break; default: - /** @see Zend_Http_Client_Exception */ - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception("Not a supported HTTP authentication type: '$type'"); } @@ -1626,8 +1576,6 @@ protected function _validateHeaderValue($value, $recurse = true) } if (!is_string($value) && (!is_object($value) || !method_exists($value, '__toString'))) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('Invalid header value detected'); } diff --git a/library/Zend/Http/Client/Adapter/Curl.php b/library/Zend/Http/Client/Adapter/Curl.php index 8f99c877..ad68e424 100644 --- a/library/Zend/Http/Client/Adapter/Curl.php +++ b/library/Zend/Http/Client/Adapter/Curl.php @@ -91,8 +91,6 @@ class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interfac public function __construct() { if (!extension_loaded('curl')) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('cURL extension has to be loaded to use this Zend_Http_Client adapter.'); } $this->_invalidOverwritableCurlOptions = [ @@ -126,8 +124,6 @@ public function setConfig($config = []) if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Array or Zend_Config object expected, got ' . gettype($config) ); @@ -242,8 +238,6 @@ public function connect($host, $port = 80, $secure = false) if (!$this->_curl) { $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' . $host . ':' . $port); } @@ -276,14 +270,10 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = { // Make sure we're properly connected if (!$this->_curl) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected'); } if ($this->_connected_to[0] != $uri->getHost() || $this->_connected_to[1] != $uri->getPort()) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host'); } @@ -322,8 +312,6 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = } if (!isset($this->_config['curloptions'][CURLOPT_INFILESIZE])) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.'); } @@ -371,14 +359,10 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = default: // For now, through an exception for unsupported request methods - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Method currently not supported'); } if (is_resource($body) && $curlMethod != CURLOPT_PUT) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Streaming requests are allowed only with PUT'); } @@ -440,8 +424,6 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = foreach ((array) $this->_config['curloptions'] as $k => $v) { if (!in_array($k, $this->_invalidOverwritableCurlOptions)) { if (curl_setopt($this->_curl, $k, $v) == false) { - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception(sprintf("Unknown or erroreous cURL option '%s' set", $k)); } } @@ -460,8 +442,6 @@ public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = $request .= $body; if (empty($this->_response)) { - require_once 'Zend/Http/Client/Exception.php'; - throw new Zend_Http_Client_Exception('Error in cURL request: ' . curl_error($this->_curl)); } diff --git a/library/Zend/Http/Client/Adapter/Exception.php b/library/Zend/Http/Client/Adapter/Exception.php index 1250d053..e8c58262 100644 --- a/library/Zend/Http/Client/Adapter/Exception.php +++ b/library/Zend/Http/Client/Adapter/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Http_Client_Exception */ -require_once 'Zend/Http/Client/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/Client/Adapter/Proxy.php b/library/Zend/Http/Client/Adapter/Proxy.php index 1d2dcfdd..6439a14a 100644 --- a/library/Zend/Http/Client/Adapter/Proxy.php +++ b/library/Zend/Http/Client/Adapter/Proxy.php @@ -128,8 +128,6 @@ public function write( // Make sure we're properly connected if (!$this->socket) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Trying to write but we are not connected' ); @@ -141,8 +139,6 @@ public function write( if ($this->connected_to[0] != "tcp://$host" || $this->connected_to[1] != $port ) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Trying to write but we are connected to the wrong proxy server' ); @@ -209,8 +205,6 @@ public function write( // Send the request if (!@fwrite($this->socket, $request)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Error writing request to proxy server' ); @@ -218,8 +212,6 @@ public function write( if (is_resource($body)) { if (stream_copy_to_stream($body, $this->socket) == 0) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Error writing request to server' ); @@ -264,8 +256,6 @@ protected function connectHandshake( // Send the request if (!@fwrite($this->socket, $request)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Error writing request to proxy server' ); @@ -286,8 +276,6 @@ protected function connectHandshake( // Check that the response from the proxy is 200 if (Zend_Http_Response::extractCode($response) != 200) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Unable to connect to HTTPS proxy. Server response: ' . $response ); @@ -311,8 +299,6 @@ protected function connectHandshake( } if (!$success) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Unable to connect to HTTPS server through proxy: could not ' . 'negotiate secure connection.' diff --git a/library/Zend/Http/Client/Adapter/Socket.php b/library/Zend/Http/Client/Adapter/Socket.php index daffa580..ead97599 100644 --- a/library/Zend/Http/Client/Adapter/Socket.php +++ b/library/Zend/Http/Client/Adapter/Socket.php @@ -105,8 +105,6 @@ public function setConfig($config = []) if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Array or Zend_Config object expected, got ' . gettype($config) ); @@ -149,8 +147,6 @@ public function setStreamContext($context) $this->_context = stream_context_create($context); } else { // Invalid parameter - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Expecting either a stream context resource or array, got ' . gettype($context) ); @@ -201,16 +197,12 @@ public function connect($host, $port = 80, $secure = false) if ($this->config['sslcert'] !== null) { if (!stream_context_set_option($context, 'ssl', 'local_cert', $this->config['sslcert'])) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Unable to set sslcert option'); } } if ($this->config['sslpassphrase'] !== null) { if (!stream_context_set_option($context, 'ssl', 'passphrase', $this->config['sslpassphrase'])) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Unable to set sslpassphrase option'); } } @@ -230,7 +222,6 @@ public function connect($host, $port = 80, $secure = false) if (!$this->socket) { $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; throw new Zend_Http_Client_Adapter_Exception( 'Unable to Connect to ' . $host . ':' . $port . '. Error #' . $errno . ': ' . $errstr); @@ -238,8 +229,6 @@ public function connect($host, $port = 80, $secure = false) // Set the stream timeout if (!stream_set_timeout($this->socket, (int) $this->config['timeout'])) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Unable to set the connection timeout'); } @@ -263,16 +252,12 @@ public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = ' { // Make sure we're properly connected if (!$this->socket) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected'); } $host = $uri->getHost(); $host = (strtolower($uri->getScheme()) == 'https' ? $this->config['ssltransport'] : 'tcp') . '://' . $host; if ($this->connected_to[0] != $host || $this->connected_to[1] != $uri->getPort()) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host'); } @@ -301,15 +286,11 @@ public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = ' // Send the request if (!@fwrite($this->socket, $request)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); } if (is_resource($body)) { if (stream_copy_to_stream($body, $this->socket) == 0) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); } } @@ -377,7 +358,6 @@ public function read() $chunksize = trim($line); if (!ctype_xdigit($chunksize)) { $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; throw new Zend_Http_Client_Adapter_Exception('Invalid chunk size "' . $chunksize . '" unable to read chunked body'); @@ -421,7 +401,6 @@ public function read() } while ($chunksize > 0); } else { $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; throw new Zend_Http_Client_Adapter_Exception('Cannot handle "' . $headers['transfer-encoding'] . '" transfer encoding'); @@ -525,7 +504,6 @@ protected function _checkSocketReadTimeout() $timedout = $info['timed_out']; if ($timedout) { $this->close(); - require_once 'Zend/Http/Client/Adapter/Exception.php'; throw new Zend_Http_Client_Adapter_Exception( "Read timed out after {$this->config['timeout']} seconds", diff --git a/library/Zend/Http/Client/Adapter/Test.php b/library/Zend/Http/Client/Adapter/Test.php index 0f0c6a3e..b5a48eac 100644 --- a/library/Zend/Http/Client/Adapter/Test.php +++ b/library/Zend/Http/Client/Adapter/Test.php @@ -103,8 +103,6 @@ public function setConfig($config = []) if ($config instanceof Zend_Config) { $config = $config->toArray(); } elseif (!is_array($config)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Array or Zend_Config object expected, got ' . gettype($config) ); @@ -126,7 +124,6 @@ public function connect($host, $port = 80, $secure = false) { if ($this->_nextRequestWillFail) { $this->_nextRequestWillFail = false; - require_once 'Zend/Http/Client/Adapter/Exception.php'; throw new Zend_Http_Client_Adapter_Exception('Request failed'); } @@ -228,8 +225,6 @@ public function addResponse($response) public function setResponseIndex($index) { if ($index < 0 || $index >= count($this->responses)) { - require_once 'Zend/Http/Client/Adapter/Exception.php'; - throw new Zend_Http_Client_Adapter_Exception( 'Index out of range of response buffer size'); } diff --git a/library/Zend/Http/Client/Exception.php b/library/Zend/Http/Client/Exception.php index 9fffb817..52104601 100644 --- a/library/Zend/Http/Client/Exception.php +++ b/library/Zend/Http/Client/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Http_Exception */ -require_once 'Zend/Http/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/Cookie.php b/library/Zend/Http/Cookie.php index 742fc14a..6f549254 100644 --- a/library/Zend/Http/Cookie.php +++ b/library/Zend/Http/Cookie.php @@ -104,20 +104,14 @@ class Zend_Http_Cookie public function __construct($name, $value, $domain, $expires = null, $path = null, $secure = false) { if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception("Cookie name cannot contain these characters: =,; \\t\\r\\n\\013\\014 ({$name})"); } if (!$this->name = (string) $name) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('Cookies must have a name'); } if (!$this->domain = (string) $domain) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('Cookies must have a domain'); } @@ -235,8 +229,6 @@ public function match($uri, $matchSessionCookies = true, $now = null) // Make sure we have a valid Zend_Uri_Http object if (!($uri->valid() && ($uri->getScheme() == 'http' || $uri->getScheme() == 'https'))) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('Passed URI is not a valid HTTP or HTTPS URI'); } @@ -394,14 +386,10 @@ public static function fromString($cookieStr, $refUri = null, $encodeValue = tru public static function matchCookieDomain($cookieDomain, $host) { if (!$cookieDomain) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('$cookieDomain is expected to be a cookie domain'); } if (!$host) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('$host is expected to be a host name'); } @@ -430,14 +418,10 @@ public static function matchCookieDomain($cookieDomain, $host) public static function matchCookiePath($cookiePath, $path) { if (!$cookiePath) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('$cookiePath is expected to be a cookie path'); } if (!$path) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('$path is expected to be a host name'); } diff --git a/library/Zend/Http/CookieJar.php b/library/Zend/Http/CookieJar.php index 558e1650..830c17ae 100644 --- a/library/Zend/Http/CookieJar.php +++ b/library/Zend/Http/CookieJar.php @@ -134,8 +134,6 @@ public function addCookie($cookie, $ref_uri = null, $encodeValue = true) $this->cookies[$domain][$path][$cookie->getName()] = $cookie; $this->_rawCookies[] = $cookie; } else { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('Supplient argument is not a valid cookie string or object'); } } @@ -151,8 +149,6 @@ public function addCookie($cookie, $ref_uri = null, $encodeValue = true) public function addCookiesFromResponse($response, $ref_uri, $encodeValue = true) { if (!$response instanceof Zend_Http_Response) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('$response is expected to be a Response object, ' . gettype($response) . ' was passed'); } @@ -204,8 +200,6 @@ public function getMatchingCookies($uri, $matchSessionCookies = true, $uri = Zend_Uri::factory($uri); } if (!$uri instanceof Zend_Uri_Http) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('Invalid URI string or object passed'); } @@ -247,8 +241,6 @@ public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT) } if (!$uri instanceof Zend_Uri_Http) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('Invalid URI specified'); } @@ -280,8 +272,6 @@ public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT) break; default: - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception("Invalid value passed for \$ret_as: {$ret_as}"); break; diff --git a/library/Zend/Http/Exception.php b/library/Zend/Http/Exception.php index 2000c930..67da9797 100644 --- a/library/Zend/Http/Exception.php +++ b/library/Zend/Http/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/Header/Exception/InvalidArgumentException.php b/library/Zend/Http/Header/Exception/InvalidArgumentException.php index 0857e0d6..6de1e50c 100644 --- a/library/Zend/Http/Header/Exception/InvalidArgumentException.php +++ b/library/Zend/Http/Header/Exception/InvalidArgumentException.php @@ -20,8 +20,6 @@ /** * @see Zend_Http_Exception */ -require_once 'Zend/Http/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/Header/Exception/RuntimeException.php b/library/Zend/Http/Header/Exception/RuntimeException.php index 91e7c4be..fc073364 100644 --- a/library/Zend/Http/Header/Exception/RuntimeException.php +++ b/library/Zend/Http/Header/Exception/RuntimeException.php @@ -20,8 +20,6 @@ /** * @see Zend_Http_Exception */ -require_once 'Zend/Http/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/Header/HeaderValue.php b/library/Zend/Http/Header/HeaderValue.php index 4d342f5a..14c41361 100644 --- a/library/Zend/Http/Header/HeaderValue.php +++ b/library/Zend/Http/Header/HeaderValue.php @@ -114,8 +114,6 @@ public static function isValid($value) public static function assertValid($value) { if (!self::isValid($value)) { - require_once 'Zend/Http/Header/Exception/InvalidArgumentException.php'; - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid header value'); } } diff --git a/library/Zend/Http/Header/SetCookie.php b/library/Zend/Http/Header/SetCookie.php index 88832a69..bed965bc 100644 --- a/library/Zend/Http/Header/SetCookie.php +++ b/library/Zend/Http/Header/SetCookie.php @@ -21,13 +21,9 @@ /** * @see Zend_Http_Header_Exception_InvalidArgumentException */ -require_once 'Zend/Http/Header/Exception/InvalidArgumentException.php'; - /** * @see Zend_Http_Header_Exception_RuntimeException */ -require_once 'Zend/Http/Header/Exception/RuntimeException.php'; - /** * @see Zend_Http_Header_HeaderValue */ diff --git a/library/Zend/Http/Response.php b/library/Zend/Http/Response.php index b54040cc..ccdc8640 100644 --- a/library/Zend/Http/Response.php +++ b/library/Zend/Http/Response.php @@ -151,8 +151,6 @@ public function __construct($code, array $headers, $body = null, $version = '1.1 { // Make sure the response code is valid and set it if (self::responseCodeAsText($code) === null) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception("{$code} is not a valid HTTP response code"); } @@ -162,8 +160,6 @@ public function __construct($code, array $headers, $body = null, $version = '1.1 if (is_int($name)) { $header = explode(':', $value, 2); if (count($header) != 2) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception("'{$value}' is not a valid HTTP header"); } @@ -179,8 +175,6 @@ public function __construct($code, array $headers, $body = null, $version = '1.1 // Set the HTTP version if (!preg_match('|^\d\.\d$|', $version)) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception("Invalid HTTP response version: $version"); } @@ -581,8 +575,6 @@ public static function extractHeaders($response_str) } // Anything else is an error condition - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception('Invalid header line detected'); } @@ -627,8 +619,6 @@ public static function decodeChunkedBody($body) while (trim($body)) { if (!preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception("Error parsing body - doesn't seem to be a chunked message"); } @@ -657,8 +647,6 @@ public static function decodeChunkedBody($body) public static function decodeGzip($body) { if (!function_exists('gzinflate')) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception( 'zlib extension is required in order to decode "gzip" encoding' ); @@ -679,8 +667,6 @@ public static function decodeGzip($body) public static function decodeDeflate($body) { if (!function_exists('gzuncompress')) { - require_once 'Zend/Http/Exception.php'; - throw new Zend_Http_Exception( 'zlib extension is required in order to decode "deflate" encoding' ); diff --git a/library/Zend/Http/UserAgent.php b/library/Zend/Http/UserAgent.php index 5ce65ee3..f881a3e5 100644 --- a/library/Zend/Http/UserAgent.php +++ b/library/Zend/Http/UserAgent.php @@ -229,8 +229,6 @@ public function setOptions($options) && !$options instanceof ArrayAccess && !$options instanceof Traversable ) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception(sprintf( 'Invalid argument; expected array, Zend_Config object, or object implementing ArrayAccess and Traversable; received %s', (is_object($options) ? get_class($options) : gettype($options)) @@ -334,8 +332,6 @@ protected function _getUserAgentDevice($browserType) if (is_array($deviceConfig) && isset($deviceConfig['classname'])) { $device = (string) $deviceConfig['classname']; if (!class_exists($device)) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception(sprintf( 'Invalid classname "%s" provided in device configuration for browser type "%s"', $device, @@ -469,8 +465,6 @@ public function getStorage($browser = null) public function setStorage(Zend_Http_UserAgent_Storage $storage) { if ($this->_immutable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception( 'The User-Agent device object has already been retrieved; the storage object is now immutable' ); @@ -529,8 +523,6 @@ public function setConfig($config = []) // Verify that Config parameters are in an array. if (!is_array($config) && !$config instanceof Traversable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception(sprintf( 'Config parameters must be in an array or a Traversable object; received "%s"', (is_object($config) ? get_class($config) : gettype($config)) @@ -613,8 +605,6 @@ public function getBrowserType() public function setBrowserType($browserType) { if ($this->_immutable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception( 'The User-Agent device object has already been retrieved; the browser type is now immutable' ); @@ -656,16 +646,12 @@ public function getServer() public function setServer($server) { if ($this->_immutable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception( 'The User-Agent device object has already been retrieved; the server array is now immutable' ); } if (!is_array($server) && !$server instanceof Traversable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception(sprintf( 'Expected an array or object implementing Traversable; received %s', (is_object($server) ? get_class($server) : gettype($server)) @@ -721,8 +707,6 @@ public function getServerValue($key) public function setServerValue($key, $value) { if ($this->_immutable) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception( 'The User-Agent device object has already been retrieved; the server array is now immutable' ); @@ -756,16 +740,12 @@ public function setPluginLoader($type, $loader) } $loader = new $loader(); } elseif (!is_object($loader)) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception(sprintf( 'Expected a plugin loader class or object; received %s', gettype($loader) )); } if (!$loader instanceof Zend_Loader_PluginLoader) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception(sprintf( 'Expected an object extending Zend_Loader_PluginLoader; received %s', get_class($loader) @@ -826,8 +806,6 @@ protected function _validateLoaderType($type) if (!in_array($type, $this->_loaderTypes)) { $types = implode(', ', $this->_loaderTypes); - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception(sprintf( 'Expected one of "%s" for plugin loader type; received "%s"', $types, diff --git a/library/Zend/Http/UserAgent/AbstractDevice.php b/library/Zend/Http/UserAgent/AbstractDevice.php index 134f32ea..6b2137b8 100644 --- a/library/Zend/Http/UserAgent/AbstractDevice.php +++ b/library/Zend/Http/UserAgent/AbstractDevice.php @@ -773,8 +773,6 @@ protected function _loadFeaturesAdapter() $config = $config[$browserType]['features']; if (empty($config['classname'])) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "classname" config parameter defined'); } @@ -783,14 +781,10 @@ protected function _loadFeaturesAdapter() if (isset($config['path'])) { $path = $config['path']; } else { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "path" config parameter defined'); } if (false === include_once($path)) { - require_once 'Zend/Http/UserAgent/Exception.php'; - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter path that does not exist'); } } diff --git a/library/Zend/Http/UserAgent/Exception.php b/library/Zend/Http/UserAgent/Exception.php index 168f0ea8..0fa6f2a8 100644 --- a/library/Zend/Http/UserAgent/Exception.php +++ b/library/Zend/Http/UserAgent/Exception.php @@ -18,8 +18,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php b/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php index 2c5a937a..5b8e46f1 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php @@ -40,8 +40,6 @@ public function __construct() { $browscap = ini_get('browscap'); if (empty($browscap) || !file_exists($browscap)) { - require_once 'Zend/Http/UserAgent/Features/Exception.php'; - throw new Zend_Http_UserAgent_Features_Exception(sprintf( '%s requires a browscap entry in php.ini pointing to a valid browscap.ini; none present', self::class diff --git a/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php b/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php index 9bc6e0ef..700dd2cc 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php @@ -41,8 +41,6 @@ public static function getFromRequest($request, array $config) { if (!class_exists('Mobi_Mtld_DA_Api')) { if (!isset($config['deviceatlas'])) { - require_once 'Zend/Http/UserAgent/Features/Exception.php'; - throw new Zend_Http_UserAgent_Features_Exception('"DeviceAtlas" configuration is not defined'); } } @@ -51,8 +49,6 @@ public static function getFromRequest($request, array $config) if (!class_exists('Mobi_Mtld_DA_Api')) { if (empty($config['deviceatlas_lib_dir'])) { - require_once 'Zend/Http/UserAgent/Features/Exception.php'; - throw new Zend_Http_UserAgent_Features_Exception('The "deviceatlas_lib_dir" parameter is not defined'); } @@ -61,8 +57,6 @@ public static function getFromRequest($request, array $config) } if (empty($config['deviceatlas_data'])) { - require_once 'Zend/Http/UserAgent/Features/Exception.php'; - throw new Zend_Http_UserAgent_Features_Exception('The "deviceatlas_data" parameter is not defined'); } diff --git a/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php b/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php index 25aeb20e..4fb8a8e9 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php @@ -45,8 +45,6 @@ public static function getFromRequest($request, array $config) // if (!isset($config['terawurfl'])) { // No configuration - require_once 'Zend/Http/UserAgent/Features/Exception.php'; - throw new Zend_Http_UserAgent_Features_Exception('"TeraWurfl" configuration is not defined'); } @@ -54,8 +52,6 @@ public static function getFromRequest($request, array $config) if (empty($config['terawurfl_lib_dir'])) { // No lib_dir given - require_once 'Zend/Http/UserAgent/Features/Exception.php'; - throw new Zend_Http_UserAgent_Features_Exception('The "terawurfl_lib_dir" parameter is not defined'); } diff --git a/library/Zend/Http/UserAgent/Features/Exception.php b/library/Zend/Http/UserAgent/Features/Exception.php index 9692f844..a4c6fc39 100644 --- a/library/Zend/Http/UserAgent/Features/Exception.php +++ b/library/Zend/Http/UserAgent/Features/Exception.php @@ -18,8 +18,6 @@ /** * @see Zend_Browser_Exception */ -require_once 'Zend/Http/UserAgent/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/UserAgent/Storage/Exception.php b/library/Zend/Http/UserAgent/Storage/Exception.php index 6b0251b9..41966ca2 100644 --- a/library/Zend/Http/UserAgent/Storage/Exception.php +++ b/library/Zend/Http/UserAgent/Storage/Exception.php @@ -18,8 +18,6 @@ /** * @see Zend_Http_UserAgent_Exception */ -require_once 'Zend/Http/UserAgent/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/UserAgent/Storage/Session.php b/library/Zend/Http/UserAgent/Storage/Session.php index 9f3f7ced..234e2a26 100644 --- a/library/Zend/Http/UserAgent/Storage/Session.php +++ b/library/Zend/Http/UserAgent/Storage/Session.php @@ -79,8 +79,6 @@ public function __construct($options = null) $options = (array) $options; } if (null !== $options && !is_array($options)) { - require_once 'Zend/Http/UserAgent/Storage/Exception.php'; - throw new Zend_Http_UserAgent_Storage_Exception(sprintf( 'Expected array or object options; "%s" provided', gettype($options) diff --git a/library/Zend/Json.php b/library/Zend/Json.php index 295b818a..1471d2fc 100644 --- a/library/Zend/Json.php +++ b/library/Zend/Json.php @@ -81,13 +81,10 @@ public static function decode($encodedValue, $objectDecodeType = Zend_Json::TYPE return null; } if ($decode === null) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Decoding failed'); } // php >= 5.3 } elseif (($jsonLastErr = json_last_error()) != JSON_ERROR_NONE) { - require_once 'Zend/Json/Exception.php'; switch ($jsonLastErr) { case JSON_ERROR_DEPTH: throw new Zend_Json_Exception('Decoding failed: Maximum stack depth exceeded'); @@ -272,8 +269,6 @@ protected static function _processXml($simpleXmlElementObject, $ignoreXmlAttribu // Keep an eye on how deeply we are involved in recursion. if ($recursionDepth > self::$maxRecursionDepthAllowed) { // XML tree is too deep. Exit now by throwing an exception. - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception( 'Function _processXml exceeded the allowed recursion depth of ' . self::$maxRecursionDepthAllowed); @@ -358,8 +353,6 @@ public static function fromXml($xmlStringContents, $ignoreXmlAttributes = true) // If it is not a valid XML content, throw an exception. if ($simpleXmlElementObject == null) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Function fromXml was called with an invalid XML formatted string.'); } // End of if ($simpleXmlElementObject == null) diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index f7718da3..af95a3d6 100644 --- a/library/Zend/Json/Decoder.php +++ b/library/Zend/Json/Decoder.php @@ -136,13 +136,9 @@ protected function __construct($source, $decodeType) public static function decode($source = null, $objectDecodeType = Zend_Json::TYPE_ARRAY) { if (null === $source) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Must specify JSON encoded source for decoding'); } if (!is_string($source)) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Can only decode JSON encoded strings'); } @@ -202,8 +198,6 @@ protected function _decodeObject() while ($tok && $tok != self::RBRACE) { if ($tok != self::DATUM || !is_string($this->_tokenValue)) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Missing key in object encoding: ' . $this->_source); } @@ -211,8 +205,6 @@ protected function _decodeObject() $tok = $this->_getNextToken(); if ($tok != self::COLON) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Missing ":" in object encoding: ' . $this->_source); } @@ -225,8 +217,6 @@ protected function _decodeObject() } if ($tok != self::COMMA) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Missing "," in object encoding: ' . $this->_source); } @@ -279,8 +269,6 @@ protected function _decodeArray() } if ($tok != self::COMMA) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Missing "," in array encoding: ' . $this->_source); } @@ -407,8 +395,6 @@ protected function _getNextToken() break; default: - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Illegal escape ' . "sequence '" . $chr . "'"); } @@ -464,16 +450,12 @@ protected function _getNextToken() if (is_numeric($datum)) { if (preg_match('/^0\d+$/', $datum)) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception("Octal notation not supported by JSON (value: $datum)"); } $val = intval($datum); $fVal = floatval($datum); $this->_tokenValue = ($val == $fVal ? $val : $fVal); } else { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception("Illegal number format: $datum"); } @@ -481,8 +463,6 @@ protected function _getNextToken() $this->_offset = $start + strlen($datum); } } else { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception('Illegal Token'); } diff --git a/library/Zend/Json/Encoder.php b/library/Zend/Json/Encoder.php index b98d1ed0..ea8a7ec6 100644 --- a/library/Zend/Json/Encoder.php +++ b/library/Zend/Json/Encoder.php @@ -116,7 +116,6 @@ protected function _encodeObject(&$value) && $this->_options['silenceCyclicalExceptions'] === true) { return '"* RECURSION (' . get_class($value) . ') *"'; } - require_once 'Zend/Json/Exception.php'; throw new Zend_Json_Exception( 'Cycles not supported in JSON encoding, cycle introduced by ' @@ -394,8 +393,6 @@ public static function encodeClass($className, $package = '') { $cls = new ReflectionClass($className); if (!$cls->isInstantiable()) { - require_once 'Zend/Json/Exception.php'; - throw new Zend_Json_Exception("$className must be instantiable"); } diff --git a/library/Zend/Json/Exception.php b/library/Zend/Json/Exception.php index 08d646ab..54bbe259 100644 --- a/library/Zend/Json/Exception.php +++ b/library/Zend/Json/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Layout.php b/library/Zend/Layout.php index 5f1b76be..8a3ceb4e 100644 --- a/library/Zend/Layout.php +++ b/library/Zend/Layout.php @@ -160,8 +160,6 @@ public function __construct($options = null, $initMvc = false) } elseif ($options instanceof Zend_Config) { $this->setConfig($options); } else { - require_once 'Zend/Layout/Exception.php'; - throw new Zend_Layout_Exception('Invalid option provided to constructor'); } } @@ -242,8 +240,6 @@ public function setOptions($options) if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (!is_array($options)) { - require_once 'Zend/Layout/Exception.php'; - throw new Zend_Layout_Exception('setOptions() expects either an array or a Zend_Config object'); } @@ -785,8 +781,6 @@ public function assign($spec, $value = null) return $this; } - require_once 'Zend/Layout/Exception.php'; - throw new Zend_Layout_Exception('Invalid values passed to assign()'); } diff --git a/library/Zend/Layout/Controller/Action/Helper/Layout.php b/library/Zend/Layout/Controller/Action/Helper/Layout.php index e90cbd53..a022ea9d 100644 --- a/library/Zend/Layout/Controller/Action/Helper/Layout.php +++ b/library/Zend/Layout/Controller/Action/Helper/Layout.php @@ -174,8 +174,6 @@ public function __call($method, $args) return call_user_func_array([$layout, $method], $args); } - require_once 'Zend/Layout/Exception.php'; - throw new Zend_Layout_Exception(sprintf("Invalid method '%s' called on layout action helper", $method)); } } diff --git a/library/Zend/Layout/Exception.php b/library/Zend/Layout/Exception.php index 5e033bcd..403afe60 100644 --- a/library/Zend/Layout/Exception.php +++ b/library/Zend/Layout/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Loader.php b/library/Zend/Loader.php index 38c9826c..f7625099 100644 --- a/library/Zend/Loader.php +++ b/library/Zend/Loader.php @@ -50,8 +50,6 @@ public static function loadClass($class, $dirs = null) } if ((null !== $dirs) && !is_string($dirs) && !is_array($dirs)) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception('Directory argument must be a string or an array'); } @@ -78,8 +76,6 @@ public static function loadClass($class, $dirs = null) } if (!class_exists($class, false) && !interface_exists($class, false)) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception("File \"$file\" does not exist or class \"$class\" was not found in the file"); } } @@ -259,8 +255,6 @@ public static function registerAutoload($class = \Zend_Loader::class, $enabled = self::loadClass($class); $methods = get_class_methods($class); if (!in_array('autoload', (array) $methods)) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception("The class \"$class\" does not have an autoload() method"); } @@ -283,8 +277,6 @@ protected static function _securityCheck($filename) { // Security check if (preg_match('/[^a-z0-9\\/\\\\_.:-]/i', $filename)) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception('Security check: Illegal character in filename'); } } diff --git a/library/Zend/Loader/Autoloader/Resource.php b/library/Zend/Loader/Autoloader/Resource.php index 1463abea..018358a3 100644 --- a/library/Zend/Loader/Autoloader/Resource.php +++ b/library/Zend/Loader/Autoloader/Resource.php @@ -66,8 +66,6 @@ public function __construct($options) $options = $options->toArray(); } if (!is_array($options)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Options must be passed to resource loader constructor'); } @@ -77,8 +75,6 @@ public function __construct($options) if ((null === $namespace) || (null === $this->getBasePath()) ) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Resource loader requires both a namespace and a base path for initialization'); } @@ -114,13 +110,9 @@ public function __call($method, $args) if ('get' == substr($method, 0, 3)) { $type = strtolower(substr($method, 3)); if (!$this->hasResourceType($type)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception("Invalid resource type $type; cannot load resource"); } if (empty($args)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Cannot load resources; no resource specified'); } $resource = array_shift($args); @@ -128,8 +120,6 @@ public function __call($method, $args) return $this->load($resource, $type); } - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception("Method '$method' is not supported"); } @@ -293,8 +283,6 @@ public function addResourceType($type, $path, $namespace = null) $type = strtolower($type); if (!isset($this->_resourceTypes[$type])) { if (null === $namespace) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Initial definition of a resource type must include a namespace'); } $namespaceTopLevel = $this->getNamespace(); @@ -304,8 +292,6 @@ public function addResourceType($type, $path, $namespace = null) ]; } if (!is_string($path)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Invalid path specification provided; must be string'); } $this->_resourceTypes[$type]['path'] = $this->getBasePath() . '/' . rtrim($path, '\/'); @@ -345,13 +331,9 @@ public function addResourceTypes(array $types) { foreach ($types as $type => $spec) { if (!is_array($spec)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('addResourceTypes() expects an array of arrays'); } if (!isset($spec['path'])) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('addResourceTypes() expects each array to include a paths element'); } $paths = $spec['path']; @@ -474,14 +456,10 @@ public function load($resource, $type = null) if (null === $type) { $type = $this->getDefaultResourceType(); if (empty($type)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('No resource type specified'); } } if (!$this->hasResourceType($type)) { - require_once 'Zend/Loader/Exception.php'; - throw new Zend_Loader_Exception('Invalid resource type specified'); } $namespace = $this->_resourceTypes[$type]['namespace']; diff --git a/library/Zend/Loader/Exception.php b/library/Zend/Loader/Exception.php index ac555895..9f02dad6 100644 --- a/library/Zend/Loader/Exception.php +++ b/library/Zend/Loader/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @uses Zend_Exception * diff --git a/library/Zend/Loader/PluginLoader.php b/library/Zend/Loader/PluginLoader.php index fba933f4..f456111c 100644 --- a/library/Zend/Loader/PluginLoader.php +++ b/library/Zend/Loader/PluginLoader.php @@ -151,8 +151,6 @@ protected function _formatPrefix($prefix) public function addPrefixPath($prefix, $path) { if (!is_string($prefix) || !is_string($path)) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Zend_Loader_PluginLoader::addPrefixPath() method only takes strings for prefix and path.'); } @@ -263,16 +261,12 @@ public function removePrefixPath($prefix, $path = null) } if (!isset($registry[$prefix])) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Prefix ' . $prefix . ' was not found in the PluginLoader.'); } if ($path != null) { $pos = array_search($path, $registry[$prefix]); if (false === $pos) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Prefix ' . $prefix . ' / Path ' . $path . ' was not found in the PluginLoader.'); } unset($registry[$prefix][$pos]); @@ -436,7 +430,6 @@ public function load($name, $throwExceptions = true) foreach ($registry as $prefix => $paths) { $message .= "\n$prefix: " . implode(PATH_SEPARATOR, $paths); } - require_once 'Zend/Loader/PluginLoader/Exception.php'; throw new Zend_Loader_PluginLoader_Exception($message); } @@ -474,18 +467,12 @@ public static function setIncludeFileCache($file) } if (!file_exists($file) && !file_exists(dirname($file))) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Specified file does not exist and/or directory does not exist (' . $file . ')'); } if (file_exists($file) && !is_writable($file)) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Specified file is not writeable (' . $file . ')'); } if (!file_exists($file) && file_exists(dirname($file)) && !is_writable(dirname($file))) { - require_once 'Zend/Loader/PluginLoader/Exception.php'; - throw new Zend_Loader_PluginLoader_Exception('Specified file is not writeable (' . $file . ')'); } diff --git a/library/Zend/Loader/PluginLoader/Exception.php b/library/Zend/Loader/PluginLoader/Exception.php index 20fa1ed6..3c635029 100644 --- a/library/Zend/Loader/PluginLoader/Exception.php +++ b/library/Zend/Loader/PluginLoader/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Loader_Exception */ -require_once 'Zend/Loader/Exception.php'; - /** * Plugin class loader exceptions. * diff --git a/library/Zend/Locale.php b/library/Zend/Locale.php index 7876da2f..be53edee 100644 --- a/library/Zend/Locale.php +++ b/library/Zend/Locale.php @@ -1175,14 +1175,10 @@ public static function setDefault($locale, $quality = 1) { if (($locale === 'auto') or ($locale === 'root') or ($locale === 'default') or ($locale === 'environment') or ($locale === 'browser')) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('Only full qualified locales can be used as default!'); } if (($quality < 0.1) or ($quality > 100)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('Quality must be between 0.1 and 100'); } @@ -1198,8 +1194,6 @@ public static function setDefault($locale, $quality = 1) if (isset(self::$_localeData[$elocale[0]]) === true) { self::$_default = [$elocale[0] => $quality]; } else { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown locale '" . (string) $locale . "' can not be set as default!"); } } @@ -1780,8 +1774,6 @@ public static function findLocale($locale = null) $locale = Zend_Locale::getLocaleToTerritory($locale); if (empty($locale)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("The locale '$locale' is no known locale"); } } else { @@ -1941,8 +1933,6 @@ private static function _prepareLocale($locale, $strict = false) // This can only happen when someone extends Zend_Locale and erases the default if ($locale === null) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('Autodetection of Locale has been failed!'); } diff --git a/library/Zend/Locale/Data.php b/library/Zend/Locale/Data.php index f27e922f..67d1d896 100644 --- a/library/Zend/Locale/Data.php +++ b/library/Zend/Locale/Data.php @@ -133,8 +133,6 @@ private static function _findRoute($locale, $path, $attribute, $value, &$temp) if (empty(self::$_ldml[(string) $locale])) { $filename = __DIR__ . '/Data/' . $locale . '.xml'; if (!file_exists($filename)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Missing locale file '$filename' for '$locale' locale."); } @@ -281,8 +279,6 @@ private static function _checkLocale($locale) } if (!(Zend_Locale::isLocale((string) $locale, null, false))) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('Locale (' . (string) $locale . ') is a unknown locale'); } @@ -988,8 +984,6 @@ public static function getList($locale, $path, $value = false) break; default: - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown list ($path) for parsing locale data."); break; @@ -1605,8 +1599,6 @@ public static function getContent($locale, $path, $value = false) break; default: - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown detail ($path) for parsing locale data."); break; diff --git a/library/Zend/Locale/Exception.php b/library/Zend/Locale/Exception.php index 73272af6..a670c7d5 100644 --- a/library/Zend/Locale/Exception.php +++ b/library/Zend/Locale/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php index 5583d7a0..6ea43cc6 100644 --- a/library/Zend/Locale/Format.php +++ b/library/Zend/Locale/Format.php @@ -93,7 +93,6 @@ private static function _checkOptions(array $options = []) } $options['number_format'] = Zend_Locale_Data::getContent($locale, 'decimalnumber'); } elseif ((gettype($value) !== 'string') and ($value !== null)) { - require_once 'Zend/Locale/Exception.php'; $stringValue = (string) (is_array($value) ? implode(' ', $value) : $value); throw new Zend_Locale_Exception("Unknown number format type '" . gettype($value) . "'. " @@ -110,7 +109,6 @@ private static function _checkOptions(array $options = []) } $options['date_format'] = Zend_Locale_Format::getDateFormat($locale); } elseif ((gettype($value) !== 'string') and ($value !== null)) { - require_once 'Zend/Locale/Exception.php'; $stringValue = (string) (is_array($value) ? implode(' ', $value) : $value); throw new Zend_Locale_Exception("Unknown dateformat type '" . gettype($value) . "'. " @@ -126,8 +124,6 @@ private static function _checkOptions(array $options = []) case 'format_type' : if (($value != 'php') && ($value != 'iso')) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown date format type '$value'. Only 'iso' and 'php'" . ' are supported.'); } @@ -136,8 +132,6 @@ private static function _checkOptions(array $options = []) case 'fix_date' : if (($value !== true) && ($value !== false)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('Enabling correction of dates must be either true or false' . "(fix_date='$value')."); } @@ -169,16 +163,12 @@ private static function _checkOptions(array $options = []) } if (($value < -1) || ($value > 30)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("'$value' precision is not a whole number less than 30."); } break; default: - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown option: '$name' = '$value'"); break; @@ -215,8 +205,6 @@ public static function convertNumerals($input, $from, $to = null) $from = strtolower($from); $source = Zend_Locale_Data::getContent('en', 'numberingsystem', $from); if (empty($source)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown script '$from'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9."); } @@ -224,8 +212,6 @@ public static function convertNumerals($input, $from, $to = null) $to = strtolower($to); $target = Zend_Locale_Data::getContent('en', 'numberingsystem', $to); if (empty($target)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("Unknown script '$to'. Use 'Latn' for digits 0,1,2,3,4,5,6,7,8,9."); } } else { @@ -264,8 +250,6 @@ public static function getNumber($input, array $options = []) } if (!self::isNumber($input, $options)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception('No localized value in ' . $input . ' found, or the given number does not match the localized format'); } @@ -360,7 +344,6 @@ public static function toNumber($value, array $options = []) if (iconv_strpos($format, '0') === false) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception('Wrong format... missing 0'); } @@ -921,7 +904,6 @@ private static function _parseDate($date, $options) if (empty($parse)) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unknown date format, neither date nor time in '" . $format . "' found"); } @@ -942,7 +924,6 @@ private static function _parseDate($date, $options) if ((is_countable($splitted[0]) ? count($splitted[0]) : 0) == 0) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("No date part in '$date' found."); } @@ -1054,7 +1035,6 @@ private static function _parseDate($date, $options) or (isset($result['year']) and (iconv_strpos($date, $result['year']) === false)))) { if ($options['fix_date'] !== true) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unable to parse date '$date' using '" . $format . "' (false month, $position, $month)"); @@ -1071,10 +1051,9 @@ private static function _parseDate($date, $options) if ($result['day'] > 31) { if ($options['fix_date'] !== true) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unable to parse date '$date' using '" - . $format . "' (d <> y)"); + . $format . "' (d <> y)"); } $temp = $result['year']; $result['year'] = $result['day']; @@ -1088,10 +1067,9 @@ private static function _parseDate($date, $options) if ($result['month'] > 31) { if ($options['fix_date'] !== true) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unable to parse date '$date' using '" - . $format . "' (M <> y)"); + . $format . "' (M <> y)"); } $temp = $result['year']; $result['year'] = $result['month']; @@ -1105,10 +1083,9 @@ private static function _parseDate($date, $options) if ($result['month'] > 12) { if ($options['fix_date'] !== true || $result['month'] > 31) { self::_setEncoding($oenc); - require_once 'Zend/Locale/Exception.php'; throw new Zend_Locale_Exception("Unable to parse date '$date' using '" - . $format . "' (M <> d)"); + . $format . "' (M <> d)"); } $temp = $result['day']; $result['day'] = $result['month']; @@ -1176,8 +1153,6 @@ public static function getDateFormat($locale = null) { $format = Zend_Locale_Data::getContent($locale, 'date'); if (empty($format)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("failed to receive data from locale $locale"); } @@ -1279,8 +1254,6 @@ public static function getTimeFormat($locale = null) { $format = Zend_Locale_Data::getContent($locale, 'time'); if (empty($format)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("failed to receive data from locale $locale"); } @@ -1322,8 +1295,6 @@ public static function getDateTimeFormat($locale = null) { $format = Zend_Locale_Data::getContent($locale, 'datetime'); if (empty($format)) { - require_once 'Zend/Locale/Exception.php'; - throw new Zend_Locale_Exception("failed to receive data from locale $locale"); } diff --git a/library/Zend/Locale/Math/Exception.php b/library/Zend/Locale/Math/Exception.php index 62b2d67c..3ab29436 100644 --- a/library/Zend/Locale/Math/Exception.php +++ b/library/Zend/Locale/Math/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Locale/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Locale/Math/PhpMath.php b/library/Zend/Locale/Math/PhpMath.php index 3fcdae33..7b3c8d1e 100644 --- a/library/Zend/Locale/Math/PhpMath.php +++ b/library/Zend/Locale/Math/PhpMath.php @@ -65,8 +65,6 @@ public static function Add($op1, $op2, $scale = null) $op2 = self::normalize($op2); $result = $op1 + $op2; if (is_infinite($result) or (abs($result - $op2 - $op1) > $precision)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("addition overflow: $op1 + $op2 != $result", $op1, $op2, $result); } @@ -89,8 +87,6 @@ public static function Sub($op1, $op2, $scale = null) $op2 = self::normalize($op2); $result = $op1 - $op2; if (is_infinite($result) or (abs($result + $op2 - $op1) > $precision)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("subtraction overflow: $op1 - $op2 != $result", $op1, $op2, $result); } @@ -112,8 +108,6 @@ public static function Pow($op1, $op2, $scale = null) $result = $op1 ** $op2; if (is_infinite($result) or is_nan($result)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("power overflow: $op1 ^ $op2", $op1, $op2, $result); } @@ -133,8 +127,6 @@ public static function Mul($op1, $op2, $scale = null) $op2 = self::normalize($op2); $result = $op1 * $op2; if (is_infinite($result) or is_nan($result)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("multiplication overflow: $op1 * $op2 != $result", $op1, $op2, $result); } @@ -148,8 +140,6 @@ public static function Div($op1, $op2, $scale = null) } if (empty($op2)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception('can not divide by zero', $op1, $op2, null); } if (empty($op1)) { @@ -159,8 +149,6 @@ public static function Div($op1, $op2, $scale = null) $op2 = self::normalize($op2); $result = $op1 / $op2; if (is_infinite($result) or is_nan($result)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("division overflow: $op1 / $op2 != $result", $op1, $op2, $result); } @@ -200,8 +188,6 @@ public static function Mod($op1, $op2) } $result = $op1 % $op2; if (is_nan($result) or (($op1 - $result) % $op2 != 0)) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("modulus calculation error: $op1 % $op2 != $result", $op1, $op2, $result); } @@ -239,8 +225,6 @@ public static function Comp($op1, $op2, $scale = null) public static function Scale($scale) { if ($scale > 9) { - require_once 'Zend/Locale/Math/Exception.php'; - throw new Zend_Locale_Math_Exception("can not scale to precision $scale", $scale, null, null); } self::$defaultScale = $scale; diff --git a/library/Zend/Navigation.php b/library/Zend/Navigation.php index 2158e290..c8e7440b 100644 --- a/library/Zend/Navigation.php +++ b/library/Zend/Navigation.php @@ -40,8 +40,6 @@ public function __construct($pages = null) if (is_array($pages) || $pages instanceof Zend_Config) { $this->addPages($pages); } elseif (null !== $pages) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $pages must be an array, an ' . 'instance of Zend_Config, or null'); diff --git a/library/Zend/Navigation/Container.php b/library/Zend/Navigation/Container.php index 2a923373..0be515a9 100644 --- a/library/Zend/Navigation/Container.php +++ b/library/Zend/Navigation/Container.php @@ -99,8 +99,6 @@ public function notifyOrderUpdated() public function addPage($page) { if ($page === $this) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'A page cannot have itself as a parent'); } @@ -109,8 +107,6 @@ public function addPage($page) require_once 'Zend/Navigation/Page.php'; $page = Zend_Navigation_Page::factory($page); } elseif (!$page instanceof Zend_Navigation_Page) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $page must be an instance of ' . 'Zend_Navigation_Page or Zend_Config, or an array'); @@ -153,8 +149,6 @@ public function addPages($pages) } if (!is_array($pages)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $pages must be an array, an ' . 'instance of Zend_Config or an instance of ' @@ -475,8 +469,6 @@ public function __call($method, $arguments) return $this->{$match[1]}($match[2], $arguments[0], !empty($arguments[1])); } - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( sprintf( 'Bad method call: Unknown method %s::%s', @@ -523,7 +515,6 @@ public function current(): mixed if (isset($this->_pages[$hash])) { return $this->_pages[$hash]; } - require_once 'Zend/Navigation/Exception.php'; throw new Zend_Navigation_Exception( 'Corruption detected in container; ' diff --git a/library/Zend/Navigation/Exception.php b/library/Zend/Navigation/Exception.php index f10d1a21..df0ce374 100644 --- a/library/Zend/Navigation/Exception.php +++ b/library/Zend/Navigation/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * Navigation exception. * diff --git a/library/Zend/Navigation/Page.php b/library/Zend/Navigation/Page.php index 619fe2b8..39e08b13 100644 --- a/library/Zend/Navigation/Page.php +++ b/library/Zend/Navigation/Page.php @@ -201,8 +201,6 @@ public static function factory($options) } if (!is_array($options)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $options must be an array or Zend_Config'); } @@ -233,8 +231,6 @@ public static function factory($options) $page = new $type($options); if (!$page instanceof Zend_Navigation_Page) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception(sprintf( 'Invalid argument: Detected type "%s", which ' . 'is not an instance of Zend_Navigation_Page', @@ -260,8 +256,6 @@ public static function factory($options) return new Zend_Navigation_Page_Uri($options); } - require_once 'Zend/Navigation/Exception.php'; - $message = 'Invalid argument: Unable to determine class to instantiate'; if (isset($options['label'])) { $message .= ' (Page label: ' . $options['label'] . ')'; @@ -340,8 +334,6 @@ public function setOptions(array $options) public function setLabel($label) { if (null !== $label && !is_string($label)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $label must be a string or null'); } @@ -371,8 +363,6 @@ public function getLabel() public function setFragment($fragment) { if (null !== $fragment && !is_string($fragment)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $fragment must be a string or null'); } @@ -403,8 +393,6 @@ public function getFragment() public function setId($id = null) { if (null !== $id && !is_string($id) && !is_numeric($id)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $id must be a string, number or null'); } @@ -435,8 +423,6 @@ public function getId() public function setClass($class = null) { if (null !== $class && !is_string($class)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $class must be a string or null'); } @@ -467,8 +453,6 @@ public function getClass() public function setTitle($title = null) { if (null !== $title && !is_string($title)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $title must be a non-empty string'); } @@ -499,8 +483,6 @@ public function getTitle() public function setTarget($target = null) { if (null !== $target && !is_string($target)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $target must be a string or null'); } @@ -532,8 +514,6 @@ public function setAccesskey($character = null) { if (null !== $character && (!is_string($character) || 1 != strlen($character))) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $character must be a single character or null' ); @@ -577,8 +557,6 @@ public function setRel($relations = null) } if (!is_array($relations)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $relations must be an ' . 'array or an instance of Zend_Config'); @@ -641,8 +619,6 @@ public function setRev($relations = null) } if (!is_array($relations)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $relations must be an ' . 'array or an instance of Zend_Config'); @@ -693,16 +669,12 @@ public function getRev($relation = null) public function setCustomHtmlAttrib($name, $value) { if (!is_string($name)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $name must be a string' ); } if (null !== $value && !is_string($value)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $value must be a string or null' ); @@ -727,8 +699,6 @@ public function setCustomHtmlAttrib($name, $value) public function getCustomHtmlAttrib($name) { if (!is_string($name)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $name must be a string' ); @@ -777,8 +747,6 @@ public function getCustomHtmlAttribs() public function removeCustomHtmlAttrib($name) { if (!is_string($name)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $name must be a string' ); @@ -820,8 +788,6 @@ public function setOrder($order = null) } if (null !== $order && !is_int($order)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $order must be an integer or null, ' . 'or a string that casts to an integer'); @@ -865,8 +831,6 @@ public function setResource($resource = null) || $resource instanceof Zend_Acl_Resource_Interface) { $this->_resource = $resource; } else { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $resource must be null, a string, ' . ' or an instance of Zend_Acl_Resource_Interface'); @@ -1031,8 +995,6 @@ public function getVisible($recursive = false) public function setParent(?Zend_Navigation_Container $parent = null) { if ($parent === $this) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'A page cannot have itself as a parent'); } @@ -1082,8 +1044,6 @@ public function getParent() public function set($property, $value) { if (!is_string($property) || empty($property)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $property must be a non-empty string'); } @@ -1114,8 +1074,6 @@ public function set($property, $value) public function get($property) { if (!is_string($property) || empty($property)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $property must be a non-empty string'); } @@ -1195,8 +1153,6 @@ public function __unset($name) { $method = 'set' . self::_normalizePropertyName($name); if (method_exists($this, $method)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception(sprintf( 'Unsetting native property "%s" is not allowed', $name)); diff --git a/library/Zend/Navigation/Page/Mvc.php b/library/Zend/Navigation/Page/Mvc.php index 776a156d..cdba2350 100644 --- a/library/Zend/Navigation/Page/Mvc.php +++ b/library/Zend/Navigation/Page/Mvc.php @@ -293,8 +293,6 @@ public function getHref() public function setAction($action) { if (null !== $action && !is_string($action)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $action must be a string or null' ); @@ -330,8 +328,6 @@ public function getAction() public function setController($controller) { if (null !== $controller && !is_string($controller)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $controller must be a string or null' ); @@ -367,8 +363,6 @@ public function getController() public function setModule($module) { if (null !== $module && !is_string($module)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $module must be a string or null' ); @@ -541,8 +535,6 @@ public function getParam($name) public function setRoute($route) { if (null !== $route && (!is_string($route) || strlen($route) < 1)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $route must be a non-empty string or null' ); @@ -637,8 +629,6 @@ public function getEncodeUrl() public function setScheme($scheme) { if (null !== $scheme && !is_string($scheme)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $scheme must be a string or null' ); diff --git a/library/Zend/Navigation/Page/Uri.php b/library/Zend/Navigation/Page/Uri.php index 26168e63..4ced0424 100644 --- a/library/Zend/Navigation/Page/Uri.php +++ b/library/Zend/Navigation/Page/Uri.php @@ -47,8 +47,6 @@ class Zend_Navigation_Page_Uri extends Zend_Navigation_Page public function setUri($uri) { if (null !== $uri && !is_string($uri)) { - require_once 'Zend/Navigation/Exception.php'; - throw new Zend_Navigation_Exception( 'Invalid argument: $uri must be a string or null'); } diff --git a/library/Zend/Paginator.php b/library/Zend/Paginator.php index f1f6d759..80272155 100644 --- a/library/Zend/Paginator.php +++ b/library/Zend/Paginator.php @@ -278,11 +278,6 @@ public static function factory($data, $adapter = self::INTERNAL_ADAPTER, } else { $type = (is_object($data)) ? get_class($data) : gettype($data); - /** - * @see Zend_Paginator_Exception - */ - require_once 'Zend/Paginator/Exception.php'; - throw new Zend_Paginator_Exception('No adapter for type ' . $type); } } @@ -439,11 +434,6 @@ public function __construct($adapter) } elseif ($adapter instanceof Zend_Paginator_AdapterAggregate) { $this->_adapter = $adapter->getPaginatorAdapter(); } else { - /** - * @see Zend_Paginator_Exception - */ - require_once 'Zend/Paginator/Exception.php'; - throw new Zend_Paginator_Exception( 'Zend_Paginator only accepts instances of the type ' . 'Zend_Paginator_Adapter_Interface or Zend_Paginator_AdapterAggregate.' @@ -687,11 +677,6 @@ public function getItem($itemNumber, $pageNumber = null) $itemCount = $this->getItemCount($page); if ($itemCount == 0) { - /** - * @see Zend_Paginator_Exception - */ - require_once 'Zend/Paginator/Exception.php'; - throw new Zend_Paginator_Exception('Page ' . $pageNumber . ' does not exist'); } @@ -702,13 +687,8 @@ public function getItem($itemNumber, $pageNumber = null) $itemNumber = $this->normalizeItemNumber($itemNumber); if ($itemNumber > $itemCount) { - /** - * @see Zend_Paginator_Exception - */ - require_once 'Zend/Paginator/Exception.php'; - throw new Zend_Paginator_Exception('Page ' . $pageNumber . ' does not' - . ' contain item number ' . $itemNumber); + . ' contain item number ' . $itemNumber); } return $page[$itemNumber - 1]; @@ -1141,11 +1121,6 @@ protected function _loadScrollingStyle($scrollingStyle = null) switch (strtolower(gettype($scrollingStyle))) { case 'object': if (!$scrollingStyle instanceof Zend_Paginator_ScrollingStyle_Interface) { - /** - * @see Zend_View_Exception - */ - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception('Scrolling style must implement ' . \Zend_Paginator_ScrollingStyle_Interface::class); } @@ -1161,11 +1136,6 @@ protected function _loadScrollingStyle($scrollingStyle = null) // Fall through to default case default: - /** - * @see Zend_View_Exception - */ - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception('Scrolling style must be a class ' . 'name or object implementing Zend_Paginator_ScrollingStyle_Interface'); } diff --git a/library/Zend/Paginator/Adapter/Iterator.php b/library/Zend/Paginator/Adapter/Iterator.php index 55a631a9..cbab2e14 100644 --- a/library/Zend/Paginator/Adapter/Iterator.php +++ b/library/Zend/Paginator/Adapter/Iterator.php @@ -55,11 +55,6 @@ class Zend_Paginator_Adapter_Iterator implements Zend_Paginator_Adapter_Interfac public function __construct(Iterator $iterator) { if (!$iterator instanceof Countable) { - /** - * @see Zend_Paginator_Exception - */ - require_once 'Zend/Paginator/Exception.php'; - throw new Zend_Paginator_Exception('Iterator must implement Countable'); } diff --git a/library/Zend/Paginator/Exception.php b/library/Zend/Paginator/Exception.php index 44f0c315..3c7a46a7 100644 --- a/library/Zend/Paginator/Exception.php +++ b/library/Zend/Paginator/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/ProgressBar.php b/library/Zend/ProgressBar.php index 00993b80..e9790f14 100644 --- a/library/Zend/ProgressBar.php +++ b/library/Zend/ProgressBar.php @@ -83,8 +83,6 @@ public function __construct(Zend_ProgressBar_Adapter $adapter, $min = 0, $max = { // Check min/max values and set them if ($min > $max) { - require_once 'Zend/ProgressBar/Exception.php'; - throw new Zend_ProgressBar_Exception('$max must be greater than $min'); } diff --git a/library/Zend/Registry.php b/library/Zend/Registry.php index 5f19d678..ed9b247c 100644 --- a/library/Zend/Registry.php +++ b/library/Zend/Registry.php @@ -60,8 +60,6 @@ public static function getInstance() public static function setInstance(Zend_Registry $registry) { if (self::$_registry !== null) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception('Registry is already initialized'); } @@ -87,14 +85,10 @@ protected static function init() public static function setClassName($registryClassName = \Zend_Registry::class) { 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'); } @@ -134,8 +128,6 @@ 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'"); } diff --git a/library/Zend/Rest/Client.php b/library/Zend/Rest/Client.php index 18385400..6fb5ac48 100644 --- a/library/Zend/Rest/Client.php +++ b/library/Zend/Rest/Client.php @@ -103,8 +103,6 @@ private function _prepareRest($path) { // Get the URI object and configure it if (!$this->_uri instanceof Zend_Uri_Http) { - require_once 'Zend/Rest/Client/Exception.php'; - throw new Zend_Rest_Client_Exception('URI object must be set before performing call'); } diff --git a/library/Zend/Rest/Client/Exception.php b/library/Zend/Rest/Client/Exception.php index 15dfb2c0..c82bc466 100644 --- a/library/Zend/Rest/Client/Exception.php +++ b/library/Zend/Rest/Client/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Rest_Exception. */ -require_once 'Zend/Rest/Exception.php'; - /** * Zend_Rest_Server_Exception. * diff --git a/library/Zend/Rest/Client/Result.php b/library/Zend/Rest/Client/Result.php index 754426ee..dd8c69de 100644 --- a/library/Zend/Rest/Client/Result.php +++ b/library/Zend/Rest/Client/Result.php @@ -53,7 +53,6 @@ public function __construct($data) $message = 'REST Response Error: ' . $this->_errstr; $this->_errstr = null; } - require_once 'Zend/Rest/Client/Result/Exception.php'; throw new Zend_Rest_Client_Result_Exception($message); } diff --git a/library/Zend/Rest/Client/Result/Exception.php b/library/Zend/Rest/Client/Result/Exception.php index 30b18d66..0e017ab0 100644 --- a/library/Zend/Rest/Client/Result/Exception.php +++ b/library/Zend/Rest/Client/Result/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Rest_Client_Exception */ -require_once 'Zend/Rest/Client/Exception.php'; - /** * Zend_Rest_Client_Result_Exception. * diff --git a/library/Zend/Rest/Exception.php b/library/Zend/Rest/Exception.php index f4089113..b577f0de 100644 --- a/library/Zend/Rest/Exception.php +++ b/library/Zend/Rest/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Service/Exception.php b/library/Zend/Service/Exception.php index 444d1991..e53edf80 100644 --- a/library/Zend/Service/Exception.php +++ b/library/Zend/Service/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Session.php b/library/Zend/Session.php index 195ed8e0..e64f7dc1 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -189,9 +189,6 @@ public static function setOptions(array $userOptions = []) } elseif (isset(self::$_localOptions[$userOptionName])) { self::${self::$_localOptions[$userOptionName]} = $userOptionValue; } else { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("Unknown option: $userOptionName = $userOptionValue"); } } @@ -268,9 +265,6 @@ public static function getSaveHandler() public static function regenerateId() { if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('You must call ' . self::class . '::' . __FUNCTION__ . "() before any output has been sent to the browser; output started in {$filename}/{$linenum}"); } @@ -382,8 +376,6 @@ public static function start($options = false) } if (self::$_sessionStarted && self::$_destroyed) { - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('The session was explicitly destroyed during this request, attempting to re-start is not allowed.'); } @@ -398,26 +390,17 @@ public static function start($options = false) // In strict mode, do not allow auto-starting Zend_Session, such as via "new Zend_Session_Namespace()" if (self::$_strict && $options === true) { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('You must explicitly start the session with Zend_Session::start() when session options are set to strict.'); } $filename = $linenum = null; if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Session must be started before any output has been sent to the browser;' . " output started in {$filename}/{$linenum}"); } // See http://www.php.net/manual/en/ref.session.php for explanation if (!self::$_unitTestEnabled && defined('SID')) { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('session has already been started by session.auto-start or session_start()'); } @@ -428,10 +411,8 @@ public static function start($options = false) */ $errorLevel = (is_int(self::$_throwStartupExceptions)) ? self::$_throwStartupExceptions : E_ALL; - // @see Zend_Session_Exception if (!self::$_unitTestEnabled) { if (self::$_throwStartupExceptions) { - require_once 'Zend/Session/Exception.php'; set_error_handler([\Zend_Session_Exception::class, 'handleSessionStartError'], $errorLevel); } @@ -614,24 +595,15 @@ public static function getId() public static function setId($id) { if (!self::$_unitTestEnabled && defined('SID')) { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('The session has already been started. The session id must be set first.'); } if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('You must call ' . self::class . '::' . __FUNCTION__ . "() before any output has been sent to the browser; output started in {$filename}/{$linenum}"); } if (!is_string($id) || $id === '') { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('You must provide a non-empty string as a session identifier.'); } @@ -745,9 +717,6 @@ private static function _processValidators() } $validator = new $validator_name(); if ($validator->validate() === false) { - /** @see Zend_Session_Validator_Exception */ - require_once 'Zend/Session/Validator/Exception.php'; - throw new Zend_Session_Validator_Exception("This session is not valid according to {$validator_name}."); } } @@ -798,9 +767,6 @@ public static function namespaceGet($namespace) public static function getIterator() { if (parent::$_readable === false) { - /** @see Zend_Session_Exception */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(parent::_THROW_NOT_READABLE_MSG); } diff --git a/library/Zend/Session/Abstract.php b/library/Zend/Session/Abstract.php index a396b826..8a0fc5ed 100644 --- a/library/Zend/Session/Abstract.php +++ b/library/Zend/Session/Abstract.php @@ -73,11 +73,6 @@ abstract class Zend_Session_Abstract protected static function _namespaceIsset($namespace, $name = null) { if (self::$_readable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG); } @@ -97,11 +92,6 @@ protected static function _namespaceIsset($namespace, $name = null) protected static function _namespaceUnset($namespace, $name = null) { if (self::$_writable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(self::_THROW_NOT_WRITABLE_MSG); } @@ -131,11 +121,6 @@ protected static function _namespaceUnset($namespace, $name = null) protected static function &_namespaceGet($namespace, $name = null) { if (self::$_readable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG); } diff --git a/library/Zend/Session/Exception.php b/library/Zend/Session/Exception.php index d276049f..d3d4b04f 100644 --- a/library/Zend/Session/Exception.php +++ b/library/Zend/Session/Exception.php @@ -22,8 +22,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * Zend_Session_Exception. * diff --git a/library/Zend/Session/Namespace.php b/library/Zend/Session/Namespace.php index 61caa6bd..86c15f48 100644 --- a/library/Zend/Session/Namespace.php +++ b/library/Zend/Session/Namespace.php @@ -93,38 +93,18 @@ public static function resetSingleInstance($namespaceName = null) public function __construct($namespace = 'Default', $singleInstance = false) { if ($namespace === '') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Session namespace must be a non-empty string.'); } if ($namespace[0] == '_') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Session namespace must not start with an underscore.'); } if (preg_match('#(^[0-9])#i', $namespace[0])) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Session namespace must not start with a number.'); } if (isset(self::$_singleInstances[$namespace])) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("A session namespace object already exists for this namespace ('$namespace'), and no additional accessors (session namespace objects) for this namespace are permitted."); } @@ -138,11 +118,6 @@ public function __construct($namespace = 'Default', $singleInstance = false) Zend_Session::start(true); // attempt auto-start (throws exception if strict option set) if (self::$_readable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(self::_THROW_NOT_READABLE_MSG); } @@ -260,11 +235,6 @@ public function unsetAll() public function &__get($name) { if ($name === '') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("The '$name' key must be a non-empty string"); } @@ -282,29 +252,14 @@ public function &__get($name) public function __set($name, $value) { if (isset(self::$_namespaceLocks[$this->_namespace])) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('This session/namespace has been marked as read-only.'); } if ($name === '') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("The '$name' key must be a non-empty string"); } if (parent::$_writable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG); } @@ -349,11 +304,6 @@ public function applySet($callback) $arg_list[0] = $_SESSION[$this->_namespace]; $result = call_user_func_array($callback, $arg_list); if (!is_array($result)) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Result must be an array. Got: ' . gettype($result)); } $_SESSION[$this->_namespace] = $result; @@ -371,11 +321,6 @@ public function applySet($callback) public function __isset($name) { if ($name === '') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("The '$name' key must be a non-empty string"); } @@ -392,11 +337,6 @@ public function __isset($name) public function __unset($name) { if ($name === '') { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception("The '$name' key must be a non-empty string"); } @@ -413,20 +353,10 @@ public function __unset($name) public function setExpirationSeconds($seconds, $variables = null) { if (parent::$_writable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG); } if ($seconds <= 0) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Seconds must be positive.'); } @@ -457,20 +387,10 @@ public function setExpirationSeconds($seconds, $variables = null) public function setExpirationHops($hops, $variables = null, $hopCountOnUsageOnly = false) { if (parent::$_writable === false) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception(parent::_THROW_NOT_WRITABLE_MSG); } if ($hops <= 0) { - /** - * @see Zend_Session_Exception - */ - require_once 'Zend/Session/Exception.php'; - throw new Zend_Session_Exception('Hops must be positive number.'); } diff --git a/library/Zend/Session/Validator/Exception.php b/library/Zend/Session/Validator/Exception.php index 78cb7671..c628a56b 100644 --- a/library/Zend/Session/Validator/Exception.php +++ b/library/Zend/Session/Validator/Exception.php @@ -22,8 +22,6 @@ /** * @see Zend_Session_Exception */ -require_once 'Zend/Session/Exception.php'; - /** * Zend_Session_Validator_Exception. * diff --git a/library/Zend/Test/PHPUnit/ControllerTestCase.php b/library/Zend/Test/PHPUnit/ControllerTestCase.php index 85560206..22761530 100644 --- a/library/Zend/Test/PHPUnit/ControllerTestCase.php +++ b/library/Zend/Test/PHPUnit/ControllerTestCase.php @@ -78,8 +78,6 @@ abstract class Zend_Test_PHPUnit_ControllerTestCase extends \PHPUnit\Framework\T public function __set($name, $value) { if (in_array($name, ['request', 'response', 'frontController'])) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception(sprintf('Setting %s object manually is not allowed', $name)); } $this->$name = $value; diff --git a/library/Zend/Text/Exception.php b/library/Zend/Text/Exception.php index 6e1cd4b2..e775a94a 100644 --- a/library/Zend/Text/Exception.php +++ b/library/Zend/Text/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * Exception class for Zend_Text. * diff --git a/library/Zend/Text/Figlet.php b/library/Zend/Text/Figlet.php index 1bec6e81..6a57ea83 100644 --- a/library/Zend/Text/Figlet.php +++ b/library/Zend/Text/Figlet.php @@ -456,8 +456,6 @@ public function render($text, $encoding = 'UTF-8') $textLength = @iconv_strlen($text, 'UTF-8'); if ($textLength === false) { - require_once 'Zend/Text/Figlet/Exception.php'; - throw new Zend_Text_Figlet_Exception('$text is not encoded with ' . $encoding); } @@ -991,18 +989,14 @@ protected function _loadFont($fontFile) { // Check if the font file exists if (!file_exists($fontFile)) { - require_once 'Zend/Text/Figlet/Exception.php'; - throw new Zend_Text_Figlet_Exception($fontFile . ': Font file not found'); } // Check if gzip support is required if (substr($fontFile, -3) === '.gz') { if (!function_exists('gzcompress')) { - require_once 'Zend/Text/Figlet/Exception.php'; - throw new Zend_Text_Figlet_Exception('GZIP library is required for ' - . 'gzip compressed font files'); + . 'gzip compressed font files'); } $fontFile = 'compress.zlib://' . $fontFile; @@ -1014,8 +1008,6 @@ protected function _loadFont($fontFile) // Try to open the file $fp = fopen($fontFile, 'rb'); if ($fp === false) { - require_once 'Zend/Text/Figlet/Exception.php'; - throw new Zend_Text_Figlet_Exception($fontFile . ': Could not open file'); } @@ -1039,8 +1031,6 @@ protected function _loadFont($fontFile) $this->_fontSmush); if ($magic !== self::FONTFILE_MAGIC_NUMBER || $numsRead < 5) { - require_once 'Zend/Text/Figlet/Exception.php'; - throw new Zend_Text_Figlet_Exception($fontFile . ': Not a FIGlet 2 font file'); } diff --git a/library/Zend/Text/Figlet/Exception.php b/library/Zend/Text/Figlet/Exception.php index 55404f49..9ce159bc 100644 --- a/library/Zend/Text/Figlet/Exception.php +++ b/library/Zend/Text/Figlet/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Text_Exception */ -require_once 'Zend/Text/Exception.php'; - /** * Exception class for Zend_Figlet. * diff --git a/library/Zend/Translate.php b/library/Zend/Translate.php index 51492ba0..510c12a1 100644 --- a/library/Zend/Translate.php +++ b/library/Zend/Translate.php @@ -127,8 +127,6 @@ public function setAdapter($options = []) unset($options['adapter']); $this->_adapter = new $adapter($options); if (!$this->_adapter instanceof Zend_Translate_Adapter) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Adapter ' . $adapter . ' does not extend Zend_Translate_Adapter'); } } @@ -201,7 +199,6 @@ public function __call($method, array $options) if (method_exists($this->_adapter, $method)) { return call_user_func_array([$this->_adapter, $method], $options); } - require_once 'Zend/Translate/Exception.php'; throw new Zend_Translate_Exception("Unknown method '" . $method . "' called!"); } diff --git a/library/Zend/Translate/Adapter.php b/library/Zend/Translate/Adapter.php index ca397e46..5a33dfd0 100644 --- a/library/Zend/Translate/Adapter.php +++ b/library/Zend/Translate/Adapter.php @@ -215,8 +215,6 @@ public function addTranslation($options = []) } if (!isset($options['content']) || empty($options['content'])) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception("Required option 'content' is missing"); } @@ -226,8 +224,6 @@ public function addTranslation($options = []) } if ((array_key_exists('log', $options)) && !($options['log'] instanceof Zend_Log)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Instance of Zend_Log expected for option log'); } @@ -240,8 +236,6 @@ public function addTranslation($options = []) $options['locale'] = Zend_Locale::findLocale($options['locale']); } } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception("The given Language '{$options['locale']}' does not exist", 0, $e); } @@ -355,8 +349,6 @@ public function setOptions(array $options = []) } elseif ((isset($this->_options[$key]) and ($this->_options[$key] != $option)) or !isset($this->_options[$key])) { if (($key == 'log') && !($option instanceof Zend_Log)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Instance of Zend_Log expected for option log'); } @@ -436,8 +428,6 @@ public function setLocale($locale) try { $locale = Zend_Locale::findLocale($locale); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception("The given Language ({$locale}) does not exist", 0, $e); } @@ -634,8 +624,6 @@ private function _addTranslationData($options = []) try { $options['locale'] = Zend_Locale::findLocale($options['locale']); } catch (Zend_Locale_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception("The given Language '{$options['locale']}' does not exist", 0, $e); } diff --git a/library/Zend/Translate/Adapter/Array.php b/library/Zend/Translate/Adapter/Array.php index 01b238c0..f8b6ae46 100644 --- a/library/Zend/Translate/Adapter/Array.php +++ b/library/Zend/Translate/Adapter/Array.php @@ -52,8 +52,6 @@ protected function _loadTranslationData($data, $locale, array $options = []) } } if (!is_array($data)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception("Error including array or file '" . $data . "'"); } diff --git a/library/Zend/Translate/Exception.php b/library/Zend/Translate/Exception.php index 2e589c66..7a5fe3b0 100644 --- a/library/Zend/Translate/Exception.php +++ b/library/Zend/Translate/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Translate/Plural.php b/library/Zend/Translate/Plural.php index c94b3988..096907fe 100644 --- a/library/Zend/Translate/Plural.php +++ b/library/Zend/Translate/Plural.php @@ -212,8 +212,6 @@ public static function setPlural($rule, $locale) } if (!is_callable($rule)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('The given rule can not be called'); } diff --git a/library/Zend/Uri.php b/library/Zend/Uri.php index df1db397..16f3b135 100644 --- a/library/Zend/Uri.php +++ b/library/Zend/Uri.php @@ -98,15 +98,11 @@ public static function factory($uri = 'http', $className = null) $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'); } @@ -126,8 +122,6 @@ public static function factory($uri = 'http', $className = null) case 'mailto': // TODO default: - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Scheme \"$scheme\" is not supported"); break; @@ -139,16 +133,12 @@ public static function factory($uri = 'http', $className = null) 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"); } diff --git a/library/Zend/Uri/Exception.php b/library/Zend/Uri/Exception.php index bbb8b831..2f79ff2a 100644 --- a/library/Zend/Uri/Exception.php +++ b/library/Zend/Uri/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * Exceptions for Zend_Uri. * diff --git a/library/Zend/Uri/Http.php b/library/Zend/Uri/Http.php index 1e2ee752..caebefe6 100644 --- a/library/Zend/Uri/Http.php +++ b/library/Zend/Uri/Http.php @@ -148,8 +148,6 @@ protected function __construct($scheme, $schemeSpecific = '') // Validate the URI if ($this->valid() === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Invalid URI supplied'); } } @@ -165,8 +163,6 @@ protected function __construct($scheme, $schemeSpecific = '') public static function fromString($uri) { if (is_string($uri) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('$uri is not a string'); } @@ -175,8 +171,6 @@ public static function fromString($uri) $schemeSpecific = isset($uri[1]) === true ? $uri[1] : ''; if (in_array($scheme, ['http', 'https']) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Invalid scheme: '$scheme'"); } @@ -196,8 +190,6 @@ protected function _parseUri($schemeSpecific) $pattern = '~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~'; $status = @preg_match($pattern, $schemeSpecific, $matches); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: scheme-specific decomposition failed'); } @@ -216,8 +208,6 @@ protected function _parseUri($schemeSpecific) $pattern = '~^(([^:@]*)(:([^@]*))?@)?((?(?=[[])[[][^]]+[]]|[^:]+))(:(.*))?$~'; $status = @preg_match($pattern, $combo, $matches); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: authority decomposition failed'); } @@ -239,8 +229,6 @@ protected function _parseUri($schemeSpecific) public function getUri() { if ($this->valid() === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('One or more parts of the URI are invalid'); } @@ -314,8 +302,6 @@ public function validateUsername($username = null) . self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $username); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: username validation failed'); } @@ -332,8 +318,6 @@ public function validateUsername($username = null) public function setUsername($username) { if ($this->validateUsername($username) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Username \"$username\" is not a valid HTTP username"); } @@ -384,8 +368,6 @@ public function validatePassword($password = null) . self::CHAR_ALNUM . self::CHAR_MARK . ';:&=+$,' . '])+$/', $password); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: password validation failed.'); } @@ -402,8 +384,6 @@ public function validatePassword($password = null) public function setPassword($password) { if ($this->validatePassword($password) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Password \"$password\" is not a valid HTTP password."); } @@ -460,8 +440,6 @@ public function validateHost($host = null) public function setHost($host) { if ($this->validateHost($host) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Host \"$host\" is not a valid HTTP host"); } @@ -514,8 +492,6 @@ public function validatePort($port = null) public function setPort($port) { if ($this->validatePort($port) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Port \"$port\" is not a valid HTTP port."); } @@ -558,8 +534,6 @@ public function validatePath($path = null) $pattern = '/^' . $this->_regex['path'] . '$/'; $status = @preg_match($pattern, $path); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: path validation failed'); } @@ -576,8 +550,6 @@ public function validatePath($path = null) public function setPath($path) { if ($this->validatePath($path) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Path \"$path\" is not a valid HTTP path"); } @@ -640,8 +612,6 @@ public function validateQuery($query = null) $pattern = '/^' . $this->_regex['uric'] . '*$/'; $status = @preg_match($pattern, $query); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: query validation failed'); } @@ -707,8 +677,6 @@ public function setQuery($query) // Make sure the query is valid, and set it if ($this->validateQuery($query) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("'$query' is not a valid query string"); } @@ -752,8 +720,6 @@ public function validateFragment($fragment = null) $pattern = '/^' . $this->_regex['uric'] . '*$/'; $status = @preg_match($pattern, $fragment); if ($status === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception('Internal error: fragment validation failed'); } @@ -770,8 +736,6 @@ public function validateFragment($fragment = null) public function setFragment($fragment) { if ($this->validateFragment($fragment) === false) { - require_once 'Zend/Uri/Exception.php'; - throw new Zend_Uri_Exception("Fragment \"$fragment\" is not a valid HTTP fragment"); } diff --git a/library/Zend/Validate.php b/library/Zend/Validate.php index b0a76baf..6cea8e1c 100644 --- a/library/Zend/Validate.php +++ b/library/Zend/Validate.php @@ -242,9 +242,7 @@ public static function is($value, $classBaseName, array $args = [], $namespaces // 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'"); + throw new Zend_Validate_Exception("Validate class not found from basename '$classBaseName'"); } /** diff --git a/library/Zend/Validate/Abstract.php b/library/Zend/Validate/Abstract.php index 356a308d..ede97f93 100644 --- a/library/Zend/Validate/Abstract.php +++ b/library/Zend/Validate/Abstract.php @@ -151,8 +151,6 @@ public function setMessage($messageString, $messageKey = null) } if (!isset($this->_messageTemplates[$messageKey])) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("No message template exists for key '$messageKey'"); } @@ -192,10 +190,6 @@ public function __get($property) if (array_key_exists($property, $this->_messageVariables)) { return $this->{$this->_messageVariables[$property]}; } - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("No property exists by the name '$property'"); } @@ -361,8 +355,6 @@ public function setTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid translator specified'); } @@ -409,8 +401,6 @@ public static function setDefaultTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { self::$_defaultTranslator = $translator->getAdapter(); } else { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid translator specified'); } } diff --git a/library/Zend/Validate/Barcode.php b/library/Zend/Validate/Barcode.php index b7b743c8..c9a3e4a9 100644 --- a/library/Zend/Validate/Barcode.php +++ b/library/Zend/Validate/Barcode.php @@ -94,8 +94,6 @@ public function __construct($adapter) if (array_key_exists('adapter', $adapter)) { $adapter = $adapter['adapter']; } else { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Missing option 'adapter'"); } } @@ -138,8 +136,6 @@ public function setAdapter($adapter, $options = null) $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' ); diff --git a/library/Zend/Validate/Between.php b/library/Zend/Validate/Between.php index e9a1afbe..25eabb58 100644 --- a/library/Zend/Validate/Between.php +++ b/library/Zend/Validate/Between.php @@ -111,8 +111,6 @@ public function __construct($options) } if (!array_key_exists('min', $options) || !array_key_exists('max', $options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Missing option. 'min' and 'max' has to be given"); } diff --git a/library/Zend/Validate/Callback.php b/library/Zend/Validate/Callback.php index 67d9ad97..1ccd0db5 100644 --- a/library/Zend/Validate/Callback.php +++ b/library/Zend/Validate/Callback.php @@ -81,8 +81,6 @@ public function __construct($callback = null) } if (null === ($initializedCallack = $this->getCallback())) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('No callback registered'); } } @@ -107,8 +105,6 @@ public function getCallback() public function setCallback($callback) { if (!is_callable($callback)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid callback given'); } $this->_callback = $callback; diff --git a/library/Zend/Validate/CreditCard.php b/library/Zend/Validate/CreditCard.php index a5b4f5fa..21b2d700 100644 --- a/library/Zend/Validate/CreditCard.php +++ b/library/Zend/Validate/CreditCard.php @@ -229,8 +229,6 @@ public function getService() public function setService($service) { if (!is_callable($service)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid callback given'); } diff --git a/library/Zend/Validate/Db/Abstract.php b/library/Zend/Validate/Db/Abstract.php index 017758b5..746255a4 100644 --- a/library/Zend/Validate/Db/Abstract.php +++ b/library/Zend/Validate/Db/Abstract.php @@ -122,14 +122,10 @@ public function __construct($options) } if (!array_key_exists('table', $options) && !array_key_exists('schema', $options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Table or Schema option missing!'); } if (!array_key_exists('field', $options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Field option missing!'); } @@ -162,8 +158,6 @@ public function getAdapter() if ($this->_adapter === null) { $this->_adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); if (null === $this->_adapter) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('No database adapter present'); } } @@ -181,8 +175,6 @@ public function getAdapter() public function setAdapter($adapter) { if (!($adapter instanceof Zend_Db_Adapter_Abstract)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Adapter option must be a database adapter!'); } diff --git a/library/Zend/Validate/EmailAddress.php b/library/Zend/Validate/EmailAddress.php index 8cb64652..63e4cdd4 100644 --- a/library/Zend/Validate/EmailAddress.php +++ b/library/Zend/Validate/EmailAddress.php @@ -289,8 +289,6 @@ public function getValidateMx() public function setValidateMx($mx) { if ((bool) $mx && !$this->validateMxSupported()) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('MX checking not available on this system'); } diff --git a/library/Zend/Validate/Exception.php b/library/Zend/Validate/Exception.php index c25eb13a..b6cd01d9 100644 --- a/library/Zend/Validate/Exception.php +++ b/library/Zend/Validate/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/File/Count.php b/library/Zend/Validate/File/Count.php index 536ef14a..653c3fd1 100644 --- a/library/Zend/Validate/File/Count.php +++ b/library/Zend/Validate/File/Count.php @@ -106,8 +106,6 @@ public function __construct($options) } elseif (is_string($options) || is_numeric($options)) { $options = ['max' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -149,17 +147,13 @@ public function setMin($min) } if (!is_string($min) and !is_numeric($min)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } $min = (integer) $min; if (($this->_max !== null) && ($min > $this->_max)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("The minimum must be less than or equal to the maximum file count, but $min >" - . " {$this->_max}"); + . " {$this->_max}"); } $this->_min = $min; @@ -191,17 +185,13 @@ public function setMax($max) } if (!is_string($max) and !is_numeric($max)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } $max = (integer) $max; if (($this->_min !== null) && ($max < $this->_min)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum must be greater than or equal to the minimum file count, but ' - . "$max < {$this->_min}"); + . "$max < {$this->_min}"); } $this->_max = $max; diff --git a/library/Zend/Validate/File/Crc32.php b/library/Zend/Validate/File/Crc32.php index 4b4e409a..d5a51c09 100644 --- a/library/Zend/Validate/File/Crc32.php +++ b/library/Zend/Validate/File/Crc32.php @@ -67,8 +67,6 @@ public function __construct($options) } elseif (is_scalar($options)) { $options = ['hash1' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } diff --git a/library/Zend/Validate/File/Exists.php b/library/Zend/Validate/File/Exists.php index d5beac33..a6b19096 100644 --- a/library/Zend/Validate/File/Exists.php +++ b/library/Zend/Validate/File/Exists.php @@ -68,8 +68,6 @@ public function __construct($directory = []) } elseif (is_string($directory)) { $directory = explode(',', $directory); } elseif (!is_array($directory)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -123,8 +121,6 @@ public function addDirectory($directory) if (is_string($directory)) { $directory = explode(',', $directory); } elseif (!is_array($directory)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } diff --git a/library/Zend/Validate/File/FilesSize.php b/library/Zend/Validate/File/FilesSize.php index e3309506..94fb35b9 100644 --- a/library/Zend/Validate/File/FilesSize.php +++ b/library/Zend/Validate/File/FilesSize.php @@ -71,8 +71,6 @@ public function __construct($options) } elseif (is_scalar($options)) { $options = ['max' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } diff --git a/library/Zend/Validate/File/Hash.php b/library/Zend/Validate/File/Hash.php index c7171744..d487617e 100644 --- a/library/Zend/Validate/File/Hash.php +++ b/library/Zend/Validate/File/Hash.php @@ -65,8 +65,6 @@ public function __construct($options) } elseif (is_scalar($options)) { $options = ['hash1' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -114,8 +112,6 @@ public function addHash($options) if (is_string($options)) { $options = [$options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('False parameter given'); } @@ -128,8 +124,6 @@ public function addHash($options) } if (!in_array($algorithm, $known)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Unknown algorithm '{$algorithm}'"); } diff --git a/library/Zend/Validate/File/ImageSize.php b/library/Zend/Validate/File/ImageSize.php index b8407811..9e28d8cb 100644 --- a/library/Zend/Validate/File/ImageSize.php +++ b/library/Zend/Validate/File/ImageSize.php @@ -135,8 +135,6 @@ public function __construct($options) } } } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -200,8 +198,6 @@ public function setImageMin($options) { if (isset($options['minwidth'])) { if (($this->_maxwidth !== null) and ($options['minwidth'] > $this->_maxwidth)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The minimum image width must be less than or equal to the ' . " maximum image width, but {$options['minwidth']} > {$this->_maxwidth}"); } @@ -209,8 +205,6 @@ public function setImageMin($options) if (isset($options['maxheight'])) { if (($this->_maxheight !== null) and ($options['minheight'] > $this->_maxheight)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The minimum image height must be less than or equal to the ' . " maximum image height, but {$options['minheight']} > {$this->_maxheight}"); } @@ -238,8 +232,6 @@ public function setImageMax($options) { if (isset($options['maxwidth'])) { if (($this->_minwidth !== null) and ($options['maxwidth'] < $this->_minwidth)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum image width must be greater than or equal to the ' . "minimum image width, but {$options['maxwidth']} < {$this->_minwidth}"); } @@ -247,8 +239,6 @@ public function setImageMax($options) if (isset($options['maxheight'])) { if (($this->_minheight !== null) and ($options['maxheight'] < $this->_minheight)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum image height must be greater than or equal to the ' . "minimum image height, but {$options['maxheight']} < {$this->_minwidth}"); } diff --git a/library/Zend/Validate/File/Md5.php b/library/Zend/Validate/File/Md5.php index 5ad74b31..8fbc449e 100644 --- a/library/Zend/Validate/File/Md5.php +++ b/library/Zend/Validate/File/Md5.php @@ -69,8 +69,6 @@ public function __construct($options) } elseif (is_scalar($options)) { $options = ['hash1' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } diff --git a/library/Zend/Validate/File/MimeType.php b/library/Zend/Validate/File/MimeType.php index 1c957e1f..3343b7b4 100644 --- a/library/Zend/Validate/File/MimeType.php +++ b/library/Zend/Validate/File/MimeType.php @@ -133,8 +133,6 @@ public function __construct($mimetype) } elseif (is_string($mimetype)) { $mimetype = explode(',', $mimetype); } elseif (!is_array($mimetype)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -170,7 +168,6 @@ public function getMagicFile() !(@ini_get('safe_mode') == 'On' || @ini_get('safe_mode') === 1) && $this->shouldTryCommonMagicFiles() // @see ZF-11784 ) { - require_once 'Zend/Validate/Exception.php'; foreach ($this->_magicFiles as $file) { // supressing errors which are thrown due to openbase_dir restrictions try { @@ -207,12 +204,9 @@ public function setMagicFile($file) $this->_magicfile = null; } elseif (!(class_exists(\finfo::class, false))) { $this->_magicfile = null; - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Magicfile can not be set. There is no finfo extension installed'); } elseif (!is_file($file) || !is_readable($file)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The given magicfile can not be read'); } else { $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME; @@ -221,7 +215,6 @@ public function setMagicFile($file) restore_error_handler(); if (empty($this->_finfo)) { $this->_finfo = null; - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception( sprintf('The given magicfile ("%s") is not accepted by finfo', $file), @@ -336,8 +329,6 @@ public function addMimeType($mimetype) if (is_string($mimetype)) { $mimetype = explode(',', $mimetype); } elseif (!is_array($mimetype)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } diff --git a/library/Zend/Validate/File/Sha1.php b/library/Zend/Validate/File/Sha1.php index 265f333d..663487ee 100644 --- a/library/Zend/Validate/File/Sha1.php +++ b/library/Zend/Validate/File/Sha1.php @@ -69,8 +69,6 @@ public function __construct($options) } elseif (is_scalar($options)) { $options = ['hash1' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } diff --git a/library/Zend/Validate/File/Size.php b/library/Zend/Validate/File/Size.php index 4c437137..1c98a79d 100644 --- a/library/Zend/Validate/File/Size.php +++ b/library/Zend/Validate/File/Size.php @@ -104,8 +104,6 @@ public function __construct($options) } elseif (is_string($options) || is_numeric($options)) { $options = ['max' => $options]; } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -182,18 +180,14 @@ public function getMin($raw = false) public function setMin($min) { if (!is_string($min) and !is_numeric($min)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } $min = (integer) $this->_fromByteString($min); $max = $this->getMax(true); if (($max !== null) && ($min > $max)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("The minimum must be less than or equal to the maximum filesize, but $min >" - . " $max"); + . " $max"); } $this->_min = $min; @@ -228,18 +222,14 @@ public function getMax($raw = false) public function setMax($max) { if (!is_string($max) && !is_numeric($max)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options to validator provided'); } $max = (integer) $this->_fromByteString($max); $min = $this->getMin(true); if (($min !== null) && ($max < $min)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum must be greater than or equal to the minimum filesize, but ' - . "$max < $min"); + . "$max < $min"); } $this->_max = $max; diff --git a/library/Zend/Validate/File/Upload.php b/library/Zend/Validate/File/Upload.php index 34e8d978..469593ae 100644 --- a/library/Zend/Validate/File/Upload.php +++ b/library/Zend/Validate/File/Upload.php @@ -108,8 +108,6 @@ public function getFiles($file = null) } if (count($return) === 0) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("The file '$file' was not found"); } diff --git a/library/Zend/Validate/GreaterThan.php b/library/Zend/Validate/GreaterThan.php index 80aa1b34..7d6e5e80 100644 --- a/library/Zend/Validate/GreaterThan.php +++ b/library/Zend/Validate/GreaterThan.php @@ -66,8 +66,6 @@ public function __construct($min) if (array_key_exists('min', $min)) { $min = $min['min']; } else { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Missing option 'min'"); } } diff --git a/library/Zend/Validate/Iban.php b/library/Zend/Validate/Iban.php index 462b4247..1a60b88d 100644 --- a/library/Zend/Validate/Iban.php +++ b/library/Zend/Validate/Iban.php @@ -179,8 +179,6 @@ public function setLocale($locale = null) require_once 'Zend/Locale.php'; $locale = Zend_Locale::findLocale($locale); if (strlen($locale) < 4) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Region must be given for IBAN validation'); } } diff --git a/library/Zend/Validate/InArray.php b/library/Zend/Validate/InArray.php index b09c5ba2..0bbe4f27 100644 --- a/library/Zend/Validate/InArray.php +++ b/library/Zend/Validate/InArray.php @@ -68,8 +68,6 @@ public function __construct($options) if ($options instanceof Zend_Config) { $options = $options->toArray(); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Array expected as parameter'); } else { $count = func_num_args(); diff --git a/library/Zend/Validate/Ip.php b/library/Zend/Validate/Ip.php index 5809c7bf..63b4dadb 100644 --- a/library/Zend/Validate/Ip.php +++ b/library/Zend/Validate/Ip.php @@ -101,8 +101,6 @@ public function setOptions($options) } if (!$this->_options['allowipv4'] && !$this->_options['allowipv6']) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Nothing to validate. Check your options'); } diff --git a/library/Zend/Validate/Isbn.php b/library/Zend/Validate/Isbn.php index a5a8ae6d..2a18b23f 100644 --- a/library/Zend/Validate/Isbn.php +++ b/library/Zend/Validate/Isbn.php @@ -70,11 +70,6 @@ public function __construct($options = []) $options = $options->toArray(); } if (!is_array($options)) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid options provided.'); } @@ -226,11 +221,6 @@ public function setSeparator($separator) { // check separator if (!in_array($separator, ['-', ' ', ''])) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid ISBN separator.'); } @@ -260,11 +250,6 @@ public function setType($type) { // check type if (!in_array($type, [self::AUTO, self::ISBN10, self::ISBN13])) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Invalid ISBN type'); } diff --git a/library/Zend/Validate/LessThan.php b/library/Zend/Validate/LessThan.php index 4517a2dd..225623aa 100644 --- a/library/Zend/Validate/LessThan.php +++ b/library/Zend/Validate/LessThan.php @@ -66,8 +66,6 @@ public function __construct($max) if (array_key_exists('max', $max)) { $max = $max['max']; } else { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Missing option 'max'"); } } diff --git a/library/Zend/Validate/NotEmpty.php b/library/Zend/Validate/NotEmpty.php index 118413da..5802b43e 100644 --- a/library/Zend/Validate/NotEmpty.php +++ b/library/Zend/Validate/NotEmpty.php @@ -135,8 +135,6 @@ public function setType($type = null) } if (!is_int($type) || ($type < 0) || ($type > self::ALL)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Unknown type'); } diff --git a/library/Zend/Validate/PostCode.php b/library/Zend/Validate/PostCode.php index 73131043..7683c8d1 100644 --- a/library/Zend/Validate/PostCode.php +++ b/library/Zend/Validate/PostCode.php @@ -93,8 +93,6 @@ public function __construct($options = null) $format = $this->getFormat(); if (empty($format)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('A postcode-format string has to be given for validation'); } } @@ -123,8 +121,6 @@ public function setLocale($locale = null) $locale = new Zend_Locale($this->_locale); $region = $locale->getRegion(); if (empty($region)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Unable to detect a region for the locale '$locale'"); } @@ -135,8 +131,6 @@ public function setLocale($locale = null) ); if (empty($format)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Unable to detect a postcode format for the region '{$locale->getRegion()}'"); } @@ -165,8 +159,6 @@ public function getFormat() public function setFormat($format) { if (empty($format) || !is_string($format)) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('A postcode-format string has to be given for validation'); } diff --git a/library/Zend/Validate/Regex.php b/library/Zend/Validate/Regex.php index 425647c7..79522054 100644 --- a/library/Zend/Validate/Regex.php +++ b/library/Zend/Validate/Regex.php @@ -70,8 +70,6 @@ public function __construct($pattern) if (array_key_exists('pattern', $pattern)) { $pattern = $pattern['pattern']; } else { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Missing option 'pattern'"); } } @@ -102,8 +100,6 @@ public function setPattern($pattern) $status = @preg_match($this->_pattern, 'Test'); if (false === $status) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("Internal error while using the pattern '$this->_pattern'"); } diff --git a/library/Zend/Validate/StringLength.php b/library/Zend/Validate/StringLength.php index df67dd86..a3bd8628 100644 --- a/library/Zend/Validate/StringLength.php +++ b/library/Zend/Validate/StringLength.php @@ -130,13 +130,8 @@ public function getMin() public function setMin($min) { if (null !== $this->_max && $min > $this->_max) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception("The minimum must be less than or equal to the maximum length, but $min >" - . " $this->_max"); + . " $this->_max"); } $this->_min = max(0, (integer) $min); @@ -165,13 +160,8 @@ public function setMax($max) if (null === $max) { $this->_max = null; } elseif ($max < $this->_min) { - /** - * @see Zend_Validate_Exception - */ - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('The maximum must be greater than or equal to the minimum length, but ' - . "$max < $this->_min"); + . "$max < $this->_min"); } else { $this->_max = (integer) $max; } @@ -213,8 +203,6 @@ public function setEncoding($encoding = null) $result = ini_get('default_charset'); } if (!$result) { - require_once 'Zend/Validate/Exception.php'; - throw new Zend_Validate_Exception('Given encoding not supported on this OS!'); } diff --git a/library/Zend/View/Abstract.php b/library/Zend/View/Abstract.php index c7bea265..b2d83f94 100644 --- a/library/Zend/View/Abstract.php +++ b/library/Zend/View/Abstract.php @@ -284,7 +284,6 @@ public function __set($key, $val) return; } - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Setting private or protected class members is not allowed'); $e->setView($this); @@ -460,7 +459,6 @@ public function setPluginLoader(Zend_Loader_PluginLoader $loader, $type) { $type = strtolower($type); if (!in_array($type, $this->_loaderTypes)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Invalid plugin loader type "%s"', $type)); $e->setView($this); @@ -483,7 +481,6 @@ public function getPluginLoader($type) { $type = strtolower($type); if (!in_array($type, $this->_loaderTypes)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Invalid plugin loader type "%s"; cannot retrieve', $type)); $e->setView($this); @@ -579,7 +576,6 @@ public function getHelperPaths() public function registerHelper($helper, $name) { if (!is_object($helper)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('View helper must be an object'); $e->setView($this); @@ -588,7 +584,6 @@ public function registerHelper($helper, $name) if (!$helper instanceof Zend_View_Interface) { if (!method_exists($helper, $name)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'View helper must implement Zend_View_Interface or have a method matching the name provided' ); @@ -824,7 +819,6 @@ public function assign($spec, $value = null) if (is_string($spec)) { // assign by name and value if ('_' == substr($spec, 0, 1)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Setting private or protected class members is not allowed'); $e->setView($this); @@ -843,14 +837,12 @@ public function assign($spec, $value = null) $this->$key = $val; } if ($error) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Setting private or protected class members is not allowed'); $e->setView($this); throw $e; } } else { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('assign() expects a string or array, received ' . gettype($spec)); $e->setView($this); @@ -992,7 +984,6 @@ public function strictVars($flag = true) protected function _script($name) { if ($this->isLfiProtectionOn() && preg_match('#\.\.[\\\/]#', $name)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Requested scripts may not include parent directory traversal ("../", "..\\" notation)'); $e->setView($this); @@ -1000,7 +991,6 @@ protected function _script($name) } if (0 == (is_countable($this->_path['script']) ? count($this->_path['script']) : 0)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('no view script directory set; unable to determine location for view script'); $e->setView($this); @@ -1013,10 +1003,9 @@ protected function _script($name) } } - require_once 'Zend/View/Exception.php'; $message = "script '$name' not found in path (" - . implode(PATH_SEPARATOR, $this->_path['script']) - . ')'; + . implode(PATH_SEPARATOR, $this->_path['script']) + . ')'; $e = new Zend_View_Exception($message); $e->setView($this); diff --git a/library/Zend/View/Exception.php b/library/Zend/View/Exception.php index e4271354..197f638d 100644 --- a/library/Zend/View/Exception.php +++ b/library/Zend/View/Exception.php @@ -20,8 +20,6 @@ /** * Zend_Exception. */ -require_once 'Zend/Exception.php'; - /** * Exception for Zend_View class. * diff --git a/library/Zend/View/Helper/Action.php b/library/Zend/View/Helper/Action.php index e4b1173b..6683b9ba 100644 --- a/library/Zend/View/Helper/Action.php +++ b/library/Zend/View/Helper/Action.php @@ -58,7 +58,6 @@ public function __construct() $front = Zend_Controller_Front::getInstance(); $modules = $front->getControllerDirectory(); if (empty($modules)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Action helper depends on valid front controller instance'); $e->setView($this->view); @@ -69,7 +68,6 @@ public function __construct() $response = $front->getResponse(); if (empty($request) || empty($response)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Action view helper requires both a registered request and response object in the front controller instance'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Doctype.php b/library/Zend/View/Helper/Doctype.php index 78767407..63534e61 100644 --- a/library/Zend/View/Helper/Doctype.php +++ b/library/Zend/View/Helper/Doctype.php @@ -130,7 +130,6 @@ public function doctype($doctype = null) break; default: if (substr($doctype, 0, 9) != 'setView($this->view); diff --git a/library/Zend/View/Helper/FormElement.php b/library/Zend/View/Helper/FormElement.php index 385b00b3..b2a91f9f 100644 --- a/library/Zend/View/Helper/FormElement.php +++ b/library/Zend/View/Helper/FormElement.php @@ -61,7 +61,6 @@ public function setTranslator($translator = null) } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid translator specified'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Gravatar.php b/library/Zend/View/Helper/Gravatar.php index 7a193893..e24ef4fe 100644 --- a/library/Zend/View/Helper/Gravatar.php +++ b/library/Zend/View/Helper/Gravatar.php @@ -198,8 +198,6 @@ public function setRating($rating) break; default: - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception(sprintf( 'The rating value "%s" is not allowed', $rating diff --git a/library/Zend/View/Helper/HeadLink.php b/library/Zend/View/Helper/HeadLink.php index 2409d308..85b0852c 100644 --- a/library/Zend/View/Helper/HeadLink.php +++ b/library/Zend/View/Helper/HeadLink.php @@ -160,7 +160,6 @@ public function __call($method, $args) } if (1 > $argc) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('%s requires at least one argument', $method)); $e->setView($this->view); @@ -219,7 +218,6 @@ protected function _isValid($value) public function append($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('append() expects a data token; please use one of the custom append*() methods'); $e->setView($this->view); @@ -238,7 +236,6 @@ public function append($value) public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('offsetSet() expects a data token; please use one of the custom offsetSet*() methods'); $e->setView($this->view); @@ -258,7 +255,6 @@ public function offsetSet($index, $value): void public function prepend($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('prepend() expects a data token; please use one of the custom prepend*() methods'); $e->setView($this->view); @@ -278,7 +274,6 @@ public function prepend($value) public function set($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('set() expects a data token; please use one of the custom set*() methods'); $e->setView($this->view); @@ -437,7 +432,6 @@ protected function _isDuplicateStylesheet($uri) public function createDataAlternate(array $args) { if (3 > count($args)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Alternate tags require 3 arguments; %s provided', count($args))); $e->setView($this->view); diff --git a/library/Zend/View/Helper/HeadMeta.php b/library/Zend/View/Helper/HeadMeta.php index c12eaaec..2e2f6c5b 100644 --- a/library/Zend/View/Helper/HeadMeta.php +++ b/library/Zend/View/Helper/HeadMeta.php @@ -115,7 +115,6 @@ protected function _normalizeType($type) case 'Property': return 'property'; default: - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Invalid type "%s" passed to _normalizeType', $type)); $e->setView($this->view); @@ -161,7 +160,6 @@ public function __call($method, $args) } if (2 > $argc) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Too few arguments provided; requires key value, and content'); $e->setView($this->view); @@ -246,7 +244,6 @@ protected function _isValid($item) public function append($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to append; please use appendMeta()'); $e->setView($this->view); @@ -265,7 +262,6 @@ public function append($value) public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetName() or offsetSetHttpEquiv()'); $e->setView($this->view); @@ -283,7 +279,6 @@ public function offsetSet($index, $value): void public function offsetUnset($index): void { if (!in_array($index, $this->getContainer()->getKeys())) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid index passed to offsetUnset()'); $e->setView($this->view); @@ -301,7 +296,6 @@ public function offsetUnset($index): void public function prepend($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to prepend; please use prependMeta()'); $e->setView($this->view); @@ -319,7 +313,6 @@ public function prepend($value) public function set($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to set; please use setMeta()'); $e->setView($this->view); @@ -344,7 +337,6 @@ public function set($value) public function itemToString(stdClass $item) { if (!in_array($item->type, $this->_typeKeys)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Invalid type "%s" provided for meta', $item->type)); $e->setView($this->view); @@ -356,8 +348,6 @@ public function itemToString(stdClass $item) foreach ($item->modifiers as $key => $value) { if (!is_null($this->view) && $this->view->doctype()->isHtml5() && $key == 'scheme') { - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception('Invalid modifier ' . '"scheme" provided; not supported by HTML5'); } diff --git a/library/Zend/View/Helper/HeadScript.php b/library/Zend/View/Helper/HeadScript.php index 0385b975..e3a92e61 100644 --- a/library/Zend/View/Helper/HeadScript.php +++ b/library/Zend/View/Helper/HeadScript.php @@ -156,7 +156,6 @@ public function headScript($mode = Zend_View_Helper_HeadScript::FILE, $spec = nu public function captureStart($captureType = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $type = 'text/javascript', $attrs = []) { if ($this->_captureLock) { - require_once 'Zend/View/Helper/Placeholder/Container/Exception.php'; $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest headScript captures'); $e->setView($this->view); @@ -220,7 +219,6 @@ public function __call($method, $args) $index = null; if (preg_match('/^(?Pset|(ap|pre)pend|offsetSet)(?PFile|Script)$/', $method, $matches)) { if (1 > count($args)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Method "%s" requires at least one argument', $method)); $e->setView($this->view); @@ -235,7 +233,6 @@ public function __call($method, $args) if ('offsetSet' == $action) { $index = array_shift($args); if (1 > count($args)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Method "%s" requires at least two arguments, an index and source', $method)); $e->setView($this->view); @@ -329,7 +326,6 @@ protected function _isValid($value) public function append($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid argument passed to append(); please use one of the helper methods, appendScript() or appendFile()'); $e->setView($this->view); @@ -347,7 +343,6 @@ public function append($value) public function prepend($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid argument passed to prepend(); please use one of the helper methods, prependScript() or prependFile()'); $e->setView($this->view); @@ -365,7 +360,6 @@ public function prepend($value) public function set($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid argument passed to set(); please use one of the helper methods, setScript() or setFile()'); $e->setView($this->view); @@ -384,7 +378,6 @@ public function set($value) public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid argument passed to offsetSet(); please use one of the helper methods, offsetSetScript() or offsetSetFile()'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/HeadStyle.php b/library/Zend/View/Helper/HeadStyle.php index 173cb40f..a490f3db 100644 --- a/library/Zend/View/Helper/HeadStyle.php +++ b/library/Zend/View/Helper/HeadStyle.php @@ -153,7 +153,6 @@ public function __call($method, $args) } if (1 > $argc) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Method "%s" requires minimally content for the stylesheet', $method)); $e->setView($this->view); @@ -206,7 +205,6 @@ protected function _isValid($value) public function append($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to append; please use appendStyle()'); $e->setView($this->view); @@ -225,7 +223,6 @@ public function append($value) public function offsetSet($index, $value): void { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetStyle()'); $e->setView($this->view); @@ -243,7 +240,6 @@ public function offsetSet($index, $value): void public function prepend($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to prepend; please use prependStyle()'); $e->setView($this->view); @@ -261,7 +257,6 @@ public function prepend($value) public function set($value) { if (!$this->_isValid($value)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to set; please use setStyle()'); $e->setView($this->view); @@ -280,7 +275,6 @@ public function set($value) public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $attrs = null) { if ($this->_captureLock) { - require_once 'Zend/View/Helper/Placeholder/Container/Exception.php'; $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest headStyle captures'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/HeadTitle.php b/library/Zend/View/Helper/HeadTitle.php index 35d8cc09..3a363668 100644 --- a/library/Zend/View/Helper/HeadTitle.php +++ b/library/Zend/View/Helper/HeadTitle.php @@ -97,8 +97,6 @@ public function setDefaultAttachOrder($setType) Zend_View_Helper_Placeholder_Container_Abstract::SET, Zend_View_Helper_Placeholder_Container_Abstract::PREPEND, ])) { - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception("You must use a valid attach order: 'PREPEND', 'APPEND' or 'SET'"); } @@ -131,7 +129,6 @@ public function setTranslator($translate) } elseif ($translate instanceof Zend_Translate) { $this->_translator = $translate->getAdapter(); } else { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/HtmlList.php b/library/Zend/View/Helper/HtmlList.php index 8ddf051e..727e63d3 100644 --- a/library/Zend/View/Helper/HtmlList.php +++ b/library/Zend/View/Helper/HtmlList.php @@ -45,7 +45,6 @@ class Zend_View_Helper_HtmlList extends Zend_View_Helper_FormElement public function htmlList(array $items, $ordered = false, $attribs = false, $escape = true) { if (!is_array($items)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('First param must be an array'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Navigation.php b/library/Zend/View/Helper/Navigation.php index 76890bcd..1e17f4b6 100644 --- a/library/Zend/View/Helper/Navigation.php +++ b/library/Zend/View/Helper/Navigation.php @@ -173,7 +173,6 @@ public function findHelper($proxy, $strict = true) if (!$helper instanceof Zend_View_Helper_Navigation_Helper) { if ($strict) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Proxy helper "%s" is not an instance of ' . \Zend_View_Helper_Navigation_Helper::class, diff --git a/library/Zend/View/Helper/Navigation/Breadcrumbs.php b/library/Zend/View/Helper/Navigation/Breadcrumbs.php index 66cfc753..27fc3fd5 100644 --- a/library/Zend/View/Helper/Navigation/Breadcrumbs.php +++ b/library/Zend/View/Helper/Navigation/Breadcrumbs.php @@ -259,7 +259,6 @@ public function renderPartial(?Zend_Navigation_Container $container = null, } if (empty($partial)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'Unable to render menu: No partial view script provided' ); @@ -292,7 +291,6 @@ public function renderPartial(?Zend_Navigation_Container $container = null, if (is_array($partial)) { if (count($partial) != 2) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'Unable to render menu: A view partial supplied as ' . 'an array must contain two values: partial view ' diff --git a/library/Zend/View/Helper/Navigation/HelperAbstract.php b/library/Zend/View/Helper/Navigation/HelperAbstract.php index 2272f332..d4d1e47c 100644 --- a/library/Zend/View/Helper/Navigation/HelperAbstract.php +++ b/library/Zend/View/Helper/Navigation/HelperAbstract.php @@ -495,7 +495,6 @@ public function setRole($role = null) || $role instanceof Zend_Acl_Role_Interface) { $this->_role = $role; } else { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( '$role must be a string, null, or an instance of ' . 'Zend_Acl_Role_Interface; %s given', @@ -989,8 +988,6 @@ public static function setDefaultRole($role = null) || $role instanceof Zend_Acl_Role_Interface) { self::$_defaultRole = $role; } else { - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception( '$role must be null|string|Zend_Acl_Role_Interface' ); diff --git a/library/Zend/View/Helper/Navigation/Links.php b/library/Zend/View/Helper/Navigation/Links.php index 1eda84b4..b8b6c75e 100644 --- a/library/Zend/View/Helper/Navigation/Links.php +++ b/library/Zend/View/Helper/Navigation/Links.php @@ -268,7 +268,6 @@ public function findAllRelations(Zend_Navigation_Page $page, public function findRelation(Zend_Navigation_Page $page, $rel, $type) { if (!in_array($rel, ['rel', 'rev'])) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Invalid argument: $rel must be "rel" or "rev"; "%s" given', $rel)); @@ -729,7 +728,6 @@ protected function _convertToPages($mixed, $recursive = true) public function renderLink(Zend_Navigation_Page $page, $attrib, $relation) { if (!in_array($attrib, ['rel', 'rev'])) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Invalid relation attribute "%s", must be "rel" or "rev"', $attrib)); diff --git a/library/Zend/View/Helper/Navigation/Menu.php b/library/Zend/View/Helper/Navigation/Menu.php index 973b7978..08b7771c 100644 --- a/library/Zend/View/Helper/Navigation/Menu.php +++ b/library/Zend/View/Helper/Navigation/Menu.php @@ -1051,7 +1051,6 @@ public function renderPartial(?Zend_Navigation_Container $container = null, } if (empty($partial)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'Unable to render menu: No partial view script provided' ); @@ -1066,7 +1065,6 @@ public function renderPartial(?Zend_Navigation_Container $container = null, if (is_array($partial)) { if (count($partial) != 2) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception( 'Unable to render menu: A view partial supplied as ' . 'an array must contain two values: partial view ' diff --git a/library/Zend/View/Helper/Navigation/Sitemap.php b/library/Zend/View/Helper/Navigation/Sitemap.php index 7cf2eb66..3d27848e 100644 --- a/library/Zend/View/Helper/Navigation/Sitemap.php +++ b/library/Zend/View/Helper/Navigation/Sitemap.php @@ -195,7 +195,6 @@ public function setServerUrl($serverUrl) if ($uri->valid()) { $this->_serverUrl = $uri->getUri(); } else { - require_once 'Zend/Uri/Exception.php'; $e = new Zend_Uri_Exception(sprintf( 'Invalid server URL: "%s"', $serverUrl)); @@ -347,7 +346,6 @@ public function getDomSitemap(?Zend_Navigation_Container $container = null) if ($this->getUseSitemapValidators() && !$locValidator->isValid($url)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Encountered an invalid URL for Sitemap XML: "%s"', $url)); @@ -406,7 +404,6 @@ public function getDomSitemap(?Zend_Navigation_Container $container = null) // validate using schema if specified if ($this->getUseSchemaValidation()) { if (!@$dom->schemaValidate(self::SITEMAP_XSD)) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf( 'Sitemap is invalid according to XML Schema at "%s"', self::SITEMAP_XSD)); diff --git a/library/Zend/View/Helper/PaginationControl.php b/library/Zend/View/Helper/PaginationControl.php index 876dd150..5252a774 100644 --- a/library/Zend/View/Helper/PaginationControl.php +++ b/library/Zend/View/Helper/PaginationControl.php @@ -92,8 +92,6 @@ public function paginationControl(?Zend_Paginator $paginator = null, $scrollingS /** * @see Zend_View_Exception */ - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception('No paginator instance provided or incorrect type'); $e->setView($this->view); @@ -106,7 +104,6 @@ public function paginationControl(?Zend_Paginator $paginator = null, $scrollingS /** * @see Zend_View_Exception */ - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('No view partial provided and no default set'); $e->setView($this->view); @@ -127,7 +124,6 @@ public function paginationControl(?Zend_Paginator $paginator = null, $scrollingS /** * @see Zend_View_Exception */ - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('A view partial supplied as an array must contain two values: the filename and its module'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Partial.php b/library/Zend/View/Helper/Partial.php index 4893be3c..f7678b99 100644 --- a/library/Zend/View/Helper/Partial.php +++ b/library/Zend/View/Helper/Partial.php @@ -76,7 +76,6 @@ public function partial($name = null, $module = null, $model = null) require_once 'Zend/Controller/Front.php'; $moduleDir = Zend_Controller_Front::getInstance()->getControllerDirectory($module); if (null === $moduleDir) { - require_once 'Zend/View/Helper/Partial/Exception.php'; $e = new Zend_View_Helper_Partial_Exception('Cannot render partial; module does not exist'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Partial/Exception.php b/library/Zend/View/Helper/Partial/Exception.php index 33ec29c8..8561095b 100644 --- a/library/Zend/View/Helper/Partial/Exception.php +++ b/library/Zend/View/Helper/Partial/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_View_Exception */ -require_once 'Zend/View/Exception.php'; - /** * Exception for Zend_View_Helper_Partial class. * diff --git a/library/Zend/View/Helper/PartialLoop.php b/library/Zend/View/Helper/PartialLoop.php index 8c986bb7..8e4267c5 100644 --- a/library/Zend/View/Helper/PartialLoop.php +++ b/library/Zend/View/Helper/PartialLoop.php @@ -66,7 +66,6 @@ public function partialLoop($name = null, $module = null, $model = null) && (!$model instanceof Traversable) && (is_object($model) && !method_exists($model, 'toArray')) ) { - require_once 'Zend/View/Helper/Partial/Exception.php'; $e = new Zend_View_Helper_Partial_Exception('PartialLoop helper requires iterable data'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Placeholder/Container/Abstract.php b/library/Zend/View/Helper/Placeholder/Container/Abstract.php index 9144e72f..738b6293 100644 --- a/library/Zend/View/Helper/Placeholder/Container/Abstract.php +++ b/library/Zend/View/Helper/Placeholder/Container/Abstract.php @@ -271,7 +271,6 @@ public function getWhitespace($indent) public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $key = null) { if ($this->_captureLock) { - require_once 'Zend/View/Helper/Placeholder/Container/Exception.php'; $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest placeholder captures for the same placeholder'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Placeholder/Container/Exception.php b/library/Zend/View/Helper/Placeholder/Container/Exception.php index 10c42317..d0faae2f 100644 --- a/library/Zend/View/Helper/Placeholder/Container/Exception.php +++ b/library/Zend/View/Helper/Placeholder/Container/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_View_Exception */ -require_once 'Zend/View/Exception.php'; - /** * Exception for Zend_View_Helper_Placeholder_Container class. * diff --git a/library/Zend/View/Helper/Placeholder/Container/Standalone.php b/library/Zend/View/Helper/Placeholder/Container/Standalone.php index b8d00499..efbc61a0 100644 --- a/library/Zend/View/Helper/Placeholder/Container/Standalone.php +++ b/library/Zend/View/Helper/Placeholder/Container/Standalone.php @@ -231,7 +231,6 @@ public function __call($method, $args) return $return; } - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Method "' . $method . '" does not exist'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Placeholder/Registry.php b/library/Zend/View/Helper/Placeholder/Registry.php index 139438a9..98bb9d28 100644 --- a/library/Zend/View/Helper/Placeholder/Registry.php +++ b/library/Zend/View/Helper/Placeholder/Registry.php @@ -171,7 +171,6 @@ public function setContainerClass($name) $reflection = new ReflectionClass($name); if (!$reflection->isSubclassOf(new ReflectionClass(\Zend_View_Helper_Placeholder_Container_Abstract::class))) { - require_once 'Zend/View/Helper/Placeholder/Registry/Exception.php'; $e = new Zend_View_Helper_Placeholder_Registry_Exception('Invalid Container class specified'); $e->setView($this->view); diff --git a/library/Zend/View/Helper/Placeholder/Registry/Exception.php b/library/Zend/View/Helper/Placeholder/Registry/Exception.php index 25251b0a..1dedb154 100644 --- a/library/Zend/View/Helper/Placeholder/Registry/Exception.php +++ b/library/Zend/View/Helper/Placeholder/Registry/Exception.php @@ -18,8 +18,6 @@ */ /** Zend_View_Exception */ -require_once 'Zend/View/Exception.php'; - /** * Exception for Zend_View_Helper_Placeholder_Registry class. * diff --git a/library/Zend/View/Helper/Translate.php b/library/Zend/View/Helper/Translate.php index 66886bcb..9eec75e5 100644 --- a/library/Zend/View/Helper/Translate.php +++ b/library/Zend/View/Helper/Translate.php @@ -108,7 +108,6 @@ public function setTranslator($translate) } elseif ($translate instanceof Zend_Translate) { $this->_translator = $translate->getAdapter(); } else { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); $e->setView($this->view); @@ -146,7 +145,6 @@ public function setLocale($locale = null) { $translate = $this->getTranslator(); if ($translate === null) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); $e->setView($this->view); @@ -167,7 +165,6 @@ public function getLocale() { $translate = $this->getTranslator(); if ($translate === null) { - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('You must set an instance of Zend_Translate or Zend_Translate_Adapter'); $e->setView($this->view); diff --git a/library/Zend/Xml/Exception.php b/library/Zend/Xml/Exception.php index c93e4118..6dc6bb67 100644 --- a/library/Zend/Xml/Exception.php +++ b/library/Zend/Xml/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/ZendX/Exception.php b/library/ZendX/Exception.php index 04cf4dd3..b52c2480 100644 --- a/library/ZendX/Exception.php +++ b/library/ZendX/Exception.php @@ -20,8 +20,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; - /** * Exception class for ZendX. * diff --git a/library/ZendX/JQuery/Exception.php b/library/ZendX/JQuery/Exception.php index 30e673df..63214497 100644 --- a/library/ZendX/JQuery/Exception.php +++ b/library/ZendX/JQuery/Exception.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Exception.php'; - /** * jQuery Exception. * diff --git a/library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php b/library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php index c45e1a5a..dcaf63fe 100644 --- a/library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php +++ b/library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php @@ -55,8 +55,6 @@ abstract class ZendX_JQuery_Form_Decorator_UiWidgetContainer extends Zend_Form_D public function getHelper() { if (null === $this->_helper) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('No view helper specified fo DijitContainer decorator'); } diff --git a/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php b/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php index b9bd0ff4..b60b45ea 100644 --- a/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php +++ b/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php @@ -144,8 +144,6 @@ public function render($content) $element = $this->getElement(); $view = $element->getView(); if (null === $view) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('UiWidgetElement decorator cannot render without a registered view object'); } diff --git a/library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php b/library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php index e1cd0f36..24c5082a 100644 --- a/library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php +++ b/library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php @@ -62,8 +62,6 @@ abstract class ZendX_JQuery_Form_Decorator_UiWidgetPane extends Zend_Form_Decora public function getHelper() { if (null === $this->_helper) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception('No view helper specified fo UiWidgetContainer decorator'); } @@ -112,8 +110,6 @@ public function getJQueryParams() // Ensure we have a title param if (!array_key_exists('title', $this->_jQueryParams)) { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception("UiWidgetPane Decorators have to have a jQueryParam 'title' to render. This title can been set via setJQueryParam('title') on the parent element."); } @@ -147,8 +143,6 @@ public function render($content) if (isset($jQueryParams['containerId'])) { $id = $jQueryParams['containerId'] . '-container'; } else { - require_once 'Zend/Form/Decorator/Exception.php'; - throw new Zend_Form_Decorator_Exception("UiWidgetPane Decorators have to have a jQueryParam 'containerId', to point at their parent container. This containerId has been set via setAttrib('id') on the parent element."); } diff --git a/library/ZendX/JQuery/Form/Element/UiWidget.php b/library/ZendX/JQuery/Form/Element/UiWidget.php index 0b91e15b..75e37817 100644 --- a/library/ZendX/JQuery/Form/Element/UiWidget.php +++ b/library/ZendX/JQuery/Form/Element/UiWidget.php @@ -161,8 +161,6 @@ public function getDecorators() } } if ($foundUiWidgetElementMarker === false) { - require_once 'ZendX/JQuery/Form/Exception.php'; - throw new ZendX_JQuery_Form_Exception( 'Cannot render jQuery form element without at least one decorator ' . "implementing the 'ZendX_JQuery_Form_Decorator_UiWidgetElementMarker' interface. " diff --git a/library/ZendX/JQuery/Form/Exception.php b/library/ZendX/JQuery/Form/Exception.php index 5090171d..b2cc63c3 100644 --- a/library/ZendX/JQuery/Form/Exception.php +++ b/library/ZendX/JQuery/Form/Exception.php @@ -3,8 +3,6 @@ /** * @see ZendX_JQuery_Exception */ -require_once 'ZendX/JQuery/Exception.php'; - class ZendX_JQuery_Form_Exception extends ZendX_JQuery_Exception { } diff --git a/library/ZendX/JQuery/View/Exception.php b/library/ZendX/JQuery/View/Exception.php index dd0718a8..70a1763a 100644 --- a/library/ZendX/JQuery/View/Exception.php +++ b/library/ZendX/JQuery/View/Exception.php @@ -16,8 +16,6 @@ * * @version $Id: Exception.php 11941 2008-10-13 19:41:38Z matthew $ */ -require_once 'ZendX/JQuery/Exception.php'; - /** * jQuery Exception. * diff --git a/library/ZendX/JQuery/View/Helper/AutoComplete.php b/library/ZendX/JQuery/View/Helper/AutoComplete.php index 0fbcb4bd..359f853c 100644 --- a/library/ZendX/JQuery/View/Helper/AutoComplete.php +++ b/library/ZendX/JQuery/View/Helper/AutoComplete.php @@ -61,8 +61,6 @@ public function autoComplete($id, $value = null, array $params = [], array $attr $params['source'] = $params['data']; unset($params['data']); } else { - require_once 'ZendX/JQuery/Exception.php'; - throw new ZendX_JQuery_Exception( "Cannot construct AutoComplete field without specifying 'source' field, " . 'either an url or an array of elements.' diff --git a/library/ZendX/JQuery/View/Helper/DatePicker.php b/library/ZendX/JQuery/View/Helper/DatePicker.php index da3fa267..a9d1a668 100644 --- a/library/ZendX/JQuery/View/Helper/DatePicker.php +++ b/library/ZendX/JQuery/View/Helper/DatePicker.php @@ -87,8 +87,6 @@ public static function resolveZendLocaleToDatePickerFormat($format = null) if ($format == null) { $locale = Zend_Registry::get(\Zend_Locale::class); if (!($locale instanceof Zend_Locale)) { - require_once 'ZendX/JQuery/Exception.php'; - throw new ZendX_JQuery_Exception('Cannot resolve Zend Locale format by default, no application wide locale is set.'); } /** diff --git a/library/ZendX/JQuery/View/Helper/JQuery.php b/library/ZendX/JQuery/View/Helper/JQuery.php index 9700af66..009e768b 100644 --- a/library/ZendX/JQuery/View/Helper/JQuery.php +++ b/library/ZendX/JQuery/View/Helper/JQuery.php @@ -108,8 +108,6 @@ public function setView(Zend_View_Interface $view) public function __call($method, $args) { if (!method_exists($this->_container, $method)) { - require_once 'Zend/View/Exception.php'; - throw new Zend_View_Exception(sprintf('Invalid method "%s" called on jQuery view helper', $method)); } diff --git a/library/ZendX/JQuery/View/Helper/JQuery/Container.php b/library/ZendX/JQuery/View/Helper/JQuery/Container.php index eb07b6c8..9fa7948d 100644 --- a/library/ZendX/JQuery/View/Helper/JQuery/Container.php +++ b/library/ZendX/JQuery/View/Helper/JQuery/Container.php @@ -447,8 +447,6 @@ public function useLocalPath() public function onLoadCaptureStart() { if ($this->_captureLock) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception('Cannot nest onLoad captures'); } @@ -480,8 +478,6 @@ public function onLoadCaptureEnd() public function javascriptCaptureStart() { if ($this->_captureLock) { - require_once 'Zend/Exception.php'; - throw new Zend_Exception('Cannot nest captures'); } diff --git a/library/ZendX/JQuery/View/Helper/UiWidgetPane.php b/library/ZendX/JQuery/View/Helper/UiWidgetPane.php index 800dbfe4..1c831288 100644 --- a/library/ZendX/JQuery/View/Helper/UiWidgetPane.php +++ b/library/ZendX/JQuery/View/Helper/UiWidgetPane.php @@ -57,8 +57,6 @@ abstract class ZendX_JQuery_View_Helper_UiWidgetPane extends ZendX_JQuery_View_H public function captureStart($id, $name, array $options = []) { if (array_key_exists($id, $this->_captureLock)) { - require_once 'ZendX/JQuery/View/Exception.php'; - throw new ZendX_JQuery_View_Exception(sprintf('Lock already exists for id "%s"', $id)); } @@ -83,8 +81,6 @@ public function captureEnd($id) $name = null; $options = null; if (!array_key_exists($id, $this->_captureLock)) { - require_once 'ZendX/JQuery/View/Exception.php'; - throw new ZendX_JQuery_View_Exception(sprintf('No capture lock exists for id "%s"; nothing to capture', $id)); } diff --git a/tests/Zend/Captcha/ImageTest.php b/tests/Zend/Captcha/ImageTest.php index 78f235ac..2428aed9 100644 --- a/tests/Zend/Captcha/ImageTest.php +++ b/tests/Zend/Captcha/ImageTest.php @@ -109,8 +109,6 @@ protected function _getTmpDir() $tmpdir = realpath(dirname($tempFile)); unlink($tempFile); } else { - require_once 'Zend/File/Transfer/Exception.php'; - throw new Zend_File_Transfer_Exception('Could not determine temp directory'); } } diff --git a/tests/Zend/Controller/Action/Helper/FlashMessengerTest.php b/tests/Zend/Controller/Action/Helper/FlashMessengerTest.php index 32fbfa79..d40b26d7 100644 --- a/tests/Zend/Controller/Action/Helper/FlashMessengerTest.php +++ b/tests/Zend/Controller/Action/Helper/FlashMessengerTest.php @@ -21,7 +21,6 @@ require_once 'Zend/Controller/Response/Cli.php'; require_once 'Zend/Controller/Action/HelperBroker.php'; require_once 'Zend/Controller/Action/Helper/FlashMessenger.php'; -require_once 'Zend/Controller/Exception.php'; require_once 'Zend/Session.php'; require_once dirname(__FILE__, 3) . '/_files/HelperFlashMessengerController.php'; diff --git a/tests/Zend/Controller/Plugin/ErrorHandlerTest.php b/tests/Zend/Controller/Plugin/ErrorHandlerTest.php index 6951f4ff..bee467f2 100644 --- a/tests/Zend/Controller/Plugin/ErrorHandlerTest.php +++ b/tests/Zend/Controller/Plugin/ErrorHandlerTest.php @@ -20,9 +20,6 @@ require_once 'Zend/Controller/Request/Http.php'; require_once 'Zend/Controller/Response/Http.php'; -require_once 'Zend/Controller/Dispatcher/Exception.php'; -require_once 'Zend/Controller/Action/Exception.php'; - require_once 'Zend/Controller/Front.php'; /** diff --git a/tests/Zend/Controller/Response/HttpTest.php b/tests/Zend/Controller/Response/HttpTest.php index 58bdd113..d29c3ca6 100644 --- a/tests/Zend/Controller/Response/HttpTest.php +++ b/tests/Zend/Controller/Response/HttpTest.php @@ -20,8 +20,6 @@ // Call Zend_Controller_Response_HttpTest::main() if this source file is executed directly. require_once 'Zend/Controller/Response/Http.php'; -require_once 'Zend/Controller/Response/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License * diff --git a/tests/Zend/ExceptionTest.php b/tests/Zend/ExceptionTest.php index 4ec99ca0..6b4db801 100644 --- a/tests/Zend/ExceptionTest.php +++ b/tests/Zend/ExceptionTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Exception.php'; - /** * @group Zend_Exception * diff --git a/tests/Zend/Validate/File/MimeTypeTest.php b/tests/Zend/Validate/File/MimeTypeTest.php index 2271af6f..9346e524 100644 --- a/tests/Zend/Validate/File/MimeTypeTest.php +++ b/tests/Zend/Validate/File/MimeTypeTest.php @@ -156,8 +156,6 @@ public function testSetAndGetMagicFile() public function testSetMagicFileWithinConstructor() { - require_once 'Zend/Validate/Exception.php'; - try { $validator = new Zend_Validate_File_MimeType(['image/gif', 'magicfile' => __FILE__]); $this->fail('Zend_Validate_File_MimeType should not accept invalid magic file.'); diff --git a/tests/Zend/Xml/MultibyteTest.php b/tests/Zend/Xml/MultibyteTest.php index 61b63d2e..63871757 100644 --- a/tests/Zend/Xml/MultibyteTest.php +++ b/tests/Zend/Xml/MultibyteTest.php @@ -25,8 +25,6 @@ */ require_once 'Zend/Xml/TestAsset/Security.php'; -require_once 'Zend/Xml/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License * diff --git a/tests/Zend/Xml/SecurityTest.php b/tests/Zend/Xml/SecurityTest.php index 920111c3..9bc4e7e1 100644 --- a/tests/Zend/Xml/SecurityTest.php +++ b/tests/Zend/Xml/SecurityTest.php @@ -22,8 +22,6 @@ */ require_once 'Zend/Xml/Security.php'; -require_once 'Zend/Xml/Exception.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License * From d9cc5f51a6be3fc76568058b4d340c4a9cc745f5 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Thu, 21 Sep 2023 13:25:32 +0800 Subject: [PATCH 03/28] Leverage autoload for library code But not tests themselves because that breaks too much stuff --- library/Zend/Acl.php | 25 ---------------- library/Zend/Acl/Assert/Interface.php | 15 ---------- library/Zend/Acl/Resource.php | 5 ---- library/Zend/Acl/Role.php | 5 ---- library/Zend/Acl/Role/Registry.php | 5 ---- library/Zend/Application.php | 1 - .../Zend/Application/Bootstrap/Bootstrap.php | 5 ---- .../Bootstrap/BootstrapAbstract.php | 10 ------- .../Zend/Application/Module/Autoloader.php | 1 - library/Zend/Application/Module/Bootstrap.php | 5 ---- .../Application/Resource/Cachemanager.php | 1 - library/Zend/Application/Resource/Db.php | 5 ---- .../Application/Resource/Frontcontroller.php | 5 ---- library/Zend/Application/Resource/Layout.php | 5 ---- library/Zend/Application/Resource/Locale.php | 5 ---- library/Zend/Application/Resource/Mail.php | 5 ---- library/Zend/Application/Resource/Modules.php | 5 ---- .../Zend/Application/Resource/Navigation.php | 5 ---- .../Application/Resource/ResourceAbstract.php | 5 ---- library/Zend/Application/Resource/Router.php | 5 ---- library/Zend/Application/Resource/Session.php | 5 ---- library/Zend/Application/Resource/View.php | 5 ---- library/Zend/Cache/Backend/BlackHole.php | 10 ------- .../Zend/Cache/Backend/ExtendedInterface.php | 5 ---- library/Zend/Cache/Backend/File.php | 10 ------- library/Zend/Cache/Backend/Test.php | 10 ------- library/Zend/Cache/Frontend/Capture.php | 5 ---- library/Zend/Cache/Frontend/Class.php | 5 ---- library/Zend/Cache/Frontend/File.php | 5 ---- library/Zend/Cache/Frontend/Function.php | 5 ---- library/Zend/Cache/Frontend/Output.php | 5 ---- library/Zend/Cache/Frontend/Page.php | 5 ---- library/Zend/Cache/Manager.php | 1 - library/Zend/Captcha/Adapter.php | 1 - library/Zend/Captcha/Base.php | 2 -- library/Zend/Captcha/Dumb.php | 1 - library/Zend/Captcha/Figlet.php | 2 -- library/Zend/Captcha/Image.php | 1 - library/Zend/Captcha/Word.php | 2 -- library/Zend/Config/Ini.php | 5 ---- library/Zend/Config/Xml.php | 6 ---- library/Zend/Console/Getopt.php | 1 - library/Zend/Controller/Action.php | 17 ----------- .../Controller/Action/Helper/Abstract.php | 5 ---- .../Controller/Action/Helper/ActionStack.php | 11 +------ .../Controller/Action/Helper/AjaxContext.php | 5 ---- .../Action/Helper/AutoComplete/Abstract.php | 10 +------ .../Zend/Controller/Action/Helper/Cache.php | 9 ------ .../Action/Helper/ContextSwitch.php | 7 ----- .../Action/Helper/FlashMessenger.php | 10 ------- .../Zend/Controller/Action/Helper/Json.php | 11 +------ .../Controller/Action/Helper/Redirector.php | 5 ---- library/Zend/Controller/Action/Helper/Url.php | 5 ---- .../Controller/Action/Helper/ViewRenderer.php | 26 ++-------------- .../Zend/Controller/Action/HelperBroker.php | 11 ------- .../Zend/Controller/Dispatcher/Abstract.php | 2 -- .../Zend/Controller/Dispatcher/Interface.php | 2 -- .../Zend/Controller/Dispatcher/Standard.php | 2 -- library/Zend/Controller/Front.php | 12 -------- .../Zend/Controller/Plugin/ActionStack.php | 2 -- library/Zend/Controller/Plugin/Broker.php | 1 - .../Zend/Controller/Plugin/ErrorHandler.php | 1 - library/Zend/Controller/Plugin/PutHandler.php | 10 ------- library/Zend/Controller/Request/Apache404.php | 2 -- library/Zend/Controller/Request/Http.php | 2 -- .../Zend/Controller/Request/HttpTestCase.php | 5 ---- library/Zend/Controller/Request/Simple.php | 1 - library/Zend/Controller/Response/Cli.php | 1 - library/Zend/Controller/Response/Http.php | 1 - .../Zend/Controller/Response/HttpTestCase.php | 5 ---- library/Zend/Controller/Router/Abstract.php | 2 -- library/Zend/Controller/Router/Rewrite.php | 4 --- library/Zend/Controller/Router/Route.php | 1 - .../Zend/Controller/Router/Route/Abstract.php | 7 ----- .../Zend/Controller/Router/Route/Chain.php | 1 - .../Zend/Controller/Router/Route/Hostname.php | 2 -- .../Controller/Router/Route/Interface.php | 1 - .../Zend/Controller/Router/Route/Module.php | 1 - .../Zend/Controller/Router/Route/Regex.php | 1 - .../Zend/Controller/Router/Route/Static.php | 1 - library/Zend/Date.php | 4 --- library/Zend/File/ClassFileLocator.php | 1 - library/Zend/File/Transfer.php | 5 ---- .../Zend/File/Transfer/Adapter/Abstract.php | 1 - library/Zend/File/Transfer/Adapter/Http.php | 6 ---- library/Zend/Filter.php | 6 ---- library/Zend/Filter/Alnum.php | 9 ------ library/Zend/Filter/Alpha.php | 9 ------ library/Zend/Filter/BaseName.php | 5 ---- library/Zend/Filter/Boolean.php | 7 ----- library/Zend/Filter/Callback.php | 5 ---- library/Zend/Filter/Compress.php | 6 ---- library/Zend/Filter/Compress/Bz2.php | 5 ---- .../Zend/Filter/Compress/CompressAbstract.php | 5 ---- library/Zend/Filter/Compress/Gz.php | 5 ---- library/Zend/Filter/Compress/Lzf.php | 5 ---- library/Zend/Filter/Compress/Rar.php | 5 ---- library/Zend/Filter/Compress/Tar.php | 7 ----- library/Zend/Filter/Compress/Zip.php | 5 ---- library/Zend/Filter/Decompress.php | 5 ---- library/Zend/Filter/Digits.php | 5 ---- library/Zend/Filter/Dir.php | 5 ---- library/Zend/Filter/File/LowerCase.php | 5 ---- library/Zend/Filter/File/Rename.php | 5 ---- library/Zend/Filter/File/UpperCase.php | 5 ---- library/Zend/Filter/HtmlEntities.php | 5 ---- library/Zend/Filter/Inflector.php | 6 ---- library/Zend/Filter/Input.php | 17 ----------- library/Zend/Filter/Int.php | 5 ---- library/Zend/Filter/Null.php | 5 ---- library/Zend/Filter/PregReplace.php | 5 ---- library/Zend/Filter/RealPath.php | 5 ---- library/Zend/Filter/StringToLower.php | 5 ---- library/Zend/Filter/StringToUpper.php | 5 ---- library/Zend/Filter/StringTrim.php | 5 ---- library/Zend/Filter/StripNewlines.php | 5 ---- library/Zend/Filter/StripTags.php | 5 ---- library/Zend/Filter/Word/CamelCaseToDash.php | 5 ---- .../Zend/Filter/Word/CamelCaseToSeparator.php | 5 ---- .../Filter/Word/CamelCaseToUnderscore.php | 5 ---- library/Zend/Filter/Word/DashToCamelCase.php | 5 ---- library/Zend/Filter/Word/DashToSeparator.php | 5 ---- library/Zend/Filter/Word/DashToUnderscore.php | 5 ---- .../Zend/Filter/Word/Separator/Abstract.php | 5 ---- .../Zend/Filter/Word/SeparatorToCamelCase.php | 5 ---- library/Zend/Filter/Word/SeparatorToDash.php | 5 ---- .../Zend/Filter/Word/SeparatorToSeparator.php | 5 ---- .../Filter/Word/UnderscoreToCamelCase.php | 5 ---- library/Zend/Filter/Word/UnderscoreToDash.php | 5 ---- .../Filter/Word/UnderscoreToSeparator.php | 5 ---- library/Zend/Form.php | 6 ---- library/Zend/Form/Decorator/Abstract.php | 1 - library/Zend/Form/Decorator/Callback.php | 1 - library/Zend/Form/Decorator/Captcha.php | 1 - library/Zend/Form/Decorator/Captcha/Word.php | 1 - library/Zend/Form/Decorator/Description.php | 2 -- library/Zend/Form/Decorator/DtDdWrapper.php | 1 - library/Zend/Form/Decorator/Errors.php | 1 - library/Zend/Form/Decorator/Fieldset.php | 1 - library/Zend/Form/Decorator/File.php | 3 -- library/Zend/Form/Decorator/Form.php | 1 - library/Zend/Form/Decorator/FormElements.php | 1 - library/Zend/Form/Decorator/FormErrors.php | 1 - library/Zend/Form/Decorator/HtmlTag.php | 8 ----- library/Zend/Form/Decorator/Image.php | 2 -- library/Zend/Form/Decorator/Label.php | 2 -- .../Zend/Form/Decorator/PrepareElements.php | 1 - library/Zend/Form/Decorator/Tooltip.php | 1 - library/Zend/Form/Decorator/ViewHelper.php | 1 - library/Zend/Form/Decorator/ViewScript.php | 1 - library/Zend/Form/DisplayGroup.php | 3 -- library/Zend/Form/Element.php | 6 ---- library/Zend/Form/Element/Button.php | 1 - library/Zend/Form/Element/Captcha.php | 3 -- library/Zend/Form/Element/Checkbox.php | 1 - library/Zend/Form/Element/File.php | 4 --- library/Zend/Form/Element/Hash.php | 2 -- library/Zend/Form/Element/Hidden.php | 1 - library/Zend/Form/Element/Image.php | 1 - library/Zend/Form/Element/Multi.php | 1 - library/Zend/Form/Element/MultiCheckbox.php | 1 - library/Zend/Form/Element/Multiselect.php | 1 - library/Zend/Form/Element/Note.php | 1 - library/Zend/Form/Element/Password.php | 1 - library/Zend/Form/Element/Radio.php | 1 - library/Zend/Form/Element/Reset.php | 1 - library/Zend/Form/Element/Select.php | 1 - library/Zend/Form/Element/Submit.php | 1 - library/Zend/Form/Element/Text.php | 1 - library/Zend/Form/Element/Textarea.php | 1 - library/Zend/Form/Element/Xhtml.php | 1 - library/Zend/Form/SubForm.php | 1 - library/Zend/Http/Client.php | 30 ------------------- library/Zend/Http/Client/Adapter/Curl.php | 14 --------- library/Zend/Http/Client/Adapter/Proxy.php | 13 -------- library/Zend/Http/Client/Adapter/Socket.php | 13 -------- library/Zend/Http/Client/Adapter/Test.php | 13 -------- library/Zend/Http/Cookie.php | 7 ----- library/Zend/Http/CookieJar.php | 13 -------- library/Zend/Http/Header/SetCookie.php | 4 --- library/Zend/Http/Response.php | 5 ---- library/Zend/Http/UserAgent.php | 2 -- .../Zend/Http/UserAgent/AbstractDevice.php | 1 - library/Zend/Http/UserAgent/Bot.php | 1 - library/Zend/Http/UserAgent/Checker.php | 1 - library/Zend/Http/UserAgent/Console.php | 1 - library/Zend/Http/UserAgent/Desktop.php | 1 - library/Zend/Http/UserAgent/Email.php | 1 - .../UserAgent/Features/Adapter/Browscap.php | 1 - .../Features/Adapter/DeviceAtlas.php | 1 - .../UserAgent/Features/Adapter/TeraWurfl.php | 1 - library/Zend/Http/UserAgent/Feed.php | 1 - library/Zend/Http/UserAgent/Mobile.php | 1 - library/Zend/Http/UserAgent/Offline.php | 1 - library/Zend/Http/UserAgent/Probe.php | 1 - library/Zend/Http/UserAgent/Spam.php | 1 - .../Http/UserAgent/Storage/NonPersistent.php | 5 ---- .../Zend/Http/UserAgent/Storage/Session.php | 10 ------- library/Zend/Http/UserAgent/Text.php | 1 - library/Zend/Http/UserAgent/Validator.php | 1 - library/Zend/Json.php | 6 ---- library/Zend/Json/Decoder.php | 5 ---- library/Zend/Layout.php | 7 ----- .../Controller/Action/Helper/Layout.php | 12 ++------ .../Zend/Layout/Controller/Plugin/Layout.php | 1 - library/Zend/Loader.php | 1 - library/Zend/Loader/Autoloader.php | 1 - library/Zend/Loader/Autoloader/Resource.php | 2 -- library/Zend/Loader/PluginLoader.php | 2 -- library/Zend/Locale.php | 14 --------- library/Zend/Locale/Data.php | 4 --- library/Zend/Locale/Format.php | 2 -- library/Zend/Locale/Math.php | 1 - library/Zend/Navigation.php | 5 ---- library/Zend/Navigation/Container.php | 1 - library/Zend/Navigation/Page.php | 10 ------- library/Zend/Navigation/Page/Mvc.php | 12 -------- library/Zend/Navigation/Page/Uri.php | 5 ---- library/Zend/Paginator.php | 12 -------- library/Zend/Paginator/Adapter/Array.php | 5 ---- library/Zend/Paginator/Adapter/Iterator.php | 10 ------- library/Zend/Paginator/Adapter/Null.php | 5 ---- library/Zend/Paginator/ScrollingStyle/All.php | 5 ---- .../Zend/Paginator/ScrollingStyle/Elastic.php | 5 ---- .../Zend/Paginator/ScrollingStyle/Jumping.php | 5 ---- .../Zend/Paginator/ScrollingStyle/Sliding.php | 5 ---- library/Zend/ProgressBar.php | 2 -- library/Zend/Registry.php | 1 - library/Zend/Rest/Client.php | 3 -- library/Zend/Rest/Client/Result.php | 1 - library/Zend/Rest/Controller.php | 1 - library/Zend/Rest/Route.php | 20 ------------- library/Zend/Service/Abstract.php | 1 - library/Zend/Session.php | 16 ---------- library/Zend/Session/Namespace.php | 10 ------- library/Zend/Session/Validator/Abstract.php | 5 ---- .../Zend/Session/Validator/HttpUserAgent.php | 5 ---- .../Zend/Test/PHPUnit/ControllerTestCase.php | 8 ----- library/Zend/Translate.php | 10 ------- library/Zend/Translate/Adapter.php | 11 ------- library/Zend/Translate/Adapter/Array.php | 2 -- library/Zend/Uri.php | 2 -- library/Zend/Uri/Http.php | 10 ------- library/Zend/Validate.php | 12 -------- library/Zend/Validate/Abstract.php | 6 ---- library/Zend/Validate/Alnum.php | 10 +------ library/Zend/Validate/Alpha.php | 10 +------ library/Zend/Validate/Barcode.php | 11 ------- .../Zend/Validate/Barcode/AdapterAbstract.php | 5 ---- library/Zend/Validate/Barcode/Code25.php | 5 ---- .../Validate/Barcode/Code25interleaved.php | 5 ---- library/Zend/Validate/Barcode/Code39.php | 5 ---- library/Zend/Validate/Barcode/Code39ext.php | 5 ---- library/Zend/Validate/Barcode/Code93.php | 5 ---- library/Zend/Validate/Barcode/Code93ext.php | 5 ---- library/Zend/Validate/Barcode/Ean12.php | 5 ---- library/Zend/Validate/Barcode/Ean13.php | 5 ---- library/Zend/Validate/Barcode/Ean14.php | 5 ---- library/Zend/Validate/Barcode/Ean18.php | 5 ---- library/Zend/Validate/Barcode/Ean2.php | 5 ---- library/Zend/Validate/Barcode/Ean5.php | 5 ---- library/Zend/Validate/Barcode/Ean8.php | 5 ---- library/Zend/Validate/Barcode/Gtin12.php | 5 ---- library/Zend/Validate/Barcode/Gtin13.php | 5 ---- library/Zend/Validate/Barcode/Gtin14.php | 5 ---- library/Zend/Validate/Barcode/Identcode.php | 5 ---- .../Zend/Validate/Barcode/Intelligentmail.php | 5 ---- library/Zend/Validate/Barcode/Issn.php | 5 ---- library/Zend/Validate/Barcode/Itf14.php | 5 ---- library/Zend/Validate/Barcode/Leitcode.php | 5 ---- library/Zend/Validate/Barcode/Planet.php | 5 ---- library/Zend/Validate/Barcode/Postnet.php | 5 ---- library/Zend/Validate/Barcode/Royalmail.php | 5 ---- library/Zend/Validate/Barcode/Sscc.php | 5 ---- library/Zend/Validate/Barcode/Upca.php | 5 ---- library/Zend/Validate/Barcode/Upce.php | 5 ---- library/Zend/Validate/Between.php | 5 ---- library/Zend/Validate/Callback.php | 5 ---- library/Zend/Validate/Ccnum.php | 10 +------ library/Zend/Validate/CreditCard.php | 6 ---- library/Zend/Validate/Date.php | 9 ------ library/Zend/Validate/Db/Abstract.php | 5 ---- library/Zend/Validate/Db/NoRecordExists.php | 5 ---- library/Zend/Validate/Db/RecordExists.php | 5 ---- library/Zend/Validate/Digits.php | 6 ---- library/Zend/Validate/EmailAddress.php | 10 ------- library/Zend/Validate/File/Count.php | 5 ---- library/Zend/Validate/File/Crc32.php | 6 ---- .../Zend/Validate/File/ExcludeExtension.php | 6 ---- .../Zend/Validate/File/ExcludeMimeType.php | 6 ---- library/Zend/Validate/File/Exists.php | 5 ---- library/Zend/Validate/File/Extension.php | 6 ---- library/Zend/Validate/File/FilesSize.php | 6 ---- library/Zend/Validate/File/Hash.php | 6 ---- library/Zend/Validate/File/ImageSize.php | 6 ---- library/Zend/Validate/File/IsCompressed.php | 5 ---- library/Zend/Validate/File/IsImage.php | 5 ---- library/Zend/Validate/File/Md5.php | 6 ---- library/Zend/Validate/File/MimeType.php | 6 ---- library/Zend/Validate/File/NotExists.php | 5 ---- library/Zend/Validate/File/Sha1.php | 6 ---- library/Zend/Validate/File/Size.php | 6 ---- library/Zend/Validate/File/Upload.php | 5 ---- library/Zend/Validate/File/WordCount.php | 6 ---- library/Zend/Validate/Float.php | 12 -------- library/Zend/Validate/GreaterThan.php | 5 ---- library/Zend/Validate/Hex.php | 5 ---- library/Zend/Validate/Hostname.php | 10 ------- library/Zend/Validate/Iban.php | 7 ----- library/Zend/Validate/Identical.php | 1 - library/Zend/Validate/InArray.php | 5 ---- library/Zend/Validate/Int.php | 12 -------- library/Zend/Validate/Ip.php | 5 ---- library/Zend/Validate/Isbn.php | 5 ---- library/Zend/Validate/LessThan.php | 5 ---- library/Zend/Validate/NotEmpty.php | 5 ---- library/Zend/Validate/PostCode.php | 12 -------- library/Zend/Validate/Regex.php | 5 ---- library/Zend/Validate/Sitemap/Changefreq.php | 5 ---- library/Zend/Validate/Sitemap/Lastmod.php | 5 ---- library/Zend/Validate/Sitemap/Loc.php | 10 ------- library/Zend/Validate/Sitemap/Priority.php | 5 ---- library/Zend/Validate/StringLength.php | 5 ---- library/Zend/View.php | 2 -- library/Zend/View/Abstract.php | 3 -- library/Zend/View/Helper/Abstract.php | 5 ---- library/Zend/View/Helper/Action.php | 1 - library/Zend/View/Helper/BaseUrl.php | 2 -- library/Zend/View/Helper/Currency.php | 4 --- library/Zend/View/Helper/DeclareVars.php | 1 - library/Zend/View/Helper/Doctype.php | 2 -- library/Zend/View/Helper/Fieldset.php | 1 - library/Zend/View/Helper/Form.php | 1 - library/Zend/View/Helper/FormButton.php | 1 - library/Zend/View/Helper/FormCheckbox.php | 1 - library/Zend/View/Helper/FormElement.php | 5 ---- library/Zend/View/Helper/FormErrors.php | 1 - library/Zend/View/Helper/FormFile.php | 1 - library/Zend/View/Helper/FormHidden.php | 1 - library/Zend/View/Helper/FormImage.php | 1 - library/Zend/View/Helper/FormLabel.php | 1 - .../Zend/View/Helper/FormMultiCheckbox.php | 1 - library/Zend/View/Helper/FormNote.php | 1 - library/Zend/View/Helper/FormPassword.php | 1 - library/Zend/View/Helper/FormRadio.php | 2 -- library/Zend/View/Helper/FormReset.php | 1 - library/Zend/View/Helper/FormSelect.php | 1 - library/Zend/View/Helper/FormSubmit.php | 1 - library/Zend/View/Helper/FormText.php | 1 - library/Zend/View/Helper/FormTextarea.php | 1 - library/Zend/View/Helper/Gravatar.php | 1 - library/Zend/View/Helper/HeadLink.php | 1 - library/Zend/View/Helper/HeadMeta.php | 1 - library/Zend/View/Helper/HeadScript.php | 1 - library/Zend/View/Helper/HeadStyle.php | 1 - library/Zend/View/Helper/HeadTitle.php | 2 -- library/Zend/View/Helper/HtmlElement.php | 6 ---- library/Zend/View/Helper/HtmlFlash.php | 5 ---- library/Zend/View/Helper/HtmlList.php | 1 - library/Zend/View/Helper/HtmlObject.php | 5 ---- library/Zend/View/Helper/HtmlPage.php | 5 ---- library/Zend/View/Helper/HtmlQuicktime.php | 5 ---- library/Zend/View/Helper/InlineScript.php | 1 - library/Zend/View/Helper/Json.php | 4 --- library/Zend/View/Helper/Layout.php | 2 -- library/Zend/View/Helper/Navigation.php | 5 ---- .../View/Helper/Navigation/Breadcrumbs.php | 5 ---- .../View/Helper/Navigation/HelperAbstract.php | 13 -------- library/Zend/View/Helper/Navigation/Links.php | 5 ---- library/Zend/View/Helper/Navigation/Menu.php | 5 ---- .../Zend/View/Helper/Navigation/Sitemap.php | 11 ------- library/Zend/View/Helper/Partial.php | 2 -- library/Zend/View/Helper/PartialLoop.php | 1 - library/Zend/View/Helper/Placeholder.php | 2 -- .../View/Helper/Placeholder/Container.php | 1 - .../Placeholder/Container/Standalone.php | 2 -- .../Zend/View/Helper/Placeholder/Registry.php | 4 --- .../Zend/View/Helper/RenderToPlaceholder.php | 1 - library/Zend/View/Helper/Translate.php | 3 -- library/Zend/View/Helper/Url.php | 1 - library/Zend/View/Helper/UserAgent.php | 2 -- library/ZendX/JQuery.php | 10 +------ library/ZendX/JQuery/Form.php | 1 - .../Form/Decorator/UiWidgetContainer.php | 1 - .../JQuery/Form/Decorator/UiWidgetElement.php | 10 ------- .../JQuery/Form/Decorator/UiWidgetPane.php | 1 - .../ZendX/JQuery/Form/Element/UiWidget.php | 1 - .../ZendX/JQuery/View/Helper/AutoComplete.php | 5 ---- .../ZendX/JQuery/View/Helper/DatePicker.php | 11 ------- .../JQuery/View/Helper/DialogContainer.php | 5 ---- library/ZendX/JQuery/View/Helper/JQuery.php | 21 ------------- .../JQuery/View/Helper/JQuery/Container.php | 5 ---- library/ZendX/JQuery/View/Helper/Slider.php | 5 ---- library/ZendX/JQuery/View/Helper/Spinner.php | 5 ---- .../ZendX/JQuery/View/Helper/TabContainer.php | 5 ---- library/ZendX/JQuery/View/Helper/UiWidget.php | 10 ------- tests/Zend/Acl/AclTest.php | 3 -- .../Resource/FrontcontrollerTest.php | 23 ++------------ .../Zend/Application/Resource/ModulesTest.php | 1 - .../Zend/Application/Resource/SessionTest.php | 3 -- .../Application/Resource/UseragentTest.php | 2 -- tests/Zend/Application/Resource/ViewTest.php | 1 - tests/Zend/Captcha/DumbTest.php | 1 - tests/Zend/Captcha/FigletTest.php | 4 --- tests/Zend/Captcha/ImageTest.php | 2 -- .../Action/Helper/ActionStackTest.php | 2 -- .../Action/Helper/AjaxContextTest.php | 7 ----- .../Controller/Action/Helper/CacheTest.php | 7 ----- .../Action/Helper/ContextSwitchTest.php | 9 ------ .../Action/Helper/FlashMessengerTest.php | 6 ---- .../Controller/Action/Helper/JsonTest.php | 5 ---- .../Action/Helper/RedirectorTest.php | 5 ---- .../Zend/Controller/Action/Helper/UrlTest.php | 1 - .../Action/Helper/ViewRendererTest.php | 6 ---- .../Action/HelperBroker/PriorityStackTest.php | 2 -- .../Controller/Action/HelperBrokerTest.php | 4 --- tests/Zend/Controller/ActionTest.php | 4 --- .../Controller/Dispatcher/StandardTest.php | 5 ---- tests/Zend/Controller/FrontTest.php | 7 ----- .../Controller/Plugin/ActionStackTest.php | 2 -- tests/Zend/Controller/Plugin/BrokerTest.php | 4 --- .../Controller/Plugin/ErrorHandlerTest.php | 2 -- .../Zend/Controller/Plugin/PutHandlerTest.php | 2 -- tests/Zend/Controller/Response/HttpTest.php | 2 -- tests/Zend/Controller/Router/RewriteTest.php | 3 -- .../Controller/Router/Route/ModuleTest.php | 1 - .../_files/Admin/FooBarController.php | 1 - .../Controller/_files/Admin/FooController.php | 1 - .../_files/Helpers/NamespacedHelper.php | 1 - tests/Zend/Controller/_files/ObController.php | 1 - tests/Zend/Date/DateObjectTest.php | 1 - tests/Zend/DateTest.php | 12 ++------ .../File/Transfer/Adapter/AbstractTest.php | 6 ---- tests/Zend/File/Transfer/Adapter/HttpTest.php | 6 ---- tests/Zend/Filter/BooleanTest.php | 1 - tests/Zend/Filter/HtmlEntitiesTest.php | 1 - tests/Zend/Filter/InputTest.php | 13 -------- tests/Zend/Filter/StringTrimTest.php | 1 - tests/Zend/Form/Decorator/AbstractTest.php | 4 --- tests/Zend/Form/Decorator/CallbackTest.php | 1 - tests/Zend/Form/Decorator/DescriptionTest.php | 3 -- tests/Zend/Form/Decorator/ErrorsTest.php | 2 -- tests/Zend/Form/Decorator/FieldsetTest.php | 4 --- tests/Zend/Form/Decorator/FileTest.php | 2 -- tests/Zend/Form/Decorator/FormErrorsTest.php | 4 --- tests/Zend/Form/Decorator/FormTest.php | 4 --- tests/Zend/Form/Decorator/HtmlTagTest.php | 1 - tests/Zend/Form/Decorator/ImageTest.php | 3 -- tests/Zend/Form/Decorator/LabelTest.php | 4 --- .../Form/Decorator/PrepareElementsTest.php | 4 --- tests/Zend/Form/Decorator/ViewHelperTest.php | 4 --- tests/Zend/Form/Decorator/ViewScriptTest.php | 3 -- tests/Zend/Form/DisplayGroupTest.php | 11 ------- tests/Zend/Form/Element/ButtonTest.php | 2 -- tests/Zend/Form/Element/CheckboxTest.php | 2 -- tests/Zend/Form/Element/FileTest.php | 8 ----- tests/Zend/Form/Element/HashTest.php | 1 - tests/Zend/Form/Element/ImageTest.php | 2 -- tests/Zend/Form/Element/MultiCheckboxTest.php | 1 - tests/Zend/Form/Element/MultiselectTest.php | 6 ---- tests/Zend/Form/Element/PasswordTest.php | 1 - tests/Zend/Form/Element/RadioTest.php | 1 - tests/Zend/Form/Element/SelectTest.php | 3 -- tests/Zend/Form/Element/SubmitTest.php | 8 ----- tests/Zend/Form/ElementTest.php | 18 ----------- tests/Zend/Form/FormTest.php | 14 --------- tests/Zend/Form/SubFormTest.php | 1 - tests/Zend/Layout/HelperTest.php | 3 -- tests/Zend/Layout/LayoutTest.php | 8 ----- tests/Zend/Layout/PluginTest.php | 5 ---- tests/Zend/Loader/AutoloaderFactoryTest.php | 2 -- tests/Zend/Loader/PluginLoaderTest.php | 1 - tests/Zend/Loader/StandardAutoloaderTest.php | 1 - tests/Zend/Locale/DataTest.php | 1 - tests/Zend/Locale/MathTest.php | 1 - tests/Zend/LocaleTest.php | 2 -- tests/Zend/Navigation/ContainerTest.php | 3 -- tests/Zend/Navigation/Page/MvcTest.php | 4 --- tests/Zend/Navigation/PageTest.php | 2 -- tests/Zend/NavigationTest.php | 1 - .../Test/PHPUnit/ControllerTestCaseTest.php | 12 -------- tests/Zend/Test/PHPUnit/_files/bootstrap.php | 6 ---- tests/Zend/Translate/Adapter/ArrayTest.php | 4 --- tests/Zend/TranslateTest.php | 5 ---- tests/Zend/Validate/AbstractTest.php | 1 - tests/Zend/Validate/BarcodeTest.php | 1 - tests/Zend/Validate/CreditCardTest.php | 2 -- tests/Zend/Validate/EmailAddressTest.php | 2 -- tests/Zend/Validate/FloatTest.php | 1 - tests/Zend/Validate/HostnameTest.php | 1 - tests/Zend/Validate/NotEmptyTest.php | 1 - tests/Zend/View/Helper/ActionTest.php | 1 - .../View/Helper/AttributeJsEscapingTest.php | 2 -- tests/Zend/View/Helper/DeclareVarsTest.php | 1 - tests/Zend/View/Helper/FieldsetTest.php | 1 - tests/Zend/View/Helper/FormButtonTest.php | 1 - tests/Zend/View/Helper/FormCheckboxTest.php | 2 -- tests/Zend/View/Helper/FormErrorsTest.php | 1 - tests/Zend/View/Helper/FormFileTest.php | 2 -- tests/Zend/View/Helper/FormImageTest.php | 1 - tests/Zend/View/Helper/FormLabelTest.php | 1 - .../View/Helper/FormMultiCheckboxTest.php | 2 -- tests/Zend/View/Helper/FormPasswordTest.php | 2 -- tests/Zend/View/Helper/FormRadioTest.php | 3 -- tests/Zend/View/Helper/FormResetTest.php | 2 -- tests/Zend/View/Helper/FormSelectTest.php | 1 - tests/Zend/View/Helper/FormSubmitTest.php | 2 -- tests/Zend/View/Helper/FormTest.php | 1 - tests/Zend/View/Helper/FormTextTest.php | 2 -- tests/Zend/View/Helper/FormTextareaTest.php | 1 - tests/Zend/View/Helper/HeadTitleTest.php | 2 -- tests/Zend/View/Helper/HtmlFlashTest.php | 1 - tests/Zend/View/Helper/HtmlListTest.php | 1 - tests/Zend/View/Helper/HtmlObjectTest.php | 1 - tests/Zend/View/Helper/HtmlPageTest.php | 1 - tests/Zend/View/Helper/HtmlQuicktimeTest.php | 1 - tests/Zend/View/Helper/JsonTest.php | 4 --- tests/Zend/View/Helper/LayoutTest.php | 3 -- .../View/Helper/Navigation/SitemapTest.php | 2 -- .../View/Helper/Navigation/TestAbstract.php | 8 ----- .../View/Helper/PaginationControlTest.php | 2 -- .../View/Helper/RenderToPlaceholderTest.php | 1 - tests/Zend/View/Helper/ServerUrlTest.php | 1 - tests/Zend/View/Helper/TranslateTest.php | 1 - tests/Zend/View/Helper/UrlTest.php | 1 - tests/Zend/View/Helper/UserAgentTest.php | 2 -- tests/Zend/ViewTest.php | 3 -- tests/ZendX/JQuery/Form/DecoratorTest.php | 3 -- tests/ZendX/JQuery/Form/ElementTest.php | 7 ----- tests/ZendX/JQuery/JQueryTest.php | 4 --- tests/ZendX/JQuery/View/DatePickerTest.php | 1 - tests/ZendX/JQuery/View/jQueryTestCase.php | 3 -- 532 files changed, 17 insertions(+), 2312 deletions(-) diff --git a/library/Zend/Acl.php b/library/Zend/Acl.php index 056a11b1..de7dc146 100644 --- a/library/Zend/Acl.php +++ b/library/Zend/Acl.php @@ -17,31 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Acl_Resource_Interface - */ -require_once 'Zend/Acl/Resource/Interface.php'; - -/** - * @see Zend_Acl_Role_Registry - */ -require_once 'Zend/Acl/Role/Registry.php'; - -/** - * @see Zend_Acl_Assert_Interface - */ -require_once 'Zend/Acl/Assert/Interface.php'; - -/** - * @see Zend_Acl_Role - */ -require_once 'Zend/Acl/Role.php'; - -/** - * @see Zend_Acl_Resource - */ -require_once 'Zend/Acl/Resource.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Acl/Assert/Interface.php b/library/Zend/Acl/Assert/Interface.php index 624091b4..f4ce4a46 100644 --- a/library/Zend/Acl/Assert/Interface.php +++ b/library/Zend/Acl/Assert/Interface.php @@ -17,21 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Acl - */ -require_once 'Zend/Acl.php'; - -/** - * @see Zend_Acl_Role_Interface - */ -require_once 'Zend/Acl/Role/Interface.php'; - -/** - * @see Zend_Acl_Resource_Interface - */ -require_once 'Zend/Acl/Resource/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Acl/Resource.php b/library/Zend/Acl/Resource.php index c4ebc7e3..7d621e8b 100644 --- a/library/Zend/Acl/Resource.php +++ b/library/Zend/Acl/Resource.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Acl_Resource_Interface - */ -require_once 'Zend/Acl/Resource/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Acl/Role.php b/library/Zend/Acl/Role.php index 9aab1e24..840231b3 100644 --- a/library/Zend/Acl/Role.php +++ b/library/Zend/Acl/Role.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Acl_Role_Interface - */ -require_once 'Zend/Acl/Role/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Acl/Role/Registry.php b/library/Zend/Acl/Role/Registry.php index 3ba90eb2..1f62220c 100644 --- a/library/Zend/Acl/Role/Registry.php +++ b/library/Zend/Acl/Role/Registry.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Acl_Role_Interface - */ -require_once 'Zend/Acl/Role/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Application.php b/library/Zend/Application.php index 8c470d30..2e86c209 100644 --- a/library/Zend/Application.php +++ b/library/Zend/Application.php @@ -72,7 +72,6 @@ public function __construct($environment, $options = null, $suppressNotFoundWarn { $this->_environment = (string) $environment; - require_once 'Zend/Loader/Autoloader.php'; $this->_autoloader = Zend_Loader_Autoloader::getInstance(); $this->_autoloader->suppressNotFoundWarnings($suppressNotFoundWarnings); diff --git a/library/Zend/Application/Bootstrap/Bootstrap.php b/library/Zend/Application/Bootstrap/Bootstrap.php index 8503241d..3ce79ef3 100644 --- a/library/Zend/Application/Bootstrap/Bootstrap.php +++ b/library/Zend/Application/Bootstrap/Bootstrap.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Bootstrap_BootstrapAbstract - */ -require_once 'Zend/Application/Bootstrap/BootstrapAbstract.php'; - /** * Concrete base class for bootstrap classes. * diff --git a/library/Zend/Application/Bootstrap/BootstrapAbstract.php b/library/Zend/Application/Bootstrap/BootstrapAbstract.php index 576dc28c..99f6c037 100644 --- a/library/Zend/Application/Bootstrap/BootstrapAbstract.php +++ b/library/Zend/Application/Bootstrap/BootstrapAbstract.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Bootstrap_Bootstrapper - */ -require_once 'Zend/Application/Bootstrap/Bootstrapper.php'; - -/** - * @see Zend_Application_Bootstrap_ResourceBootstrapper - */ -require_once 'Zend/Application/Bootstrap/ResourceBootstrapper.php'; - /** * Abstract base class for bootstrap classes. * diff --git a/library/Zend/Application/Module/Autoloader.php b/library/Zend/Application/Module/Autoloader.php index 5dbcb4c6..84fb42d3 100644 --- a/library/Zend/Application/Module/Autoloader.php +++ b/library/Zend/Application/Module/Autoloader.php @@ -18,7 +18,6 @@ */ /** @see Zend_Loader_Autoloader_Resource */ -require_once 'Zend/Loader/Autoloader/Resource.php'; /** * Resource loader for application module classes. diff --git a/library/Zend/Application/Module/Bootstrap.php b/library/Zend/Application/Module/Bootstrap.php index 05ab45e7..e370300b 100644 --- a/library/Zend/Application/Module/Bootstrap.php +++ b/library/Zend/Application/Module/Bootstrap.php @@ -17,11 +17,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Application_Bootstrap_Bootstrap - */ -require_once 'Zend/Application/Bootstrap/Bootstrap.php'; - /** * Base bootstrap class for modules. * diff --git a/library/Zend/Application/Resource/Cachemanager.php b/library/Zend/Application/Resource/Cachemanager.php index 11d687b7..0951a443 100644 --- a/library/Zend/Application/Resource/Cachemanager.php +++ b/library/Zend/Application/Resource/Cachemanager.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; /** * Cache Manager resource. diff --git a/library/Zend/Application/Resource/Db.php b/library/Zend/Application/Resource/Db.php index 0e454983..93f449b1 100644 --- a/library/Zend/Application/Resource/Db.php +++ b/library/Zend/Application/Resource/Db.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Resource for creating database adapter. * diff --git a/library/Zend/Application/Resource/Frontcontroller.php b/library/Zend/Application/Resource/Frontcontroller.php index f3555bb4..6ef9e9bf 100644 --- a/library/Zend/Application/Resource/Frontcontroller.php +++ b/library/Zend/Application/Resource/Frontcontroller.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Front Controller resource. * diff --git a/library/Zend/Application/Resource/Layout.php b/library/Zend/Application/Resource/Layout.php index b3cb418a..8755ae06 100644 --- a/library/Zend/Application/Resource/Layout.php +++ b/library/Zend/Application/Resource/Layout.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Resource for settings layout options. * diff --git a/library/Zend/Application/Resource/Locale.php b/library/Zend/Application/Resource/Locale.php index 0d5a80be..9840c645 100644 --- a/library/Zend/Application/Resource/Locale.php +++ b/library/Zend/Application/Resource/Locale.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Resource for initializing the locale. * diff --git a/library/Zend/Application/Resource/Mail.php b/library/Zend/Application/Resource/Mail.php index abcfe5e9..ee0601d9 100644 --- a/library/Zend/Application/Resource/Mail.php +++ b/library/Zend/Application/Resource/Mail.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Resource for setting up Mail Transport and default From & ReplyTo addresses. * diff --git a/library/Zend/Application/Resource/Modules.php b/library/Zend/Application/Resource/Modules.php index 990071a1..6c75d75d 100644 --- a/library/Zend/Application/Resource/Modules.php +++ b/library/Zend/Application/Resource/Modules.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Module bootstrapping resource. * diff --git a/library/Zend/Application/Resource/Navigation.php b/library/Zend/Application/Resource/Navigation.php index 5bd3aa03..d9aa75b4 100644 --- a/library/Zend/Application/Resource/Navigation.php +++ b/library/Zend/Application/Resource/Navigation.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Resource for setting navigation structure. * diff --git a/library/Zend/Application/Resource/ResourceAbstract.php b/library/Zend/Application/Resource/ResourceAbstract.php index 962857fd..db02bd16 100644 --- a/library/Zend/Application/Resource/ResourceAbstract.php +++ b/library/Zend/Application/Resource/ResourceAbstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_Resource - */ -require_once 'Zend/Application/Resource/Resource.php'; - /** * Abstract class for bootstrap resources. * diff --git a/library/Zend/Application/Resource/Router.php b/library/Zend/Application/Resource/Router.php index 102ac608..4231dfe1 100644 --- a/library/Zend/Application/Resource/Router.php +++ b/library/Zend/Application/Resource/Router.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Resource for initializing the locale. * diff --git a/library/Zend/Application/Resource/Session.php b/library/Zend/Application/Resource/Session.php index 57e1084e..18405ed7 100644 --- a/library/Zend/Application/Resource/Session.php +++ b/library/Zend/Application/Resource/Session.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Resource for setting session options. * diff --git a/library/Zend/Application/Resource/View.php b/library/Zend/Application/Resource/View.php index fa88d6cf..36c7e9c9 100644 --- a/library/Zend/Application/Resource/View.php +++ b/library/Zend/Application/Resource/View.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Application_Resource_ResourceAbstract - */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; - /** * Resource for settings view options. * diff --git a/library/Zend/Cache/Backend/BlackHole.php b/library/Zend/Cache/Backend/BlackHole.php index 4d977875..ab9cac18 100644 --- a/library/Zend/Cache/Backend/BlackHole.php +++ b/library/Zend/Cache/Backend/BlackHole.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Backend_Interface - */ -require_once 'Zend/Cache/Backend/ExtendedInterface.php'; - -/** - * @see Zend_Cache_Backend - */ -require_once 'Zend/Cache/Backend.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Backend/ExtendedInterface.php b/library/Zend/Cache/Backend/ExtendedInterface.php index 945924ab..988b86ca 100644 --- a/library/Zend/Cache/Backend/ExtendedInterface.php +++ b/library/Zend/Cache/Backend/ExtendedInterface.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Backend_Interface - */ -require_once 'Zend/Cache/Backend/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Backend/File.php b/library/Zend/Cache/Backend/File.php index 063790b9..8c70a216 100644 --- a/library/Zend/Cache/Backend/File.php +++ b/library/Zend/Cache/Backend/File.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Backend_Interface - */ -require_once 'Zend/Cache/Backend/ExtendedInterface.php'; - -/** - * @see Zend_Cache_Backend - */ -require_once 'Zend/Cache/Backend.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Backend/Test.php b/library/Zend/Cache/Backend/Test.php index d3415d0a..8ee047bb 100644 --- a/library/Zend/Cache/Backend/Test.php +++ b/library/Zend/Cache/Backend/Test.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Backend_Interface - */ -require_once 'Zend/Cache/Backend/ExtendedInterface.php'; - -/** - * @see Zend_Cache_Backend - */ -require_once 'Zend/Cache/Backend.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Frontend/Capture.php b/library/Zend/Cache/Frontend/Capture.php index e36b4f73..4fc83801 100644 --- a/library/Zend/Cache/Frontend/Capture.php +++ b/library/Zend/Cache/Frontend/Capture.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Core - */ -require_once 'Zend/Cache/Core.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Frontend/Class.php b/library/Zend/Cache/Frontend/Class.php index cb11e128..0672ad51 100644 --- a/library/Zend/Cache/Frontend/Class.php +++ b/library/Zend/Cache/Frontend/Class.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Core - */ -require_once 'Zend/Cache/Core.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Frontend/File.php b/library/Zend/Cache/Frontend/File.php index a6f4d8e6..5ed6aa4d 100644 --- a/library/Zend/Cache/Frontend/File.php +++ b/library/Zend/Cache/Frontend/File.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Core - */ -require_once 'Zend/Cache/Core.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Frontend/Function.php b/library/Zend/Cache/Frontend/Function.php index c93b461f..18797322 100644 --- a/library/Zend/Cache/Frontend/Function.php +++ b/library/Zend/Cache/Frontend/Function.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Core - */ -require_once 'Zend/Cache/Core.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Frontend/Output.php b/library/Zend/Cache/Frontend/Output.php index f81581bb..b1c55019 100644 --- a/library/Zend/Cache/Frontend/Output.php +++ b/library/Zend/Cache/Frontend/Output.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Core - */ -require_once 'Zend/Cache/Core.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Frontend/Page.php b/library/Zend/Cache/Frontend/Page.php index 6d3584c3..95f8b2af 100644 --- a/library/Zend/Cache/Frontend/Page.php +++ b/library/Zend/Cache/Frontend/Page.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Cache_Core - */ -require_once 'Zend/Cache/Core.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Cache/Manager.php b/library/Zend/Cache/Manager.php index 20a1b740..42bf7422 100644 --- a/library/Zend/Cache/Manager.php +++ b/library/Zend/Cache/Manager.php @@ -19,7 +19,6 @@ /** @see Zend_Cache_Exception */ /** @see Zend_Cache */ -require_once 'Zend/Cache.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Captcha/Adapter.php b/library/Zend/Captcha/Adapter.php index 2583c4b7..87bb9b57 100644 --- a/library/Zend/Captcha/Adapter.php +++ b/library/Zend/Captcha/Adapter.php @@ -16,7 +16,6 @@ */ /** @see Zend_Validate_Interface */ -require_once 'Zend/Validate/Interface.php'; /** * Generic Captcha adapter interface. diff --git a/library/Zend/Captcha/Base.php b/library/Zend/Captcha/Base.php index d6f9f179..cab5c0f7 100644 --- a/library/Zend/Captcha/Base.php +++ b/library/Zend/Captcha/Base.php @@ -16,10 +16,8 @@ */ /** @see Zend_Captcha_Adapter */ -require_once 'Zend/Captcha/Adapter.php'; /** @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Base class for Captcha adapters. diff --git a/library/Zend/Captcha/Dumb.php b/library/Zend/Captcha/Dumb.php index 77059ee5..185b6cda 100644 --- a/library/Zend/Captcha/Dumb.php +++ b/library/Zend/Captcha/Dumb.php @@ -16,7 +16,6 @@ */ /** @see Zend_Captcha_Word */ -require_once 'Zend/Captcha/Word.php'; /** * Example dumb word-based captcha. diff --git a/library/Zend/Captcha/Figlet.php b/library/Zend/Captcha/Figlet.php index 924ff22d..0f2a3dac 100644 --- a/library/Zend/Captcha/Figlet.php +++ b/library/Zend/Captcha/Figlet.php @@ -16,10 +16,8 @@ */ /** @see Zend_Captcha_Word */ -require_once 'Zend/Captcha/Word.php'; /** @see Zend_Text_Figlet */ -require_once 'Zend/Text/Figlet.php'; /** * Captcha based on figlet text rendering service. diff --git a/library/Zend/Captcha/Image.php b/library/Zend/Captcha/Image.php index 3574d7ff..8548f3f1 100644 --- a/library/Zend/Captcha/Image.php +++ b/library/Zend/Captcha/Image.php @@ -18,7 +18,6 @@ */ /** @see Zend_Captcha_Word */ -require_once 'Zend/Captcha/Word.php'; /** * Image-based captcha element. diff --git a/library/Zend/Captcha/Word.php b/library/Zend/Captcha/Word.php index 91066e54..97aeb13d 100644 --- a/library/Zend/Captcha/Word.php +++ b/library/Zend/Captcha/Word.php @@ -16,7 +16,6 @@ */ /** @see Zend_Captcha_Base */ -require_once 'Zend/Captcha/Base.php'; /** * Word-based captcha adapter. @@ -272,7 +271,6 @@ public function getSession() if (!isset($this->_session) || (null === $this->_session)) { $id = $this->getId(); if (!class_exists($this->_sessionClass)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($this->_sessionClass); } $this->_session = new $this->_sessionClass('Zend_Form_Captcha_' . $id); diff --git a/library/Zend/Config/Ini.php b/library/Zend/Config/Ini.php index 5c7f77bf..c4f27130 100644 --- a/library/Zend/Config/Ini.php +++ b/library/Zend/Config/Ini.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Config - */ -require_once 'Zend/Config.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Config/Xml.php b/library/Zend/Config/Xml.php index f37db56f..f8480e98 100644 --- a/library/Zend/Config/Xml.php +++ b/library/Zend/Config/Xml.php @@ -17,13 +17,7 @@ * @version $Id$ */ -/** - * @see Zend_Config - */ -require_once 'Zend/Config.php'; - /** @see Zend_Xml_Security */ -require_once 'Zend/Xml/Security.php'; /** @see Zend_Xml_Exception */ /** diff --git a/library/Zend/Console/Getopt.php b/library/Zend/Console/Getopt.php index 8f9780af..f1dffa8d 100644 --- a/library/Zend/Console/Getopt.php +++ b/library/Zend/Console/Getopt.php @@ -505,7 +505,6 @@ public function toJson() /** * @see Zend_Json */ - require_once 'Zend/Json.php'; $json = Zend_Json::encode($j); return $json; diff --git a/library/Zend/Controller/Action.php b/library/Zend/Controller/Action.php index d6859adf..2dbeff9e 100644 --- a/library/Zend/Controller/Action.php +++ b/library/Zend/Controller/Action.php @@ -17,21 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_HelperBroker - */ -require_once 'Zend/Controller/Action/HelperBroker.php'; - -/** - * @see Zend_Controller_Action_Interface - */ -require_once 'Zend/Controller/Action/Interface.php'; - -/** - * @see Zend_Controller_Front - */ -require_once 'Zend/Controller/Front.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -164,7 +149,6 @@ public function initView() return $this->view; } - require_once 'Zend/View/Interface.php'; if (isset($this->view) && ($this->view instanceof Zend_View_Interface)) { return $this->view; } @@ -180,7 +164,6 @@ public function initView() throw new Zend_Controller_Exception('Missing base view directory ("' . $baseDir . '")'); } - require_once 'Zend/View.php'; $this->view = new Zend_View(['basePath' => $baseDir]); return $this->view; diff --git a/library/Zend/Controller/Action/Helper/Abstract.php b/library/Zend/Controller/Action/Helper/Abstract.php index f7b54904..2ff2ad20 100644 --- a/library/Zend/Controller/Action/Helper/Abstract.php +++ b/library/Zend/Controller/Action/Helper/Abstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action - */ -require_once 'Zend/Controller/Action.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Action/Helper/ActionStack.php b/library/Zend/Controller/Action/Helper/ActionStack.php index 9fe41dda..c8bada2c 100644 --- a/library/Zend/Controller/Action/Helper/ActionStack.php +++ b/library/Zend/Controller/Action/Helper/ActionStack.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - /** * Add to action stack. * @@ -46,10 +41,7 @@ public function __construct() { $front = Zend_Controller_Front::getInstance(); if (!$front->hasPlugin(\Zend_Controller_Plugin_ActionStack::class)) { - /** - * @see Zend_Controller_Plugin_ActionStack - */ - require_once 'Zend/Controller/Plugin/ActionStack.php'; + // @see Zend_Controller_Plugin_ActionStack $this->_actionStack = new Zend_Controller_Plugin_ActionStack(); $front->registerPlugin($this->_actionStack, 97); } else { @@ -99,7 +91,6 @@ public function actionToStack($action, $controller = null, $module = null, array /** * @see Zend_Controller_Request_Simple */ - require_once 'Zend/Controller/Request/Simple.php'; $newRequest = new Zend_Controller_Request_Simple($action, $controller, $module, $params); return $this->pushStack($newRequest); diff --git a/library/Zend/Controller/Action/Helper/AjaxContext.php b/library/Zend/Controller/Action/Helper/AjaxContext.php index 58130088..f1acedbb 100644 --- a/library/Zend/Controller/Action/Helper/AjaxContext.php +++ b/library/Zend/Controller/Action/Helper/AjaxContext.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_ContextSwitch - */ -require_once 'Zend/Controller/Action/Helper/ContextSwitch.php'; - /** * Simplify AJAX context switching based on requested format. * diff --git a/library/Zend/Controller/Action/Helper/AutoComplete/Abstract.php b/library/Zend/Controller/Action/Helper/AutoComplete/Abstract.php index 065f32cd..6f1b00fe 100644 --- a/library/Zend/Controller/Action/Helper/AutoComplete/Abstract.php +++ b/library/Zend/Controller/Action/Helper/AutoComplete/Abstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - /** * Create and send autocompletion lists. * @@ -65,10 +60,7 @@ abstract public function prepareAutoCompletion($data, $keepLayouts = false); */ public function disableLayouts() { - /** - * @see Zend_Layout - */ - require_once 'Zend/Layout.php'; + // @see Zend_Layout if (null !== ($layout = Zend_Layout::getMvcInstance())) { $layout->disableLayout(); } diff --git a/library/Zend/Controller/Action/Helper/Cache.php b/library/Zend/Controller/Action/Helper/Cache.php index 75ee8ea7..0a5bec19 100644 --- a/library/Zend/Controller/Action/Helper/Cache.php +++ b/library/Zend/Controller/Action/Helper/Cache.php @@ -17,18 +17,9 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - /** * @see Zend_Controller_Action_Exception */ -/** - * @see Zend_Cache_Manager - */ -require_once 'Zend/Cache/Manager.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Controller/Action/Helper/ContextSwitch.php b/library/Zend/Controller/Action/Helper/ContextSwitch.php index e6b345d6..08a4c564 100644 --- a/library/Zend/Controller/Action/Helper/ContextSwitch.php +++ b/library/Zend/Controller/Action/Helper/ContextSwitch.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - /** * Simplify context switching based on requested format. * @@ -286,7 +281,6 @@ public function initContext($format = null) /** * @see Zend_Layout */ - require_once 'Zend/Layout.php'; $layout = Zend_Layout::getMvcInstance(); if (null !== $layout) { $layout->disableLayout(); @@ -1104,7 +1098,6 @@ public function postJsonContext() $view = $viewRenderer->view; if ($view instanceof Zend_View_Interface) { if (method_exists($view, 'getVars')) { - require_once 'Zend/Json.php'; $vars = Zend_Json::encode($view->getVars()); $this->getResponse()->setBody($vars); } else { diff --git a/library/Zend/Controller/Action/Helper/FlashMessenger.php b/library/Zend/Controller/Action/Helper/FlashMessenger.php index 18e007c5..95754e8a 100644 --- a/library/Zend/Controller/Action/Helper/FlashMessenger.php +++ b/library/Zend/Controller/Action/Helper/FlashMessenger.php @@ -15,16 +15,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Session - */ -require_once 'Zend/Session.php'; - -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - /** * Flash Messenger - implement session-based messages. * diff --git a/library/Zend/Controller/Action/Helper/Json.php b/library/Zend/Controller/Action/Helper/Json.php index e909de7a..2cd9165b 100644 --- a/library/Zend/Controller/Action/Helper/Json.php +++ b/library/Zend/Controller/Action/Helper/Json.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - /** * Simplify AJAX context switching based on requested format. * @@ -64,15 +59,11 @@ public function encodeJson($data, $keepLayouts = false, $encodeData = true) /** * @see Zend_View_Helper_Json */ - require_once 'Zend/View/Helper/Json.php'; $jsonHelper = new Zend_View_Helper_Json(); $data = $jsonHelper->json($data, $keepLayouts, $encodeData); if (!$keepLayouts) { - /** - * @see Zend_Controller_Action_HelperBroker - */ - require_once 'Zend/Controller/Action/HelperBroker.php'; + // @see Zend_Controller_Action_HelperBroker Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true); } diff --git a/library/Zend/Controller/Action/Helper/Redirector.php b/library/Zend/Controller/Action/Helper/Redirector.php index 8ca9ee04..ccad96c4 100644 --- a/library/Zend/Controller/Action/Helper/Redirector.php +++ b/library/Zend/Controller/Action/Helper/Redirector.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Controller/Action/Helper/Url.php b/library/Zend/Controller/Action/Helper/Url.php index 5bf08feb..236aaaa6 100644 --- a/library/Zend/Controller/Action/Helper/Url.php +++ b/library/Zend/Controller/Action/Helper/Url.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - /** * Helper for creating URLs for redirects and other tasks. * diff --git a/library/Zend/Controller/Action/Helper/ViewRenderer.php b/library/Zend/Controller/Action/Helper/ViewRenderer.php index 67ab9f79..cbd7f285 100644 --- a/library/Zend/Controller/Action/Helper/ViewRenderer.php +++ b/library/Zend/Controller/Action/Helper/ViewRenderer.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_Helper_Abstract - */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; - -/** - * @see Zend_View - */ -require_once 'Zend/View.php'; - /** * View script integration. * @@ -259,18 +249,9 @@ public function getModuleDirectory() public function getInflector() { if (null === $this->_inflector) { - /** - * @see Zend_Filter_Inflector - */ - require_once 'Zend/Filter/Inflector.php'; - /** - * @see Zend_Filter_PregReplace - */ - require_once 'Zend/Filter/PregReplace.php'; - /** - * @see Zend_Filter_Word_UnderscoreToSeparator - */ - require_once 'Zend/Filter/Word/UnderscoreToSeparator.php'; + // @see Zend_Filter_Inflector + // @see Zend_Filter_PregReplace + // @see Zend_Filter_Word_UnderscoreToSeparator $this->_inflector = new Zend_Filter_Inflector(); $this->_inflector->setStaticRuleReference('moduleDir', $this->_moduleDir) // moduleDir must be specified before the less specific 'module' ->addRules([ @@ -859,7 +840,6 @@ protected function _translateSpec(array $vars = []) $module = $dispatcher->formatModuleName($request->getModuleName()); // Format controller name - require_once 'Zend/Filter/Word/CamelCaseToDash.php'; $filter = new Zend_Filter_Word_CamelCaseToDash(); $controller = $filter->filter($request->getControllerName()); $controller = $dispatcher->formatControllerName($controller); diff --git a/library/Zend/Controller/Action/HelperBroker.php b/library/Zend/Controller/Action/HelperBroker.php index 9b749921..26a31898 100644 --- a/library/Zend/Controller/Action/HelperBroker.php +++ b/library/Zend/Controller/Action/HelperBroker.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Action_HelperBroker_PriorityStack - */ -require_once 'Zend/Controller/Action/HelperBroker/PriorityStack.php'; - -/** - * @see Zend_Loader - */ -require_once 'Zend/Loader.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -73,7 +63,6 @@ public static function setPluginLoader($loader) public static function getPluginLoader() { if (null === self::$_pluginLoader) { - require_once 'Zend/Loader/PluginLoader.php'; self::$_pluginLoader = new Zend_Loader_PluginLoader([ 'Zend_Controller_Action_Helper' => 'Zend/Controller/Action/Helper/', ]); diff --git a/library/Zend/Controller/Dispatcher/Abstract.php b/library/Zend/Controller/Dispatcher/Abstract.php index 9d0e4a8b..a7ce45c4 100644 --- a/library/Zend/Controller/Dispatcher/Abstract.php +++ b/library/Zend/Controller/Dispatcher/Abstract.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Dispatcher_Interface */ -require_once 'Zend/Controller/Dispatcher/Interface.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License @@ -258,7 +257,6 @@ protected function _formatName($unformatted, $isAction = false) public function getFrontController() { if (null === $this->_frontController) { - require_once 'Zend/Controller/Front.php'; $this->_frontController = Zend_Controller_Front::getInstance(); } diff --git a/library/Zend/Controller/Dispatcher/Interface.php b/library/Zend/Controller/Dispatcher/Interface.php index 7d9eb92d..e4254c7e 100644 --- a/library/Zend/Controller/Dispatcher/Interface.php +++ b/library/Zend/Controller/Dispatcher/Interface.php @@ -20,12 +20,10 @@ /** * Zend_Controller_Request_Abstract. */ -require_once 'Zend/Controller/Request/Abstract.php'; /** * Zend_Controller_Response_Abstract. */ -require_once 'Zend/Controller/Response/Abstract.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Controller/Dispatcher/Standard.php b/library/Zend/Controller/Dispatcher/Standard.php index b325c1c9..6bd3af19 100644 --- a/library/Zend/Controller/Dispatcher/Standard.php +++ b/library/Zend/Controller/Dispatcher/Standard.php @@ -18,10 +18,8 @@ */ /** Zend_Loader */ -require_once 'Zend/Loader.php'; /** Zend_Controller_Dispatcher_Abstract */ -require_once 'Zend/Controller/Dispatcher/Abstract.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Controller/Front.php b/library/Zend/Controller/Front.php index c76316b2..d0425daa 100644 --- a/library/Zend/Controller/Front.php +++ b/library/Zend/Controller/Front.php @@ -18,13 +18,10 @@ */ /** Zend_Loader */ -require_once 'Zend/Loader.php'; /** Zend_Controller_Action_HelperBroker */ -require_once 'Zend/Controller/Action/HelperBroker.php'; /** Zend_Controller_Plugin_Broker */ -require_once 'Zend/Controller/Plugin/Broker.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License @@ -459,7 +456,6 @@ public function setRequest($request) { if (is_string($request)) { if (!class_exists($request)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($request); } $request = new $request(); @@ -500,7 +496,6 @@ public function setRouter($router) { if (is_string($router)) { if (!class_exists($router)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($router); } $router = new $router(); @@ -526,7 +521,6 @@ public function setRouter($router) public function getRouter() { if (null == $this->_router) { - require_once 'Zend/Controller/Router/Rewrite.php'; $this->setRouter(new Zend_Controller_Router_Rewrite()); } @@ -606,7 +600,6 @@ public function getDispatcher() { // Instantiate the default dispatcher if one was not set. if (!$this->_dispatcher instanceof Zend_Controller_Dispatcher_Interface) { - require_once 'Zend/Controller/Dispatcher/Standard.php'; $this->_dispatcher = new Zend_Controller_Dispatcher_Standard(); } @@ -629,7 +622,6 @@ public function setResponse($response) { if (is_string($response)) { if (!class_exists($response)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($response); } $response = new $response(); @@ -860,12 +852,10 @@ public function dispatch(?Zend_Controller_Request_Abstract $request = null, ?Zen { if (!$this->getParam('noErrorHandler') && !$this->_plugins->hasPlugin(\Zend_Controller_Plugin_ErrorHandler::class)) { // Register with stack index of 100 - require_once 'Zend/Controller/Plugin/ErrorHandler.php'; $this->_plugins->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(), 100); } if (!$this->getParam('noViewRenderer') && !Zend_Controller_Action_HelperBroker::hasHelper('viewRenderer')) { - require_once 'Zend/Controller/Action/Helper/ViewRenderer.php'; Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-80, new Zend_Controller_Action_Helper_ViewRenderer()); } @@ -873,7 +863,6 @@ public function dispatch(?Zend_Controller_Request_Abstract $request = null, ?Zen if (null !== $request) { $this->setRequest($request); } elseif ((null === $request) && (null === ($request = $this->getRequest()))) { - require_once 'Zend/Controller/Request/Http.php'; $request = new Zend_Controller_Request_Http(); $this->setRequest($request); } @@ -889,7 +878,6 @@ public function dispatch(?Zend_Controller_Request_Abstract $request = null, ?Zen if (null !== $response) { $this->setResponse($response); } elseif ((null === $this->_response) && (null === ($this->_response = $this->getResponse()))) { - require_once 'Zend/Controller/Response/Http.php'; $response = new Zend_Controller_Response_Http(); $this->setResponse($response); } diff --git a/library/Zend/Controller/Plugin/ActionStack.php b/library/Zend/Controller/Plugin/ActionStack.php index d1cdd83f..a121592e 100644 --- a/library/Zend/Controller/Plugin/ActionStack.php +++ b/library/Zend/Controller/Plugin/ActionStack.php @@ -16,10 +16,8 @@ */ /** Zend_Controller_Plugin_Abstract */ -require_once 'Zend/Controller/Plugin/Abstract.php'; /** Zend_Registry */ -require_once 'Zend/Registry.php'; /** * Manage a stack of actions. diff --git a/library/Zend/Controller/Plugin/Broker.php b/library/Zend/Controller/Plugin/Broker.php index 39f2ab97..56ef3dc3 100644 --- a/library/Zend/Controller/Plugin/Broker.php +++ b/library/Zend/Controller/Plugin/Broker.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Plugin_Abstract */ -require_once 'Zend/Controller/Plugin/Abstract.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Controller/Plugin/ErrorHandler.php b/library/Zend/Controller/Plugin/ErrorHandler.php index 2fabfb42..18a2ae73 100644 --- a/library/Zend/Controller/Plugin/ErrorHandler.php +++ b/library/Zend/Controller/Plugin/ErrorHandler.php @@ -16,7 +16,6 @@ */ /** Zend_Controller_Plugin_Abstract */ -require_once 'Zend/Controller/Plugin/Abstract.php'; /** * Handle exceptions that bubble up based on missing controllers, actions, or diff --git a/library/Zend/Controller/Plugin/PutHandler.php b/library/Zend/Controller/Plugin/PutHandler.php index 7347a073..4d188f6e 100644 --- a/library/Zend/Controller/Plugin/PutHandler.php +++ b/library/Zend/Controller/Plugin/PutHandler.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Plugin_Abstract - */ -require_once 'Zend/Controller/Plugin/Abstract.php'; - -/** - * @see Zend_Controller_Request_Http - */ -require_once 'Zend/Controller/Request/Http.php'; - /** * Plugin to digest PUT request body and make params available just like POST. * diff --git a/library/Zend/Controller/Request/Apache404.php b/library/Zend/Controller/Request/Apache404.php index d68e7337..ec91dfb1 100644 --- a/library/Zend/Controller/Request/Apache404.php +++ b/library/Zend/Controller/Request/Apache404.php @@ -18,10 +18,8 @@ */ /** Zend_Controller_Request_Http */ -require_once 'Zend/Controller/Request/Http.php'; /** Zend_Uri */ -require_once 'Zend/Uri.php'; /** * Zend_Controller_Request_Apache404. diff --git a/library/Zend/Controller/Request/Http.php b/library/Zend/Controller/Request/Http.php index dbe47368..de738c84 100644 --- a/library/Zend/Controller/Request/Http.php +++ b/library/Zend/Controller/Request/Http.php @@ -18,10 +18,8 @@ */ /** @see Zend_Controller_Request_Abstract */ -require_once 'Zend/Controller/Request/Abstract.php'; /** @see Zend_Uri */ -require_once 'Zend/Uri.php'; /** * Zend_Controller_Request_Http. diff --git a/library/Zend/Controller/Request/HttpTestCase.php b/library/Zend/Controller/Request/HttpTestCase.php index d4d7d49a..faa334e5 100644 --- a/library/Zend/Controller/Request/HttpTestCase.php +++ b/library/Zend/Controller/Request/HttpTestCase.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Request_Http - */ -require_once 'Zend/Controller/Request/Http.php'; - /** * Zend_Controller_Request_HttpTestCase. * diff --git a/library/Zend/Controller/Request/Simple.php b/library/Zend/Controller/Request/Simple.php index e4562162..e9b28da0 100644 --- a/library/Zend/Controller/Request/Simple.php +++ b/library/Zend/Controller/Request/Simple.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Request_Abstract */ -require_once 'Zend/Controller/Request/Abstract.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Controller/Response/Cli.php b/library/Zend/Controller/Response/Cli.php index c63f8d39..9f02ad30 100644 --- a/library/Zend/Controller/Response/Cli.php +++ b/library/Zend/Controller/Response/Cli.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Response_Abstract */ -require_once 'Zend/Controller/Response/Abstract.php'; /** * Zend_Controller_Response_Cli. diff --git a/library/Zend/Controller/Response/Http.php b/library/Zend/Controller/Response/Http.php index 17f4c94e..dd61c04a 100644 --- a/library/Zend/Controller/Response/Http.php +++ b/library/Zend/Controller/Response/Http.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Response_Abstract */ -require_once 'Zend/Controller/Response/Abstract.php'; /** * Zend_Controller_Response_Http. diff --git a/library/Zend/Controller/Response/HttpTestCase.php b/library/Zend/Controller/Response/HttpTestCase.php index 298e6b00..c27363a6 100644 --- a/library/Zend/Controller/Response/HttpTestCase.php +++ b/library/Zend/Controller/Response/HttpTestCase.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Response_Http - */ -require_once 'Zend/Controller/Response/Http.php'; - /** * Zend_Controller_Response_HttpTestCase. * diff --git a/library/Zend/Controller/Router/Abstract.php b/library/Zend/Controller/Router/Abstract.php index 999d5c1b..6e700eb9 100644 --- a/library/Zend/Controller/Router/Abstract.php +++ b/library/Zend/Controller/Router/Abstract.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Router_Interface */ -require_once 'Zend/Controller/Router/Interface.php'; /** * Simple first implementation of a router, to be replaced @@ -152,7 +151,6 @@ public function getFrontController() return $this->_frontController; } - require_once 'Zend/Controller/Front.php'; $this->_frontController = Zend_Controller_Front::getInstance(); return $this->_frontController; diff --git a/library/Zend/Controller/Router/Rewrite.php b/library/Zend/Controller/Router/Rewrite.php index c8bbb078..21d2acfb 100644 --- a/library/Zend/Controller/Router/Rewrite.php +++ b/library/Zend/Controller/Router/Rewrite.php @@ -18,10 +18,8 @@ */ /** Zend_Controller_Router_Abstract */ -require_once 'Zend/Controller/Router/Abstract.php'; /** Zend_Controller_Router_Route */ -require_once 'Zend/Controller/Router/Route.php'; /** * Ruby routing based Router. @@ -87,7 +85,6 @@ public function addDefaultRoutes() $dispatcher = $this->getFrontController()->getDispatcher(); $request = $this->getFrontController()->getRequest(); - require_once 'Zend/Controller/Router/Route/Module.php'; $compat = new Zend_Controller_Router_Route_Module([], $dispatcher, $request); $this->_routes = ['default' => $compat] + $this->_routes; @@ -206,7 +203,6 @@ protected function _getRouteFromConfig(Zend_Config $info) { $class = $info->type ?? \Zend_Controller_Router_Route::class; if (!class_exists($class)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($class); } diff --git a/library/Zend/Controller/Router/Route.php b/library/Zend/Controller/Router/Route.php index 97905555..6c1794e6 100644 --- a/library/Zend/Controller/Router/Route.php +++ b/library/Zend/Controller/Router/Route.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Router_Route_Abstract */ -require_once 'Zend/Controller/Router/Route/Abstract.php'; /** * Route. diff --git a/library/Zend/Controller/Router/Route/Abstract.php b/library/Zend/Controller/Router/Route/Abstract.php index c7549e2b..66eda7fc 100644 --- a/library/Zend/Controller/Router/Route/Abstract.php +++ b/library/Zend/Controller/Router/Route/Abstract.php @@ -17,11 +17,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Controller_Router_Route_Interface - */ -require_once 'Zend/Controller/Router/Route/Interface.php'; - /** * Abstract Route. * @@ -106,8 +101,6 @@ public function isAbstract($flag = null) */ public function chain(Zend_Controller_Router_Route_Abstract $route, $separator = '/') { - require_once 'Zend/Controller/Router/Route/Chain.php'; - $chain = new Zend_Controller_Router_Route_Chain(); $chain->chain($this)->chain($route, $separator); diff --git a/library/Zend/Controller/Router/Route/Chain.php b/library/Zend/Controller/Router/Route/Chain.php index b8728d31..9b689c1d 100644 --- a/library/Zend/Controller/Router/Route/Chain.php +++ b/library/Zend/Controller/Router/Route/Chain.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Router_Route_Abstract */ -require_once 'Zend/Controller/Router/Route/Abstract.php'; /** * Chain route is used for managing route chaining. diff --git a/library/Zend/Controller/Router/Route/Hostname.php b/library/Zend/Controller/Router/Route/Hostname.php index 5ae4c439..9c32207c 100644 --- a/library/Zend/Controller/Router/Route/Hostname.php +++ b/library/Zend/Controller/Router/Route/Hostname.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Router_Route_Abstract */ -require_once 'Zend/Controller/Router/Route/Abstract.php'; /** * Hostname Route. @@ -125,7 +124,6 @@ public function setRequest(?Zend_Controller_Request_Abstract $request = null) public function getRequest() { if ($this->_request === null) { - require_once 'Zend/Controller/Front.php'; $this->_request = Zend_Controller_Front::getInstance()->getRequest(); } diff --git a/library/Zend/Controller/Router/Route/Interface.php b/library/Zend/Controller/Router/Route/Interface.php index f57e4f29..7680149c 100644 --- a/library/Zend/Controller/Router/Route/Interface.php +++ b/library/Zend/Controller/Router/Route/Interface.php @@ -18,7 +18,6 @@ */ /** Zend_Config */ -require_once 'Zend/Config.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Controller/Router/Route/Module.php b/library/Zend/Controller/Router/Route/Module.php index 23076940..5022ba1e 100644 --- a/library/Zend/Controller/Router/Route/Module.php +++ b/library/Zend/Controller/Router/Route/Module.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Router_Route_Abstract */ -require_once 'Zend/Controller/Router/Route/Abstract.php'; /** * Module Route. diff --git a/library/Zend/Controller/Router/Route/Regex.php b/library/Zend/Controller/Router/Route/Regex.php index f9e9c430..a84f05fb 100644 --- a/library/Zend/Controller/Router/Route/Regex.php +++ b/library/Zend/Controller/Router/Route/Regex.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Router_Route_Abstract */ -require_once 'Zend/Controller/Router/Route/Abstract.php'; /** * Regex Route. diff --git a/library/Zend/Controller/Router/Route/Static.php b/library/Zend/Controller/Router/Route/Static.php index 51af912b..5ed5449e 100644 --- a/library/Zend/Controller/Router/Route/Static.php +++ b/library/Zend/Controller/Router/Route/Static.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Router_Route_Abstract */ -require_once 'Zend/Controller/Router/Route/Abstract.php'; /** * StaticRoute is used for managing static URIs. diff --git a/library/Zend/Date.php b/library/Zend/Date.php index e0a163f3..c9ef9860 100644 --- a/library/Zend/Date.php +++ b/library/Zend/Date.php @@ -20,10 +20,6 @@ /** * Include needed Date classes. */ -require_once 'Zend/Date/DateObject.php'; -require_once 'Zend/Locale.php'; -require_once 'Zend/Locale/Format.php'; -require_once 'Zend/Locale/Math.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/File/ClassFileLocator.php b/library/Zend/File/ClassFileLocator.php index 46feddc2..5ff25e78 100644 --- a/library/Zend/File/ClassFileLocator.php +++ b/library/Zend/File/ClassFileLocator.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/File/PhpClassFile.php'; /** * Locate files containing PHP classes, interfaces, or abstracts. diff --git a/library/Zend/File/Transfer.php b/library/Zend/File/Transfer.php index 59e2c1fb..83827d56 100644 --- a/library/Zend/File/Transfer.php +++ b/library/Zend/File/Transfer.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Loader - */ -require_once 'Zend/Loader.php'; - /** * Base class for all protocols supporting file transfers. * diff --git a/library/Zend/File/Transfer/Adapter/Abstract.php b/library/Zend/File/Transfer/Adapter/Abstract.php index 087b5bf3..f20dd162 100644 --- a/library/Zend/File/Transfer/Adapter/Abstract.php +++ b/library/Zend/File/Transfer/Adapter/Abstract.php @@ -223,7 +223,6 @@ public function getPluginLoader($type) 'Zend_' . $prefixSegment . '_File' => 'Zend/' . $pathSegment . '/File', ]; - require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader($paths); } else { $loader = $this->_loaders[$type]; diff --git a/library/Zend/File/Transfer/Adapter/Http.php b/library/Zend/File/Transfer/Adapter/Http.php index 493a0f7d..08edc51a 100644 --- a/library/Zend/File/Transfer/Adapter/Http.php +++ b/library/Zend/File/Transfer/Adapter/Http.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_File_Transfer_Adapter_Abstract - */ -require_once 'Zend/File/Transfer/Adapter/Abstract.php'; - /** * File transfer adapter class for the HTTP protocol. * @@ -387,7 +382,6 @@ public static function getProgress($id = null) if (isset($adapter, $status['id'])) { if ($adapter instanceof Zend_ProgressBar_Adapter) { - require_once 'Zend/ProgressBar.php'; $adapter = new Zend_ProgressBar($adapter, 0, $status['total'], $session); } diff --git a/library/Zend/Filter.php b/library/Zend/Filter.php index 37e12a69..96a2185c 100644 --- a/library/Zend/Filter.php +++ b/library/Zend/Filter.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -200,7 +195,6 @@ public static function get($value, $classBaseName, array $args = [], $namespaces */ public static function filterStatic($value, $classBaseName, array $args = [], $namespaces = []) { - require_once 'Zend/Loader.php'; $namespaces = array_merge((array) $namespaces, self::$_defaultNamespaces, [\Zend_Filter::class]); foreach ($namespaces as $namespace) { $className = $namespace . '_' . ucfirst($classBaseName); diff --git a/library/Zend/Filter/Alnum.php b/library/Zend/Filter/Alnum.php index 754291c4..c99838a5 100644 --- a/library/Zend/Filter/Alnum.php +++ b/library/Zend/Filter/Alnum.php @@ -17,15 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; -/** - * @see Zend_Locale - */ -require_once 'Zend/Locale.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Alpha.php b/library/Zend/Filter/Alpha.php index c2445021..d1094d24 100644 --- a/library/Zend/Filter/Alpha.php +++ b/library/Zend/Filter/Alpha.php @@ -17,15 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; -/** - * @see Zend_Locale - */ -require_once 'Zend/Locale.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/BaseName.php b/library/Zend/Filter/BaseName.php index 996a966b..883e263f 100644 --- a/library/Zend/Filter/BaseName.php +++ b/library/Zend/Filter/BaseName.php @@ -18,11 +18,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Boolean.php b/library/Zend/Filter/Boolean.php index 3849d2ca..511678da 100644 --- a/library/Zend/Filter/Boolean.php +++ b/library/Zend/Filter/Boolean.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -185,7 +180,6 @@ public function setLocale($locale = null) throw new Zend_Filter_Exception('Locale has to be string, array or an instance of Zend_Locale'); } - require_once 'Zend/Locale.php'; foreach ($locale as $single) { if (!Zend_Locale::isLocale($single)) { throw new Zend_Filter_Exception("Unknown locale '$single'"); @@ -239,7 +233,6 @@ public function filter($value) if ($type >= self::YES) { $type -= self::YES; if (is_string($value)) { - require_once 'Zend/Locale.php'; $locales = $this->getLocale(); foreach ($locales as $locale) { if ($this->_getLocalizedQuestion($value, false, $locale) === false) { diff --git a/library/Zend/Filter/Callback.php b/library/Zend/Filter/Callback.php index 7485a0ed..14a3df65 100644 --- a/library/Zend/Filter/Callback.php +++ b/library/Zend/Filter/Callback.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Compress.php b/library/Zend/Filter/Compress.php index 86288d3c..420d774e 100644 --- a/library/Zend/Filter/Compress.php +++ b/library/Zend/Filter/Compress.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * Compresses a given string. * @@ -93,7 +88,6 @@ public function getAdapter() $adapter = $this->_adapter; $options = $this->getAdapterOptions(); if (!class_exists($adapter)) { - require_once 'Zend/Loader.php'; if (Zend_Loader::isReadable('Zend/Filter/Compress/' . ucfirst($adapter) . '.php')) { $adapter = 'Zend_Filter_Compress_' . ucfirst($adapter); } diff --git a/library/Zend/Filter/Compress/Bz2.php b/library/Zend/Filter/Compress/Bz2.php index 46a17707..7284dba7 100644 --- a/library/Zend/Filter/Compress/Bz2.php +++ b/library/Zend/Filter/Compress/Bz2.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Compress_CompressAbstract - */ -require_once 'Zend/Filter/Compress/CompressAbstract.php'; - /** * Compression adapter for Bz2. * diff --git a/library/Zend/Filter/Compress/CompressAbstract.php b/library/Zend/Filter/Compress/CompressAbstract.php index 9f3dc342..c1e5e1e7 100644 --- a/library/Zend/Filter/Compress/CompressAbstract.php +++ b/library/Zend/Filter/Compress/CompressAbstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Compress_CompressInterface - */ -require_once 'Zend/Filter/Compress/CompressInterface.php'; - /** * Abstract compression adapter. * diff --git a/library/Zend/Filter/Compress/Gz.php b/library/Zend/Filter/Compress/Gz.php index d1789e29..a45116fc 100644 --- a/library/Zend/Filter/Compress/Gz.php +++ b/library/Zend/Filter/Compress/Gz.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Compress_CompressAbstract - */ -require_once 'Zend/Filter/Compress/CompressAbstract.php'; - /** * Compression adapter for Gzip (ZLib). * diff --git a/library/Zend/Filter/Compress/Lzf.php b/library/Zend/Filter/Compress/Lzf.php index c55e789a..89769139 100644 --- a/library/Zend/Filter/Compress/Lzf.php +++ b/library/Zend/Filter/Compress/Lzf.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Compress_CompressInterface - */ -require_once 'Zend/Filter/Compress/CompressInterface.php'; - /** * Compression adapter for Lzf. * diff --git a/library/Zend/Filter/Compress/Rar.php b/library/Zend/Filter/Compress/Rar.php index 874ecb86..0a824eda 100644 --- a/library/Zend/Filter/Compress/Rar.php +++ b/library/Zend/Filter/Compress/Rar.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Compress_CompressAbstract - */ -require_once 'Zend/Filter/Compress/CompressAbstract.php'; - /** * Compression adapter for Rar. * diff --git a/library/Zend/Filter/Compress/Tar.php b/library/Zend/Filter/Compress/Tar.php index 90cbd11f..f6353481 100644 --- a/library/Zend/Filter/Compress/Tar.php +++ b/library/Zend/Filter/Compress/Tar.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Compress_CompressAbstract - */ -require_once 'Zend/Filter/Compress/CompressAbstract.php'; - /** * Compression adapter for Tar. * @@ -53,8 +48,6 @@ class Zend_Filter_Compress_Tar extends Zend_Filter_Compress_CompressAbstract public function __construct($options = null) { if (!class_exists('Archive_Tar')) { - require_once 'Zend/Loader.php'; - try { Zend_Loader::loadClass('Archive_Tar'); } catch (Zend_Exception $e) { diff --git a/library/Zend/Filter/Compress/Zip.php b/library/Zend/Filter/Compress/Zip.php index 4c4a14f2..a8afa7ce 100644 --- a/library/Zend/Filter/Compress/Zip.php +++ b/library/Zend/Filter/Compress/Zip.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Compress_CompressAbstract - */ -require_once 'Zend/Filter/Compress/CompressAbstract.php'; - /** * Compression adapter for zip. * diff --git a/library/Zend/Filter/Decompress.php b/library/Zend/Filter/Decompress.php index f14e1488..36e021a9 100644 --- a/library/Zend/Filter/Decompress.php +++ b/library/Zend/Filter/Decompress.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Compress - */ -require_once 'Zend/Filter/Compress.php'; - /** * Decompresses a given string. * diff --git a/library/Zend/Filter/Digits.php b/library/Zend/Filter/Digits.php index db8b5dbf..55aebabf 100644 --- a/library/Zend/Filter/Digits.php +++ b/library/Zend/Filter/Digits.php @@ -18,11 +18,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Dir.php b/library/Zend/Filter/Dir.php index eaf6cfd5..7f8c508f 100644 --- a/library/Zend/Filter/Dir.php +++ b/library/Zend/Filter/Dir.php @@ -18,11 +18,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/File/LowerCase.php b/library/Zend/Filter/File/LowerCase.php index 0c901761..48f9c541 100644 --- a/library/Zend/Filter/File/LowerCase.php +++ b/library/Zend/Filter/File/LowerCase.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_StringToLower - */ -require_once 'Zend/Filter/StringToLower.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/File/Rename.php b/library/Zend/Filter/File/Rename.php index 347d2ee8..19558bd5 100644 --- a/library/Zend/Filter/File/Rename.php +++ b/library/Zend/Filter/File/Rename.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/File/UpperCase.php b/library/Zend/Filter/File/UpperCase.php index e444a7e7..ca5731b1 100644 --- a/library/Zend/Filter/File/UpperCase.php +++ b/library/Zend/Filter/File/UpperCase.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_StringToUpper - */ -require_once 'Zend/Filter/StringToUpper.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/HtmlEntities.php b/library/Zend/Filter/HtmlEntities.php index 219455f1..a8e0c6f1 100644 --- a/library/Zend/Filter/HtmlEntities.php +++ b/library/Zend/Filter/HtmlEntities.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Inflector.php b/library/Zend/Filter/Inflector.php index b3fb15e1..9be00698 100644 --- a/library/Zend/Filter/Inflector.php +++ b/library/Zend/Filter/Inflector.php @@ -21,12 +21,6 @@ * @see Zend_Filter * @see Zend_Filter_Interface */ -require_once 'Zend/Filter.php'; - -/** - * @see Zend_Loader_PluginLoader - */ -require_once 'Zend/Loader/PluginLoader.php'; /** * Filter chain for string inflection. diff --git a/library/Zend/Filter/Input.php b/library/Zend/Filter/Input.php index 7c9d9595..ce9f6c80 100644 --- a/library/Zend/Filter/Input.php +++ b/library/Zend/Filter/Input.php @@ -17,21 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Loader - */ -require_once 'Zend/Loader.php'; - -/** - * @see Zend_Filter - */ -require_once 'Zend/Filter.php'; - -/** - * @see Zend_Validate - */ -require_once 'Zend/Validate.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -283,7 +268,6 @@ public function getPluginLoader($type) throw new Zend_Filter_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } - require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( [$prefixSegment => $pathSegment] ); @@ -622,7 +606,6 @@ public function getTranslator() } if ($this->_translator === null) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Translate::class)) { $translator = Zend_Registry::get(\Zend_Translate::class); if ($translator instanceof Zend_Translate_Adapter) { diff --git a/library/Zend/Filter/Int.php b/library/Zend/Filter/Int.php index c05667a9..faa2e259 100644 --- a/library/Zend/Filter/Int.php +++ b/library/Zend/Filter/Int.php @@ -18,11 +18,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Null.php b/library/Zend/Filter/Null.php index b45aa010..2cbd00da 100644 --- a/library/Zend/Filter/Null.php +++ b/library/Zend/Filter/Null.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/PregReplace.php b/library/Zend/Filter/PregReplace.php index 20e7e9bd..a87b5d56 100644 --- a/library/Zend/Filter/PregReplace.php +++ b/library/Zend/Filter/PregReplace.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/RealPath.php b/library/Zend/Filter/RealPath.php index 16183cd3..a0366673 100644 --- a/library/Zend/Filter/RealPath.php +++ b/library/Zend/Filter/RealPath.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/StringToLower.php b/library/Zend/Filter/StringToLower.php index 2dc35934..690f7323 100644 --- a/library/Zend/Filter/StringToLower.php +++ b/library/Zend/Filter/StringToLower.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/StringToUpper.php b/library/Zend/Filter/StringToUpper.php index a3f253ad..24062522 100644 --- a/library/Zend/Filter/StringToUpper.php +++ b/library/Zend/Filter/StringToUpper.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/StringTrim.php b/library/Zend/Filter/StringTrim.php index cce43f5a..d4ab337d 100644 --- a/library/Zend/Filter/StringTrim.php +++ b/library/Zend/Filter/StringTrim.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/StripNewlines.php b/library/Zend/Filter/StripNewlines.php index 4f453185..448c9e88 100644 --- a/library/Zend/Filter/StripNewlines.php +++ b/library/Zend/Filter/StripNewlines.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/StripTags.php b/library/Zend/Filter/StripTags.php index df9dbdf7..4eaf3f25 100644 --- a/library/Zend/Filter/StripTags.php +++ b/library/Zend/Filter/StripTags.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/CamelCaseToDash.php b/library/Zend/Filter/Word/CamelCaseToDash.php index 7345797e..c3dbb456 100644 --- a/library/Zend/Filter/Word/CamelCaseToDash.php +++ b/library/Zend/Filter/Word/CamelCaseToDash.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Word/CamelCaseToSeparator.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/CamelCaseToSeparator.php b/library/Zend/Filter/Word/CamelCaseToSeparator.php index a490c7c4..a98a159e 100644 --- a/library/Zend/Filter/Word/CamelCaseToSeparator.php +++ b/library/Zend/Filter/Word/CamelCaseToSeparator.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_PregReplace - */ -require_once 'Zend/Filter/Word/Separator/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/CamelCaseToUnderscore.php b/library/Zend/Filter/Word/CamelCaseToUnderscore.php index bd4bd581..d5c58782 100644 --- a/library/Zend/Filter/Word/CamelCaseToUnderscore.php +++ b/library/Zend/Filter/Word/CamelCaseToUnderscore.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_CamelCaseToSeparator - */ -require_once 'Zend/Filter/Word/CamelCaseToSeparator.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/DashToCamelCase.php b/library/Zend/Filter/Word/DashToCamelCase.php index 024e12a1..96866616 100644 --- a/library/Zend/Filter/Word/DashToCamelCase.php +++ b/library/Zend/Filter/Word/DashToCamelCase.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Word/SeparatorToCamelCase.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/DashToSeparator.php b/library/Zend/Filter/Word/DashToSeparator.php index 5102978a..5b11ad8f 100644 --- a/library/Zend/Filter/Word/DashToSeparator.php +++ b/library/Zend/Filter/Word/DashToSeparator.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_PregReplace - */ -require_once 'Zend/Filter/Word/Separator/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/DashToUnderscore.php b/library/Zend/Filter/Word/DashToUnderscore.php index 4a7091c0..705672fe 100644 --- a/library/Zend/Filter/Word/DashToUnderscore.php +++ b/library/Zend/Filter/Word/DashToUnderscore.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_PregReplace - */ -require_once 'Zend/Filter/Word/SeparatorToSeparator.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/Separator/Abstract.php b/library/Zend/Filter/Word/Separator/Abstract.php index 7c214ee7..c105eb78 100644 --- a/library/Zend/Filter/Word/Separator/Abstract.php +++ b/library/Zend/Filter/Word/Separator/Abstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_PregReplace - */ -require_once 'Zend/Filter/PregReplace.php'; - /** * @uses Zend_Filter_PregReplace * diff --git a/library/Zend/Filter/Word/SeparatorToCamelCase.php b/library/Zend/Filter/Word/SeparatorToCamelCase.php index f4de4ffc..e9929978 100644 --- a/library/Zend/Filter/Word/SeparatorToCamelCase.php +++ b/library/Zend/Filter/Word/SeparatorToCamelCase.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_PregReplace - */ -require_once 'Zend/Filter/Word/Separator/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/SeparatorToDash.php b/library/Zend/Filter/Word/SeparatorToDash.php index 0eb381df..6152414f 100644 --- a/library/Zend/Filter/Word/SeparatorToDash.php +++ b/library/Zend/Filter/Word/SeparatorToDash.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_SeperatorToSeparator - */ -require_once 'Zend/Filter/Word/SeparatorToSeparator.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/SeparatorToSeparator.php b/library/Zend/Filter/Word/SeparatorToSeparator.php index 5e67966f..7bffa4c1 100644 --- a/library/Zend/Filter/Word/SeparatorToSeparator.php +++ b/library/Zend/Filter/Word/SeparatorToSeparator.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_PregReplace - */ -require_once 'Zend/Filter/PregReplace.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/UnderscoreToCamelCase.php b/library/Zend/Filter/Word/UnderscoreToCamelCase.php index edb88434..2b2c2c1d 100644 --- a/library/Zend/Filter/Word/UnderscoreToCamelCase.php +++ b/library/Zend/Filter/Word/UnderscoreToCamelCase.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_Interface - */ -require_once 'Zend/Filter/Word/SeparatorToCamelCase.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/UnderscoreToDash.php b/library/Zend/Filter/Word/UnderscoreToDash.php index c661a3df..4ae2cd33 100644 --- a/library/Zend/Filter/Word/UnderscoreToDash.php +++ b/library/Zend/Filter/Word/UnderscoreToDash.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_PregReplace - */ -require_once 'Zend/Filter/Word/SeparatorToSeparator.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Filter/Word/UnderscoreToSeparator.php b/library/Zend/Filter/Word/UnderscoreToSeparator.php index efc084c9..394f839e 100644 --- a/library/Zend/Filter/Word/UnderscoreToSeparator.php +++ b/library/Zend/Filter/Word/UnderscoreToSeparator.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Filter_PregReplace - */ -require_once 'Zend/Filter/Word/SeparatorToSeparator.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Form.php b/library/Zend/Form.php index 6cc47858..40d6d4cf 100644 --- a/library/Zend/Form.php +++ b/library/Zend/Form.php @@ -16,7 +16,6 @@ */ /** @see Zend_Validate_Interface */ -require_once 'Zend/Validate/Interface.php'; /** * Zend_Form. @@ -479,7 +478,6 @@ public function getPluginLoader($type = null) throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); } - require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( ['Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/'] ); @@ -1935,7 +1933,6 @@ public function addDisplayGroup(array $elements, $name, $options = null) } if (!class_exists($class)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($class); } $this->_displayGroups[$name] = new $class( @@ -2462,7 +2459,6 @@ public function isValidPartial(array $data) */ public function processAjax(array $data) { - require_once 'Zend/Json.php'; if ($this->isValidPartial($data)) { return Zend_Json::encode(true); } @@ -2781,7 +2777,6 @@ public function setView(?Zend_View_Interface $view = null) public function getView() { if (null === $this->_view) { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $this->setView($viewRenderer->view); } @@ -3195,7 +3190,6 @@ public function hasTranslator() public static function getDefaultTranslator() { if (null === self::$_translatorDefault) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Translate::class)) { $translator = Zend_Registry::get(\Zend_Translate::class); if ($translator instanceof Zend_Translate_Adapter) { diff --git a/library/Zend/Form/Decorator/Abstract.php b/library/Zend/Form/Decorator/Abstract.php index 4cd57252..10b6972c 100644 --- a/library/Zend/Form/Decorator/Abstract.php +++ b/library/Zend/Form/Decorator/Abstract.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Interface */ -require_once 'Zend/Form/Decorator/Interface.php'; /** * Zend_Form_Decorator_Abstract. diff --git a/library/Zend/Form/Decorator/Callback.php b/library/Zend/Form/Decorator/Callback.php index 4bb59122..7d50585b 100644 --- a/library/Zend/Form/Decorator/Callback.php +++ b/library/Zend/Form/Decorator/Callback.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_Callback. diff --git a/library/Zend/Form/Decorator/Captcha.php b/library/Zend/Form/Decorator/Captcha.php index 88dd4008..49f70800 100644 --- a/library/Zend/Form/Decorator/Captcha.php +++ b/library/Zend/Form/Decorator/Captcha.php @@ -16,7 +16,6 @@ */ /** @see Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Captcha generic decorator. diff --git a/library/Zend/Form/Decorator/Captcha/Word.php b/library/Zend/Form/Decorator/Captcha/Word.php index 9f74a507..7860880a 100644 --- a/library/Zend/Form/Decorator/Captcha/Word.php +++ b/library/Zend/Form/Decorator/Captcha/Word.php @@ -16,7 +16,6 @@ */ /** @see Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Word-based captcha decorator. diff --git a/library/Zend/Form/Decorator/Description.php b/library/Zend/Form/Decorator/Description.php index 387c60df..cf1516c0 100644 --- a/library/Zend/Form/Decorator/Description.php +++ b/library/Zend/Form/Decorator/Description.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_Description. @@ -185,7 +184,6 @@ public function render($content) } if (!empty($tag)) { - require_once 'Zend/Form/Decorator/HtmlTag.php'; $options['tag'] = $tag; $decorator = new Zend_Form_Decorator_HtmlTag($options); $description = $decorator->render($description); diff --git a/library/Zend/Form/Decorator/DtDdWrapper.php b/library/Zend/Form/Decorator/DtDdWrapper.php index eaae07b3..0354042e 100644 --- a/library/Zend/Form/Decorator/DtDdWrapper.php +++ b/library/Zend/Form/Decorator/DtDdWrapper.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_DtDdWrapper. diff --git a/library/Zend/Form/Decorator/Errors.php b/library/Zend/Form/Decorator/Errors.php index bbef0277..0bfab998 100644 --- a/library/Zend/Form/Decorator/Errors.php +++ b/library/Zend/Form/Decorator/Errors.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_Errors. diff --git a/library/Zend/Form/Decorator/Fieldset.php b/library/Zend/Form/Decorator/Fieldset.php index 9778297d..ff7b3820 100644 --- a/library/Zend/Form/Decorator/Fieldset.php +++ b/library/Zend/Form/Decorator/Fieldset.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_Fieldset. diff --git a/library/Zend/Form/Decorator/File.php b/library/Zend/Form/Decorator/File.php index df120fe0..a0824807 100644 --- a/library/Zend/Form/Decorator/File.php +++ b/library/Zend/Form/Decorator/File.php @@ -16,13 +16,10 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** Zend_Form_Decorator_Marker_File_Interface */ -require_once 'Zend/Form/Decorator/Marker/File/Interface.php'; /** Zend_File_Transfer_Adapter_Http */ -require_once 'Zend/File/Transfer/Adapter/Http.php'; /** * Zend_Form_Decorator_File. diff --git a/library/Zend/Form/Decorator/Form.php b/library/Zend/Form/Decorator/Form.php index d1898bda..0a1724b1 100644 --- a/library/Zend/Form/Decorator/Form.php +++ b/library/Zend/Form/Decorator/Form.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_Form. diff --git a/library/Zend/Form/Decorator/FormElements.php b/library/Zend/Form/Decorator/FormElements.php index 84b34da5..901b3890 100644 --- a/library/Zend/Form/Decorator/FormElements.php +++ b/library/Zend/Form/Decorator/FormElements.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_FormElements. diff --git a/library/Zend/Form/Decorator/FormErrors.php b/library/Zend/Form/Decorator/FormErrors.php index ca64e30f..1952bf45 100644 --- a/library/Zend/Form/Decorator/FormErrors.php +++ b/library/Zend/Form/Decorator/FormErrors.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_FormErrors. diff --git a/library/Zend/Form/Decorator/HtmlTag.php b/library/Zend/Form/Decorator/HtmlTag.php index 790d3430..891c223e 100644 --- a/library/Zend/Form/Decorator/HtmlTag.php +++ b/library/Zend/Form/Decorator/HtmlTag.php @@ -15,11 +15,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Form_Decorator_Abstract - */ -require_once 'Zend/Form/Decorator/Abstract.php'; - /** * Zend_Form_Decorator_Element_HtmlTag. * @@ -108,9 +103,6 @@ protected function _htmlAttribs(array $attribs) public function normalizeTag($tag) { if (!isset($this->_tagFilter)) { - require_once 'Zend/Filter.php'; - require_once 'Zend/Filter/Alnum.php'; - require_once 'Zend/Filter/StringToLower.php'; $this->_tagFilter = new Zend_Filter(); $this->_tagFilter->addFilter(new Zend_Filter_Alnum()) ->addFilter(new Zend_Filter_StringToLower()); diff --git a/library/Zend/Form/Decorator/Image.php b/library/Zend/Form/Decorator/Image.php index 42f4e6ba..b3f12a57 100644 --- a/library/Zend/Form/Decorator/Image.php +++ b/library/Zend/Form/Decorator/Image.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_Image. @@ -136,7 +135,6 @@ public function render($content) $image = $view->formImage($name, $element->getImageValue(), $attribs); if (null !== $tag) { - require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); $decorator->setOptions(['tag' => $tag]); $image = $decorator->render($image); diff --git a/library/Zend/Form/Decorator/Label.php b/library/Zend/Form/Decorator/Label.php index 7c8675e2..c5cae6b8 100644 --- a/library/Zend/Form/Decorator/Label.php +++ b/library/Zend/Form/Decorator/Label.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_Label. @@ -437,7 +436,6 @@ public function render($content) } if (null !== $tag) { - require_once 'Zend/Form/Decorator/HtmlTag.php'; $decorator = new Zend_Form_Decorator_HtmlTag(); if (null !== $this->_tagClass) { $decorator->setOptions(['tag' => $tag, diff --git a/library/Zend/Form/Decorator/PrepareElements.php b/library/Zend/Form/Decorator/PrepareElements.php index b16f1fbb..cc76d5d8 100644 --- a/library/Zend/Form/Decorator/PrepareElements.php +++ b/library/Zend/Form/Decorator/PrepareElements.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_FormElements */ -require_once 'Zend/Form/Decorator/FormElements.php'; /** * Zend_Form_Decorator_PrepareElements. diff --git a/library/Zend/Form/Decorator/Tooltip.php b/library/Zend/Form/Decorator/Tooltip.php index eebfc996..c336f834 100644 --- a/library/Zend/Form/Decorator/Tooltip.php +++ b/library/Zend/Form/Decorator/Tooltip.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_Tooltip. diff --git a/library/Zend/Form/Decorator/ViewHelper.php b/library/Zend/Form/Decorator/ViewHelper.php index f89268e8..2684fd48 100644 --- a/library/Zend/Form/Decorator/ViewHelper.php +++ b/library/Zend/Form/Decorator/ViewHelper.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_ViewHelper. diff --git a/library/Zend/Form/Decorator/ViewScript.php b/library/Zend/Form/Decorator/ViewScript.php index 44bcf49c..757e5e6d 100644 --- a/library/Zend/Form/Decorator/ViewScript.php +++ b/library/Zend/Form/Decorator/ViewScript.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Decorator_Abstract */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Zend_Form_Decorator_ViewScript. diff --git a/library/Zend/Form/DisplayGroup.php b/library/Zend/Form/DisplayGroup.php index 49e13324..bddd69c6 100644 --- a/library/Zend/Form/DisplayGroup.php +++ b/library/Zend/Form/DisplayGroup.php @@ -927,7 +927,6 @@ public function setView(?Zend_View_Interface $view = null) public function getView() { if (null === $this->_view) { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $this->setView($viewRenderer->view); } @@ -1004,8 +1003,6 @@ public function getTranslator() } if (null === $this->_translator) { - require_once 'Zend/Form.php'; - return Zend_Form::getDefaultTranslator(); } diff --git a/library/Zend/Form/Element.php b/library/Zend/Form/Element.php index 493e59fc..8651394d 100644 --- a/library/Zend/Form/Element.php +++ b/library/Zend/Form/Element.php @@ -16,16 +16,12 @@ */ /** @see Zend_Filter */ -require_once 'Zend/Filter.php'; /** @see Zend_Form */ -require_once 'Zend/Form.php'; /** @see Zend_Validate_Interface */ -require_once 'Zend/Validate/Interface.php'; /** @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Zend_Form_Element. @@ -1098,7 +1094,6 @@ public function getPluginLoader($type) $pathSegment = 'Form/Decorator'; } if (!isset($this->_loaders[$type])) { - require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( ['Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/'] ); @@ -1901,7 +1896,6 @@ public function setView(?Zend_View_Interface $view = null) public function getView() { if (null === $this->_view) { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); $this->setView($viewRenderer->view); } diff --git a/library/Zend/Form/Element/Button.php b/library/Zend/Form/Element/Button.php index de89e853..544ea19e 100644 --- a/library/Zend/Form/Element/Button.php +++ b/library/Zend/Form/Element/Button.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Submit */ -require_once 'Zend/Form/Element/Submit.php'; /** * Button form element. diff --git a/library/Zend/Form/Element/Captcha.php b/library/Zend/Form/Element/Captcha.php index bc3783f6..61915def 100644 --- a/library/Zend/Form/Element/Captcha.php +++ b/library/Zend/Form/Element/Captcha.php @@ -18,10 +18,8 @@ */ /** @see Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** @see Zend_Captcha_Adapter */ -require_once 'Zend/Captcha/Adapter.php'; /** * Generic captcha element. @@ -198,7 +196,6 @@ public function getPluginLoader($type) $type = strtoupper($type); if ($type == self::CAPTCHA) { if (!isset($this->_loaders[$type])) { - require_once 'Zend/Loader/PluginLoader.php'; $this->_loaders[$type] = new Zend_Loader_PluginLoader( ['Zend_Captcha' => 'Zend/Captcha/'] ); diff --git a/library/Zend/Form/Element/Checkbox.php b/library/Zend/Form/Element/Checkbox.php index cadf498e..e58d582d 100644 --- a/library/Zend/Form/Element/Checkbox.php +++ b/library/Zend/Form/Element/Checkbox.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Checkbox form element. diff --git a/library/Zend/Form/Element/File.php b/library/Zend/Form/Element/File.php index eea2a56a..95e71bbc 100644 --- a/library/Zend/Form/Element/File.php +++ b/library/Zend/Form/Element/File.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Zend_Form_Element. @@ -126,7 +125,6 @@ public function getPluginLoader($type) } if (!array_key_exists($type, $this->_loaders)) { - require_once 'Zend/Loader/PluginLoader.php'; $loader = new Zend_Loader_PluginLoader([ 'Zend_File_Transfer_Adapter' => 'Zend/File/Transfer/Adapter/', ]); @@ -782,8 +780,6 @@ public function getTranslator() $translator = $this->getTransferAdapter()->getTranslator(); if (null === $translator) { - require_once 'Zend/Form.php'; - return Zend_Form::getDefaultTranslator(); } diff --git a/library/Zend/Form/Element/Hash.php b/library/Zend/Form/Element/Hash.php index 27d803da..1cb29c02 100644 --- a/library/Zend/Form/Element/Hash.php +++ b/library/Zend/Form/Element/Hash.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * CSRF form protection. @@ -103,7 +102,6 @@ public function setSession($session) public function getSession() { if (null === $this->_session) { - require_once 'Zend/Session/Namespace.php'; $this->_session = new Zend_Session_Namespace($this->getSessionName()); } diff --git a/library/Zend/Form/Element/Hidden.php b/library/Zend/Form/Element/Hidden.php index f1e48a80..87428f33 100644 --- a/library/Zend/Form/Element/Hidden.php +++ b/library/Zend/Form/Element/Hidden.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Hidden form element. diff --git a/library/Zend/Form/Element/Image.php b/library/Zend/Form/Element/Image.php index d415b0ec..89c8f9b1 100644 --- a/library/Zend/Form/Element/Image.php +++ b/library/Zend/Form/Element/Image.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Image form element. diff --git a/library/Zend/Form/Element/Multi.php b/library/Zend/Form/Element/Multi.php index 858f3db2..40a05fdd 100644 --- a/library/Zend/Form/Element/Multi.php +++ b/library/Zend/Form/Element/Multi.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Base class for multi-option form elements. diff --git a/library/Zend/Form/Element/MultiCheckbox.php b/library/Zend/Form/Element/MultiCheckbox.php index aae1e2f8..d794c8f2 100644 --- a/library/Zend/Form/Element/MultiCheckbox.php +++ b/library/Zend/Form/Element/MultiCheckbox.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Multi */ -require_once 'Zend/Form/Element/Multi.php'; /** * MultiCheckbox form element. diff --git a/library/Zend/Form/Element/Multiselect.php b/library/Zend/Form/Element/Multiselect.php index 4e5f29cd..b75207b9 100644 --- a/library/Zend/Form/Element/Multiselect.php +++ b/library/Zend/Form/Element/Multiselect.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Select */ -require_once 'Zend/Form/Element/Select.php'; /** * Multiselect form element. diff --git a/library/Zend/Form/Element/Note.php b/library/Zend/Form/Element/Note.php index e3442cbf..58f86db6 100644 --- a/library/Zend/Form/Element/Note.php +++ b/library/Zend/Form/Element/Note.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Element to show an HTML note. diff --git a/library/Zend/Form/Element/Password.php b/library/Zend/Form/Element/Password.php index d39bfbb8..92cbc1c0 100644 --- a/library/Zend/Form/Element/Password.php +++ b/library/Zend/Form/Element/Password.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Password form element. diff --git a/library/Zend/Form/Element/Radio.php b/library/Zend/Form/Element/Radio.php index 7fa26fdd..b00bdb8e 100644 --- a/library/Zend/Form/Element/Radio.php +++ b/library/Zend/Form/Element/Radio.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Multi */ -require_once 'Zend/Form/Element/Multi.php'; /** * Radio form element. diff --git a/library/Zend/Form/Element/Reset.php b/library/Zend/Form/Element/Reset.php index fa2cd618..c9c3bee3 100644 --- a/library/Zend/Form/Element/Reset.php +++ b/library/Zend/Form/Element/Reset.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Submit */ -require_once 'Zend/Form/Element/Submit.php'; /** * Reset form element. diff --git a/library/Zend/Form/Element/Select.php b/library/Zend/Form/Element/Select.php index a17a5167..3fe4ecb0 100644 --- a/library/Zend/Form/Element/Select.php +++ b/library/Zend/Form/Element/Select.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Multi */ -require_once 'Zend/Form/Element/Multi.php'; /** * Select.php form element. diff --git a/library/Zend/Form/Element/Submit.php b/library/Zend/Form/Element/Submit.php index 102c756e..f40d520f 100644 --- a/library/Zend/Form/Element/Submit.php +++ b/library/Zend/Form/Element/Submit.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Submit form element. diff --git a/library/Zend/Form/Element/Text.php b/library/Zend/Form/Element/Text.php index d22a5a49..33990bd1 100644 --- a/library/Zend/Form/Element/Text.php +++ b/library/Zend/Form/Element/Text.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Text form element. diff --git a/library/Zend/Form/Element/Textarea.php b/library/Zend/Form/Element/Textarea.php index 2489a5df..6b9405ca 100644 --- a/library/Zend/Form/Element/Textarea.php +++ b/library/Zend/Form/Element/Textarea.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element_Xhtml */ -require_once 'Zend/Form/Element/Xhtml.php'; /** * Textarea form element. diff --git a/library/Zend/Form/Element/Xhtml.php b/library/Zend/Form/Element/Xhtml.php index 156824b5..4e635985 100644 --- a/library/Zend/Form/Element/Xhtml.php +++ b/library/Zend/Form/Element/Xhtml.php @@ -16,7 +16,6 @@ */ /** Zend_Form_Element */ -require_once 'Zend/Form/Element.php'; /** * Base element for XHTML elements. diff --git a/library/Zend/Form/SubForm.php b/library/Zend/Form/SubForm.php index 57df2832..bf04c30a 100644 --- a/library/Zend/Form/SubForm.php +++ b/library/Zend/Form/SubForm.php @@ -16,7 +16,6 @@ */ /** Zend_Form */ -require_once 'Zend/Form.php'; /** * Zend_Form_SubForm. diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php index 83e8b5e7..cc63d845 100644 --- a/library/Zend/Http/Client.php +++ b/library/Zend/Http/Client.php @@ -18,36 +18,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Loader - */ -require_once 'Zend/Loader.php'; - -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; - -/** - * @see Zend_Http_Client_Adapter_Interface - */ -require_once 'Zend/Http/Client/Adapter/Interface.php'; - -/** - * @see Zend_Http_Header_HeaderValue - */ -require_once 'Zend/Http/Header/HeaderValue.php'; - -/** - * @see Zend_Http_Response - */ -require_once 'Zend/Http/Response.php'; - -/** - * @see Zend_Http_Response_Stream - */ -require_once 'Zend/Http/Response/Stream.php'; - /** * Zend_Http_Client is an implementation of an HTTP client in PHP. The client * supports basic features like sending different HTTP requests and handling diff --git a/library/Zend/Http/Client/Adapter/Curl.php b/library/Zend/Http/Client/Adapter/Curl.php index ad68e424..b11fbdca 100644 --- a/library/Zend/Http/Client/Adapter/Curl.php +++ b/library/Zend/Http/Client/Adapter/Curl.php @@ -18,20 +18,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Uri_Http - */ -require_once 'Zend/Uri/Http.php'; - -/** - * @see Zend_Http_Client_Adapter_Interface - */ -require_once 'Zend/Http/Client/Adapter/Interface.php'; -/** - * @see Zend_Http_Client_Adapter_Stream - */ -require_once 'Zend/Http/Client/Adapter/Stream.php'; - /** * An adapter class for Zend_Http_Client based on the curl extension. * Curl requires libcurl. See for full requirements the PHP manual: http://php.net/curl. diff --git a/library/Zend/Http/Client/Adapter/Proxy.php b/library/Zend/Http/Client/Adapter/Proxy.php index 6439a14a..2969d2ba 100644 --- a/library/Zend/Http/Client/Adapter/Proxy.php +++ b/library/Zend/Http/Client/Adapter/Proxy.php @@ -18,19 +18,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Uri_Http - */ -require_once 'Zend/Uri/Http.php'; -/** - * @see Zend_Http_Client - */ -require_once 'Zend/Http/Client.php'; -/** - * @see Zend_Http_Client_Adapter_Socket - */ -require_once 'Zend/Http/Client/Adapter/Socket.php'; - /** * HTTP Proxy-supporting Zend_Http_Client adapter class, based on the default * socket based adapter. diff --git a/library/Zend/Http/Client/Adapter/Socket.php b/library/Zend/Http/Client/Adapter/Socket.php index ead97599..efce3dc6 100644 --- a/library/Zend/Http/Client/Adapter/Socket.php +++ b/library/Zend/Http/Client/Adapter/Socket.php @@ -18,19 +18,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Uri_Http - */ -require_once 'Zend/Uri/Http.php'; -/** - * @see Zend_Http_Client_Adapter_Interface - */ -require_once 'Zend/Http/Client/Adapter/Interface.php'; -/** - * @see Zend_Http_Client_Adapter_Stream - */ -require_once 'Zend/Http/Client/Adapter/Stream.php'; - /** * A sockets based (stream_socket_client) adapter class for Zend_Http_Client. Can be used * on almost every PHP environment, and does not require any special extensions. diff --git a/library/Zend/Http/Client/Adapter/Test.php b/library/Zend/Http/Client/Adapter/Test.php index b5a48eac..f5d8d2ba 100644 --- a/library/Zend/Http/Client/Adapter/Test.php +++ b/library/Zend/Http/Client/Adapter/Test.php @@ -17,19 +17,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Uri_Http - */ -require_once 'Zend/Uri/Http.php'; -/** - * @see Zend_Http_Response - */ -require_once 'Zend/Http/Response.php'; -/** - * @see Zend_Http_Client_Adapter_Interface - */ -require_once 'Zend/Http/Client/Adapter/Interface.php'; - /** * A testing-purposes adapter. * diff --git a/library/Zend/Http/Cookie.php b/library/Zend/Http/Cookie.php index 6f549254..3764b6e8 100644 --- a/library/Zend/Http/Cookie.php +++ b/library/Zend/Http/Cookie.php @@ -18,11 +18,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Uri_Http - */ -require_once 'Zend/Uri/Http.php'; - /** * Zend_Http_Cookie is a class describing an HTTP cookie and all it's parameters. * @@ -339,8 +334,6 @@ public static function fromString($cookieStr, $refUri = null, $encodeValue = tru * * @see Zend_Date */ - require_once 'Zend/Date.php'; - $expireDate = new Zend_Date($v); $expires = $expireDate->getTimestamp(); } diff --git a/library/Zend/Http/CookieJar.php b/library/Zend/Http/CookieJar.php index 830c17ae..74437fff 100644 --- a/library/Zend/Http/CookieJar.php +++ b/library/Zend/Http/CookieJar.php @@ -17,19 +17,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; -/** - * @see Zend_Http_Cookie - */ -require_once 'Zend/Http/Cookie.php'; -/** - * @see Zend_Http_Response - */ -require_once 'Zend/Http/Response.php'; - /** * A Zend_Http_CookieJar object is designed to contain and maintain HTTP cookies, and should * be used along with Zend_Http_Client in order to manage cookies across HTTP requests and diff --git a/library/Zend/Http/Header/SetCookie.php b/library/Zend/Http/Header/SetCookie.php index bed965bc..7bba0891 100644 --- a/library/Zend/Http/Header/SetCookie.php +++ b/library/Zend/Http/Header/SetCookie.php @@ -24,10 +24,6 @@ /** * @see Zend_Http_Header_Exception_RuntimeException */ -/** - * @see Zend_Http_Header_HeaderValue - */ -require_once 'Zend/Http/Header/HeaderValue.php'; /** * Zend_Http_Client is an implementation of an HTTP client in PHP. The client diff --git a/library/Zend/Http/Response.php b/library/Zend/Http/Response.php index ccdc8640..426932d8 100644 --- a/library/Zend/Http/Response.php +++ b/library/Zend/Http/Response.php @@ -18,11 +18,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Http_Header_HeaderValue - */ -require_once 'Zend/Http/Header/HeaderValue.php'; - /** * Zend_Http_Response represents an HTTP 1.0 / 1.1 response message. It * includes easy access to all the response's different elemts, as well as some diff --git a/library/Zend/Http/UserAgent.php b/library/Zend/Http/UserAgent.php index f881a3e5..67cebc34 100644 --- a/library/Zend/Http/UserAgent.php +++ b/library/Zend/Http/UserAgent.php @@ -735,7 +735,6 @@ public function setPluginLoader($type, $loader) if (is_string($loader)) { if (!class_exists($loader)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($loader); } $loader = new $loader(); @@ -783,7 +782,6 @@ public function getPluginLoader($type) { $type = $this->_validateLoaderType($type); if (!isset($this->_loaders[$type])) { - require_once 'Zend/Loader/PluginLoader.php'; $this->setPluginLoader($type, new Zend_Loader_PluginLoader()); } diff --git a/library/Zend/Http/UserAgent/AbstractDevice.php b/library/Zend/Http/UserAgent/AbstractDevice.php index 6b2137b8..437d27ee 100644 --- a/library/Zend/Http/UserAgent/AbstractDevice.php +++ b/library/Zend/Http/UserAgent/AbstractDevice.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/Device.php'; /** * Abstract Class to define a browser device. diff --git a/library/Zend/Http/UserAgent/Bot.php b/library/Zend/Http/UserAgent/Bot.php index bb77b384..2d4ca3db 100644 --- a/library/Zend/Http/UserAgent/Bot.php +++ b/library/Zend/Http/UserAgent/Bot.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/AbstractDevice.php'; /** * Bot browser type matcher. diff --git a/library/Zend/Http/UserAgent/Checker.php b/library/Zend/Http/UserAgent/Checker.php index 332b63fc..dc9679cc 100644 --- a/library/Zend/Http/UserAgent/Checker.php +++ b/library/Zend/Http/UserAgent/Checker.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/Desktop.php'; /** * Checker browser type matcher. diff --git a/library/Zend/Http/UserAgent/Console.php b/library/Zend/Http/UserAgent/Console.php index 24cd10f5..4fa6bada 100644 --- a/library/Zend/Http/UserAgent/Console.php +++ b/library/Zend/Http/UserAgent/Console.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/Desktop.php'; /** * Console browser type matcher. diff --git a/library/Zend/Http/UserAgent/Desktop.php b/library/Zend/Http/UserAgent/Desktop.php index 54a8e848..193dbdca 100644 --- a/library/Zend/Http/UserAgent/Desktop.php +++ b/library/Zend/Http/UserAgent/Desktop.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/AbstractDevice.php'; /** * Desktop browser type matcher. diff --git a/library/Zend/Http/UserAgent/Email.php b/library/Zend/Http/UserAgent/Email.php index 7317e742..051a75ef 100644 --- a/library/Zend/Http/UserAgent/Email.php +++ b/library/Zend/Http/UserAgent/Email.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/Desktop.php'; /** * Email browser type matcher. diff --git a/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php b/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php index 5b8e46f1..9a44ed63 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/Browscap.php @@ -18,7 +18,6 @@ /** * Zend_Http_UserAgent_Features_Adapter_Interface. */ -require_once 'Zend/Http/UserAgent/Features/Adapter.php'; /** * Features adapter utilizing PHP's native browscap support. diff --git a/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php b/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php index 700dd2cc..de59a4c7 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php @@ -18,7 +18,6 @@ /** * Zend_Http_UserAgent_Features_Adapter_Interface. */ -require_once 'Zend/Http/UserAgent/Features/Adapter.php'; /** * Features adapter build with the Tera Wurfl Api diff --git a/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php b/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php index 4fb8a8e9..f4e3144c 100644 --- a/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php +++ b/library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php @@ -18,7 +18,6 @@ /** * Zend_Http_UserAgent_Features_Adapter_Interface. */ -require_once 'Zend/Http/UserAgent/Features/Adapter.php'; /** * Features adapter build with the Tera Wurfl Api diff --git a/library/Zend/Http/UserAgent/Feed.php b/library/Zend/Http/UserAgent/Feed.php index 9dd427a8..59b1cf45 100644 --- a/library/Zend/Http/UserAgent/Feed.php +++ b/library/Zend/Http/UserAgent/Feed.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/AbstractDevice.php'; /** * Feed browser type matcher. diff --git a/library/Zend/Http/UserAgent/Mobile.php b/library/Zend/Http/UserAgent/Mobile.php index 773649c0..e866dd3f 100644 --- a/library/Zend/Http/UserAgent/Mobile.php +++ b/library/Zend/Http/UserAgent/Mobile.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/AbstractDevice.php'; /** * Mobile browser type matcher. diff --git a/library/Zend/Http/UserAgent/Offline.php b/library/Zend/Http/UserAgent/Offline.php index 8858e9f0..ecfc1a68 100644 --- a/library/Zend/Http/UserAgent/Offline.php +++ b/library/Zend/Http/UserAgent/Offline.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/Desktop.php'; /** * Offline browser type matcher. diff --git a/library/Zend/Http/UserAgent/Probe.php b/library/Zend/Http/UserAgent/Probe.php index ea2a7a94..055ad6e4 100644 --- a/library/Zend/Http/UserAgent/Probe.php +++ b/library/Zend/Http/UserAgent/Probe.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/AbstractDevice.php'; /** * Probe browser type matcher. diff --git a/library/Zend/Http/UserAgent/Spam.php b/library/Zend/Http/UserAgent/Spam.php index da049220..c1c43f94 100644 --- a/library/Zend/Http/UserAgent/Spam.php +++ b/library/Zend/Http/UserAgent/Spam.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/AbstractDevice.php'; /** * Spam browser type matcher. diff --git a/library/Zend/Http/UserAgent/Storage/NonPersistent.php b/library/Zend/Http/UserAgent/Storage/NonPersistent.php index e11abcc4..dc4a703a 100644 --- a/library/Zend/Http/UserAgent/Storage/NonPersistent.php +++ b/library/Zend/Http/UserAgent/Storage/NonPersistent.php @@ -17,11 +17,6 @@ * @version $Id: NonPersistent.php 20096 2010-01-06 02:05:09Z bkarwin $ */ -/** - * @see Zend_Http_UserAgent_Storage_Interface - */ -require_once 'Zend/Http/UserAgent/Storage.php'; - /** * Non-Persistent Browser Storage. * diff --git a/library/Zend/Http/UserAgent/Storage/Session.php b/library/Zend/Http/UserAgent/Storage/Session.php index 234e2a26..4bb384ee 100644 --- a/library/Zend/Http/UserAgent/Storage/Session.php +++ b/library/Zend/Http/UserAgent/Storage/Session.php @@ -15,16 +15,6 @@ * @license http://framework.zend.com/license/new-bsd New BSD License */ -/** - * @see Zend_Http_UserAgent_Storage - */ -require_once 'Zend/Http/UserAgent/Storage.php'; - -/** - * @see Zend_Session_Namespace - */ -require_once 'Zend/Session/Namespace.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Http/UserAgent/Text.php b/library/Zend/Http/UserAgent/Text.php index fec83c31..28498d09 100644 --- a/library/Zend/Http/UserAgent/Text.php +++ b/library/Zend/Http/UserAgent/Text.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/AbstractDevice.php'; /** * Text browser type matcher. diff --git a/library/Zend/Http/UserAgent/Validator.php b/library/Zend/Http/UserAgent/Validator.php index 93572262..c7f9f0df 100644 --- a/library/Zend/Http/UserAgent/Validator.php +++ b/library/Zend/Http/UserAgent/Validator.php @@ -14,7 +14,6 @@ * * @license http://framework.zend.com/license/new-bsd New BSD License */ -require_once 'Zend/Http/UserAgent/Desktop.php'; /** * Validator browser type matcher. diff --git a/library/Zend/Json.php b/library/Zend/Json.php index 1471d2fc..1e745056 100644 --- a/library/Zend/Json.php +++ b/library/Zend/Json.php @@ -22,10 +22,8 @@ * * @see Zend_Json_Expr */ -require_once 'Zend/Json/Expr.php'; /** @see Zend_Xml_Security */ -require_once 'Zend/Xml/Security.php'; /** * Class for encoding to and decoding from JSON. @@ -100,8 +98,6 @@ public static function decode($encodedValue, $objectDecodeType = Zend_Json::TYPE return $decode; } - require_once 'Zend/Json/Decoder.php'; - return Zend_Json_Decoder::decode($encodedValue, $objectDecodeType); } @@ -145,7 +141,6 @@ public static function encode($valueToEncode, $cycleCheck = false, $options = [] /** * @see Zend_Json_Encoder */ - require_once 'Zend/Json/Encoder.php'; $valueToEncode = self::_recursiveJsonExprFinder($valueToEncode, $javascriptExpressions); } @@ -153,7 +148,6 @@ public static function encode($valueToEncode, $cycleCheck = false, $options = [] if (function_exists('json_encode') && self::$useBuiltinEncoderDecoder !== true) { $encodedResult = json_encode($valueToEncode, JSON_THROW_ON_ERROR); } else { - require_once 'Zend/Json/Encoder.php'; $encodedResult = Zend_Json_Encoder::encode($valueToEncode, $cycleCheck, $options); } diff --git a/library/Zend/Json/Decoder.php b/library/Zend/Json/Decoder.php index af95a3d6..77dfd2af 100644 --- a/library/Zend/Json/Decoder.php +++ b/library/Zend/Json/Decoder.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Json - */ -require_once 'Zend/Json.php'; - /** * Decode JSON encoded string to PHP variable constructs. * diff --git a/library/Zend/Layout.php b/library/Zend/Layout.php index 8a3ceb4e..75b13a77 100644 --- a/library/Zend/Layout.php +++ b/library/Zend/Layout.php @@ -266,11 +266,9 @@ protected function _initMvc() protected function _initPlugin() { $pluginClass = $this->getPluginClass(); - require_once 'Zend/Controller/Front.php'; $front = Zend_Controller_Front::getInstance(); if (!$front->hasPlugin($pluginClass)) { if (!class_exists($pluginClass)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($pluginClass); } $front->registerPlugin( @@ -287,10 +285,8 @@ protected function _initPlugin() protected function _initHelper() { $helperClass = $this->getHelperClass(); - require_once 'Zend/Controller/Action/HelperBroker.php'; if (!Zend_Controller_Action_HelperBroker::hasHelper('layout')) { if (!class_exists($helperClass)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($helperClass); } Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-90, new $helperClass($this)); @@ -317,7 +313,6 @@ public function setConfig(Zend_Config $config) protected function _initVarContainer() { if (null === $this->_container) { - require_once 'Zend/View/Helper/Placeholder/Registry.php'; $this->_container = Zend_View_Helper_Placeholder_Registry::getRegistry()->getContainer(self::class); } @@ -581,7 +576,6 @@ public function setPluginClass($pluginClass) public function getView() { if (null === $this->_view) { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); if (null === $viewRenderer->view) { $viewRenderer->initView(); @@ -660,7 +654,6 @@ public function setInflector(Zend_Filter_Inflector $inflector) public function getInflector() { if (null === $this->_inflector) { - require_once 'Zend/Filter/Inflector.php'; $inflector = new Zend_Filter_Inflector(); $inflector->setTargetReference($this->_inflectorTarget) ->addRules([':script' => ['Word_CamelCaseToDash', 'StringToLower']]) diff --git a/library/Zend/Layout/Controller/Action/Helper/Layout.php b/library/Zend/Layout/Controller/Action/Helper/Layout.php index a022ea9d..2ec8d467 100644 --- a/library/Zend/Layout/Controller/Action/Helper/Layout.php +++ b/library/Zend/Layout/Controller/Action/Helper/Layout.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Action_Helper_Abstract */ -require_once 'Zend/Controller/Action/Helper/Abstract.php'; /** * Helper for interacting with Zend_Layout objects. @@ -56,7 +55,6 @@ public function __construct(?Zend_Layout $layout = null) /** * @see Zend_Layout */ - require_once 'Zend/Layout.php'; $layout = Zend_Layout::getMvcInstance(); } @@ -83,10 +81,7 @@ public function init() public function getFrontController() { if (null === $this->_frontController) { - /** - * @see Zend_Controller_Front - */ - require_once 'Zend/Controller/Front.php'; + // @see Zend_Controller_Front $this->_frontController = Zend_Controller_Front::getInstance(); } @@ -101,10 +96,7 @@ public function getFrontController() public function getLayoutInstance() { if (null === $this->_layout) { - /** - * @see Zend_Layout - */ - require_once 'Zend/Layout.php'; + // @see Zend_Layout if (null === ($this->_layout = Zend_Layout::getMvcInstance())) { $this->_layout = new Zend_Layout(); } diff --git a/library/Zend/Layout/Controller/Plugin/Layout.php b/library/Zend/Layout/Controller/Plugin/Layout.php index f9492433..690a7b2f 100644 --- a/library/Zend/Layout/Controller/Plugin/Layout.php +++ b/library/Zend/Layout/Controller/Plugin/Layout.php @@ -16,7 +16,6 @@ */ /** Zend_Controller_Plugin_Abstract */ -require_once 'Zend/Controller/Plugin/Abstract.php'; /** * Render layouts. diff --git a/library/Zend/Loader.php b/library/Zend/Loader.php index f7625099..bbf49c40 100644 --- a/library/Zend/Loader.php +++ b/library/Zend/Loader.php @@ -247,7 +247,6 @@ public static function autoload($class) public static function registerAutoload($class = \Zend_Loader::class, $enabled = true) { trigger_error(self::class . '::' . __METHOD__ . ' is deprecated as of 1.8.0 and will be removed with 2.0.0; use Zend_Loader_Autoloader instead', E_USER_NOTICE); - require_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->setFallbackAutoloader(true); diff --git a/library/Zend/Loader/Autoloader.php b/library/Zend/Loader/Autoloader.php index e6f7c7e2..ab964969 100644 --- a/library/Zend/Loader/Autoloader.php +++ b/library/Zend/Loader/Autoloader.php @@ -18,7 +18,6 @@ */ /** Zend_Loader */ -require_once 'Zend/Loader.php'; /** * Autoloader stack and namespace autoloader. diff --git a/library/Zend/Loader/Autoloader/Resource.php b/library/Zend/Loader/Autoloader/Resource.php index 018358a3..2be5a12f 100644 --- a/library/Zend/Loader/Autoloader/Resource.php +++ b/library/Zend/Loader/Autoloader/Resource.php @@ -18,7 +18,6 @@ */ /** Zend_Loader_Autoloader_Interface */ -require_once 'Zend/Loader/Autoloader/Interface.php'; /** * Resource loader. @@ -81,7 +80,6 @@ public function __construct($options) if (!empty($namespace)) { $namespace .= '_'; } - require_once 'Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance()->unshiftAutoloader($this, $namespace); } diff --git a/library/Zend/Loader/PluginLoader.php b/library/Zend/Loader/PluginLoader.php index f456111c..5547ba74 100644 --- a/library/Zend/Loader/PluginLoader.php +++ b/library/Zend/Loader/PluginLoader.php @@ -18,10 +18,8 @@ */ /** Zend_Loader_PluginLoader_Interface */ -require_once 'Zend/Loader/PluginLoader/Interface.php'; /** Zend_Loader */ -require_once 'Zend/Loader.php'; /** * Generic plugin class loader. diff --git a/library/Zend/Locale.php b/library/Zend/Locale.php index be53edee..cde1a082 100644 --- a/library/Zend/Locale.php +++ b/library/Zend/Locale.php @@ -1216,8 +1216,6 @@ public static function getEnvironment() return self::$_environment; } - require_once 'Zend/Locale/Data/Translation.php'; - $language = setlocale(LC_ALL, 0); $languages = explode(';', $language); $languagearray = []; @@ -1450,7 +1448,6 @@ public function equals(Zend_Locale $object) */ public static function getTranslationList($path = null, $locale = null, $value = null) { - require_once 'Zend/Locale/Data.php'; $locale = self::findLocale($locale); $result = Zend_Locale_Data::getList($locale, $path, $value); if (empty($result) === true) { @@ -1537,7 +1534,6 @@ public static function getTerritoryTranslationList($locale = null) */ public static function getTranslation($value = null, $path = null, $locale = null) { - require_once 'Zend/Locale/Data.php'; $locale = self::findLocale($locale); $result = Zend_Locale_Data::getContent($locale, $path, $value); if (empty($result) === true && '0' !== $result) { @@ -1625,7 +1621,6 @@ public static function getTerritoryTranslation($value, $locale = null) */ public static function getQuestion($locale = null) { - require_once 'Zend/Locale/Data.php'; $locale = self::findLocale($locale); $quest = Zend_Locale_Data::getList($locale, 'question'); $yes = explode(':', $quest['yes']); @@ -1759,7 +1754,6 @@ public static function isLocale($locale, $strict = false, $compatible = true) public static function findLocale($locale = null) { if ($locale === null) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Locale::class)) { $locale = Zend_Registry::get(\Zend_Locale::class); } @@ -1825,8 +1819,6 @@ public static function getLocaleList() */ public static function getCache() { - require_once 'Zend/Locale/Data.php'; - return Zend_Locale_Data::getCache(); } @@ -1837,7 +1829,6 @@ public static function getCache() */ public static function setCache(Zend_Cache_Core $cache) { - require_once 'Zend/Locale/Data.php'; Zend_Locale_Data::setCache($cache); } @@ -1848,8 +1839,6 @@ public static function setCache(Zend_Cache_Core $cache) */ public static function hasCache() { - require_once 'Zend/Locale/Data.php'; - return Zend_Locale_Data::hasCache(); } @@ -1858,7 +1847,6 @@ public static function hasCache() */ public static function removeCache() { - require_once 'Zend/Locale/Data.php'; Zend_Locale_Data::removeCache(); } @@ -1869,7 +1857,6 @@ public static function removeCache() */ public static function clearCache($tag = null) { - require_once 'Zend/Locale/Data.php'; Zend_Locale_Data::clearCache(); } @@ -1880,7 +1867,6 @@ public static function clearCache($tag = null) */ public static function disableCache($flag) { - require_once 'Zend/Locale/Data.php'; Zend_Locale_Data::disableCache($flag); } diff --git a/library/Zend/Locale/Data.php b/library/Zend/Locale/Data.php index 67d1d896..83e46e57 100644 --- a/library/Zend/Locale/Data.php +++ b/library/Zend/Locale/Data.php @@ -20,10 +20,8 @@ /** * include needed classes. */ -require_once 'Zend/Locale.php'; /** @see Zend_Xml_Security */ -require_once 'Zend/Xml/Security.php'; /** * Locale data reader, handles the CLDR. @@ -304,7 +302,6 @@ public static function getList($locale, $path, $value = false) $locale = self::_checkLocale($locale); if (!isset(self::$_cache) && !self::$_cacheDisabled) { - require_once 'Zend/Cache.php'; self::$_cache = Zend_Cache::factory( 'Core', 'File', @@ -1015,7 +1012,6 @@ public static function getContent($locale, $path, $value = false) $locale = self::_checkLocale($locale); if (!isset(self::$_cache) && !self::$_cacheDisabled) { - require_once 'Zend/Cache.php'; self::$_cache = Zend_Cache::factory( 'Core', 'File', diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php index 6ea43cc6..e8f7e397 100644 --- a/library/Zend/Locale/Format.php +++ b/library/Zend/Locale/Format.php @@ -20,7 +20,6 @@ /** * include needed classes. */ -require_once 'Zend/Locale/Data.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License @@ -298,7 +297,6 @@ public static function getNumber($input, array $options = []) public static function toNumber($value, array $options = []) { // load class within method for speed - require_once 'Zend/Locale/Math.php'; $value = Zend_Locale_Math::floatalize($value); $value = Zend_Locale_Math::normalize($value); diff --git a/library/Zend/Locale/Math.php b/library/Zend/Locale/Math.php index 8821177e..18d66b1e 100644 --- a/library/Zend/Locale/Math.php +++ b/library/Zend/Locale/Math.php @@ -376,6 +376,5 @@ public static function Comp($op1, $op2, $scale = null) if (!extension_loaded('bcmath') || (defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') && !TESTS_ZEND_LOCALE_BCMATH_ENABLED) ) { - require_once 'Zend/Locale/Math/PhpMath.php'; Zend_Locale_Math_PhpMath::disable(); } diff --git a/library/Zend/Navigation.php b/library/Zend/Navigation.php index c8e7440b..71a50235 100644 --- a/library/Zend/Navigation.php +++ b/library/Zend/Navigation.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Navigation_Container - */ -require_once 'Zend/Navigation/Container.php'; - /** * A simple container class for {@link Zend_Navigation_Page} pages. * diff --git a/library/Zend/Navigation/Container.php b/library/Zend/Navigation/Container.php index 0be515a9..de34b636 100644 --- a/library/Zend/Navigation/Container.php +++ b/library/Zend/Navigation/Container.php @@ -104,7 +104,6 @@ public function addPage($page) } if (is_array($page) || $page instanceof Zend_Config) { - require_once 'Zend/Navigation/Page.php'; $page = Zend_Navigation_Page::factory($page); } elseif (!$page instanceof Zend_Navigation_Page) { throw new Zend_Navigation_Exception( diff --git a/library/Zend/Navigation/Page.php b/library/Zend/Navigation/Page.php index 39e08b13..0935b13c 100644 --- a/library/Zend/Navigation/Page.php +++ b/library/Zend/Navigation/Page.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Navigation_Container - */ -require_once 'Zend/Navigation/Container.php'; - /** * Base class for Zend_Navigation_Page pages. * @@ -225,7 +220,6 @@ public static function factory($options) } if (!class_exists($type)) { - require_once 'Zend/Loader.php'; @Zend_Loader::loadClass($type); } @@ -247,13 +241,9 @@ public static function factory($options) || isset($options['params']); if ($hasMvc) { - require_once 'Zend/Navigation/Page/Mvc.php'; - return new Zend_Navigation_Page_Mvc($options); } if ($hasUri) { - require_once 'Zend/Navigation/Page/Uri.php'; - return new Zend_Navigation_Page_Uri($options); } $message = 'Invalid argument: Unable to determine class to instantiate'; diff --git a/library/Zend/Navigation/Page/Mvc.php b/library/Zend/Navigation/Page/Mvc.php index cdba2350..6fc66ed5 100644 --- a/library/Zend/Navigation/Page/Mvc.php +++ b/library/Zend/Navigation/Page/Mvc.php @@ -17,22 +17,11 @@ * @version $Id$ */ -/** - * @see Zend_Navigation_Page - */ -require_once 'Zend/Navigation/Page.php'; - -/** - * @see Zend_Controller_Action_HelperBroker - */ -require_once 'Zend/Controller/Action/HelperBroker.php'; - /** * Used to check if page is active. * * @see Zend_Controller_Front */ -require_once 'Zend/Controller/Front.php'; /** * Represents a page that is defined using module, controller, action, route @@ -265,7 +254,6 @@ public function getHref() $scheme = $this->getScheme(); if (null !== $scheme) { if (null === self::$_schemeHelper) { - require_once 'Zend/View/Helper/ServerUrl.php'; self::$_schemeHelper = new Zend_View_Helper_ServerUrl(); } diff --git a/library/Zend/Navigation/Page/Uri.php b/library/Zend/Navigation/Page/Uri.php index 4ced0424..9254944f 100644 --- a/library/Zend/Navigation/Page/Uri.php +++ b/library/Zend/Navigation/Page/Uri.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Navigation_Page_Abstract - */ -require_once 'Zend/Navigation/Page.php'; - /** * Represents a page that is defined by specifying a URI. * diff --git a/library/Zend/Paginator.php b/library/Zend/Paginator.php index 80272155..528faca1 100644 --- a/library/Zend/Paginator.php +++ b/library/Zend/Paginator.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Loader_PluginLoader - */ -require_once 'Zend/Loader/PluginLoader.php'; - -/** - * @see Zend_Json - */ -require_once 'Zend/Json.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -892,8 +882,6 @@ public function getView() /** * @see Zend_Controller_Action_HelperBroker */ - require_once 'Zend/Controller/Action/HelperBroker.php'; - $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); if ($viewRenderer->view === null) { $viewRenderer->initView(); diff --git a/library/Zend/Paginator/Adapter/Array.php b/library/Zend/Paginator/Adapter/Array.php index 6b1280c0..4153b1fa 100644 --- a/library/Zend/Paginator/Adapter/Array.php +++ b/library/Zend/Paginator/Adapter/Array.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Paginator_Adapter_Interface - */ -require_once 'Zend/Paginator/Adapter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Paginator/Adapter/Iterator.php b/library/Zend/Paginator/Adapter/Iterator.php index cbab2e14..5549d8b8 100644 --- a/library/Zend/Paginator/Adapter/Iterator.php +++ b/library/Zend/Paginator/Adapter/Iterator.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Paginator_Adapter_Interface - */ -require_once 'Zend/Paginator/Adapter/Interface.php'; - -/** - * @see Zend_Paginator_SerializableLimitIterator - */ -require_once 'Zend/Paginator/SerializableLimitIterator.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Paginator/Adapter/Null.php b/library/Zend/Paginator/Adapter/Null.php index 40c3d0bc..8563b5e3 100644 --- a/library/Zend/Paginator/Adapter/Null.php +++ b/library/Zend/Paginator/Adapter/Null.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Paginator_Adapter_Interface - */ -require_once 'Zend/Paginator/Adapter/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Paginator/ScrollingStyle/All.php b/library/Zend/Paginator/ScrollingStyle/All.php index 372d99d0..9f16196b 100644 --- a/library/Zend/Paginator/ScrollingStyle/All.php +++ b/library/Zend/Paginator/ScrollingStyle/All.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Paginator_ScrollingStyle_Interface - */ -require_once 'Zend/Paginator/ScrollingStyle/Interface.php'; - /** * A scrolling style that returns every page in the collection. * Useful when it is necessary to make every page available at diff --git a/library/Zend/Paginator/ScrollingStyle/Elastic.php b/library/Zend/Paginator/ScrollingStyle/Elastic.php index 889c9a9c..00d82594 100644 --- a/library/Zend/Paginator/ScrollingStyle/Elastic.php +++ b/library/Zend/Paginator/ScrollingStyle/Elastic.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Paginator_ScrollingStyle_Sliding - */ -require_once 'Zend/Paginator/ScrollingStyle/Sliding.php'; - /** * A Google-like scrolling style. Incrementally expands the range to about * twice the given page range, then behaves like a slider. See the example diff --git a/library/Zend/Paginator/ScrollingStyle/Jumping.php b/library/Zend/Paginator/ScrollingStyle/Jumping.php index 86e2e600..4c9739e0 100644 --- a/library/Zend/Paginator/ScrollingStyle/Jumping.php +++ b/library/Zend/Paginator/ScrollingStyle/Jumping.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Paginator_ScrollingStyle_Interface - */ -require_once 'Zend/Paginator/ScrollingStyle/Interface.php'; - /** * A scrolling style in which the cursor advances to the upper bound * of the page range, the page range "jumps" to the next section, and diff --git a/library/Zend/Paginator/ScrollingStyle/Sliding.php b/library/Zend/Paginator/ScrollingStyle/Sliding.php index 7082d4b7..0a34dbff 100644 --- a/library/Zend/Paginator/ScrollingStyle/Sliding.php +++ b/library/Zend/Paginator/ScrollingStyle/Sliding.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Paginator_ScrollingStyle_Interface - */ -require_once 'Zend/Paginator/ScrollingStyle/Interface.php'; - /** * A Yahoo! Search-like scrolling style. The cursor will advance to * the middle of the range, then remain there until the user reaches diff --git a/library/Zend/ProgressBar.php b/library/Zend/ProgressBar.php index e9790f14..328a5cf9 100644 --- a/library/Zend/ProgressBar.php +++ b/library/Zend/ProgressBar.php @@ -92,8 +92,6 @@ public function __construct(Zend_ProgressBar_Adapter $adapter, $min = 0, $max = // See if we have to open a session namespace if ($persistenceNamespace !== null) { - require_once 'Zend/Session/Namespace.php'; - $this->_persistenceNamespace = new Zend_Session_Namespace($persistenceNamespace); } diff --git a/library/Zend/Registry.php b/library/Zend/Registry.php index ed9b247c..e0d133a5 100644 --- a/library/Zend/Registry.php +++ b/library/Zend/Registry.php @@ -94,7 +94,6 @@ public static function setClassName($registryClassName = \Zend_Registry::class) // @see Zend_Loader if (!class_exists($registryClassName)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($registryClassName); } diff --git a/library/Zend/Rest/Client.php b/library/Zend/Rest/Client.php index 6fb5ac48..2d9aa3ba 100644 --- a/library/Zend/Rest/Client.php +++ b/library/Zend/Rest/Client.php @@ -18,13 +18,10 @@ */ /** Zend_Service_Abstract */ -require_once 'Zend/Service/Abstract.php'; /** Zend_Rest_Client_Result */ -require_once 'Zend/Rest/Client/Result.php'; /** Zend_Uri */ -require_once 'Zend/Uri.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Rest/Client/Result.php b/library/Zend/Rest/Client/Result.php index dd8c69de..38b169de 100644 --- a/library/Zend/Rest/Client/Result.php +++ b/library/Zend/Rest/Client/Result.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Xml/Security.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Rest/Controller.php b/library/Zend/Rest/Controller.php index 4a3533b0..5ce22cb3 100644 --- a/library/Zend/Rest/Controller.php +++ b/library/Zend/Rest/Controller.php @@ -18,7 +18,6 @@ */ /** Zend_Controller_Action */ -require_once 'Zend/Controller/Action.php'; /** * An abstract class to guide implementation of action controllers for use with diff --git a/library/Zend/Rest/Route.php b/library/Zend/Rest/Route.php index 971f840f..d62bbcc4 100644 --- a/library/Zend/Rest/Route.php +++ b/library/Zend/Rest/Route.php @@ -17,26 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Controller_Router_Route_Interface - */ -require_once 'Zend/Controller/Router/Route/Interface.php'; - -/** - * @see Zend_Controller_Router_Route_Module - */ -require_once 'Zend/Controller/Router/Route/Module.php'; - -/** - * @see Zend_Controller_Dispatcher_Interface - */ -require_once 'Zend/Controller/Dispatcher/Interface.php'; - -/** - * @see Zend_Controller_Request_Abstract - */ -require_once 'Zend/Controller/Request/Abstract.php'; - /** * Rest Route. * diff --git a/library/Zend/Service/Abstract.php b/library/Zend/Service/Abstract.php index ad62c8df..554bc3c2 100644 --- a/library/Zend/Service/Abstract.php +++ b/library/Zend/Service/Abstract.php @@ -20,7 +20,6 @@ /** * Zend_Http_Client. */ -require_once 'Zend/Http/Client.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Session.php b/library/Zend/Session.php index e64f7dc1..f86b2e73 100644 --- a/library/Zend/Session.php +++ b/library/Zend/Session.php @@ -20,21 +20,6 @@ * @since Preview Release 0.2 */ -/** - * @see Zend_Session_Abstract - */ -require_once 'Zend/Session/Abstract.php'; - -/** - * @see Zend_Session_Namespace - */ -require_once 'Zend/Session/Namespace.php'; - -/** - * @see Zend_Session_SaveHandler_Interface - */ -require_once 'Zend/Session/SaveHandler/Interface.php'; - /** * Zend_Session. * @@ -712,7 +697,6 @@ private static function _processValidators() { foreach ($_SESSION['__ZF']['VALID'] as $validator_name => $valid_data) { if (!class_exists($validator_name)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($validator_name); } $validator = new $validator_name(); diff --git a/library/Zend/Session/Namespace.php b/library/Zend/Session/Namespace.php index 86c15f48..588d5856 100644 --- a/library/Zend/Session/Namespace.php +++ b/library/Zend/Session/Namespace.php @@ -19,16 +19,6 @@ * @since Preview Release 0.2 */ -/** - * @see Zend_Session - */ -require_once 'Zend/Session.php'; - -/** - * @see Zend_Session_Abstract - */ -require_once 'Zend/Session/Abstract.php'; - /** * Zend_Session_Namespace. * diff --git a/library/Zend/Session/Validator/Abstract.php b/library/Zend/Session/Validator/Abstract.php index 9b8b5d5a..a829d410 100644 --- a/library/Zend/Session/Validator/Abstract.php +++ b/library/Zend/Session/Validator/Abstract.php @@ -19,11 +19,6 @@ * @since Preview Release 0.2 */ -/** - * @see Zend_Session_Validator_Interface - */ -require_once 'Zend/Session/Validator/Interface.php'; - /** * Zend_Session_Validator_Abstract. * diff --git a/library/Zend/Session/Validator/HttpUserAgent.php b/library/Zend/Session/Validator/HttpUserAgent.php index 79a9dd32..06f391d5 100644 --- a/library/Zend/Session/Validator/HttpUserAgent.php +++ b/library/Zend/Session/Validator/HttpUserAgent.php @@ -19,11 +19,6 @@ * @since Preview Release 0.2 */ -/** - * @see Zend_Session_Validator_Abstract - */ -require_once 'Zend/Session/Validator/Abstract.php'; - /** * Zend_Session_Validator_HttpUserAgent. * diff --git a/library/Zend/Test/PHPUnit/ControllerTestCase.php b/library/Zend/Test/PHPUnit/ControllerTestCase.php index 22761530..24a800ec 100644 --- a/library/Zend/Test/PHPUnit/ControllerTestCase.php +++ b/library/Zend/Test/PHPUnit/ControllerTestCase.php @@ -18,19 +18,14 @@ */ /** @see Zend_Controller_Front */ -require_once 'Zend/Controller/Front.php'; /** @see Zend_Controller_Action_HelperBroker */ -require_once 'Zend/Controller/Action/HelperBroker.php'; /** @see Zend_Layout */ -require_once 'Zend/Layout.php'; /** @see Zend_Session */ -require_once 'Zend/Session.php'; /** @see Zend_Registry */ -require_once 'Zend/Registry.php'; /** * Functional testing scaffold for MVC applications. @@ -135,7 +130,6 @@ final public function bootstrap() } elseif (is_callable($this->bootstrap)) { call_user_func($this->bootstrap); } elseif (is_string($this->bootstrap)) { - require_once 'Zend/Loader.php'; if (Zend_Loader::isReadable($this->bootstrap)) { include $this->bootstrap; } @@ -449,7 +443,6 @@ public function getFrontController() public function getRequest() { if (null === $this->_request) { - require_once 'Zend/Controller/Request/HttpTestCase.php'; $this->_request = new Zend_Controller_Request_HttpTestCase(); } @@ -464,7 +457,6 @@ public function getRequest() public function getResponse() { if (null === $this->_response) { - require_once 'Zend/Controller/Response/HttpTestCase.php'; $this->_response = new Zend_Controller_Response_HttpTestCase(); } diff --git a/library/Zend/Translate.php b/library/Zend/Translate.php index 510c12a1..d4594b87 100644 --- a/library/Zend/Translate.php +++ b/library/Zend/Translate.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Loader - */ -require_once 'Zend/Loader.php'; - -/** - * @see Zend_Translate_Adapter - */ -require_once 'Zend/Translate/Adapter.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Translate/Adapter.php b/library/Zend/Translate/Adapter.php index 5a33dfd0..fe761c5a 100644 --- a/library/Zend/Translate/Adapter.php +++ b/library/Zend/Translate/Adapter.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Locale - */ -require_once 'Zend/Locale.php'; - -/** - * @see Zend_Translate_Plural - */ -require_once 'Zend/Translate/Plural.php'; - /** * Basic adapter class for each translation source adapter. * @@ -973,7 +963,6 @@ public static function removeCache() */ public static function clearCache($tag = null) { - require_once 'Zend/Cache.php'; if (self::$_cacheTags) { if ($tag == null) { $tag = 'Zend_Translate'; diff --git a/library/Zend/Translate/Adapter/Array.php b/library/Zend/Translate/Adapter/Array.php index f8b6ae46..93d3f9e6 100644 --- a/library/Zend/Translate/Adapter/Array.php +++ b/library/Zend/Translate/Adapter/Array.php @@ -18,10 +18,8 @@ */ /** Zend_Locale */ -require_once 'Zend/Locale.php'; /** Zend_Translate_Adapter */ -require_once 'Zend/Translate/Adapter.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Uri.php b/library/Zend/Uri.php index 16f3b135..fe878fc6 100644 --- a/library/Zend/Uri.php +++ b/library/Zend/Uri.php @@ -128,8 +128,6 @@ public static function factory($uri = 'http', $className = null) } } - require_once 'Zend/Loader.php'; - try { Zend_Loader::loadClass($className); } catch (Exception $e) { diff --git a/library/Zend/Uri/Http.php b/library/Zend/Uri/Http.php index caebefe6..0536be64 100644 --- a/library/Zend/Uri/Http.php +++ b/library/Zend/Uri/Http.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; - -/** - * @see Zend_Validate_Hostname - */ -require_once 'Zend/Validate/Hostname.php'; - /** * HTTP(S) URI handler. * diff --git a/library/Zend/Validate.php b/library/Zend/Validate.php index 6cea8e1c..ea87347e 100644 --- a/library/Zend/Validate.php +++ b/library/Zend/Validate.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Interface - */ -require_once 'Zend/Validate/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -198,7 +193,6 @@ public static function is($value, $classBaseName, array $args = [], $namespaces 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'; @@ -252,8 +246,6 @@ public static function is($value, $classBaseName, array $args = [], $namespaces */ public static function getMessageLength() { - require_once 'Zend/Validate/Abstract.php'; - return Zend_Validate_Abstract::getMessageLength(); } @@ -264,7 +256,6 @@ public static function getMessageLength() */ public static function setMessageLength($length = -1) { - require_once 'Zend/Validate/Abstract.php'; Zend_Validate_Abstract::setMessageLength($length); } @@ -277,8 +268,6 @@ public static function setMessageLength($length = -1) */ public static function getDefaultTranslator($translator = null) { - require_once 'Zend/Validate/Abstract.php'; - return Zend_Validate_Abstract::getDefaultTranslator(); } @@ -289,7 +278,6 @@ public static function getDefaultTranslator($translator = null) */ public static function setDefaultTranslator($translator = null) { - require_once 'Zend/Validate/Abstract.php'; Zend_Validate_Abstract::setDefaultTranslator($translator); } } diff --git a/library/Zend/Validate/Abstract.php b/library/Zend/Validate/Abstract.php index ede97f93..fff6d92e 100644 --- a/library/Zend/Validate/Abstract.php +++ b/library/Zend/Validate/Abstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Interface - */ -require_once 'Zend/Validate/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -413,7 +408,6 @@ public static function setDefaultTranslator($translator = null) public static function getDefaultTranslator() { if (null === self::$_defaultTranslator) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Translate::class)) { $translator = Zend_Registry::get(\Zend_Translate::class); if ($translator instanceof Zend_Translate_Adapter) { diff --git a/library/Zend/Validate/Alnum.php b/library/Zend/Validate/Alnum.php index 929a6675..a2d3e800 100644 --- a/library/Zend/Validate/Alnum.php +++ b/library/Zend/Validate/Alnum.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -131,10 +126,7 @@ public function isValid($value) } if (null === self::$_filter) { - /** - * @see Zend_Filter_Alnum - */ - require_once 'Zend/Filter/Alnum.php'; + // @see Zend_Filter_Alnum self::$_filter = new Zend_Filter_Alnum(); } diff --git a/library/Zend/Validate/Alpha.php b/library/Zend/Validate/Alpha.php index 0b58e676..fe9a9a95 100644 --- a/library/Zend/Validate/Alpha.php +++ b/library/Zend/Validate/Alpha.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -131,10 +126,7 @@ public function isValid($value) } if (null === self::$_filter) { - /** - * @see Zend_Filter_Alpha - */ - require_once 'Zend/Filter/Alpha.php'; + // @see Zend_Filter_Alpha self::$_filter = new Zend_Filter_Alpha(); } diff --git a/library/Zend/Validate/Barcode.php b/library/Zend/Validate/Barcode.php index c9a3e4a9..cbd816f6 100644 --- a/library/Zend/Validate/Barcode.php +++ b/library/Zend/Validate/Barcode.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - -/** - * @see Zend_Loader - */ -require_once 'Zend/Loader.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -125,7 +115,6 @@ public function getAdapter() 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; } diff --git a/library/Zend/Validate/Barcode/AdapterAbstract.php b/library/Zend/Validate/Barcode/AdapterAbstract.php index b5ed1769..cd43d920 100644 --- a/library/Zend/Validate/Barcode/AdapterAbstract.php +++ b/library/Zend/Validate/Barcode/AdapterAbstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterInterface - */ -require_once 'Zend/Validate/Barcode/AdapterInterface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Code25.php b/library/Zend/Validate/Barcode/Code25.php index d712d9fc..0eea6fd2 100644 --- a/library/Zend/Validate/Barcode/Code25.php +++ b/library/Zend/Validate/Barcode/Code25.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Code25interleaved.php b/library/Zend/Validate/Barcode/Code25interleaved.php index 444e60a3..91d155cf 100644 --- a/library/Zend/Validate/Barcode/Code25interleaved.php +++ b/library/Zend/Validate/Barcode/Code25interleaved.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Code39.php b/library/Zend/Validate/Barcode/Code39.php index 3da8bf00..b6fd66e1 100644 --- a/library/Zend/Validate/Barcode/Code39.php +++ b/library/Zend/Validate/Barcode/Code39.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Code39ext.php b/library/Zend/Validate/Barcode/Code39ext.php index 1cdfa783..52b8b4bb 100644 --- a/library/Zend/Validate/Barcode/Code39ext.php +++ b/library/Zend/Validate/Barcode/Code39ext.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Code93.php b/library/Zend/Validate/Barcode/Code93.php index 34c886ba..89d7cd18 100644 --- a/library/Zend/Validate/Barcode/Code93.php +++ b/library/Zend/Validate/Barcode/Code93.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Code93ext.php b/library/Zend/Validate/Barcode/Code93ext.php index ff1308e4..fcf19dd1 100644 --- a/library/Zend/Validate/Barcode/Code93ext.php +++ b/library/Zend/Validate/Barcode/Code93ext.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Ean12.php b/library/Zend/Validate/Barcode/Ean12.php index e020dbb5..7a82dd30 100644 --- a/library/Zend/Validate/Barcode/Ean12.php +++ b/library/Zend/Validate/Barcode/Ean12.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Ean13.php b/library/Zend/Validate/Barcode/Ean13.php index a6a8394e..1b7bb7ea 100644 --- a/library/Zend/Validate/Barcode/Ean13.php +++ b/library/Zend/Validate/Barcode/Ean13.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Ean14.php b/library/Zend/Validate/Barcode/Ean14.php index 41f2c438..e3dc3d6b 100644 --- a/library/Zend/Validate/Barcode/Ean14.php +++ b/library/Zend/Validate/Barcode/Ean14.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Ean18.php b/library/Zend/Validate/Barcode/Ean18.php index fc690659..f7762dc5 100644 --- a/library/Zend/Validate/Barcode/Ean18.php +++ b/library/Zend/Validate/Barcode/Ean18.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Ean2.php b/library/Zend/Validate/Barcode/Ean2.php index b66a2698..3f619856 100644 --- a/library/Zend/Validate/Barcode/Ean2.php +++ b/library/Zend/Validate/Barcode/Ean2.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Ean5.php b/library/Zend/Validate/Barcode/Ean5.php index 6296c9a9..b29115e5 100644 --- a/library/Zend/Validate/Barcode/Ean5.php +++ b/library/Zend/Validate/Barcode/Ean5.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Ean8.php b/library/Zend/Validate/Barcode/Ean8.php index d4b44510..b7fc339a 100644 --- a/library/Zend/Validate/Barcode/Ean8.php +++ b/library/Zend/Validate/Barcode/Ean8.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Gtin12.php b/library/Zend/Validate/Barcode/Gtin12.php index 007f6de6..2df2710e 100644 --- a/library/Zend/Validate/Barcode/Gtin12.php +++ b/library/Zend/Validate/Barcode/Gtin12.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Gtin13.php b/library/Zend/Validate/Barcode/Gtin13.php index 9df0499b..553a2d3f 100644 --- a/library/Zend/Validate/Barcode/Gtin13.php +++ b/library/Zend/Validate/Barcode/Gtin13.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Gtin14.php b/library/Zend/Validate/Barcode/Gtin14.php index bf03f118..d8fa6439 100644 --- a/library/Zend/Validate/Barcode/Gtin14.php +++ b/library/Zend/Validate/Barcode/Gtin14.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Identcode.php b/library/Zend/Validate/Barcode/Identcode.php index eac7b386..4e788453 100644 --- a/library/Zend/Validate/Barcode/Identcode.php +++ b/library/Zend/Validate/Barcode/Identcode.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Intelligentmail.php b/library/Zend/Validate/Barcode/Intelligentmail.php index 8b619d22..9f920b26 100644 --- a/library/Zend/Validate/Barcode/Intelligentmail.php +++ b/library/Zend/Validate/Barcode/Intelligentmail.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Issn.php b/library/Zend/Validate/Barcode/Issn.php index 7f8c1cef..044fdfe2 100644 --- a/library/Zend/Validate/Barcode/Issn.php +++ b/library/Zend/Validate/Barcode/Issn.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Itf14.php b/library/Zend/Validate/Barcode/Itf14.php index c8e3c9ec..7eb97875 100644 --- a/library/Zend/Validate/Barcode/Itf14.php +++ b/library/Zend/Validate/Barcode/Itf14.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Leitcode.php b/library/Zend/Validate/Barcode/Leitcode.php index e613dbfa..74cab4f6 100644 --- a/library/Zend/Validate/Barcode/Leitcode.php +++ b/library/Zend/Validate/Barcode/Leitcode.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Planet.php b/library/Zend/Validate/Barcode/Planet.php index 60c67414..39457929 100644 --- a/library/Zend/Validate/Barcode/Planet.php +++ b/library/Zend/Validate/Barcode/Planet.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Postnet.php b/library/Zend/Validate/Barcode/Postnet.php index 234ae760..16d2017c 100644 --- a/library/Zend/Validate/Barcode/Postnet.php +++ b/library/Zend/Validate/Barcode/Postnet.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Royalmail.php b/library/Zend/Validate/Barcode/Royalmail.php index d55edd57..65ab804d 100644 --- a/library/Zend/Validate/Barcode/Royalmail.php +++ b/library/Zend/Validate/Barcode/Royalmail.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Sscc.php b/library/Zend/Validate/Barcode/Sscc.php index 921c107e..96ee33c0 100644 --- a/library/Zend/Validate/Barcode/Sscc.php +++ b/library/Zend/Validate/Barcode/Sscc.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Upca.php b/library/Zend/Validate/Barcode/Upca.php index 61795e88..0028c922 100644 --- a/library/Zend/Validate/Barcode/Upca.php +++ b/library/Zend/Validate/Barcode/Upca.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Barcode/Upce.php b/library/Zend/Validate/Barcode/Upce.php index 0640f13c..f04813c4 100644 --- a/library/Zend/Validate/Barcode/Upce.php +++ b/library/Zend/Validate/Barcode/Upce.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Barcode_AdapterAbstract - */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Between.php b/library/Zend/Validate/Between.php index 25eabb58..d7172b1f 100644 --- a/library/Zend/Validate/Between.php +++ b/library/Zend/Validate/Between.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Callback.php b/library/Zend/Validate/Callback.php index 1ccd0db5..d562fd70 100644 --- a/library/Zend/Validate/Callback.php +++ b/library/Zend/Validate/Callback.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Ccnum.php b/library/Zend/Validate/Ccnum.php index 876918d8..a17b9026 100644 --- a/library/Zend/Validate/Ccnum.php +++ b/library/Zend/Validate/Ccnum.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -74,10 +69,7 @@ public function isValid($value) $this->_setValue($value); if (null === self::$_filter) { - /** - * @see Zend_Filter_Digits - */ - require_once 'Zend/Filter/Digits.php'; + // @see Zend_Filter_Digits self::$_filter = new Zend_Filter_Digits(); } diff --git a/library/Zend/Validate/CreditCard.php b/library/Zend/Validate/CreditCard.php index 21b2d700..a1e42a9e 100644 --- a/library/Zend/Validate/CreditCard.php +++ b/library/Zend/Validate/CreditCard.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -308,7 +303,6 @@ public function isValid($value) if (!empty($this->_service)) { try { - require_once 'Zend/Validate/Callback.php'; $callback = new Zend_Validate_Callback($this->_service); $callback->setOptions($this->_type); if (!$callback->isValid($value)) { diff --git a/library/Zend/Validate/Date.php b/library/Zend/Validate/Date.php index d3e0b8f5..b3d74113 100644 --- a/library/Zend/Validate/Date.php +++ b/library/Zend/Validate/Date.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -89,7 +84,6 @@ public function __construct($options = []) } if (!array_key_exists('locale', $options)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Locale::class)) { $options['locale'] = Zend_Registry::get(\Zend_Locale::class); } @@ -119,7 +113,6 @@ public function getLocale() */ public function setLocale($locale = null) { - require_once 'Zend/Locale.php'; $this->_locale = Zend_Locale::findLocale($locale); return $this; @@ -173,7 +166,6 @@ public function isValid($value) if (($this->_format !== null) || ($this->_locale !== null) || is_array($value) || $value instanceof Zend_Date) { - require_once 'Zend/Date.php'; if (!Zend_Date::isDate($value, $this->_format, $this->_locale)) { if ($this->_checkFormat($value) === false) { $this->_error(self::FALSEFORMAT); @@ -214,7 +206,6 @@ public function isValid($value) private function _checkFormat($value) { try { - require_once 'Zend/Locale/Format.php'; $parsed = Zend_Locale_Format::getDate($value, [ 'date_format' => $this->_format, 'format_type' => 'iso', 'fix_date' => false, ]); diff --git a/library/Zend/Validate/Db/Abstract.php b/library/Zend/Validate/Db/Abstract.php index 746255a4..8966d520 100644 --- a/library/Zend/Validate/Db/Abstract.php +++ b/library/Zend/Validate/Db/Abstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Class for Database record validation. * diff --git a/library/Zend/Validate/Db/NoRecordExists.php b/library/Zend/Validate/Db/NoRecordExists.php index e968676a..5672aefe 100644 --- a/library/Zend/Validate/Db/NoRecordExists.php +++ b/library/Zend/Validate/Db/NoRecordExists.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Db_Abstract - */ -require_once 'Zend/Validate/Db/Abstract.php'; - /** * Confirms a record does not exist in a table. * diff --git a/library/Zend/Validate/Db/RecordExists.php b/library/Zend/Validate/Db/RecordExists.php index 047909c5..6ca866e1 100644 --- a/library/Zend/Validate/Db/RecordExists.php +++ b/library/Zend/Validate/Db/RecordExists.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Db_Abstract - */ -require_once 'Zend/Validate/Db/Abstract.php'; - /** * Confirms a record exists in a table. * diff --git a/library/Zend/Validate/Digits.php b/library/Zend/Validate/Digits.php index a0c7df71..6378d280 100644 --- a/library/Zend/Validate/Digits.php +++ b/library/Zend/Validate/Digits.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -76,7 +71,6 @@ public function isValid($value) } if (null === self::$_filter) { - require_once 'Zend/Filter/Digits.php'; self::$_filter = new Zend_Filter_Digits(); } diff --git a/library/Zend/Validate/EmailAddress.php b/library/Zend/Validate/EmailAddress.php index 63e4cdd4..7b89fc2b 100644 --- a/library/Zend/Validate/EmailAddress.php +++ b/library/Zend/Validate/EmailAddress.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - -/** - * @see Zend_Validate_Hostname - */ -require_once 'Zend/Validate/Hostname.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/File/Count.php b/library/Zend/Validate/File/Count.php index 653c3fd1..851244a9 100644 --- a/library/Zend/Validate/File/Count.php +++ b/library/Zend/Validate/File/Count.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validator for counting all given files. * diff --git a/library/Zend/Validate/File/Crc32.php b/library/Zend/Validate/File/Crc32.php index d5a51c09..99259dfe 100644 --- a/library/Zend/Validate/File/Crc32.php +++ b/library/Zend/Validate/File/Crc32.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_Hash - */ -require_once 'Zend/Validate/File/Hash.php'; - /** * Validator for the crc32 hash of given files. * @@ -162,7 +157,6 @@ public function addCrc32($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/ExcludeExtension.php b/library/Zend/Validate/File/ExcludeExtension.php index 5c2691d0..c92d38d4 100644 --- a/library/Zend/Validate/File/ExcludeExtension.php +++ b/library/Zend/Validate/File/ExcludeExtension.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/File/Extension.php'; - /** * Validator for the excluding file extensions. * @@ -59,7 +54,6 @@ public function isValid($value, $file = null) { $info = []; // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/ExcludeMimeType.php b/library/Zend/Validate/File/ExcludeMimeType.php index bd3eb4cb..95d05e1f 100644 --- a/library/Zend/Validate/File/ExcludeMimeType.php +++ b/library/Zend/Validate/File/ExcludeMimeType.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_MimeType - */ -require_once 'Zend/Validate/File/MimeType.php'; - /** * Validator for the mime type of a file. * @@ -65,7 +60,6 @@ public function isValid($value, $file = null) } // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_READABLE); } diff --git a/library/Zend/Validate/File/Exists.php b/library/Zend/Validate/File/Exists.php index a6b19096..365c10a4 100644 --- a/library/Zend/Validate/File/Exists.php +++ b/library/Zend/Validate/File/Exists.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validator which checks if the file already exists in the directory. * diff --git a/library/Zend/Validate/File/Extension.php b/library/Zend/Validate/File/Extension.php index f3109015..6e534f9a 100644 --- a/library/Zend/Validate/File/Extension.php +++ b/library/Zend/Validate/File/Extension.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validator for the file extension of a file. * @@ -190,7 +185,6 @@ public function isValid($value, $file = null) { $info = []; // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/FilesSize.php b/library/Zend/Validate/File/FilesSize.php index 94fb35b9..d6c942bd 100644 --- a/library/Zend/Validate/File/FilesSize.php +++ b/library/Zend/Validate/File/FilesSize.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_Size - */ -require_once 'Zend/Validate/File/Size.php'; - /** * Validator for the size of all files which will be validated in sum. * @@ -99,7 +94,6 @@ public function __construct($options) */ public function isValid($value, $file = null) { - require_once 'Zend/Loader.php'; if (is_string($value)) { $value = [$value]; } diff --git a/library/Zend/Validate/File/Hash.php b/library/Zend/Validate/File/Hash.php index d487617e..b47db4ff 100644 --- a/library/Zend/Validate/File/Hash.php +++ b/library/Zend/Validate/File/Hash.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validator for the hash of given files. * @@ -147,7 +142,6 @@ public function addHash($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/ImageSize.php b/library/Zend/Validate/File/ImageSize.php index 9e28d8cb..614e29b2 100644 --- a/library/Zend/Validate/File/ImageSize.php +++ b/library/Zend/Validate/File/ImageSize.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validator for the image size of a image file. * @@ -299,7 +294,6 @@ public function setImageHeight($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_READABLE); } diff --git a/library/Zend/Validate/File/IsCompressed.php b/library/Zend/Validate/File/IsCompressed.php index d4b5cec8..9ef49086 100644 --- a/library/Zend/Validate/File/IsCompressed.php +++ b/library/Zend/Validate/File/IsCompressed.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_MimeType - */ -require_once 'Zend/Validate/File/MimeType.php'; - /** * Validator which checks if the file already exists in the directory. * diff --git a/library/Zend/Validate/File/IsImage.php b/library/Zend/Validate/File/IsImage.php index c5b47b11..c2ceb0e1 100644 --- a/library/Zend/Validate/File/IsImage.php +++ b/library/Zend/Validate/File/IsImage.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_MimeType - */ -require_once 'Zend/Validate/File/MimeType.php'; - /** * Validator which checks if the file already exists in the directory. * diff --git a/library/Zend/Validate/File/Md5.php b/library/Zend/Validate/File/Md5.php index 8fbc449e..e01bff28 100644 --- a/library/Zend/Validate/File/Md5.php +++ b/library/Zend/Validate/File/Md5.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_Hash - */ -require_once 'Zend/Validate/File/Hash.php'; - /** * Validator for the md5 hash of given files. * @@ -164,7 +159,6 @@ public function addMd5($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/MimeType.php b/library/Zend/Validate/File/MimeType.php index 3343b7b4..678c695c 100644 --- a/library/Zend/Validate/File/MimeType.php +++ b/library/Zend/Validate/File/MimeType.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validator for the mime type of a file. * @@ -378,7 +373,6 @@ public function isValid($value, $file = null) } // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_READABLE); } diff --git a/library/Zend/Validate/File/NotExists.php b/library/Zend/Validate/File/NotExists.php index f3fda96a..4cc58d62 100644 --- a/library/Zend/Validate/File/NotExists.php +++ b/library/Zend/Validate/File/NotExists.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_Exists - */ -require_once 'Zend/Validate/File/Exists.php'; - /** * Validator which checks if the destination file does not exist. * diff --git a/library/Zend/Validate/File/Sha1.php b/library/Zend/Validate/File/Sha1.php index 663487ee..cf6141d3 100644 --- a/library/Zend/Validate/File/Sha1.php +++ b/library/Zend/Validate/File/Sha1.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_Hash - */ -require_once 'Zend/Validate/File/Hash.php'; - /** * Validator for the sha1 hash of given files. * @@ -164,7 +159,6 @@ public function addSha1($options) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/Size.php b/library/Zend/Validate/File/Size.php index 1c98a79d..ffcdb6c1 100644 --- a/library/Zend/Validate/File/Size.php +++ b/library/Zend/Validate/File/Size.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validator for the maximum size of a file up to a max of 2GB. * @@ -275,7 +270,6 @@ protected function _setSize($size) public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/File/Upload.php b/library/Zend/Validate/File/Upload.php index 469593ae..e113970d 100644 --- a/library/Zend/Validate/File/Upload.php +++ b/library/Zend/Validate/File/Upload.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validator for the maximum size of a file up to a max of 2GB. * diff --git a/library/Zend/Validate/File/WordCount.php b/library/Zend/Validate/File/WordCount.php index 522998f1..0f9a74b6 100644 --- a/library/Zend/Validate/File/WordCount.php +++ b/library/Zend/Validate/File/WordCount.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_File_Count - */ -require_once 'Zend/Validate/File/Count.php'; - /** * Validator for counting all words in a file. * @@ -61,7 +56,6 @@ class Zend_Validate_File_WordCount extends Zend_Validate_File_Count public function isValid($value, $file = null) { // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_FOUND); } diff --git a/library/Zend/Validate/Float.php b/library/Zend/Validate/Float.php index 03d059d5..7f984974 100644 --- a/library/Zend/Validate/Float.php +++ b/library/Zend/Validate/Float.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - -/** - * @see Zend_Locale_Format - */ -require_once 'Zend/Locale/Format.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -66,7 +56,6 @@ public function __construct($locale = null) } if (empty($locale)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Locale::class)) { $locale = Zend_Registry::get(\Zend_Locale::class); } @@ -92,7 +81,6 @@ public function getLocale() */ public function setLocale($locale = null) { - require_once 'Zend/Locale.php'; $this->_locale = Zend_Locale::findLocale($locale); return $this; diff --git a/library/Zend/Validate/GreaterThan.php b/library/Zend/Validate/GreaterThan.php index 7d6e5e80..cbc6a2c6 100644 --- a/library/Zend/Validate/GreaterThan.php +++ b/library/Zend/Validate/GreaterThan.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Hex.php b/library/Zend/Validate/Hex.php index 925ce0ad..48a9ea8f 100644 --- a/library/Zend/Validate/Hex.php +++ b/library/Zend/Validate/Hex.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Hostname.php b/library/Zend/Validate/Hostname.php index 32bc24fe..cf10d63e 100644 --- a/library/Zend/Validate/Hostname.php +++ b/library/Zend/Validate/Hostname.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - -/** - * @see Zend_Validate_Ip - */ -require_once 'Zend/Validate/Ip.php'; - /** * Please note there are two standalone test scripts for testing IDN characters due to problems * with file encoding. diff --git a/library/Zend/Validate/Iban.php b/library/Zend/Validate/Iban.php index 1a60b88d..e765b132 100644 --- a/library/Zend/Validate/Iban.php +++ b/library/Zend/Validate/Iban.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validates IBAN Numbers (International Bank Account Numbers). * @@ -145,7 +140,6 @@ public function __construct($locale = null) } if (empty($locale)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Locale::class)) { $locale = Zend_Registry::get(\Zend_Locale::class); } @@ -176,7 +170,6 @@ public function getLocale() public function setLocale($locale = null) { if ($locale !== false) { - require_once 'Zend/Locale.php'; $locale = Zend_Locale::findLocale($locale); if (strlen($locale) < 4) { throw new Zend_Validate_Exception('Region must be given for IBAN validation'); diff --git a/library/Zend/Validate/Identical.php b/library/Zend/Validate/Identical.php index 661fbd8e..03af9226 100644 --- a/library/Zend/Validate/Identical.php +++ b/library/Zend/Validate/Identical.php @@ -18,7 +18,6 @@ */ /** @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License diff --git a/library/Zend/Validate/InArray.php b/library/Zend/Validate/InArray.php index 0bbe4f27..4fdb3738 100644 --- a/library/Zend/Validate/InArray.php +++ b/library/Zend/Validate/InArray.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Int.php b/library/Zend/Validate/Int.php index 6c979d9e..892af305 100644 --- a/library/Zend/Validate/Int.php +++ b/library/Zend/Validate/Int.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - -/** - * @see Zend_Locale_Format - */ -require_once 'Zend/Locale/Format.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -66,7 +56,6 @@ public function __construct($locale = null) } if (empty($locale)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Locale::class)) { $locale = Zend_Registry::get(\Zend_Locale::class); } @@ -94,7 +83,6 @@ public function getLocale() */ public function setLocale($locale = null) { - require_once 'Zend/Locale.php'; $this->_locale = Zend_Locale::findLocale($locale); return $this; diff --git a/library/Zend/Validate/Ip.php b/library/Zend/Validate/Ip.php index 63b4dadb..606f8467 100644 --- a/library/Zend/Validate/Ip.php +++ b/library/Zend/Validate/Ip.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Isbn.php b/library/Zend/Validate/Isbn.php index 2a18b23f..75db9efb 100644 --- a/library/Zend/Validate/Isbn.php +++ b/library/Zend/Validate/Isbn.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/LessThan.php b/library/Zend/Validate/LessThan.php index 225623aa..6e353b64 100644 --- a/library/Zend/Validate/LessThan.php +++ b/library/Zend/Validate/LessThan.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/NotEmpty.php b/library/Zend/Validate/NotEmpty.php index 5802b43e..1a9f696d 100644 --- a/library/Zend/Validate/NotEmpty.php +++ b/library/Zend/Validate/NotEmpty.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/PostCode.php b/library/Zend/Validate/PostCode.php index 7683c8d1..49559b4b 100644 --- a/library/Zend/Validate/PostCode.php +++ b/library/Zend/Validate/PostCode.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - -/** - * @see Zend_Locale_Format - */ -require_once 'Zend/Locale/Format.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -73,7 +63,6 @@ public function __construct($options = null) } if (empty($options)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Locale::class)) { $this->setLocale(Zend_Registry::get(\Zend_Locale::class)); } @@ -116,7 +105,6 @@ public function getLocale() */ public function setLocale($locale = null) { - require_once 'Zend/Locale.php'; $this->_locale = Zend_Locale::findLocale($locale); $locale = new Zend_Locale($this->_locale); $region = $locale->getRegion(); diff --git a/library/Zend/Validate/Regex.php b/library/Zend/Validate/Regex.php index 79522054..1659017a 100644 --- a/library/Zend/Validate/Regex.php +++ b/library/Zend/Validate/Regex.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/Validate/Sitemap/Changefreq.php b/library/Zend/Validate/Sitemap/Changefreq.php index 0e33dc30..5c479d4a 100644 --- a/library/Zend/Validate/Sitemap/Changefreq.php +++ b/library/Zend/Validate/Sitemap/Changefreq.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validates whether a given value is valid as a sitemap value. * diff --git a/library/Zend/Validate/Sitemap/Lastmod.php b/library/Zend/Validate/Sitemap/Lastmod.php index b7e03515..be68c729 100644 --- a/library/Zend/Validate/Sitemap/Lastmod.php +++ b/library/Zend/Validate/Sitemap/Lastmod.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validates whether a given value is valid as a sitemap value. * diff --git a/library/Zend/Validate/Sitemap/Loc.php b/library/Zend/Validate/Sitemap/Loc.php index 0b981690..46f2af07 100644 --- a/library/Zend/Validate/Sitemap/Loc.php +++ b/library/Zend/Validate/Sitemap/Loc.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - -/** - * @see Zend_Uri - */ -require_once 'Zend/Uri.php'; - /** * Validates whether a given value is valid as a sitemap value. * diff --git a/library/Zend/Validate/Sitemap/Priority.php b/library/Zend/Validate/Sitemap/Priority.php index 4ac4abb1..a7684c4e 100644 --- a/library/Zend/Validate/Sitemap/Priority.php +++ b/library/Zend/Validate/Sitemap/Priority.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * Validates whether a given value is valid as a sitemap value. * diff --git a/library/Zend/Validate/StringLength.php b/library/Zend/Validate/StringLength.php index a3bd8628..b0a3bee5 100644 --- a/library/Zend/Validate/StringLength.php +++ b/library/Zend/Validate/StringLength.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Validate_Abstract - */ -require_once 'Zend/Validate/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/View.php b/library/Zend/View.php index 957fe5a6..0895153c 100644 --- a/library/Zend/View.php +++ b/library/Zend/View.php @@ -20,7 +20,6 @@ /** * Abstract master class for extension. */ -require_once 'Zend/View/Abstract.php'; /** * Concrete class for handling view scripts. @@ -101,7 +100,6 @@ public function __construct($config = []) $this->_useViewStream = (bool) ini_get('short_open_tag') ? false : true; if ($this->_useViewStream) { if (!in_array('zend.view', stream_get_wrappers())) { - require_once 'Zend/View/Stream.php'; stream_wrapper_register('zend.view', \Zend_View_Stream::class); } } diff --git a/library/Zend/View/Abstract.php b/library/Zend/View/Abstract.php index b2d83f94..5d505ca8 100644 --- a/library/Zend/View/Abstract.php +++ b/library/Zend/View/Abstract.php @@ -18,13 +18,10 @@ */ /** @see Zend_Loader */ -require_once 'Zend/Loader.php'; /** @see Zend_Loader_PluginLoader */ -require_once 'Zend/Loader/PluginLoader.php'; /** @see Zend_View_Interface */ -require_once 'Zend/View/Interface.php'; /** * Abstract class for Zend_View to help enforce private constructs. diff --git a/library/Zend/View/Helper/Abstract.php b/library/Zend/View/Helper/Abstract.php index 997b6729..90e76860 100644 --- a/library/Zend/View/Helper/Abstract.php +++ b/library/Zend/View/Helper/Abstract.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_Interface - */ -require_once 'Zend/View/Helper/Interface.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/View/Helper/Action.php b/library/Zend/View/Helper/Action.php index 6683b9ba..841cdcc8 100644 --- a/library/Zend/View/Helper/Action.php +++ b/library/Zend/View/Helper/Action.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for rendering output of a controller action. diff --git a/library/Zend/View/Helper/BaseUrl.php b/library/Zend/View/Helper/BaseUrl.php index 359040c7..f5699502 100644 --- a/library/Zend/View/Helper/BaseUrl.php +++ b/library/Zend/View/Helper/BaseUrl.php @@ -18,7 +18,6 @@ */ /** @see Zend_View_Helper_Abstract */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for retrieving the BaseUrl. @@ -80,7 +79,6 @@ public function getBaseUrl() { if ($this->_baseUrl === null) { /** @see Zend_Controller_Front */ - require_once 'Zend/Controller/Front.php'; $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl(); // Remove scriptname, eg. index.php from baseUrl diff --git a/library/Zend/View/Helper/Currency.php b/library/Zend/View/Helper/Currency.php index 10ce4a8d..dbae6170 100644 --- a/library/Zend/View/Helper/Currency.php +++ b/library/Zend/View/Helper/Currency.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Currency view helper. @@ -43,7 +42,6 @@ class Zend_View_Helper_Currency extends Zend_View_Helper_Abstract public function __construct($currency = null) { if ($currency === null) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Currency::class)) { $currency = Zend_Registry::get(\Zend_Currency::class); } @@ -68,7 +66,6 @@ public function currency($value = null, $currency = null) } if (is_string($currency) || ($currency instanceof Zend_Locale)) { - require_once 'Zend/Locale.php'; if (Zend_Locale::isLocale($currency)) { $currency = ['locale' => $currency]; } @@ -95,7 +92,6 @@ public function currency($value = null, $currency = null) public function setCurrency($currency = null) { if (!$currency instanceof Zend_Currency) { - require_once 'Zend/Currency.php'; $currency = new Zend_Currency($currency); } $this->_currency = $currency; diff --git a/library/Zend/View/Helper/DeclareVars.php b/library/Zend/View/Helper/DeclareVars.php index 1220c114..fa93745e 100644 --- a/library/Zend/View/Helper/DeclareVars.php +++ b/library/Zend/View/Helper/DeclareVars.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for declaring default values of template variables. diff --git a/library/Zend/View/Helper/Doctype.php b/library/Zend/View/Helper/Doctype.php index 63534e61..d3444d76 100644 --- a/library/Zend/View/Helper/Doctype.php +++ b/library/Zend/View/Helper/Doctype.php @@ -18,10 +18,8 @@ */ /** Zend_Registry */ -require_once 'Zend/Registry.php'; /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for setting and retrieving the doctype. diff --git a/library/Zend/View/Helper/Fieldset.php b/library/Zend/View/Helper/Fieldset.php index 581e2a60..1217d874 100644 --- a/library/Zend/View/Helper/Fieldset.php +++ b/library/Zend/View/Helper/Fieldset.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_FormElement */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper for rendering fieldsets. diff --git a/library/Zend/View/Helper/Form.php b/library/Zend/View/Helper/Form.php index 6233e235..071ad3a5 100644 --- a/library/Zend/View/Helper/Form.php +++ b/library/Zend/View/Helper/Form.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_FormElement */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper for rendering HTML forms. diff --git a/library/Zend/View/Helper/FormButton.php b/library/Zend/View/Helper/FormButton.php index 33acb89e..ba4980fd 100644 --- a/library/Zend/View/Helper/FormButton.php +++ b/library/Zend/View/Helper/FormButton.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "button" element. diff --git a/library/Zend/View/Helper/FormCheckbox.php b/library/Zend/View/Helper/FormCheckbox.php index 3a12d39e..c5163f03 100644 --- a/library/Zend/View/Helper/FormCheckbox.php +++ b/library/Zend/View/Helper/FormCheckbox.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "checkbox" element. diff --git a/library/Zend/View/Helper/FormElement.php b/library/Zend/View/Helper/FormElement.php index b2a91f9f..ec99a570 100644 --- a/library/Zend/View/Helper/FormElement.php +++ b/library/Zend/View/Helper/FormElement.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_HtmlElement - */ -require_once 'Zend/View/Helper/HtmlElement.php'; - /** * Base helper for form elements. Extend this, don't use it on its own. * diff --git a/library/Zend/View/Helper/FormErrors.php b/library/Zend/View/Helper/FormErrors.php index 00e47bf0..36fbd8b8 100644 --- a/library/Zend/View/Helper/FormErrors.php +++ b/library/Zend/View/Helper/FormErrors.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to render errors for a form element. diff --git a/library/Zend/View/Helper/FormFile.php b/library/Zend/View/Helper/FormFile.php index 4b53de14..44900adb 100644 --- a/library/Zend/View/Helper/FormFile.php +++ b/library/Zend/View/Helper/FormFile.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "file" element. diff --git a/library/Zend/View/Helper/FormHidden.php b/library/Zend/View/Helper/FormHidden.php index 0fe57803..f77a58dd 100644 --- a/library/Zend/View/Helper/FormHidden.php +++ b/library/Zend/View/Helper/FormHidden.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "hidden" element. diff --git a/library/Zend/View/Helper/FormImage.php b/library/Zend/View/Helper/FormImage.php index 9b8ea07e..e37b082b 100644 --- a/library/Zend/View/Helper/FormImage.php +++ b/library/Zend/View/Helper/FormImage.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate an "image" element. diff --git a/library/Zend/View/Helper/FormLabel.php b/library/Zend/View/Helper/FormLabel.php index ce61cb30..7bd7abc9 100644 --- a/library/Zend/View/Helper/FormLabel.php +++ b/library/Zend/View/Helper/FormLabel.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_FormElement **/ -require_once 'Zend/View/Helper/FormElement.php'; /** * Form label helper. diff --git a/library/Zend/View/Helper/FormMultiCheckbox.php b/library/Zend/View/Helper/FormMultiCheckbox.php index 8ec52da5..18090141 100644 --- a/library/Zend/View/Helper/FormMultiCheckbox.php +++ b/library/Zend/View/Helper/FormMultiCheckbox.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_FormRadio */ -require_once 'Zend/View/Helper/FormRadio.php'; /** * Helper to generate a set of checkbox button elements. diff --git a/library/Zend/View/Helper/FormNote.php b/library/Zend/View/Helper/FormNote.php index e426ef3a..4a68d1fe 100644 --- a/library/Zend/View/Helper/FormNote.php +++ b/library/Zend/View/Helper/FormNote.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to show an HTML note. diff --git a/library/Zend/View/Helper/FormPassword.php b/library/Zend/View/Helper/FormPassword.php index 656442c5..7af7dd1c 100644 --- a/library/Zend/View/Helper/FormPassword.php +++ b/library/Zend/View/Helper/FormPassword.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "password" element. diff --git a/library/Zend/View/Helper/FormRadio.php b/library/Zend/View/Helper/FormRadio.php index 1caa778e..5182ae24 100644 --- a/library/Zend/View/Helper/FormRadio.php +++ b/library/Zend/View/Helper/FormRadio.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a set of radio button elements. @@ -114,7 +113,6 @@ public function formRadio($name, $value = null, $attribs = null, $value = (array) $value; // Set up the filter - Alnum + hyphen + underscore - require_once 'Zend/Filter/PregReplace.php'; $pattern = @preg_match('/\pL/u', 'a') ? '/[^\p{L}\p{N}\-\_]/u' // Unicode : '/[^a-zA-Z0-9\-\_]/'; // No Unicode diff --git a/library/Zend/View/Helper/FormReset.php b/library/Zend/View/Helper/FormReset.php index 02799246..5f920df7 100644 --- a/library/Zend/View/Helper/FormReset.php +++ b/library/Zend/View/Helper/FormReset.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "reset" button. diff --git a/library/Zend/View/Helper/FormSelect.php b/library/Zend/View/Helper/FormSelect.php index b2a10bd9..d94bc1a1 100644 --- a/library/Zend/View/Helper/FormSelect.php +++ b/library/Zend/View/Helper/FormSelect.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate "select" list of options. diff --git a/library/Zend/View/Helper/FormSubmit.php b/library/Zend/View/Helper/FormSubmit.php index d0d35d96..b4f336c0 100644 --- a/library/Zend/View/Helper/FormSubmit.php +++ b/library/Zend/View/Helper/FormSubmit.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "submit" button. diff --git a/library/Zend/View/Helper/FormText.php b/library/Zend/View/Helper/FormText.php index ef64eee8..1f459d48 100644 --- a/library/Zend/View/Helper/FormText.php +++ b/library/Zend/View/Helper/FormText.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "text" element. diff --git a/library/Zend/View/Helper/FormTextarea.php b/library/Zend/View/Helper/FormTextarea.php index 4e494227..bb1ed774 100644 --- a/library/Zend/View/Helper/FormTextarea.php +++ b/library/Zend/View/Helper/FormTextarea.php @@ -20,7 +20,6 @@ /** * Abstract class for extension. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper to generate a "textarea" element. diff --git a/library/Zend/View/Helper/Gravatar.php b/library/Zend/View/Helper/Gravatar.php index e24ef4fe..b82e3dd9 100644 --- a/library/Zend/View/Helper/Gravatar.php +++ b/library/Zend/View/Helper/Gravatar.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_HtmlElement */ -require_once 'Zend/View/Helper/HtmlElement.php'; /** * Helper for retrieving avatars from gravatar.com. diff --git a/library/Zend/View/Helper/HeadLink.php b/library/Zend/View/Helper/HeadLink.php index 85b0852c..4655f7be 100644 --- a/library/Zend/View/Helper/HeadLink.php +++ b/library/Zend/View/Helper/HeadLink.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Standalone */ -require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Zend_Layout_View_Helper_HeadLink. diff --git a/library/Zend/View/Helper/HeadMeta.php b/library/Zend/View/Helper/HeadMeta.php index 2e2f6c5b..0a61122d 100644 --- a/library/Zend/View/Helper/HeadMeta.php +++ b/library/Zend/View/Helper/HeadMeta.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Standalone */ -require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Zend_Layout_View_Helper_HeadMeta. diff --git a/library/Zend/View/Helper/HeadScript.php b/library/Zend/View/Helper/HeadScript.php index e3a92e61..860e20b7 100644 --- a/library/Zend/View/Helper/HeadScript.php +++ b/library/Zend/View/Helper/HeadScript.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Standalone */ -require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Helper for setting and retrieving script elements for HTML head section. diff --git a/library/Zend/View/Helper/HeadStyle.php b/library/Zend/View/Helper/HeadStyle.php index a490f3db..65e12373 100644 --- a/library/Zend/View/Helper/HeadStyle.php +++ b/library/Zend/View/Helper/HeadStyle.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Standalone */ -require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Helper for setting and retrieving stylesheets. diff --git a/library/Zend/View/Helper/HeadTitle.php b/library/Zend/View/Helper/HeadTitle.php index 3a363668..fe8693e0 100644 --- a/library/Zend/View/Helper/HeadTitle.php +++ b/library/Zend/View/Helper/HeadTitle.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Standalone */ -require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Helper for setting and retrieving title element for HTML head. @@ -149,7 +148,6 @@ public function setTranslator($translate) public function getTranslator() { if (null === $this->_translator) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Translate::class)) { $this->setTranslator(Zend_Registry::get(\Zend_Translate::class)); } diff --git a/library/Zend/View/Helper/HtmlElement.php b/library/Zend/View/Helper/HtmlElement.php index 82e00f01..04cd013a 100644 --- a/library/Zend/View/Helper/HtmlElement.php +++ b/library/Zend/View/Helper/HtmlElement.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_Abstract - */ -require_once 'Zend/View/Helper/Abstract.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ @@ -112,7 +107,6 @@ protected function _htmlAttribs($attribs) // Don't escape event attributes; _do_ substitute double quotes with singles if (!is_scalar($val)) { // non-scalar data should be cast to JSON first - require_once 'Zend/Json.php'; $val = Zend_Json::encode($val); } // Escape single quotes inside event attribute values. diff --git a/library/Zend/View/Helper/HtmlFlash.php b/library/Zend/View/Helper/HtmlFlash.php index 626f1d53..2f2d9a55 100644 --- a/library/Zend/View/Helper/HtmlFlash.php +++ b/library/Zend/View/Helper/HtmlFlash.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_HtmlObject - */ -require_once 'Zend/View/Helper/HtmlObject.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/View/Helper/HtmlList.php b/library/Zend/View/Helper/HtmlList.php index 727e63d3..44ae1ab5 100644 --- a/library/Zend/View/Helper/HtmlList.php +++ b/library/Zend/View/Helper/HtmlList.php @@ -20,7 +20,6 @@ /** * Zend_View_Helper_FormELement. */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper for ordered and unordered lists. diff --git a/library/Zend/View/Helper/HtmlObject.php b/library/Zend/View/Helper/HtmlObject.php index 279761c7..38e9816c 100644 --- a/library/Zend/View/Helper/HtmlObject.php +++ b/library/Zend/View/Helper/HtmlObject.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_HtmlElement - */ -require_once 'Zend/View/Helper/HtmlElement.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/View/Helper/HtmlPage.php b/library/Zend/View/Helper/HtmlPage.php index d923611a..564de54a 100644 --- a/library/Zend/View/Helper/HtmlPage.php +++ b/library/Zend/View/Helper/HtmlPage.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_HtmlObject - */ -require_once 'Zend/View/Helper/HtmlObject.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/View/Helper/HtmlQuicktime.php b/library/Zend/View/Helper/HtmlQuicktime.php index 58ad53d3..13a1a442 100644 --- a/library/Zend/View/Helper/HtmlQuicktime.php +++ b/library/Zend/View/Helper/HtmlQuicktime.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_HtmlObject - */ -require_once 'Zend/View/Helper/HtmlObject.php'; - /** * @license http://framework.zend.com/license/new-bsd New BSD License */ diff --git a/library/Zend/View/Helper/InlineScript.php b/library/Zend/View/Helper/InlineScript.php index a49366d2..dcbaca4c 100644 --- a/library/Zend/View/Helper/InlineScript.php +++ b/library/Zend/View/Helper/InlineScript.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_HeadScript */ -require_once 'Zend/View/Helper/HeadScript.php'; /** * Helper for setting and retrieving script elements for inclusion in HTML body diff --git a/library/Zend/View/Helper/Json.php b/library/Zend/View/Helper/Json.php index cf33146f..e12d1d7d 100644 --- a/library/Zend/View/Helper/Json.php +++ b/library/Zend/View/Helper/Json.php @@ -18,13 +18,10 @@ */ /** Zend_Json */ -require_once 'Zend/Json.php'; /** Zend_Controller_Front */ -require_once 'Zend/Controller/Front.php'; /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for simplifying JSON responses. @@ -72,7 +69,6 @@ public function json($data, $keepLayouts = false, $encodeData = true) $data = Zend_Json::encode($data, null, $options); } if (!$keepLayouts) { - require_once 'Zend/Layout.php'; $layout = Zend_Layout::getMvcInstance(); if ($layout instanceof Zend_Layout) { $layout->disableLayout(); diff --git a/library/Zend/View/Helper/Layout.php b/library/Zend/View/Helper/Layout.php index f7e415d8..b87df0d0 100644 --- a/library/Zend/View/Helper/Layout.php +++ b/library/Zend/View/Helper/Layout.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * View helper for retrieving layout object. @@ -41,7 +40,6 @@ class Zend_View_Helper_Layout extends Zend_View_Helper_Abstract public function getLayout() { if (null === $this->_layout) { - require_once 'Zend/Layout.php'; $this->_layout = Zend_Layout::getMvcInstance(); if (null === $this->_layout) { // Implicitly creates layout object diff --git a/library/Zend/View/Helper/Navigation.php b/library/Zend/View/Helper/Navigation.php index 1e17f4b6..ea04b583 100644 --- a/library/Zend/View/Helper/Navigation.php +++ b/library/Zend/View/Helper/Navigation.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_Navigation_HelperAbstract - */ -require_once 'Zend/View/Helper/Navigation/HelperAbstract.php'; - /** * Proxy helper for retrieving navigational helpers and forwarding calls. * diff --git a/library/Zend/View/Helper/Navigation/Breadcrumbs.php b/library/Zend/View/Helper/Navigation/Breadcrumbs.php index 27fc3fd5..71566fac 100644 --- a/library/Zend/View/Helper/Navigation/Breadcrumbs.php +++ b/library/Zend/View/Helper/Navigation/Breadcrumbs.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_Navigation_HelperAbstract - */ -require_once 'Zend/View/Helper/Navigation/HelperAbstract.php'; - /** * Helper for printing breadcrumbs. * diff --git a/library/Zend/View/Helper/Navigation/HelperAbstract.php b/library/Zend/View/Helper/Navigation/HelperAbstract.php index d4d1e47c..e523a068 100644 --- a/library/Zend/View/Helper/Navigation/HelperAbstract.php +++ b/library/Zend/View/Helper/Navigation/HelperAbstract.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_Navigation_Helper - */ -require_once 'Zend/View/Helper/Navigation/Helper.php'; - -/** - * @see Zend_View_Helper_HtmlElement - */ -require_once 'Zend/View/Helper/HtmlElement.php'; - /** * Base class for navigational helpers. * @@ -184,7 +174,6 @@ public function getContainer() { if (null === $this->_container) { // try to fetch from registry first - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Navigation::class)) { $nav = Zend_Registry::get(\Zend_Navigation::class); if ($nav instanceof Zend_Navigation_Container) { @@ -193,7 +182,6 @@ public function getContainer() } // nothing found in registry, create new container - require_once 'Zend/Navigation.php'; $this->_container = new Zend_Navigation(); } @@ -429,7 +417,6 @@ public function setTranslator($translator = null) public function getTranslator() { if (null === $this->_translator) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Translate::class)) { $this->setTranslator(Zend_Registry::get(\Zend_Translate::class)); } diff --git a/library/Zend/View/Helper/Navigation/Links.php b/library/Zend/View/Helper/Navigation/Links.php index b8b6c75e..393d8df1 100644 --- a/library/Zend/View/Helper/Navigation/Links.php +++ b/library/Zend/View/Helper/Navigation/Links.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_Navigation_HelperAbstract - */ -require_once 'Zend/View/Helper/Navigation/HelperAbstract.php'; - /** * Helper for printing elements. * diff --git a/library/Zend/View/Helper/Navigation/Menu.php b/library/Zend/View/Helper/Navigation/Menu.php index 08b7771c..4a125378 100644 --- a/library/Zend/View/Helper/Navigation/Menu.php +++ b/library/Zend/View/Helper/Navigation/Menu.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_Navigation_HelperAbstract - */ -require_once 'Zend/View/Helper/Navigation/HelperAbstract.php'; - /** * Helper for rendering menus from navigation containers. * diff --git a/library/Zend/View/Helper/Navigation/Sitemap.php b/library/Zend/View/Helper/Navigation/Sitemap.php index 3d27848e..8ff5fbe2 100644 --- a/library/Zend/View/Helper/Navigation/Sitemap.php +++ b/library/Zend/View/Helper/Navigation/Sitemap.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_View_Helper_Navigation_HelperAbstract - */ -require_once 'Zend/View/Helper/Navigation/HelperAbstract.php'; - /** * Helper for printing sitemaps. * @@ -186,7 +181,6 @@ public function getUseSchemaValidation() */ public function setServerUrl($serverUrl) { - require_once 'Zend/Uri.php'; $uri = Zend_Uri::factory($serverUrl); $uri->setFragment(''); $uri->setPath(''); @@ -294,11 +288,6 @@ public function getDomSitemap(?Zend_Navigation_Container $container = null) // check if we should validate using our own validators if ($this->getUseSitemapValidators()) { - require_once 'Zend/Validate/Sitemap/Changefreq.php'; - require_once 'Zend/Validate/Sitemap/Lastmod.php'; - require_once 'Zend/Validate/Sitemap/Loc.php'; - require_once 'Zend/Validate/Sitemap/Priority.php'; - // create validators $locValidator = new Zend_Validate_Sitemap_Loc(); $lastmodValidator = new Zend_Validate_Sitemap_Lastmod(); diff --git a/library/Zend/View/Helper/Partial.php b/library/Zend/View/Helper/Partial.php index f7678b99..79117f3c 100644 --- a/library/Zend/View/Helper/Partial.php +++ b/library/Zend/View/Helper/Partial.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for rendering a template fragment in its own variable scope. @@ -73,7 +72,6 @@ public function partial($name = null, $module = null, $model = null) } if ((null !== $module) && is_string($module)) { - require_once 'Zend/Controller/Front.php'; $moduleDir = Zend_Controller_Front::getInstance()->getControllerDirectory($module); if (null === $moduleDir) { $e = new Zend_View_Helper_Partial_Exception('Cannot render partial; module does not exist'); diff --git a/library/Zend/View/Helper/PartialLoop.php b/library/Zend/View/Helper/PartialLoop.php index 8e4267c5..a345d7cc 100644 --- a/library/Zend/View/Helper/PartialLoop.php +++ b/library/Zend/View/Helper/PartialLoop.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Partial */ -require_once 'Zend/View/Helper/Partial.php'; /** * Helper for rendering a template fragment in its own variable scope; iterates diff --git a/library/Zend/View/Helper/Placeholder.php b/library/Zend/View/Helper/Placeholder.php index 1527b6a2..cde48a90 100644 --- a/library/Zend/View/Helper/Placeholder.php +++ b/library/Zend/View/Helper/Placeholder.php @@ -18,10 +18,8 @@ */ /** Zend_View_Helper_Placeholder_Registry */ -require_once 'Zend/View/Helper/Placeholder/Registry.php'; /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for passing data between otherwise segregated Views. It's called diff --git a/library/Zend/View/Helper/Placeholder/Container.php b/library/Zend/View/Helper/Placeholder/Container.php index 0098c08a..64aafa4f 100644 --- a/library/Zend/View/Helper/Placeholder/Container.php +++ b/library/Zend/View/Helper/Placeholder/Container.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Abstract */ -require_once 'Zend/View/Helper/Placeholder/Container/Abstract.php'; /** * Container for placeholder values. diff --git a/library/Zend/View/Helper/Placeholder/Container/Standalone.php b/library/Zend/View/Helper/Placeholder/Container/Standalone.php index efbc61a0..8d289106 100644 --- a/library/Zend/View/Helper/Placeholder/Container/Standalone.php +++ b/library/Zend/View/Helper/Placeholder/Container/Standalone.php @@ -18,10 +18,8 @@ */ /** Zend_View_Helper_Placeholder_Registry */ -require_once 'Zend/View/Helper/Placeholder/Registry.php'; /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Base class for targetted placeholder helpers. diff --git a/library/Zend/View/Helper/Placeholder/Registry.php b/library/Zend/View/Helper/Placeholder/Registry.php index 98bb9d28..0fc034e1 100644 --- a/library/Zend/View/Helper/Placeholder/Registry.php +++ b/library/Zend/View/Helper/Placeholder/Registry.php @@ -18,13 +18,10 @@ */ /** Zend_Registry */ -require_once 'Zend/Registry.php'; /** Zend_View_Helper_Placeholder_Container_Abstract */ -require_once 'Zend/View/Helper/Placeholder/Container/Abstract.php'; /** Zend_View_Helper_Placeholder_Container */ -require_once 'Zend/View/Helper/Placeholder/Container.php'; /** * Registry for placeholder containers. @@ -165,7 +162,6 @@ public function deleteContainer($key) public function setContainerClass($name) { if (!class_exists($name)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($name); } diff --git a/library/Zend/View/Helper/RenderToPlaceholder.php b/library/Zend/View/Helper/RenderToPlaceholder.php index c1923031..85ff5a02 100644 --- a/library/Zend/View/Helper/RenderToPlaceholder.php +++ b/library/Zend/View/Helper/RenderToPlaceholder.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Renders a template and stores the rendered output as a placeholder diff --git a/library/Zend/View/Helper/Translate.php b/library/Zend/View/Helper/Translate.php index 9eec75e5..cb43aa9e 100644 --- a/library/Zend/View/Helper/Translate.php +++ b/library/Zend/View/Helper/Translate.php @@ -18,10 +18,8 @@ */ /** Zend_Locale */ -require_once 'Zend/Locale.php'; /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Translation view helper. @@ -125,7 +123,6 @@ public function setTranslator($translate) public function getTranslator() { if ($this->_translator === null) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Translate::class)) { $this->setTranslator(Zend_Registry::get(\Zend_Translate::class)); } diff --git a/library/Zend/View/Helper/Url.php b/library/Zend/View/Helper/Url.php index c595ba77..21b1c9d6 100644 --- a/library/Zend/View/Helper/Url.php +++ b/library/Zend/View/Helper/Url.php @@ -18,7 +18,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for making easy links and getting urls that depend on the routes and router. diff --git a/library/Zend/View/Helper/UserAgent.php b/library/Zend/View/Helper/UserAgent.php index 9027a954..7d65d21c 100644 --- a/library/Zend/View/Helper/UserAgent.php +++ b/library/Zend/View/Helper/UserAgent.php @@ -16,7 +16,6 @@ */ /** Zend_View_Helper_Abstract */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for interacting with UserAgent instance. @@ -69,7 +68,6 @@ public function setUserAgent(Zend_Http_UserAgent $userAgent) public function getUserAgent() { if (null === $this->_userAgent) { - require_once 'Zend/Http/UserAgent.php'; $this->setUserAgent(new Zend_Http_UserAgent()); } diff --git a/library/ZendX/JQuery.php b/library/ZendX/JQuery.php index 6734e767..e22fc40c 100644 --- a/library/ZendX/JQuery.php +++ b/library/ZendX/JQuery.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Json - */ -require_once 'Zend/Json.php'; - /** * jQuery Global Class holding constants and static convienience methods. * @@ -144,10 +139,7 @@ public static function encodeJson($value) } if (!class_exists(\Zend_Json::class)) { - /** - * @see Zend_Json - */ - require_once 'Zend/Json.php'; + // @see Zend_Json } return Zend_Json::encode($value, false, ['enableJsonExprFinder' => true]); diff --git a/library/ZendX/JQuery/Form.php b/library/ZendX/JQuery/Form.php index 25ad9066..396b03c7 100644 --- a/library/ZendX/JQuery/Form.php +++ b/library/ZendX/JQuery/Form.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form.php'; /** * Form Wrapper for jQuery-enabled forms. diff --git a/library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php b/library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php index dcaf63fe..eaa82565 100644 --- a/library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php +++ b/library/ZendX/JQuery/Form/Decorator/UiWidgetContainer.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Abstract Form Decorator for all jQuery UI Widget Containers. diff --git a/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php b/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php index b60b45ea..875b5012 100644 --- a/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php +++ b/library/ZendX/JQuery/Form/Decorator/UiWidgetElement.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Form_Decorator_ViewHelper - */ -require_once 'Zend/Form/Decorator/ViewHelper.php'; - -/** - * @see ZendX_JQuery_Form_Decorator_UiWidgetElementMarker - */ -require_once 'ZendX/JQuery/Form/Decorator/UiWidgetElementMarker.php'; - /** * Abstract Form Decorator for all jQuery UI Form Elements. * diff --git a/library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php b/library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php index 24c5082a..a7a79725 100644 --- a/library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php +++ b/library/ZendX/JQuery/Form/Decorator/UiWidgetPane.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Decorator/Abstract.php'; /** * Abstract Form Decorator for all jQuery UI Pane View Helpers. diff --git a/library/ZendX/JQuery/Form/Element/UiWidget.php b/library/ZendX/JQuery/Form/Element/UiWidget.php index 75e37817..70adf3a6 100644 --- a/library/ZendX/JQuery/Form/Element/UiWidget.php +++ b/library/ZendX/JQuery/Form/Element/UiWidget.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element.php'; /** * Base Form Element for jQuery View Helpers. diff --git a/library/ZendX/JQuery/View/Helper/AutoComplete.php b/library/ZendX/JQuery/View/Helper/AutoComplete.php index 359f853c..5d8bb5dc 100644 --- a/library/ZendX/JQuery/View/Helper/AutoComplete.php +++ b/library/ZendX/JQuery/View/Helper/AutoComplete.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see ZendX_JQuery_View_Helper_UiWidget - */ -require_once 'ZendX/JQuery/View/Helper/UiWidget.php'; - /** * jQuery Autocomplete View Helper. * diff --git a/library/ZendX/JQuery/View/Helper/DatePicker.php b/library/ZendX/JQuery/View/Helper/DatePicker.php index a9d1a668..42b18022 100644 --- a/library/ZendX/JQuery/View/Helper/DatePicker.php +++ b/library/ZendX/JQuery/View/Helper/DatePicker.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see Zend_Registry - */ -require_once 'Zend/Registry.php'; - -/** - * @see ZendX_JQuery_View_Helper_UiWidget - */ -require_once 'ZendX/JQuery/View/Helper/UiWidget.php'; - /** * jQuery Date Picker View Helper. * @@ -92,7 +82,6 @@ public static function resolveZendLocaleToDatePickerFormat($format = null) /** * @see Zend_Locale_Format */ - require_once 'Zend/Locale/Format.php'; $format = Zend_Locale_Format::getDateFormat($locale); } diff --git a/library/ZendX/JQuery/View/Helper/DialogContainer.php b/library/ZendX/JQuery/View/Helper/DialogContainer.php index 6c177205..c9f17a23 100644 --- a/library/ZendX/JQuery/View/Helper/DialogContainer.php +++ b/library/ZendX/JQuery/View/Helper/DialogContainer.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see ZendX_JQuery_View_Helper_UiWidget - */ -require_once 'ZendX/JQuery/View/Helper/UiWidget.php'; - /** * jQuery Dialog View Helper. * diff --git a/library/ZendX/JQuery/View/Helper/JQuery.php b/library/ZendX/JQuery/View/Helper/JQuery.php index 009e768b..c825bd2f 100644 --- a/library/ZendX/JQuery/View/Helper/JQuery.php +++ b/library/ZendX/JQuery/View/Helper/JQuery.php @@ -17,26 +17,6 @@ * @version $Id$ */ -/** - * @see ZendX_JQuery - */ -require_once 'ZendX/JQuery.php'; - -/** - * @see Zend_Registry - */ -require_once 'Zend/Registry.php'; - -/** - * @see Zend_View_Helper_Abstract - */ -require_once 'Zend/View/Helper/Abstract.php'; - -/** - * @see ZendX_JQuery_View_Helper_JQuery_Container - */ -require_once 'ZendX/JQuery/View/Helper/JQuery/Container.php'; - /** * jQuery Helper. Functions as a stack for code and loads all jQuery dependencies. * @@ -71,7 +51,6 @@ public function __construct() { $registry = Zend_Registry::getInstance(); if (!isset($registry[self::class])) { - require_once 'ZendX/JQuery/View/Helper/JQuery/Container.php'; $container = new ZendX_JQuery_View_Helper_JQuery_Container(); $registry[self::class] = $container; } diff --git a/library/ZendX/JQuery/View/Helper/JQuery/Container.php b/library/ZendX/JQuery/View/Helper/JQuery/Container.php index 9fa7948d..b4e3ce0c 100644 --- a/library/ZendX/JQuery/View/Helper/JQuery/Container.php +++ b/library/ZendX/JQuery/View/Helper/JQuery/Container.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see ZendX_JQuery - */ -require_once 'ZendX/JQuery.php'; - /** * jQuery View Helper. Transports all jQuery stack and render information across all views. * diff --git a/library/ZendX/JQuery/View/Helper/Slider.php b/library/ZendX/JQuery/View/Helper/Slider.php index 717c8043..1faf357d 100644 --- a/library/ZendX/JQuery/View/Helper/Slider.php +++ b/library/ZendX/JQuery/View/Helper/Slider.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see ZendX_JQuery_View_Helper_UiWidget - */ -require_once 'ZendX/JQuery/View/Helper/UiWidget.php'; - /** * jQuery Slider View Helper. * diff --git a/library/ZendX/JQuery/View/Helper/Spinner.php b/library/ZendX/JQuery/View/Helper/Spinner.php index a855a1df..5fee8dc4 100644 --- a/library/ZendX/JQuery/View/Helper/Spinner.php +++ b/library/ZendX/JQuery/View/Helper/Spinner.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see ZendX_JQuery_View_Helper_UiWidget - */ -require_once 'ZendX/JQuery/View/Helper/UiWidget.php'; - /** * jQuery Spinner View Helper. * diff --git a/library/ZendX/JQuery/View/Helper/TabContainer.php b/library/ZendX/JQuery/View/Helper/TabContainer.php index dbe0eed1..76244f49 100644 --- a/library/ZendX/JQuery/View/Helper/TabContainer.php +++ b/library/ZendX/JQuery/View/Helper/TabContainer.php @@ -17,11 +17,6 @@ * @version $Id$ */ -/** - * @see ZendX_JQuery_View_Helper_UiWidget - */ -require_once 'ZendX/JQuery/View/Helper/UiWidget.php'; - /** * jQuery Tabs Container View Helper. * diff --git a/library/ZendX/JQuery/View/Helper/UiWidget.php b/library/ZendX/JQuery/View/Helper/UiWidget.php index df109078..fd497468 100644 --- a/library/ZendX/JQuery/View/Helper/UiWidget.php +++ b/library/ZendX/JQuery/View/Helper/UiWidget.php @@ -17,16 +17,6 @@ * @version $Id$ */ -/** - * @see ZendX_JQuery_View_Helper_UiWidget - */ -require_once 'Zend/View/Helper/HtmlElement.php'; - -/** - * @see ZendX_JQuery - */ -require_once 'ZendX/JQuery.php'; - /** * jQuery Ui Widget Base class. * diff --git a/tests/Zend/Acl/AclTest.php b/tests/Zend/Acl/AclTest.php index 1cc6b11d..c90f7c7e 100644 --- a/tests/Zend/Acl/AclTest.php +++ b/tests/Zend/Acl/AclTest.php @@ -16,9 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Acl.php'; -require_once 'Zend/Acl/Resource.php'; -require_once 'Zend/Acl/Role.php'; require_once __DIR__ . '/_files/MockAssertion.php'; /** diff --git a/tests/Zend/Application/Resource/FrontcontrollerTest.php b/tests/Zend/Application/Resource/FrontcontrollerTest.php index a1a2bbbb..c7bcb44f 100644 --- a/tests/Zend/Application/Resource/FrontcontrollerTest.php +++ b/tests/Zend/Application/Resource/FrontcontrollerTest.php @@ -80,7 +80,6 @@ public function tearDown(): void public function testInitializationCreatesFrontControllerInstance() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([]); $resource->init(); $this->assertTrue($resource->getFrontController() instanceof Zend_Controller_Front); @@ -88,7 +87,6 @@ public function testInitializationCreatesFrontControllerInstance() public function testInitializationPushesFrontControllerToBootstrapWhenPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([]); $resource->setBootstrap($this->bootstrap); $resource->init(); @@ -97,7 +95,6 @@ public function testInitializationPushesFrontControllerToBootstrapWhenPresent() public function testShouldSetControllerDirectoryWhenStringOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'controllerDirectory' => __DIR__, ]); @@ -109,7 +106,6 @@ public function testShouldSetControllerDirectoryWhenStringOptionPresent() public function testShouldSetControllerDirectoryWhenArrayOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'controllerDirectory' => [ 'foo' => __DIR__, @@ -126,7 +122,6 @@ public function testShouldSetControllerDirectoryWhenArrayOptionPresent() */ public function testAllControllerDirectoriesShouldBeSetWhenArrayPassedToControllerDirectoryOption() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'controllerDirectory' => [ 'foo' => __DIR__, @@ -144,7 +139,6 @@ public function testAllControllerDirectoriesShouldBeSetWhenArrayPassedToControll public function testShouldSetModuleControllerDirectoryNameWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'moduleControllerDirectoryName' => 'foo', ]); @@ -156,10 +150,9 @@ public function testShouldSetModuleControllerDirectoryNameWhenOptionPresent() public function testShouldSetModuleDirectoryWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'moduleDirectory' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'modules', + . '_files' . DIRECTORY_SEPARATOR . 'modules', ]); $resource->init(); $front = $resource->getFrontController(); @@ -192,10 +185,9 @@ public function testShouldSetModuleDirectoryWhenOptionPresent() */ public function testShouldSetMultipleModuleDirectorysWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'moduleDirectory' => [__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR . 'modules', + . '_files' . DIRECTORY_SEPARATOR . 'modules', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'more_modules', ], ]); @@ -233,7 +225,6 @@ public function testShouldSetMultipleModuleDirectorysWhenOptionPresent() public function testShouldSetDefaultControllerNameWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'defaultControllerName' => 'foo', ]); @@ -245,7 +236,6 @@ public function testShouldSetDefaultControllerNameWhenOptionPresent() public function testShouldSetDefaultActionWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'defaultAction' => 'foo', ]); @@ -257,7 +247,6 @@ public function testShouldSetDefaultActionWhenOptionPresent() public function testShouldSetDefaultModuleWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'defaultModule' => 'foo', ]); @@ -269,7 +258,6 @@ public function testShouldSetDefaultModuleWhenOptionPresent() public function testShouldSetBaseUrlWhenOptionPresent() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'baseUrl' => '/foo', ]); @@ -285,7 +273,6 @@ public function testShouldSetParamsWhenOptionPresent() 'foo' => 'bar', 'bar' => 'baz', ]; - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'params' => $params, ]); @@ -300,7 +287,6 @@ public function testShouldInstantiateAndRegisterPluginsWhenOptionPassed() $plugins = [ \Zend_Controller_Plugin_ActionStack::class, ]; - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'plugins' => $plugins, ]); @@ -313,7 +299,6 @@ public function testShouldInstantiateAndRegisterPluginsWhenOptionPassed() public function testShouldReturnFrontControllerWhenComplete() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'controllerDirectory' => __DIR__, ]); @@ -323,7 +308,6 @@ public function testShouldReturnFrontControllerWhenComplete() public function testNoBaseUrlShouldBeSetIfEmptyBaseUrlProvidedInOptions() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'baseurl' => '', ]); @@ -370,7 +354,6 @@ public function testSettingOfRegisterPluginIndexActuallyWorks() */ public function testPassingReturnResponseFlagShouldAlterFrontControllerStatus() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'returnresponse' => true, ]); @@ -384,7 +367,6 @@ public function testPassingReturnResponseFlagShouldAlterFrontControllerStatus() */ public function testShouldSetDispatcherFromConfiguration() { - require_once 'Zend/Application/Resource/Frontcontroller.php'; $resource = new Zend_Application_Resource_Frontcontroller([ 'dispatcher' => [ 'class' => 'ZF9724_Dispatcher', @@ -400,7 +382,6 @@ public function testShouldSetDispatcherFromConfiguration() } } -require_once 'Zend/Controller/Dispatcher/Standard.php'; class ZF9724_Dispatcher extends Zend_Controller_Dispatcher_Standard { } diff --git a/tests/Zend/Application/Resource/ModulesTest.php b/tests/Zend/Application/Resource/ModulesTest.php index 483a4447..6ec763ee 100644 --- a/tests/Zend/Application/Resource/ModulesTest.php +++ b/tests/Zend/Application/Resource/ModulesTest.php @@ -192,7 +192,6 @@ public function testGetExecutedBootstrapsShouldReturnArrayObject() } } -require_once 'Zend/Application/Resource/Modules.php'; class ZendTest_Application_Resource_ModulesHalf extends Zend_Application_Resource_Modules { protected function bootstrapBootstraps($bootstraps) diff --git a/tests/Zend/Application/Resource/SessionTest.php b/tests/Zend/Application/Resource/SessionTest.php index b00338bc..7c8610ef 100644 --- a/tests/Zend/Application/Resource/SessionTest.php +++ b/tests/Zend/Application/Resource/SessionTest.php @@ -17,9 +17,6 @@ * * @version $Id$ */ -require_once 'Zend/Application/Resource/ResourceAbstract.php'; -require_once 'Zend/Application/Resource/Session.php'; -require_once 'Zend/Session.php'; require_once 'Zend/Session/SaveHandler/Interface.php'; /** diff --git a/tests/Zend/Application/Resource/UseragentTest.php b/tests/Zend/Application/Resource/UseragentTest.php index 2dd3c7b8..6b9b1bc1 100644 --- a/tests/Zend/Application/Resource/UseragentTest.php +++ b/tests/Zend/Application/Resource/UseragentTest.php @@ -18,8 +18,6 @@ /** * Zend_Loader_Autoloader. */ -require_once 'Zend/Loader/Autoloader.php'; -require_once 'Zend/Application/Resource/ResourceAbstract.php'; require_once 'Zend/Application/Resource/UserAgent.php'; /** diff --git a/tests/Zend/Application/Resource/ViewTest.php b/tests/Zend/Application/Resource/ViewTest.php index 82b824af..fe42f459 100644 --- a/tests/Zend/Application/Resource/ViewTest.php +++ b/tests/Zend/Application/Resource/ViewTest.php @@ -96,7 +96,6 @@ public function testOptionsPassedToResourceAreUsedToSetViewState() $options = [ 'scriptPath' => __DIR__, ]; - require_once 'Zend/Application/Resource/View.php'; $resource = new Zend_Application_Resource_View($options); $resource->init(); $view = $resource->getView(); diff --git a/tests/Zend/Captcha/DumbTest.php b/tests/Zend/Captcha/DumbTest.php index 8e91559d..154fa738 100644 --- a/tests/Zend/Captcha/DumbTest.php +++ b/tests/Zend/Captcha/DumbTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/Captcha.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Captcha/FigletTest.php b/tests/Zend/Captcha/FigletTest.php index 993d1f77..1d9ecbd8 100644 --- a/tests/Zend/Captcha/FigletTest.php +++ b/tests/Zend/Captcha/FigletTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/Captcha.php'; require_once 'Zend/Captcha/Adapter.php'; require_once 'Zend/Config.php'; @@ -74,7 +73,6 @@ public function testCaptchaAdapterCreated() public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper'); @@ -99,7 +97,6 @@ public function testCaptchaHasIdAndInput() // @group ZF-8268 public function testLabelIdIsCorrect() { - require_once 'Zend/Form.php'; $form = new Zend_Form(); $form->setElementsBelongTo('comment'); $this->element->setLabel('My Captcha'); @@ -288,7 +285,6 @@ public function testSetSessionWorks() if (headers_sent($file, $line)) { $this->markTestSkipped('Cannot use sessions because headers already sent'); } - require_once 'Zend/Session/Namespace.php'; $session = new Zend_Session_Namespace('captcha'); $this->captcha->setSession($session); $this->testCaptchaIsRendered(); diff --git a/tests/Zend/Captcha/ImageTest.php b/tests/Zend/Captcha/ImageTest.php index 2428aed9..0cbffa91 100644 --- a/tests/Zend/Captcha/ImageTest.php +++ b/tests/Zend/Captcha/ImageTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/Captcha.php'; require_once 'Zend/Captcha/Adapter.php'; /** @@ -120,7 +119,6 @@ protected function _getTmpDir() public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper'); diff --git a/tests/Zend/Controller/Action/Helper/ActionStackTest.php b/tests/Zend/Controller/Action/Helper/ActionStackTest.php index 9c9ad5dc..eff6a574 100644 --- a/tests/Zend/Controller/Action/Helper/ActionStackTest.php +++ b/tests/Zend/Controller/Action/Helper/ActionStackTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Action/Helper/ActionStack.php'; -require_once 'Zend/Controller/Front.php'; require_once 'Zend/Controller/Request/Simple.php'; /** diff --git a/tests/Zend/Controller/Action/Helper/AjaxContextTest.php b/tests/Zend/Controller/Action/Helper/AjaxContextTest.php index bb75bad9..6ef95fe8 100644 --- a/tests/Zend/Controller/Action/Helper/AjaxContextTest.php +++ b/tests/Zend/Controller/Action/Helper/AjaxContextTest.php @@ -18,13 +18,6 @@ */ require_once 'Zend/Controller/Action/Helper/AjaxContext.php'; -require_once 'Zend/Controller/Action.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Request/Http.php'; -require_once 'Zend/Controller/Request/Simple.php'; -require_once 'Zend/Controller/Response/Cli.php'; -require_once 'Zend/Layout.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Controller/Action/Helper/CacheTest.php b/tests/Zend/Controller/Action/Helper/CacheTest.php index f4ab9dac..fd681d7c 100644 --- a/tests/Zend/Controller/Action/Helper/CacheTest.php +++ b/tests/Zend/Controller/Action/Helper/CacheTest.php @@ -1,12 +1,5 @@ helper->view->addBasePath($this->basePath . '/_files/modules/bar/views'); - require_once 'Zend/Filter/PregReplace.php'; require_once 'Zend/Filter/Word/UnderscoreToSeparator.php'; $inflector = new Zend_Filter_Inflector('test.phtml'); diff --git a/tests/Zend/Controller/Action/HelperBroker/PriorityStackTest.php b/tests/Zend/Controller/Action/HelperBroker/PriorityStackTest.php index 81475d36..075a8185 100644 --- a/tests/Zend/Controller/Action/HelperBroker/PriorityStackTest.php +++ b/tests/Zend/Controller/Action/HelperBroker/PriorityStackTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Controller/Action/Helper/ViewRenderer.php'; require_once 'Zend/Controller/Action/Helper/Redirector.php'; /** diff --git a/tests/Zend/Controller/Action/HelperBrokerTest.php b/tests/Zend/Controller/Action/HelperBrokerTest.php index 781602b6..be6aaf77 100644 --- a/tests/Zend/Controller/Action/HelperBrokerTest.php +++ b/tests/Zend/Controller/Action/HelperBrokerTest.php @@ -16,12 +16,8 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Request/Http.php'; require_once 'Zend/Controller/Response/Cli.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Controller/Action/Helper/ViewRenderer.php'; require_once 'Zend/Controller/Action/Helper/Redirector.php'; /** diff --git a/tests/Zend/Controller/ActionTest.php b/tests/Zend/Controller/ActionTest.php index a2707cce..b368c9c1 100644 --- a/tests/Zend/Controller/ActionTest.php +++ b/tests/Zend/Controller/ActionTest.php @@ -16,10 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Action.php'; -require_once 'Zend/Controller/Action/Helper/Redirector.php'; -require_once 'Zend/Controller/Action/Helper/ViewRenderer.php'; -require_once 'Zend/Controller/Request/Http.php'; require_once 'Zend/Controller/Response/Cli.php'; /** diff --git a/tests/Zend/Controller/Dispatcher/StandardTest.php b/tests/Zend/Controller/Dispatcher/StandardTest.php index 608d7bd0..7021172c 100644 --- a/tests/Zend/Controller/Dispatcher/StandardTest.php +++ b/tests/Zend/Controller/Dispatcher/StandardTest.php @@ -16,11 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Dispatcher/Standard.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Request/Http.php'; -require_once 'Zend/Controller/Request/Simple.php'; require_once 'Zend/Controller/Response/Cli.php'; /** diff --git a/tests/Zend/Controller/FrontTest.php b/tests/Zend/Controller/FrontTest.php index 032be39b..997b2b4f 100644 --- a/tests/Zend/Controller/FrontTest.php +++ b/tests/Zend/Controller/FrontTest.php @@ -16,13 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Request/Http.php'; -require_once 'Zend/Controller/Response/Cli.php'; -require_once 'Zend/Controller/Dispatcher/Standard.php'; -require_once 'Zend/Controller/Router/Rewrite.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Controller/Action/Helper/Url.php'; require_once 'Zend/Controller/Action/Helper/ViewRenderer.php'; /** diff --git a/tests/Zend/Controller/Plugin/ActionStackTest.php b/tests/Zend/Controller/Plugin/ActionStackTest.php index 16a20759..899bf7d3 100644 --- a/tests/Zend/Controller/Plugin/ActionStackTest.php +++ b/tests/Zend/Controller/Plugin/ActionStackTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Plugin/ActionStack.php'; -require_once 'Zend/Controller/Request/Simple.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/Controller/Plugin/BrokerTest.php b/tests/Zend/Controller/Plugin/BrokerTest.php index 762cc3f0..f08225fd 100644 --- a/tests/Zend/Controller/Plugin/BrokerTest.php +++ b/tests/Zend/Controller/Plugin/BrokerTest.php @@ -16,10 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Controller/Request/Http.php'; -require_once 'Zend/Controller/Request/Simple.php'; require_once 'Zend/Controller/Response/Cli.php'; /** diff --git a/tests/Zend/Controller/Plugin/ErrorHandlerTest.php b/tests/Zend/Controller/Plugin/ErrorHandlerTest.php index bee467f2..3cfab431 100644 --- a/tests/Zend/Controller/Plugin/ErrorHandlerTest.php +++ b/tests/Zend/Controller/Plugin/ErrorHandlerTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Plugin/ErrorHandler.php'; -require_once 'Zend/Controller/Request/Http.php'; require_once 'Zend/Controller/Response/Http.php'; require_once 'Zend/Controller/Front.php'; diff --git a/tests/Zend/Controller/Plugin/PutHandlerTest.php b/tests/Zend/Controller/Plugin/PutHandlerTest.php index d1267989..423e1d9a 100644 --- a/tests/Zend/Controller/Plugin/PutHandlerTest.php +++ b/tests/Zend/Controller/Plugin/PutHandlerTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Plugin/PutHandler.php'; -require_once 'Zend/Controller/Request/HttpTestCase.php'; require_once 'Zend/Controller/Front.php'; /** diff --git a/tests/Zend/Controller/Response/HttpTest.php b/tests/Zend/Controller/Response/HttpTest.php index d29c3ca6..401ab147 100644 --- a/tests/Zend/Controller/Response/HttpTest.php +++ b/tests/Zend/Controller/Response/HttpTest.php @@ -19,7 +19,6 @@ // Call Zend_Controller_Response_HttpTest::main() if this source file is executed directly. -require_once 'Zend/Controller/Response/Http.php'; /** * @license http://framework.zend.com/license/new-bsd New BSD License * @@ -637,7 +636,6 @@ public function testHeaderNamesAreCaseInsensitive() } } -require_once 'Zend/Controller/Action.php'; class Zend_Controller_Response_HttpTest_Action extends Zend_Controller_Action { } diff --git a/tests/Zend/Controller/Router/RewriteTest.php b/tests/Zend/Controller/Router/RewriteTest.php index 933bf0c5..e619a26b 100644 --- a/tests/Zend/Controller/Router/RewriteTest.php +++ b/tests/Zend/Controller/Router/RewriteTest.php @@ -327,7 +327,6 @@ public function testGetCurrentRoute() public function testAddConfig() { - require_once 'Zend/Config/Ini.php'; $file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'routes.ini'; $config = new Zend_Config_Ini($file, 'testing'); @@ -347,7 +346,6 @@ public function testAddConfig() public function testAddConfigWithoutSection() { - require_once 'Zend/Config/Ini.php'; $file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'routes.ini'; $config = new Zend_Config_Ini($file, 'testing'); @@ -359,7 +357,6 @@ public function testAddConfigWithoutSection() public function testAddConfigWithRootNode() { - require_once 'Zend/Config/Ini.php'; $file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'routes-root.ini'; $config = new Zend_Config_Ini($file, 'routes'); diff --git a/tests/Zend/Controller/Router/Route/ModuleTest.php b/tests/Zend/Controller/Router/Route/ModuleTest.php index ab425a0f..f6e6df8c 100644 --- a/tests/Zend/Controller/Router/Route/ModuleTest.php +++ b/tests/Zend/Controller/Router/Route/ModuleTest.php @@ -69,7 +69,6 @@ public function setUp(): void 'module' => 'default', ]; - require_once 'Zend/Controller/Request/Http.php'; $this->_request = new Zend_Controller_Request_Http(); $front->setRequest($this->_request); diff --git a/tests/Zend/Controller/_files/Admin/FooBarController.php b/tests/Zend/Controller/_files/Admin/FooBarController.php index 890b42c3..aa77a39f 100644 --- a/tests/Zend/Controller/_files/Admin/FooBarController.php +++ b/tests/Zend/Controller/_files/Admin/FooBarController.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Action.php'; require_once __DIR__ . '/../FooController.php'; /** diff --git a/tests/Zend/Controller/_files/Admin/FooController.php b/tests/Zend/Controller/_files/Admin/FooController.php index 10b25301..1dd3e7d6 100644 --- a/tests/Zend/Controller/_files/Admin/FooController.php +++ b/tests/Zend/Controller/_files/Admin/FooController.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Action.php'; require_once __DIR__ . '/../FooController.php'; /** diff --git a/tests/Zend/Controller/_files/Helpers/NamespacedHelper.php b/tests/Zend/Controller/_files/Helpers/NamespacedHelper.php index 77065a67..2df052fe 100644 --- a/tests/Zend/Controller/_files/Helpers/NamespacedHelper.php +++ b/tests/Zend/Controller/_files/Helpers/NamespacedHelper.php @@ -4,7 +4,6 @@ use Zend_Controller_Action_Helper_Abstract; -require_once 'Zend/Controller/Action/Helper/Abstract.php'; class NamespacedHelper extends Zend_Controller_Action_Helper_Abstract { } diff --git a/tests/Zend/Controller/_files/ObController.php b/tests/Zend/Controller/_files/ObController.php index b8043f7d..df15b93f 100644 --- a/tests/Zend/Controller/_files/ObController.php +++ b/tests/Zend/Controller/_files/ObController.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Action.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Date/DateObjectTest.php b/tests/Zend/Date/DateObjectTest.php index db1f9ce6..d194314a 100644 --- a/tests/Zend/Date/DateObjectTest.php +++ b/tests/Zend/Date/DateObjectTest.php @@ -34,7 +34,6 @@ public function setUp(): void { $this->originalTimezone = date_default_timezone_get(); date_default_timezone_set('Europe/Paris'); - require_once 'Zend/Cache.php'; $this->_cache = Zend_Cache::factory('Core', 'File', ['lifetime' => 120, 'automatic_serialization' => true], ['cache_dir' => __DIR__ . '/../_files/']); diff --git a/tests/Zend/DateTest.php b/tests/Zend/DateTest.php index a11e2aa9..c55139f1 100644 --- a/tests/Zend/DateTest.php +++ b/tests/Zend/DateTest.php @@ -34,9 +34,6 @@ /** * Zend_Date. */ -require_once 'Zend/Loader.php'; -require_once 'Zend/Date.php'; -require_once 'Zend/Locale.php'; require_once 'Zend/Date/Cities.php'; // echo "BCMATH is ", Zend_Locale_Math::isBcmathDisabled() ? 'disabled':'not disabled', "\n"; @@ -57,7 +54,6 @@ public function setUp(): void { $this->originalTimezone = date_default_timezone_get(); date_default_timezone_set('Indian/Maldives'); - require_once 'Zend/Cache.php'; $this->_cache = Zend_Cache::factory('Core', 'File', ['lifetime' => 120, 'automatic_serialization' => true], ['cache_dir' => __DIR__ . '/_files/']); @@ -5331,10 +5327,9 @@ public function testSetOptions() // success } - require_once 'Zend/Cache.php'; - $cache = Zend_Cache::factory('Core', 'File', - ['lifetime' => 120, 'automatic_serialization' => true], - ['cache_dir' => __DIR__ . '/_files/']); + $cache = Zend_Cache::factory('Core', 'File', + ['lifetime' => 120, 'automatic_serialization' => true], + ['cache_dir' => __DIR__ . '/_files/']); Zend_Date::setOptions(['cache' => $cache]); } @@ -5427,7 +5422,6 @@ public function testGetFullYear() public function testZF3677() { $locale = new Zend_Locale('de_AT'); - require_once 'Zend/Registry.php'; Zend_Registry::set(\Zend_Locale::class, $locale); $date = new Zend_Date('13',null,$locale); diff --git a/tests/Zend/File/Transfer/Adapter/AbstractTest.php b/tests/Zend/File/Transfer/Adapter/AbstractTest.php index 2a557ea6..0860c0c5 100644 --- a/tests/Zend/File/Transfer/Adapter/AbstractTest.php +++ b/tests/Zend/File/Transfer/Adapter/AbstractTest.php @@ -16,12 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/File/Transfer/Adapter/Abstract.php'; -require_once 'Zend/Filter/BaseName.php'; -require_once 'Zend/Filter/StringToLower.php'; -require_once 'Zend/Filter/StringToUpper.php'; -require_once 'Zend/Loader/PluginLoader.php'; -require_once 'Zend/Validate/File/Count.php'; require_once 'Zend/Validate/File/Extension.php'; /** diff --git a/tests/Zend/File/Transfer/Adapter/HttpTest.php b/tests/Zend/File/Transfer/Adapter/HttpTest.php index 0ea5b9bf..5831d330 100644 --- a/tests/Zend/File/Transfer/Adapter/HttpTest.php +++ b/tests/Zend/File/Transfer/Adapter/HttpTest.php @@ -16,12 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/File/Transfer/Adapter/Http.php'; -require_once 'Zend/Filter/BaseName.php'; -require_once 'Zend/Filter/StringToLower.php'; -require_once 'Zend/Loader/PluginLoader.php'; -require_once 'Zend/Validate/File/Count.php'; -require_once 'Zend/Validate/File/Extension.php'; require_once 'Zend/Validate/File/Upload.php'; /** diff --git a/tests/Zend/Filter/BooleanTest.php b/tests/Zend/Filter/BooleanTest.php index 4603f13a..52e394e2 100644 --- a/tests/Zend/Filter/BooleanTest.php +++ b/tests/Zend/Filter/BooleanTest.php @@ -563,7 +563,6 @@ public function testSettingLocalePerConstructorString() */ public function testConfigObject() { - require_once 'Zend/Config.php'; $options = ['type' => 'all', 'locale' => 'de']; $config = new Zend_Config($options); diff --git a/tests/Zend/Filter/HtmlEntitiesTest.php b/tests/Zend/Filter/HtmlEntitiesTest.php index eb0c2e14..a4a31add 100644 --- a/tests/Zend/Filter/HtmlEntitiesTest.php +++ b/tests/Zend/Filter/HtmlEntitiesTest.php @@ -132,7 +132,6 @@ public function testFluentInterface() */ public function testConfigObject() { - require_once 'Zend/Config.php'; $options = ['quotestyle' => 5, 'encoding' => 'ISO-8859-1']; $config = new Zend_Config($options); diff --git a/tests/Zend/Filter/InputTest.php b/tests/Zend/Filter/InputTest.php index 6a0ffa37..bb226152 100644 --- a/tests/Zend/Filter/InputTest.php +++ b/tests/Zend/Filter/InputTest.php @@ -43,8 +43,6 @@ class Zend_Filter_InputTest extends \PHPUnit\Framework\TestCase function testIfCustomMessagesOnValidatorInstancesCanBeUsed() { // test with a Digits validator - require_once 'Zend/Validate/Digits.php'; - require_once 'Zend/Validate/NotEmpty.php'; $data = ['field1' => 'invalid data']; $customMessage = 'Hey, that\'s not a Digit!!!'; $validator = new Zend_Validate_Digits(); @@ -81,7 +79,6 @@ function testIfCustomMessagesOnValidatorInstancesCanBeUsed() */ function testAllowEmptyTrueRespectsNotEmtpyValidators() { - require_once 'Zend/Validate/NotEmpty.php'; require_once 'Zend/Validate/Digits.php'; $data = [ @@ -206,7 +203,6 @@ function testAllowEmptyTrueRespectsNotEmtpyValidators() */ public function testNoNestedMessageArrays() { - require_once 'Zend/Validate/NotEmpty.php'; $data = [ 'field1' => '', 'field2' => '', @@ -240,8 +236,6 @@ public function testNoNestedMessageArrays() */ public function testTwoValidatorsInChainShowCorrectError() { - require_once 'Zend/Validate/NotEmpty.php'; - require_once 'Zend/Validate/Float.php'; $validators = [ 'field1' => [ 'NotEmpty', 'Float', @@ -2053,8 +2047,6 @@ public function testValidatorAllowNull() */ public function testSettingNotEmptyMessageAndMessagePerKeyAndMessagePerArray() { - require_once 'Zend/Validate/NotEmpty.php'; - require_once 'Zend/Validate/Regex.php'; require_once 'Zend/Validate/StringLength.php'; $filters = []; @@ -2097,8 +2089,6 @@ public function testSettingNotEmptyMessageAndMessagePerKeyAndMessagePerArray() */ public function testSettingMultipleNotEmptyMessages() { - require_once 'Zend/Validate/NotEmpty.php'; - require_once 'Zend/Validate/Regex.php'; require_once 'Zend/Validate/StringLength.php'; $filters = []; @@ -2128,7 +2118,6 @@ public function testSettingMultipleNotEmptyMessages() */ public function testTranslateNotEmptyMessages() { - require_once 'Zend/Translate/Adapter/Array.php'; $translator = new Zend_Translate_Adapter_Array(['missingMessage' => 'Still missing'], 'en'); $validators = [ @@ -2153,9 +2142,7 @@ public function testTranslateNotEmptyMessages() */ public function testTranslateNotEmptyMessagesByUsingRegistry() { - require_once 'Zend/Translate/Adapter/Array.php'; $translator = new Zend_Translate_Adapter_Array(['missingMessage' => 'Still missing'], 'en'); - require_once 'Zend/Registry.php'; Zend_Registry::set(\Zend_Translate::class, $translator); $validators = [ diff --git a/tests/Zend/Filter/StringTrimTest.php b/tests/Zend/Filter/StringTrimTest.php index 385e0638..d6a649c6 100644 --- a/tests/Zend/Filter/StringTrimTest.php +++ b/tests/Zend/Filter/StringTrimTest.php @@ -107,7 +107,6 @@ public function testZF7902() */ public function testSetParamCharListToConstructor() { - require_once 'Zend/Config.php'; $config = new Zend_Config(['charlist' => '&']); $filter = new Zend_Filter_StringTrim($config); $this->assertEquals('&', $filter->getCharList()); diff --git a/tests/Zend/Form/Decorator/AbstractTest.php b/tests/Zend/Form/Decorator/AbstractTest.php index 0e3fb396..22d217a8 100644 --- a/tests/Zend/Form/Decorator/AbstractTest.php +++ b/tests/Zend/Form/Decorator/AbstractTest.php @@ -18,10 +18,6 @@ */ require_once 'Zend/Form/Decorator/Errors.php'; -require_once 'Zend/Config.php'; -require_once 'Zend/Form.php'; -require_once 'Zend/Form/DisplayGroup.php'; -require_once 'Zend/Form/Element.php'; require_once 'Zend/Loader/PluginLoader.php'; /** diff --git a/tests/Zend/Form/Decorator/CallbackTest.php b/tests/Zend/Form/Decorator/CallbackTest.php index 0ec11ea1..2b8eeb2a 100644 --- a/tests/Zend/Form/Decorator/CallbackTest.php +++ b/tests/Zend/Form/Decorator/CallbackTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Decorator/Callback.php'; require_once 'Zend/Form/Element.php'; /** diff --git a/tests/Zend/Form/Decorator/DescriptionTest.php b/tests/Zend/Form/Decorator/DescriptionTest.php index 16007bf0..c473abf2 100644 --- a/tests/Zend/Form/Decorator/DescriptionTest.php +++ b/tests/Zend/Form/Decorator/DescriptionTest.php @@ -18,7 +18,6 @@ */ require_once 'Zend/Form/Decorator/Description.php'; -require_once 'Zend/Form/Element.php'; require_once 'Zend/View.php'; /** @@ -156,7 +155,6 @@ public function testCanSetEscapeFlagViaOption() public function testDescriptionIsTranslatedWhenTranslationAvailable() { - require_once 'Zend/Translate.php'; $translations = ['description' => 'This is the description']; $translate = new Zend_Translate('array', $translations); $this->element->setDescription('description') @@ -171,7 +169,6 @@ public function testDescriptionIsTranslatedWhenTranslationAvailable() public function testDescriptionIsNotTranslatedTwice() { // Init translator - require_once 'Zend/Translate.php'; $translate = new Zend_Translate( [ 'adapter' => 'array', diff --git a/tests/Zend/Form/Decorator/ErrorsTest.php b/tests/Zend/Form/Decorator/ErrorsTest.php index 6b3a9082..843c8919 100644 --- a/tests/Zend/Form/Decorator/ErrorsTest.php +++ b/tests/Zend/Form/Decorator/ErrorsTest.php @@ -18,8 +18,6 @@ */ require_once 'Zend/Form/Decorator/Errors.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/Form/SubForm.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Form/Decorator/FieldsetTest.php b/tests/Zend/Form/Decorator/FieldsetTest.php index 33716fda..c77cac3f 100644 --- a/tests/Zend/Form/Decorator/FieldsetTest.php +++ b/tests/Zend/Form/Decorator/FieldsetTest.php @@ -18,10 +18,6 @@ */ require_once 'Zend/Form/Decorator/Fieldset.php'; -require_once 'Zend/Form.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/View.php'; -require_once 'Zend/Form/SubForm.php'; /** * Test class for Zend_Form_Decorator_Fieldset. * diff --git a/tests/Zend/Form/Decorator/FileTest.php b/tests/Zend/Form/Decorator/FileTest.php index 3c6f33da..384cd5cd 100644 --- a/tests/Zend/Form/Decorator/FileTest.php +++ b/tests/Zend/Form/Decorator/FileTest.php @@ -18,8 +18,6 @@ */ require_once 'Zend/Form/Decorator/File.php'; -require_once 'Zend/Form/Element/File.php'; -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/tests/Zend/Form/Decorator/FormErrorsTest.php b/tests/Zend/Form/Decorator/FormErrorsTest.php index 477a06f2..cc22ee7d 100644 --- a/tests/Zend/Form/Decorator/FormErrorsTest.php +++ b/tests/Zend/Form/Decorator/FormErrorsTest.php @@ -16,10 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Decorator/FormErrors.php'; -require_once 'Zend/Form.php'; -require_once 'Zend/Form/SubForm.php'; -require_once 'Zend/Translate.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Form/Decorator/FormTest.php b/tests/Zend/Form/Decorator/FormTest.php index d236b596..49413ea7 100644 --- a/tests/Zend/Form/Decorator/FormTest.php +++ b/tests/Zend/Form/Decorator/FormTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Decorator/Form.php'; require_once 'Zend/Form.php'; /** @@ -57,7 +56,6 @@ public function tearDown(): void public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper'); @@ -75,8 +73,6 @@ public function testCanSetHelperWithOption() $this->decorator->setOption('helper', 'formForm'); $this->assertEquals('formForm', $this->decorator->getHelper()); - require_once 'Zend/Form/DisplayGroup.php'; - require_once 'Zend/Loader/PluginLoader.php'; $attribs = [ 'enctype' => 'ascii', 'charset' => 'us-ascii', diff --git a/tests/Zend/Form/Decorator/HtmlTagTest.php b/tests/Zend/Form/Decorator/HtmlTagTest.php index bd80362e..e38abf71 100644 --- a/tests/Zend/Form/Decorator/HtmlTagTest.php +++ b/tests/Zend/Form/Decorator/HtmlTagTest.php @@ -18,7 +18,6 @@ */ require_once 'Zend/Form/Decorator/HtmlTag.php'; -require_once 'Zend/Form/Element.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Form/Decorator/ImageTest.php b/tests/Zend/Form/Decorator/ImageTest.php index 63ff6db8..2097b3c1 100644 --- a/tests/Zend/Form/Decorator/ImageTest.php +++ b/tests/Zend/Form/Decorator/ImageTest.php @@ -18,9 +18,6 @@ */ require_once 'Zend/Form/Decorator/Image.php'; -require_once 'Zend/Form.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/Form/Element/Image.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Form/Decorator/LabelTest.php b/tests/Zend/Form/Decorator/LabelTest.php index bdffec2b..f32cbc6c 100644 --- a/tests/Zend/Form/Decorator/LabelTest.php +++ b/tests/Zend/Form/Decorator/LabelTest.php @@ -18,8 +18,6 @@ */ require_once 'Zend/Form/Decorator/Label.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/Form/Element/Text.php'; require_once 'Zend/View.php'; /** @@ -247,7 +245,6 @@ public function testCanChooseNotToEscapeLabel() public function testRetrievingLabelRetrievesLabelWithTranslationAndPrefixAndSuffix() { - require_once 'Zend/Translate.php'; $translate = new Zend_Translate('array', ['My Label' => 'Translation'], 'en'); $translate->setLocale('en'); @@ -386,7 +383,6 @@ public function testRenderImplicitAppendsOnRequest() public function testLabelIsNotTranslatedTwice() { // Init translator - require_once 'Zend/Translate.php'; $translate = new Zend_Translate( [ 'adapter' => 'array', diff --git a/tests/Zend/Form/Decorator/PrepareElementsTest.php b/tests/Zend/Form/Decorator/PrepareElementsTest.php index 3d96ce35..e906286a 100644 --- a/tests/Zend/Form/Decorator/PrepareElementsTest.php +++ b/tests/Zend/Form/Decorator/PrepareElementsTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Decorator/PrepareElements.php'; -require_once 'Zend/Form.php'; require_once 'Zend/Form/SubForm.php'; /** @@ -60,7 +58,6 @@ public function tearDown(): void public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); return $view; @@ -116,7 +113,6 @@ public function testEachElementShouldHaveUpdatedViewProperty() public function testEachElementShouldHaveUpdatedTranslatorProperty() { $this->prepareForm(); - require_once 'Zend/Translate.php'; $translator = new Zend_Translate('array', ['foo' => 'bar'], 'en'); $this->form->setTranslator($translator); $this->form->render(); diff --git a/tests/Zend/Form/Decorator/ViewHelperTest.php b/tests/Zend/Form/Decorator/ViewHelperTest.php index 01bf5bee..690ccca0 100644 --- a/tests/Zend/Form/Decorator/ViewHelperTest.php +++ b/tests/Zend/Form/Decorator/ViewHelperTest.php @@ -18,8 +18,6 @@ */ require_once 'Zend/Form/Decorator/ViewHelper.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/Form/Element/Text.php'; require_once 'Zend/View.php'; /** @@ -140,8 +138,6 @@ public function testRenderRendersElementWithSpecifiedHelper() public function testMultiOptionsPassedToViewHelperAreTranslated() { - require_once 'Zend/Form/Element/Select.php'; - require_once 'Zend/Translate.php'; $element = new Zend_Form_Element_Select('foo'); $options = [ 'foo' => 'This Foo Will Not Be Displayed', diff --git a/tests/Zend/Form/Decorator/ViewScriptTest.php b/tests/Zend/Form/Decorator/ViewScriptTest.php index 69bc455f..336e701e 100644 --- a/tests/Zend/Form/Decorator/ViewScriptTest.php +++ b/tests/Zend/Form/Decorator/ViewScriptTest.php @@ -18,8 +18,6 @@ */ require_once 'Zend/Form/Decorator/ViewScript.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/Form/Element/Text.php'; require_once 'Zend/View.php'; /** @@ -148,7 +146,6 @@ public function testRenderingRendersViewScriptWithModule() $module = 'fooModule'; // add module to front controller so partial view helper can verify it exists - require_once 'Zend/Controller/Front.php'; Zend_Controller_Front::getInstance()->addControllerDirectory('', $module); $this->getElement()->setAttrib('viewModule', $module); diff --git a/tests/Zend/Form/DisplayGroupTest.php b/tests/Zend/Form/DisplayGroupTest.php index ee7b99e3..7ece4eae 100644 --- a/tests/Zend/Form/DisplayGroupTest.php +++ b/tests/Zend/Form/DisplayGroupTest.php @@ -18,16 +18,6 @@ */ require_once 'Zend/Form/DisplayGroup.php'; -require_once 'Zend/Config.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Form.php'; -require_once 'Zend/Form/Decorator/Form.php'; -require_once 'Zend/Form/Decorator/HtmlTag.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/Form/Element/Text.php'; -require_once 'Zend/Loader/PluginLoader.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/Translate.php'; require_once 'Zend/View.php'; /** @@ -355,7 +345,6 @@ public function testCanAddDecoratorAliasesToAllowMultipleDecoratorsOfSameType() */ public function testGetViewShouldNotReturnNullWhenViewRendererIsActive() { - require_once 'Zend/Controller/Action/HelperBroker.php'; $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->initView(); $view = $this->group->getView(); diff --git a/tests/Zend/Form/Element/ButtonTest.php b/tests/Zend/Form/Element/ButtonTest.php index 075d74b8..42ccb585 100644 --- a/tests/Zend/Form/Element/ButtonTest.php +++ b/tests/Zend/Form/Element/ButtonTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/Button.php'; require_once 'Zend/Translate.php'; /** @@ -62,7 +61,6 @@ public function tearDown(): void public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); return $view; diff --git a/tests/Zend/Form/Element/CheckboxTest.php b/tests/Zend/Form/Element/CheckboxTest.php index af5e8851..1068d5e8 100644 --- a/tests/Zend/Form/Element/CheckboxTest.php +++ b/tests/Zend/Form/Element/CheckboxTest.php @@ -89,7 +89,6 @@ public function testCheckedFlagIsFalseByDefault() public function testCheckedAttributeNotRenderedByDefault() { - require_once 'Zend/View.php'; $view = new Zend_View(); $html = $this->element->render($view); $this->assertStringNotContainsString('checked="checked"', $html); @@ -97,7 +96,6 @@ public function testCheckedAttributeNotRenderedByDefault() public function testCheckedAttributeRenderedWhenCheckedFlagTrue() { - require_once 'Zend/View.php'; $view = new Zend_View(); $this->element->checked = true; $html = $this->element->render($view); diff --git a/tests/Zend/Form/Element/FileTest.php b/tests/Zend/Form/Element/FileTest.php index 721513a9..68a39e9f 100644 --- a/tests/Zend/Form/Element/FileTest.php +++ b/tests/Zend/Form/Element/FileTest.php @@ -16,12 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/File.php'; -require_once 'Zend/File/Transfer/Adapter/Abstract.php'; -require_once 'Zend/Validate/File/Upload.php'; -require_once 'Zend/Form/SubForm.php'; -require_once 'Zend/Form.php'; -require_once 'Zend/Registry.php'; require_once 'Zend/View.php'; /** @@ -299,7 +293,6 @@ public function testAutoGetPostMaxSize() public function testTranslatingValidatorErrors() { - require_once 'Zend/Translate.php'; $translate = new Zend_Translate('array', ['unused', 'foo' => 'bar'], 'en'); $this->element->setTranslator($translate); @@ -418,7 +411,6 @@ public function testGetTranslatorRetrievesGlobalDefaultWhenAvailable() { $this->assertNull($this->element->getTranslator()); $translator = new Zend_Translate('array', ['foo' => 'bar']); - require_once 'Zend/Form.php'; Zend_Form::setDefaultTranslator($translator); $received = $this->element->getTranslator(); $this->assertSame($translator->getAdapter(), $received); diff --git a/tests/Zend/Form/Element/HashTest.php b/tests/Zend/Form/Element/HashTest.php index d82b9e8f..ef00b8d5 100644 --- a/tests/Zend/Form/Element/HashTest.php +++ b/tests/Zend/Form/Element/HashTest.php @@ -137,7 +137,6 @@ public function testSessionNameContainsSaltAndName() public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper'); diff --git a/tests/Zend/Form/Element/ImageTest.php b/tests/Zend/Form/Element/ImageTest.php index de15aadf..ffac8212 100644 --- a/tests/Zend/Form/Element/ImageTest.php +++ b/tests/Zend/Form/Element/ImageTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/Image.php'; -require_once 'Zend/View.php'; require_once 'Zend/Translate/Adapter/Array.php'; /** diff --git a/tests/Zend/Form/Element/MultiCheckboxTest.php b/tests/Zend/Form/Element/MultiCheckboxTest.php index 058477ab..d9696194 100644 --- a/tests/Zend/Form/Element/MultiCheckboxTest.php +++ b/tests/Zend/Form/Element/MultiCheckboxTest.php @@ -56,7 +56,6 @@ public function tearDown(): void public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper'); diff --git a/tests/Zend/Form/Element/MultiselectTest.php b/tests/Zend/Form/Element/MultiselectTest.php index 9b3f3380..d4728072 100644 --- a/tests/Zend/Form/Element/MultiselectTest.php +++ b/tests/Zend/Form/Element/MultiselectTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/Multiselect.php'; require_once 'Zend/Translate.php'; /** @@ -62,7 +61,6 @@ public function tearDown(): void public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper/'); @@ -168,14 +166,12 @@ public function testCanSetMultiOptionsUsingAssocArraysWithKeyValueKeys() */ public function testCanSetMultiOptionsUsingConfigWithKeyValueKeys() { - require_once 'Zend/Config/Xml.php'; $config = new Zend_Config_Xml(__DIR__ . '/../_files/config/multiOptions.xml', 'testing'); $this->element->setMultiOptions($config->options->toArray()); $this->assertEquals($config->options->first->value, $this->element->getMultiOption('aa')); $this->assertEquals($config->options->second->value, $this->element->getMultiOption(2)); $this->assertEquals($config->options->third->value, $this->element->getMultiOption('ssss')); - require_once 'Zend/Config/Ini.php'; $config = new Zend_Config_Ini(__DIR__ . '/../_files/config/multiOptions.ini', 'testing'); $this->element->setMultiOptions($config->options->toArray()); $this->assertEquals($config->options->first->value, $this->element->getMultiOption('aa')); @@ -211,7 +207,6 @@ public function testTranslatedOptionsAreRenderedInFinalMarkupWhenTranslatorPrese 'ThisShouldNotShow' => 'Foo Value', 'ThisShouldNeverShow' => 'Bar Value', ]; - require_once 'Zend/Translate.php'; $translate = new Zend_Translate('array', $translations, 'en'); $translate->setLocale('en'); @@ -283,7 +278,6 @@ public function testOptGroupTranslationsShouldWorkAfterPopulatingElement() 'ThisShouldNotShow' => 'Foo Value', 'ThisShouldNeverShow' => 'Bar Value', ]; - require_once 'Zend/Translate.php'; $translate = new Zend_Translate('array', $translations, 'en'); $translate->setLocale('en'); diff --git a/tests/Zend/Form/Element/PasswordTest.php b/tests/Zend/Form/Element/PasswordTest.php index 5fc8ddf7..4b9223ab 100644 --- a/tests/Zend/Form/Element/PasswordTest.php +++ b/tests/Zend/Form/Element/PasswordTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/Password.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Form/Element/RadioTest.php b/tests/Zend/Form/Element/RadioTest.php index 2e448c2a..87020357 100644 --- a/tests/Zend/Form/Element/RadioTest.php +++ b/tests/Zend/Form/Element/RadioTest.php @@ -56,7 +56,6 @@ public function tearDown(): void public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper'); diff --git a/tests/Zend/Form/Element/SelectTest.php b/tests/Zend/Form/Element/SelectTest.php index 3e0eb6f0..9d7e9eea 100644 --- a/tests/Zend/Form/Element/SelectTest.php +++ b/tests/Zend/Form/Element/SelectTest.php @@ -56,7 +56,6 @@ public function tearDown(): void public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View([ 'encoding' => 'UTF-8', ]); @@ -123,8 +122,6 @@ public function testCanDisableIndividualSelectOptions() */ public function testTranslationShouldNotRaiseWarningsWithNestedGroups() { - require_once 'Zend/Translate.php'; - require_once 'Zend/View.php'; $translate = new Zend_Translate('array', ['Select Test', 'Select Test Translated'], 'en'); $this->element ->setLabel('Select Test') diff --git a/tests/Zend/Form/Element/SubmitTest.php b/tests/Zend/Form/Element/SubmitTest.php index f0a39f60..fb19558c 100644 --- a/tests/Zend/Form/Element/SubmitTest.php +++ b/tests/Zend/Form/Element/SubmitTest.php @@ -16,10 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Form/Element/Submit.php'; -require_once 'Zend/Form.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/Translate.php'; require_once 'Zend/Translate/Adapter/Array.php'; /** @@ -62,7 +58,6 @@ public function tearDown(): void public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper/'); @@ -134,7 +129,6 @@ public function testCanPassLabelAsParameterToConstructor() public function testLabelIsTranslatedWhenTranslationAvailable() { - require_once 'Zend/Translate.php'; $translations = ['Label' => 'This is the Submit Label']; $translate = new Zend_Translate('array', $translations); $submit = new Zend_Form_Element_Submit('foo', 'Label'); @@ -144,7 +138,6 @@ public function testLabelIsTranslatedWhenTranslationAvailable() public function testLabelWhichIsSetToNameIsTranslatedWhenTranslationAvailable() { - require_once 'Zend/Translate.php'; $translations = ['foo' => 'This is the Submit Label']; $translate = new Zend_Translate('array', $translations); $submit = new Zend_Form_Element_Submit('foo'); @@ -157,7 +150,6 @@ public function testLabelWhichIsSetToNameIsTranslatedWhenTranslationAvailable() */ public function testLabelIsNotTranslatedTwice() { - require_once 'Zend/Translate.php'; $translations = ['firstLabel' => 'secondLabel', 'secondLabel' => 'thirdLabel', ]; $translate = new Zend_Translate('array', $translations); diff --git a/tests/Zend/Form/ElementTest.php b/tests/Zend/Form/ElementTest.php index f569ff30..618049b4 100644 --- a/tests/Zend/Form/ElementTest.php +++ b/tests/Zend/Form/ElementTest.php @@ -18,16 +18,6 @@ */ require_once 'Zend/Form/Element.php'; -require_once 'Zend/Config.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Form.php'; -require_once 'Zend/Form/Decorator/Abstract.php'; -require_once 'Zend/Form/Decorator/HtmlTag.php'; -require_once 'Zend/Loader/PluginLoader.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/Translate.php'; -require_once 'Zend/Validate/NotEmpty.php'; -require_once 'Zend/Validate/EmailAddress.php'; require_once 'Zend/View.php'; /** @@ -247,7 +237,6 @@ public function testRetrievingArrayValueDoesNotFilterAllValuesWhenNotIsArray() ->addFilter(new Zend_Form_ElementTest_ArrayFilter()); $test = $this->element->getValue(); $this->assertTrue(is_array($test)); - require_once 'Zend/Json.php'; $test = Zend_Json::encode($test); $this->assertStringNotContainsString('foo', $test); foreach (['bar', 'baz', 'bat'] as $value) { @@ -697,7 +686,6 @@ public function testCanAddSingleValidatorAsValidatorObject() { $this->assertFalse($this->element->getValidator(\Zend_Validate_Digits::class)); - require_once 'Zend/Validate/Digits.php'; $validator = new Zend_Validate_Digits(); $this->element->addValidator($validator); $test = $this->element->getValidator(\Zend_Validate_Digits::class); @@ -725,7 +713,6 @@ public function testCanRetrieveSingleValidatorRegisteredAsValidatorObjectUsingSh $this->assertFalse($this->element->getValidator('digits')); - require_once 'Zend/Validate/Digits.php'; $validator = new Zend_Validate_Digits(); $this->element->addValidator($validator); $test = $this->element->getValidator('digits'); @@ -984,7 +971,6 @@ public function testAddingErrorToArrayElementShouldLoopOverAllValues() ->setValue(['foo', 'bar', 'baz']) ->addError('error with value %value%'); $errors = $this->element->getMessages(); - require_once 'Zend/Json.php'; $errors = Zend_Json::encode($errors); foreach (['foo', 'bar', 'baz'] as $value) { $message = 'error with value ' . $value; @@ -1098,8 +1084,6 @@ public function testErrorsPopulatedFollowingFailedIsValidCheck() public function testMessagesPopulatedFollowingFailedIsValidCheck() { - require_once 'Zend/Validate/NotEmpty.php'; - require_once 'Zend/Validate/EmailAddress.php'; $this->element->addValidator(new Zend_Validate_NotEmpty()) ->addValidator(new Zend_Validate_EmailAddress()); @@ -1172,7 +1156,6 @@ public function testCanAddSingleFilterAsFilterObject() { $this->assertFalse($this->element->getFilter(\Zend_Filter_Digits::class)); - require_once 'Zend/Filter/Digits.php'; $filter = new Zend_Filter_Digits(); $this->element->addFilter($filter); $test = $this->element->getFilter(\Zend_Filter_Digits::class); @@ -1185,7 +1168,6 @@ public function testCanRetrieveSingleFilterRegisteredAsFilterObjectUsingShortNam $this->assertFalse($this->element->getFilter('digits')); - require_once 'Zend/Filter/Digits.php'; $filter = new Zend_Filter_Digits(); $this->element->addFilter($filter); $test = $this->element->getFilter('digits'); diff --git a/tests/Zend/Form/FormTest.php b/tests/Zend/Form/FormTest.php index fa3208c1..65d70308 100644 --- a/tests/Zend/Form/FormTest.php +++ b/tests/Zend/Form/FormTest.php @@ -18,17 +18,6 @@ */ require_once 'Zend/Form.php'; -require_once 'Zend/Config.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Form/Decorator/Form.php'; -require_once 'Zend/Form/DisplayGroup.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/Form/Element/Text.php'; -require_once 'Zend/Form/Element/File.php'; -require_once 'Zend/Form/SubForm.php'; -require_once 'Zend/Loader/PluginLoader.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/Translate.php'; require_once 'Zend/View.php'; /** @@ -379,7 +368,6 @@ public function testSetOptionsSetsDisplayGroups() */ public function testDisplayGroupOrderInConfigShouldNotMatter() { - require_once 'Zend/Config/Xml.php'; $config = new Zend_Config_Xml(__DIR__ . '/_files/config/zf3250.xml', 'sitearea', true); $form = new Zend_Form($config->test); // no assertions needed; throws error if order matters @@ -3291,7 +3279,6 @@ public function testTranslatorIsNullByDefault() public function testCanSetTranslator() { - require_once 'Zend/Translate/Adapter/Array.php'; $translator = new Zend_Translate('array', ['foo' => 'bar']); $this->form->setTranslator($translator); $received = $this->form->getTranslator(); @@ -3835,7 +3822,6 @@ public function testCanSetDisplayGroupPrefixPath() */ public function testShouldAllowSettingDisplayGroupPrefixPathViaConfigOptions() { - require_once 'Zend/Config/Ini.php'; $config = new Zend_Config_Ini(__DIR__ . '/_files/config/zf3213.ini', 'form'); $form = new Zend_Form($config); $dg = $form->foofoo; diff --git a/tests/Zend/Form/SubFormTest.php b/tests/Zend/Form/SubFormTest.php index c765246c..a3e64deb 100644 --- a/tests/Zend/Form/SubFormTest.php +++ b/tests/Zend/Form/SubFormTest.php @@ -19,7 +19,6 @@ // error_reporting(E_ALL); -require_once 'Zend/Form/SubForm.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/Layout/HelperTest.php b/tests/Zend/Layout/HelperTest.php index 965cf162..fb2aee49 100644 --- a/tests/Zend/Layout/HelperTest.php +++ b/tests/Zend/Layout/HelperTest.php @@ -16,9 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Layout/Controller/Action/Helper/Layout.php'; -require_once 'Zend/Layout.php'; -require_once 'Zend/Controller/Front.php'; require_once 'Zend/Controller/Action/HelperBroker.php'; /** diff --git a/tests/Zend/Layout/LayoutTest.php b/tests/Zend/Layout/LayoutTest.php index ce72c74a..15c2adac 100644 --- a/tests/Zend/Layout/LayoutTest.php +++ b/tests/Zend/Layout/LayoutTest.php @@ -16,12 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Layout.php'; -require_once 'Zend/Layout/Controller/Plugin/Layout.php'; -require_once 'Zend/Layout/Controller/Action/Helper/Layout.php'; -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Filter/Inflector.php'; require_once 'Zend/View/Interface.php'; require_once 'Zend/View.php'; @@ -96,7 +90,6 @@ public function testSetConfigModifiesAttributes() { $layout = new Zend_Layout(); - require_once 'Zend/Config.php'; $config = new Zend_Config([ 'layout' => 'foo', 'contentKey' => 'foo', @@ -114,7 +107,6 @@ public function testSetOptionsWithConfigObjectModifiesAttributes() { $layout = new Zend_Layout(); - require_once 'Zend/Config.php'; $config = new Zend_Config([ 'layout' => 'foo', 'contentKey' => 'foo', diff --git a/tests/Zend/Layout/PluginTest.php b/tests/Zend/Layout/PluginTest.php index 064d0b5a..dcc48267 100644 --- a/tests/Zend/Layout/PluginTest.php +++ b/tests/Zend/Layout/PluginTest.php @@ -16,11 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Layout/Controller/Plugin/Layout.php'; -require_once 'Zend/Layout.php'; -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Controller/Request/Simple.php'; require_once 'Zend/Controller/Response/Cli.php'; /** diff --git a/tests/Zend/Loader/AutoloaderFactoryTest.php b/tests/Zend/Loader/AutoloaderFactoryTest.php index cb836cee..eca80f43 100644 --- a/tests/Zend/Loader/AutoloaderFactoryTest.php +++ b/tests/Zend/Loader/AutoloaderFactoryTest.php @@ -19,8 +19,6 @@ * Preload a number of classes to ensure they're available once we've disabled * other autoloaders. */ -require_once 'Zend/Loader/AutoloaderFactory.php'; -require_once 'Zend/Loader/ClassMapAutoloader.php'; require_once 'Zend/Loader/StandardAutoloader.php'; /** diff --git a/tests/Zend/Loader/PluginLoaderTest.php b/tests/Zend/Loader/PluginLoaderTest.php index 6d2cf089..47168469 100644 --- a/tests/Zend/Loader/PluginLoaderTest.php +++ b/tests/Zend/Loader/PluginLoaderTest.php @@ -442,7 +442,6 @@ public function testStaticRegistryNamePersistsInDifferentLoaderObjects() */ public function testClassFilesGrabCorrectPathForLoadedClasses() { - require_once 'Zend/View/Helper/DeclareVars.php'; $reflection = new ReflectionClass(\Zend_View_Helper_DeclareVars::class); $expected = $reflection->getFileName(); diff --git a/tests/Zend/Loader/StandardAutoloaderTest.php b/tests/Zend/Loader/StandardAutoloaderTest.php index 45b97640..348b8412 100644 --- a/tests/Zend/Loader/StandardAutoloaderTest.php +++ b/tests/Zend/Loader/StandardAutoloaderTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Loader/StandardAutoloader.php'; require_once 'Zend/Loader/TestAsset/StandardAutoloader.php'; /** diff --git a/tests/Zend/Locale/DataTest.php b/tests/Zend/Locale/DataTest.php index ae8e43d9..146459fe 100644 --- a/tests/Zend/Locale/DataTest.php +++ b/tests/Zend/Locale/DataTest.php @@ -34,7 +34,6 @@ class Zend_Locale_DataTest extends \PHPUnit\Framework\TestCase public function setUp(): void { - require_once 'Zend/Cache.php'; $this->_cache = Zend_Cache::factory('Core', 'File', ['lifetime' => 1, 'automatic_serialization' => true], ['cache_dir' => __DIR__ . '/../_files/']); diff --git a/tests/Zend/Locale/MathTest.php b/tests/Zend/Locale/MathTest.php index cf152484..6aaef05b 100644 --- a/tests/Zend/Locale/MathTest.php +++ b/tests/Zend/Locale/MathTest.php @@ -20,7 +20,6 @@ /** * Zend_Locale_Format. */ -require_once 'Zend/Locale/Math.php'; require_once 'Zend/Locale/Math/PhpMath.php'; /** diff --git a/tests/Zend/LocaleTest.php b/tests/Zend/LocaleTest.php index f83fac8b..3922ebbe 100644 --- a/tests/Zend/LocaleTest.php +++ b/tests/Zend/LocaleTest.php @@ -22,7 +22,6 @@ /** * Zend_Locale. */ -require_once 'Zend/Locale.php'; require_once 'Zend/Cache.php'; /** @@ -50,7 +49,6 @@ public function setUp(): void { $this->_locale = setlocale(LC_ALL, 0); setlocale(LC_ALL, 'de'); - require_once 'Zend/Cache.php'; $this->_cache = Zend_Cache::factory('Core', 'File', ['lifetime' => 120, 'automatic_serialization' => true], ['cache_dir' => __DIR__ . '/_files/']); diff --git a/tests/Zend/Navigation/ContainerTest.php b/tests/Zend/Navigation/ContainerTest.php index afe2f021..1f1afa46 100644 --- a/tests/Zend/Navigation/ContainerTest.php +++ b/tests/Zend/Navigation/ContainerTest.php @@ -16,9 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Navigation.php'; -require_once 'Zend/Config.php'; -require_once 'Zend/Controller/Front.php'; require_once 'Zend/Controller/Request/Http.php'; /** diff --git a/tests/Zend/Navigation/Page/MvcTest.php b/tests/Zend/Navigation/Page/MvcTest.php index 49b30af8..6d518d7c 100644 --- a/tests/Zend/Navigation/Page/MvcTest.php +++ b/tests/Zend/Navigation/Page/MvcTest.php @@ -16,10 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Navigation/Page/Mvc.php'; -require_once 'Zend/Controller/Request/Http.php'; -require_once 'Zend/Controller/Router/Route.php'; -require_once 'Zend/Controller/Router/Route/Regex.php'; require_once 'Zend/Controller/Router/Route/Chain.php'; /** diff --git a/tests/Zend/Navigation/PageTest.php b/tests/Zend/Navigation/PageTest.php index abe6dced..f1e3692a 100644 --- a/tests/Zend/Navigation/PageTest.php +++ b/tests/Zend/Navigation/PageTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Navigation/Page.php'; require_once 'Zend/Config.php'; /** @@ -476,7 +475,6 @@ public function testSetResourceInterface() 'label' => 'hello', ]); - require_once 'Zend/Acl/Resource.php'; $resource = new Zend_Acl_Resource('bar'); $page->setResource($resource); diff --git a/tests/Zend/NavigationTest.php b/tests/Zend/NavigationTest.php index 6344f4c7..d8662529 100644 --- a/tests/Zend/NavigationTest.php +++ b/tests/Zend/NavigationTest.php @@ -61,7 +61,6 @@ public static function main() */ public function testNavigationArraySortsCorrectly() { - require_once 'Zend/Navigation/Page/Uri.php'; $page1 = new Zend_Navigation_Page_Uri(['uri' => 'page1']); $page2 = new Zend_Navigation_Page_Uri(['uri' => 'page2']); $page3 = new Zend_Navigation_Page_Uri(['uri' => 'page3']); diff --git a/tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php b/tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php index 8956385c..12177e17 100644 --- a/tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php +++ b/tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php @@ -165,10 +165,6 @@ public function testOverloadingShouldPreventSettingRequestResponseAndFrontContro public function testResetShouldResetMvcState() { - require_once 'Zend/Controller/Action/HelperBroker.php'; - require_once 'Zend/Controller/Dispatcher/Standard.php'; - require_once 'Zend/Controller/Plugin/ErrorHandler.php'; - require_once 'Zend/Controller/Router/Rewrite.php'; $request = $this->testCase->getRequest(); $response = $this->testCase->getResponse(); $router = new Zend_Controller_Router_Rewrite(); @@ -228,12 +224,6 @@ public function testBootstrapShouldInvokeCallbackSpecifiedInPublicBootstrapPrope public function bootstrapCallback() { - require_once 'Zend/Controller/Action/HelperBroker.php'; - require_once 'Zend/Controller/Dispatcher/Standard.php'; - require_once 'Zend/Controller/Front.php'; - require_once 'Zend/Controller/Plugin/ErrorHandler.php'; - require_once 'Zend/Controller/Router/Rewrite.php'; - require_once 'Zend/Registry.php'; $router = new Zend_Controller_Router_Rewrite(); $dispatcher = new Zend_Controller_Dispatcher_Standard(); $plugin = new Zend_Controller_Plugin_ErrorHandler(); @@ -450,7 +440,6 @@ public function testResetRequestShouldClearPostAndQueryParameters() */ public function testTestCaseShouldAllowUsingApplicationObjectAsBootstrap() { - require_once 'Zend/Application.php'; $application = new Zend_Application('testing', [ 'resources' => [ 'frontcontroller' => [ @@ -471,7 +460,6 @@ public function testTestCaseShouldAllowUsingApplicationObjectAsBootstrap() */ public function testWhenApplicationObjectUsedAsBootstrapTestCaseShouldExecuteBootstrapRunMethod() { - require_once 'Zend/Application.php'; $application = new Zend_Application('testing', [ 'resources' => [ 'frontcontroller' => [ diff --git a/tests/Zend/Test/PHPUnit/_files/bootstrap.php b/tests/Zend/Test/PHPUnit/_files/bootstrap.php index 88150c52..c613c25f 100644 --- a/tests/Zend/Test/PHPUnit/_files/bootstrap.php +++ b/tests/Zend/Test/PHPUnit/_files/bootstrap.php @@ -16,12 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Action/HelperBroker.php'; -require_once 'Zend/Controller/Dispatcher/Standard.php'; -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Plugin/ErrorHandler.php'; -require_once 'Zend/Controller/Router/Rewrite.php'; -require_once 'Zend/Registry.php'; $router = new Zend_Controller_Router_Rewrite(); $dispatcher = new Zend_Controller_Dispatcher_Standard(); $plugin = new Zend_Controller_Plugin_ErrorHandler(); diff --git a/tests/Zend/Translate/Adapter/ArrayTest.php b/tests/Zend/Translate/Adapter/ArrayTest.php index a4b2f1ba..0a0fafd5 100644 --- a/tests/Zend/Translate/Adapter/ArrayTest.php +++ b/tests/Zend/Translate/Adapter/ArrayTest.php @@ -209,7 +209,6 @@ public function testList() public function testOptionLocaleDirectory() { - require_once 'Zend/Translate.php'; $adapter = new Zend_Translate_Adapter_Array(__DIR__ . '/_files/testarray', 'de_AT', ['scan' => Zend_Translate::LOCALE_DIRECTORY]); $this->assertEquals(['de_AT' => 'de_AT', 'en_GB' => 'en_GB', 'ja' => 'ja'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); @@ -217,7 +216,6 @@ public function testOptionLocaleDirectory() public function testOptionLocaleFilename() { - require_once 'Zend/Translate.php'; $adapter = new Zend_Translate_Adapter_Array(__DIR__ . '/_files/testarray', 'de_DE', ['scan' => Zend_Translate::LOCALE_FILENAME]); $this->assertEquals(['de_DE' => 'de_DE', 'en_US' => 'en_US', 'ja' => 'ja'], $adapter->getList()); $this->assertEquals('Nachricht 8', $adapter->translate('Message 8')); @@ -255,7 +253,6 @@ public function testGettingAllMessages() public function testCaching() { - require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', ['lifetime' => 120, 'automatic_serialization' => true], ['cache_dir' => __DIR__ . '/_files/']); @@ -286,7 +283,6 @@ public function testCaching() public function testLoadingFilesIntoCacheAfterwards() { - require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', ['lifetime' => 120, 'automatic_serialization' => true], ['cache_dir' => __DIR__ . '/_files/']); diff --git a/tests/Zend/TranslateTest.php b/tests/Zend/TranslateTest.php index 09129aa1..47532155 100644 --- a/tests/Zend/TranslateTest.php +++ b/tests/Zend/TranslateTest.php @@ -50,7 +50,6 @@ public function setUp(): void Zend_Translate::removeCache(); } - require_once 'Zend/Translate/Adapter/Array.php'; if (Zend_Translate_Adapter_Array::hasCache()) { Zend_Translate_Adapter_Array::removeCache(); } @@ -172,7 +171,6 @@ public function testIsTranslated() public function testTestingCacheHandling() { - require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', ['lifetime' => 120, 'automatic_serialization' => true], ['cache_dir' => __DIR__ . '/_files/']); @@ -206,9 +204,7 @@ public function testExceptionWhenNoAdapterClassWasSet() public function testZF3679() { - require_once 'Zend/Locale.php'; $locale = new Zend_Locale('de_AT'); - require_once 'Zend/Registry.php'; Zend_Registry::set(\Zend_Locale::class, $locale); $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, ['msg1' => 'message1'], 'de_AT'); @@ -479,7 +475,6 @@ public function testIgnoreMultipleDirectories() */ public function testSetCacheThroughOptions() { - require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', ['lifetime' => 120, 'automatic_serialization' => true], ['cache_dir' => __DIR__ . '/_files/']); diff --git a/tests/Zend/Validate/AbstractTest.php b/tests/Zend/Validate/AbstractTest.php index 681d70cb..88ded942 100644 --- a/tests/Zend/Validate/AbstractTest.php +++ b/tests/Zend/Validate/AbstractTest.php @@ -246,7 +246,6 @@ public function testGetMessageTemplates() public function testMaximumErrorMessageLength() { - require_once 'Zend/Validate.php'; $this->assertEquals(-1, Zend_Validate::getMessageLength()); Zend_Validate_Abstract::setMessageLength(10); $this->assertEquals(10, Zend_Validate::getMessageLength()); diff --git a/tests/Zend/Validate/BarcodeTest.php b/tests/Zend/Validate/BarcodeTest.php index da3c725a..22e56194 100644 --- a/tests/Zend/Validate/BarcodeTest.php +++ b/tests/Zend/Validate/BarcodeTest.php @@ -169,7 +169,6 @@ public function testInvalidArrayConstructAdapter() public function testConfigConstructAdapter() { $array = ['adapter' => 'Ean13', 'options' => 'unknown', 'checksum' => false]; - require_once 'Zend/Config.php'; $config = new Zend_Config($array); $barcode = new Zend_Validate_Barcode($config); diff --git a/tests/Zend/Validate/CreditCardTest.php b/tests/Zend/Validate/CreditCardTest.php index 9af60ca5..338c166e 100644 --- a/tests/Zend/Validate/CreditCardTest.php +++ b/tests/Zend/Validate/CreditCardTest.php @@ -191,7 +191,6 @@ public function testInvalidServiceClass() */ public function testConfigObject() { - require_once 'Zend/Config.php'; $options = ['type' => 'Visa']; $config = new Zend_Config($options, false); @@ -204,7 +203,6 @@ public function testConfigObject() */ public function testOptionalConstructorParameterByConfigObject() { - require_once 'Zend/Config.php'; $config = new Zend_Config(['type' => 'Visa', 'service' => ['Zend_Validate_CreditCardTest', 'staticCallback']]); $validator = new Zend_Validate_CreditCard($config); diff --git a/tests/Zend/Validate/EmailAddressTest.php b/tests/Zend/Validate/EmailAddressTest.php index 73daf3af..5912c047 100644 --- a/tests/Zend/Validate/EmailAddressTest.php +++ b/tests/Zend/Validate/EmailAddressTest.php @@ -375,9 +375,7 @@ public function testGetMessages() */ public function testHostnameValidatorMessagesShouldBeTranslated() { - require_once 'Zend/Validate/Hostname.php'; $hostnameValidator = new Zend_Validate_Hostname(); - require_once 'Zend/Translate.php'; $translations = [ 'hostnameIpAddressNotAllowed' => 'hostnameIpAddressNotAllowed translation', 'hostnameUnknownTld' => 'hostnameUnknownTld translation', diff --git a/tests/Zend/Validate/FloatTest.php b/tests/Zend/Validate/FloatTest.php index bc5ee606..0d324ef5 100644 --- a/tests/Zend/Validate/FloatTest.php +++ b/tests/Zend/Validate/FloatTest.php @@ -44,7 +44,6 @@ public function setUp(): void { $this->_locale = setlocale(LC_ALL, 0); //backup locale - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered(\Zend_Locale::class)) { Zend_Registry::getInstance()->offsetUnset(\Zend_Locale::class); } diff --git a/tests/Zend/Validate/HostnameTest.php b/tests/Zend/Validate/HostnameTest.php index 5cb1e358..95d64e34 100644 --- a/tests/Zend/Validate/HostnameTest.php +++ b/tests/Zend/Validate/HostnameTest.php @@ -269,7 +269,6 @@ public function testValidatorMessagesShouldBeTranslated() { $code = null; $message = null; - require_once 'Zend/Translate.php'; $translations = [ 'hostnameInvalidLocalName' => 'this is the IP error message', ]; diff --git a/tests/Zend/Validate/NotEmptyTest.php b/tests/Zend/Validate/NotEmptyTest.php index afa4d942..a0e5c510 100644 --- a/tests/Zend/Validate/NotEmptyTest.php +++ b/tests/Zend/Validate/NotEmptyTest.php @@ -433,7 +433,6 @@ public function testSingleStringNotation() */ public function testConfigObject() { - require_once 'Zend/Config.php'; $options = ['type' => 'all']; $config = new Zend_Config($options); diff --git a/tests/Zend/View/Helper/ActionTest.php b/tests/Zend/View/Helper/ActionTest.php index 1fd2e68b..91fd5d18 100644 --- a/tests/Zend/View/Helper/ActionTest.php +++ b/tests/Zend/View/Helper/ActionTest.php @@ -234,7 +234,6 @@ public function testNestingActionsDoesNotBreakPlaceholderHelpers() */ public function testActionWithPartialsUseOfViewRendererReturnsToOriginatingViewState() { - require_once 'Zend/View/Helper/Partial.php'; $partial = new Zend_View_Helper_Partial(); $this->view->setScriptPath(__DIR__ . '/_files/modules/default/views/scripts/'); $partial->setView($this->view); diff --git a/tests/Zend/View/Helper/AttributeJsEscapingTest.php b/tests/Zend/View/Helper/AttributeJsEscapingTest.php index f84fd83b..d400e3c2 100644 --- a/tests/Zend/View/Helper/AttributeJsEscapingTest.php +++ b/tests/Zend/View/Helper/AttributeJsEscapingTest.php @@ -16,8 +16,6 @@ * * @version $Id: FormSubmitTest.php 23772 2011-02-28 21:35:29Z ralph $ */ -require_once 'Zend/View/Helper/FormSubmit.php'; -require_once 'Zend/View.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/View/Helper/DeclareVarsTest.php b/tests/Zend/View/Helper/DeclareVarsTest.php index aaa65611..2102f937 100644 --- a/tests/Zend/View/Helper/DeclareVarsTest.php +++ b/tests/Zend/View/Helper/DeclareVarsTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/DeclareVars.php'; /** diff --git a/tests/Zend/View/Helper/FieldsetTest.php b/tests/Zend/View/Helper/FieldsetTest.php index b4bea42c..70db1bd3 100644 --- a/tests/Zend/View/Helper/FieldsetTest.php +++ b/tests/Zend/View/Helper/FieldsetTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/Fieldset.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/View/Helper/FormButtonTest.php b/tests/Zend/View/Helper/FormButtonTest.php index 1ac1ce5c..cbc4daa3 100644 --- a/tests/Zend/View/Helper/FormButtonTest.php +++ b/tests/Zend/View/Helper/FormButtonTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/FormButton.php'; /** diff --git a/tests/Zend/View/Helper/FormCheckboxTest.php b/tests/Zend/View/Helper/FormCheckboxTest.php index bc0d9a67..ce90c8a6 100644 --- a/tests/Zend/View/Helper/FormCheckboxTest.php +++ b/tests/Zend/View/Helper/FormCheckboxTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/FormCheckbox.php'; -require_once 'Zend/View.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/View/Helper/FormErrorsTest.php b/tests/Zend/View/Helper/FormErrorsTest.php index 49136855..e44cded2 100644 --- a/tests/Zend/View/Helper/FormErrorsTest.php +++ b/tests/Zend/View/Helper/FormErrorsTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/FormErrors.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/View/Helper/FormFileTest.php b/tests/Zend/View/Helper/FormFileTest.php index e9d32d63..3d25134c 100644 --- a/tests/Zend/View/Helper/FormFileTest.php +++ b/tests/Zend/View/Helper/FormFileTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; -require_once 'Zend/View/Helper/FormFile.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/View/Helper/FormImageTest.php b/tests/Zend/View/Helper/FormImageTest.php index ce454a55..299cb209 100644 --- a/tests/Zend/View/Helper/FormImageTest.php +++ b/tests/Zend/View/Helper/FormImageTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/FormImage.php'; /** diff --git a/tests/Zend/View/Helper/FormLabelTest.php b/tests/Zend/View/Helper/FormLabelTest.php index 9bdddc92..c8cb0299 100644 --- a/tests/Zend/View/Helper/FormLabelTest.php +++ b/tests/Zend/View/Helper/FormLabelTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/FormLabel.php'; /** diff --git a/tests/Zend/View/Helper/FormMultiCheckboxTest.php b/tests/Zend/View/Helper/FormMultiCheckboxTest.php index dd840a9c..2e0cb338 100644 --- a/tests/Zend/View/Helper/FormMultiCheckboxTest.php +++ b/tests/Zend/View/Helper/FormMultiCheckboxTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/FormMultiCheckbox.php'; -require_once 'Zend/View.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/View/Helper/FormPasswordTest.php b/tests/Zend/View/Helper/FormPasswordTest.php index 524a16a2..bf92836e 100644 --- a/tests/Zend/View/Helper/FormPasswordTest.php +++ b/tests/Zend/View/Helper/FormPasswordTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; -require_once 'Zend/View/Helper/FormPassword.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/View/Helper/FormRadioTest.php b/tests/Zend/View/Helper/FormRadioTest.php index 0b58658c..9a3d5e82 100644 --- a/tests/Zend/View/Helper/FormRadioTest.php +++ b/tests/Zend/View/Helper/FormRadioTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/FormRadio.php'; require_once 'Zend/View.php'; /** @@ -323,7 +322,6 @@ public function testEachRadioShouldHaveIdCreatedByAppendingFilteredValue() 'options' => $options, ]); - require_once 'Zend/Filter/Alnum.php'; $filter = new Zend_Filter_Alnum(); foreach ($options as $key => $value) { $id = 'foo-' . $filter->filter($key); @@ -345,7 +343,6 @@ public function testEachRadioShouldUseAttributeIdWhenSpecified() 'options' => $options, ]); - require_once 'Zend/Filter/Alnum.php'; $filter = new Zend_Filter_Alnum(); foreach ($options as $key => $value) { $id = 'foo-bar-' . $filter->filter($key); diff --git a/tests/Zend/View/Helper/FormResetTest.php b/tests/Zend/View/Helper/FormResetTest.php index 4c0bfee0..260ec050 100644 --- a/tests/Zend/View/Helper/FormResetTest.php +++ b/tests/Zend/View/Helper/FormResetTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/FormReset.php'; -require_once 'Zend/View.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/View/Helper/FormSelectTest.php b/tests/Zend/View/Helper/FormSelectTest.php index 09f01feb..29268655 100644 --- a/tests/Zend/View/Helper/FormSelectTest.php +++ b/tests/Zend/View/Helper/FormSelectTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/FormSelect.php'; require_once 'Zend/View.php'; /** diff --git a/tests/Zend/View/Helper/FormSubmitTest.php b/tests/Zend/View/Helper/FormSubmitTest.php index bac3c363..8adfc837 100644 --- a/tests/Zend/View/Helper/FormSubmitTest.php +++ b/tests/Zend/View/Helper/FormSubmitTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/FormSubmit.php'; -require_once 'Zend/View.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/View/Helper/FormTest.php b/tests/Zend/View/Helper/FormTest.php index a4d6a47c..4c31b1ec 100644 --- a/tests/Zend/View/Helper/FormTest.php +++ b/tests/Zend/View/Helper/FormTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/Form.php'; /** diff --git a/tests/Zend/View/Helper/FormTextTest.php b/tests/Zend/View/Helper/FormTextTest.php index 53123796..43eb5028 100644 --- a/tests/Zend/View/Helper/FormTextTest.php +++ b/tests/Zend/View/Helper/FormTextTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; -require_once 'Zend/View/Helper/FormText.php'; require_once 'Zend/Registry.php'; /** diff --git a/tests/Zend/View/Helper/FormTextareaTest.php b/tests/Zend/View/Helper/FormTextareaTest.php index 151fffcb..c3c161ea 100644 --- a/tests/Zend/View/Helper/FormTextareaTest.php +++ b/tests/Zend/View/Helper/FormTextareaTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/FormTextarea.php'; /** diff --git a/tests/Zend/View/Helper/HeadTitleTest.php b/tests/Zend/View/Helper/HeadTitleTest.php index 480cbd6a..9cc1d605 100644 --- a/tests/Zend/View/Helper/HeadTitleTest.php +++ b/tests/Zend/View/Helper/HeadTitleTest.php @@ -196,8 +196,6 @@ public function testZF3577() public function testCanTranslateTitle() { - require_once 'Zend/Translate/Adapter/Array.php'; - require_once 'Zend/Registry.php'; $adapter = new Zend_Translate_Adapter_Array(['Message_1' => 'Message 1 (en)'], 'en'); Zend_Registry::set(\Zend_Translate::class, $adapter); $this->helper->enableTranslation(); diff --git a/tests/Zend/View/Helper/HtmlFlashTest.php b/tests/Zend/View/Helper/HtmlFlashTest.php index d5c5d1bf..9994c849 100644 --- a/tests/Zend/View/Helper/HtmlFlashTest.php +++ b/tests/Zend/View/Helper/HtmlFlashTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/HtmlFlash.php'; /** diff --git a/tests/Zend/View/Helper/HtmlListTest.php b/tests/Zend/View/Helper/HtmlListTest.php index a50f4dae..0ab6790f 100644 --- a/tests/Zend/View/Helper/HtmlListTest.php +++ b/tests/Zend/View/Helper/HtmlListTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/HtmlList.php'; /** diff --git a/tests/Zend/View/Helper/HtmlObjectTest.php b/tests/Zend/View/Helper/HtmlObjectTest.php index 79983410..f21f5523 100644 --- a/tests/Zend/View/Helper/HtmlObjectTest.php +++ b/tests/Zend/View/Helper/HtmlObjectTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/HtmlObject.php'; /** diff --git a/tests/Zend/View/Helper/HtmlPageTest.php b/tests/Zend/View/Helper/HtmlPageTest.php index db22fcad..da0491ac 100644 --- a/tests/Zend/View/Helper/HtmlPageTest.php +++ b/tests/Zend/View/Helper/HtmlPageTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/HtmlPage.php'; /** diff --git a/tests/Zend/View/Helper/HtmlQuicktimeTest.php b/tests/Zend/View/Helper/HtmlQuicktimeTest.php index 4050da96..561eec6c 100644 --- a/tests/Zend/View/Helper/HtmlQuicktimeTest.php +++ b/tests/Zend/View/Helper/HtmlQuicktimeTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/HtmlQuicktime.php'; /** diff --git a/tests/Zend/View/Helper/JsonTest.php b/tests/Zend/View/Helper/JsonTest.php index 7f404836..da98d82e 100644 --- a/tests/Zend/View/Helper/JsonTest.php +++ b/tests/Zend/View/Helper/JsonTest.php @@ -16,10 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/Json.php'; -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Response/Http.php'; -require_once 'Zend/Json.php'; require_once 'Zend/Layout.php'; /** diff --git a/tests/Zend/View/Helper/LayoutTest.php b/tests/Zend/View/Helper/LayoutTest.php index 9829781f..a8d49d1d 100644 --- a/tests/Zend/View/Helper/LayoutTest.php +++ b/tests/Zend/View/Helper/LayoutTest.php @@ -16,9 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View/Helper/Layout.php'; -require_once 'Zend/Layout.php'; -require_once 'Zend/Controller/Front.php'; require_once 'Zend/Controller/Action/HelperBroker.php'; /** diff --git a/tests/Zend/View/Helper/Navigation/SitemapTest.php b/tests/Zend/View/Helper/Navigation/SitemapTest.php index a61dd83b..c3b25110 100644 --- a/tests/Zend/View/Helper/Navigation/SitemapTest.php +++ b/tests/Zend/View/Helper/Navigation/SitemapTest.php @@ -17,8 +17,6 @@ * @version $Id$ */ require_once __DIR__ . '/TestAbstract.php'; -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Controller/Request/Http.php'; require_once 'Zend/View/Helper/Navigation/Sitemap.php'; /** diff --git a/tests/Zend/View/Helper/Navigation/TestAbstract.php b/tests/Zend/View/Helper/Navigation/TestAbstract.php index 5565e8b9..23f4ea51 100644 --- a/tests/Zend/View/Helper/Navigation/TestAbstract.php +++ b/tests/Zend/View/Helper/Navigation/TestAbstract.php @@ -16,14 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Acl.php'; -require_once 'Zend/Acl/Resource.php'; -require_once 'Zend/Acl/Role.php'; -require_once 'Zend/Controller/Front.php'; -require_once 'Zend/Config/Xml.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/Translate.php'; -require_once 'Zend/View.php'; require_once 'Zend/Navigation.php'; /** diff --git a/tests/Zend/View/Helper/PaginationControlTest.php b/tests/Zend/View/Helper/PaginationControlTest.php index b4c45104..4a03a5fb 100644 --- a/tests/Zend/View/Helper/PaginationControlTest.php +++ b/tests/Zend/View/Helper/PaginationControlTest.php @@ -16,8 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; -require_once 'Zend/Paginator.php'; require_once 'Zend/View/Helper/PaginationControl.php'; /** diff --git a/tests/Zend/View/Helper/RenderToPlaceholderTest.php b/tests/Zend/View/Helper/RenderToPlaceholderTest.php index 37ed6d46..6c6a3d51 100644 --- a/tests/Zend/View/Helper/RenderToPlaceholderTest.php +++ b/tests/Zend/View/Helper/RenderToPlaceholderTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/Placeholder.php'; /** diff --git a/tests/Zend/View/Helper/ServerUrlTest.php b/tests/Zend/View/Helper/ServerUrlTest.php index 2f774976..c5ac7916 100644 --- a/tests/Zend/View/Helper/ServerUrlTest.php +++ b/tests/Zend/View/Helper/ServerUrlTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/Controller/Front.php'; require_once 'Zend/View/Helper/ServerUrl.php'; /** diff --git a/tests/Zend/View/Helper/TranslateTest.php b/tests/Zend/View/Helper/TranslateTest.php index c8d74a9d..29303636 100644 --- a/tests/Zend/View/Helper/TranslateTest.php +++ b/tests/Zend/View/Helper/TranslateTest.php @@ -24,7 +24,6 @@ require_once 'Zend/Registry.php'; /** Zend_Translate */ -require_once 'Zend/Translate.php'; require_once 'Zend/Translate/Adapter/Array.php'; /** diff --git a/tests/Zend/View/Helper/UrlTest.php b/tests/Zend/View/Helper/UrlTest.php index 1fda2e0a..d8df1954 100644 --- a/tests/Zend/View/Helper/UrlTest.php +++ b/tests/Zend/View/Helper/UrlTest.php @@ -16,7 +16,6 @@ * * @version $Id$ */ -require_once 'Zend/View.php'; require_once 'Zend/View/Helper/Url.php'; // Test dependency on Front Controller because there is no way to get the Controller out of View instance dynamically diff --git a/tests/Zend/View/Helper/UserAgentTest.php b/tests/Zend/View/Helper/UserAgentTest.php index 562dbd8e..214ef434 100644 --- a/tests/Zend/View/Helper/UserAgentTest.php +++ b/tests/Zend/View/Helper/UserAgentTest.php @@ -17,8 +17,6 @@ * * @version $Id: UserAgentTest.php $ */ -require_once 'Zend/View.php'; -require_once 'Zend/View/Helper/UserAgent.php'; require_once 'Zend/Http/UserAgent.php'; /** diff --git a/tests/Zend/ViewTest.php b/tests/Zend/ViewTest.php index 88c32550..20cc287a 100644 --- a/tests/Zend/ViewTest.php +++ b/tests/Zend/ViewTest.php @@ -825,7 +825,6 @@ public function testGetScriptPath() public function testGetHelper() { // require so we can do type hinting - require_once 'Zend/View/Helper/DeclareVars.php'; $view = new Zend_View(); $view->declareVars(); $helper = $view->getHelper('declareVars'); @@ -834,7 +833,6 @@ public function testGetHelper() public function testGetHelperPath() { - require_once 'Zend/View/Helper/DeclareVars.php'; $reflection = new ReflectionClass(\Zend_View_Helper_DeclareVars::class); $expected = $reflection->getFileName(); @@ -1109,7 +1107,6 @@ public function testRegisterHelperShouldThrowExceptionIfProvidedANonHelperObject */ public function testRegisterHelperShouldRegisterViewObjectWithHelper() { - require_once 'Zend/View/Helper/Doctype.php'; $view = new Zend_View(); $helper = new Zend_View_Helper_Doctype(); $view->registerHelper($helper, 'doctype'); diff --git a/tests/ZendX/JQuery/Form/DecoratorTest.php b/tests/ZendX/JQuery/Form/DecoratorTest.php index 8494d7a7..75958c45 100644 --- a/tests/ZendX/JQuery/Form/DecoratorTest.php +++ b/tests/ZendX/JQuery/Form/DecoratorTest.php @@ -18,14 +18,11 @@ */ require_once __DIR__ . '/../../../TestHelper.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/View.php'; require_once 'ZendX/JQuery.php'; require_once 'ZendX/JQuery/View/Helper/JQuery.php'; require_once 'ZendX/JQuery/Form.php'; require_once 'ZendX/JQuery/Form/Element/Spinner.php'; -require_once 'Zend/Form/Decorator/ViewHelper.php'; require_once 'ZendX/JQuery/Form/Decorator/UiWidgetElement.php'; require_once 'ZendX/JQuery/Form/Decorator/TabContainer.php'; require_once 'ZendX/JQuery/Form/Decorator/TabPane.php'; diff --git a/tests/ZendX/JQuery/Form/ElementTest.php b/tests/ZendX/JQuery/Form/ElementTest.php index ed52b2e3..aa00ba5d 100644 --- a/tests/ZendX/JQuery/Form/ElementTest.php +++ b/tests/ZendX/JQuery/Form/ElementTest.php @@ -18,12 +18,6 @@ */ require_once __DIR__ . '/../../../TestHelper.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/View.php'; -require_once 'Zend/Form/Element.php'; -require_once 'Zend/Form/SubForm.php'; -require_once 'Zend/Form/Decorator/Description.php'; -require_once 'Zend/Json.php'; require_once 'ZendX/JQuery.php'; require_once 'ZendX/JQuery/Form.php'; require_once 'ZendX/JQuery/View/Helper/JQuery.php'; @@ -33,7 +27,6 @@ require_once 'ZendX/JQuery/Form/Element/DatePicker.php'; require_once 'ZendX/JQuery/Form/Element/AutoComplete.php'; -require_once 'Zend/Form/Decorator/ViewHelper.php'; require_once 'ZendX/JQuery/Form/Decorator/UiWidgetElement.php'; class ZendX_JQuery_Form_ElementTest extends \PHPUnit\Framework\TestCase diff --git a/tests/ZendX/JQuery/JQueryTest.php b/tests/ZendX/JQuery/JQueryTest.php index 9a0cbbf8..0e8008f1 100644 --- a/tests/ZendX/JQuery/JQueryTest.php +++ b/tests/ZendX/JQuery/JQueryTest.php @@ -18,12 +18,8 @@ */ require_once __DIR__ . '/../../TestHelper.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/View.php'; -require_once 'Zend/Form.php'; require_once 'ZendX/JQuery.php'; require_once 'ZendX/JQuery/Form.php'; -require_once 'Zend/Form/Element.php'; require_once 'ZendX/JQuery/Form/Element/Spinner.php'; class ZendX_JQuery_JQueryTest extends \PHPUnit\Framework\TestCase diff --git a/tests/ZendX/JQuery/View/DatePickerTest.php b/tests/ZendX/JQuery/View/DatePickerTest.php index 2849c788..ec272e40 100644 --- a/tests/ZendX/JQuery/View/DatePickerTest.php +++ b/tests/ZendX/JQuery/View/DatePickerTest.php @@ -18,7 +18,6 @@ */ require_once 'jQueryTestCase.php'; -require_once 'Zend/Locale.php'; require_once 'ZendX/JQuery/View/Helper/DatePicker.php'; class ZendX_JQuery_View_DatePickerTest extends ZendX_JQuery_View_jQueryTestCase diff --git a/tests/ZendX/JQuery/View/jQueryTestCase.php b/tests/ZendX/JQuery/View/jQueryTestCase.php index e04a5eaa..b7c6619a 100644 --- a/tests/ZendX/JQuery/View/jQueryTestCase.php +++ b/tests/ZendX/JQuery/View/jQueryTestCase.php @@ -18,8 +18,6 @@ */ require_once __DIR__ . '/../../../TestHelper.php'; -require_once 'Zend/Registry.php'; -require_once 'Zend/View.php'; require_once 'ZendX/JQuery.php'; require_once 'ZendX/JQuery/View/Helper/JQuery.php'; @@ -56,7 +54,6 @@ public function tearDown(): void */ public function getView() { - require_once 'Zend/View.php'; $view = new Zend_View(); $view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper'); From a7ac0f2c435cea6b572b29d5457e469c3b1433e5 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Mon, 25 Sep 2023 09:24:03 +0800 Subject: [PATCH 04/28] Correct types --- library/Zend/Form/Element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Form/Element.php b/library/Zend/Form/Element.php index 8651394d..742bccb5 100644 --- a/library/Zend/Form/Element.php +++ b/library/Zend/Form/Element.php @@ -922,7 +922,7 @@ public function setAttribs(array $attribs) * * @param string $name * - * @return string + * @return ?string */ public function getAttrib($name) { From 1f10f7c60e5717721d40556fc8451d148bfb246f Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Wed, 8 Nov 2023 12:48:37 +0900 Subject: [PATCH 05/28] Avoid deprecation warning --- library/Zend/Controller/Router/Route/Module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Controller/Router/Route/Module.php b/library/Zend/Controller/Router/Route/Module.php index 5022ba1e..662a3533 100644 --- a/library/Zend/Controller/Router/Route/Module.php +++ b/library/Zend/Controller/Router/Route/Module.php @@ -261,7 +261,7 @@ public function assemble($data = [], $reset = false, $encode = true, $partial = } } else { if ($encode) { - $value = urlencode($value); + $value = urlencode($value ?? ''); } $url .= self::URI_DELIMITER . $key; $url .= self::URI_DELIMITER . $value; From ae6779727bc24482b8f607305daef9241fb8e2ac Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Tue, 9 Apr 2024 15:40:45 +0800 Subject: [PATCH 06/28] Loosen typing according to reality --- library/Zend/File/Transfer/Adapter/Abstract.php | 2 +- library/Zend/Filter/Null.php | 2 +- library/Zend/Form.php | 2 +- library/Zend/Form/Element/File.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/Zend/File/Transfer/Adapter/Abstract.php b/library/Zend/File/Transfer/Adapter/Abstract.php index f20dd162..dfa1860b 100644 --- a/library/Zend/File/Transfer/Adapter/Abstract.php +++ b/library/Zend/File/Transfer/Adapter/Abstract.php @@ -764,7 +764,7 @@ public function hasErrors() /** * Adds a new filter for this class. * - * @param array|string $filter Type of filter to add + * @param array|string|Zend_Filter_Interface $filter Type of filter to add * @param array|string $options Options to set for the filter * @param array|string $files Files to limit this filter to * diff --git a/library/Zend/Filter/Null.php b/library/Zend/Filter/Null.php index 2cbd00da..4e1e134c 100644 --- a/library/Zend/Filter/Null.php +++ b/library/Zend/Filter/Null.php @@ -49,7 +49,7 @@ class Zend_Filter_Null implements Zend_Filter_Interface /** * Constructor. * - * @param array|string|Zend_Config $options OPTIONAL + * @param array|int|string|Zend_Config $options OPTIONAL */ public function __construct($options = null) { diff --git a/library/Zend/Form.php b/library/Zend/Form.php index 40d6d4cf..afe30dbb 100644 --- a/library/Zend/Form.php +++ b/library/Zend/Form.php @@ -2807,7 +2807,7 @@ protected function _getDecorator($name, $options) /** * Add a decorator for rendering the element. * - * @param string|Zend_Form_Decorator_Interface $decorator + * @param array|string|Zend_Form_Decorator_Interface $decorator * @param array|Zend_Config $options Options with which to initialize decorator * * @return Zend_Form diff --git a/library/Zend/Form/Element/File.php b/library/Zend/Form/Element/File.php index 95e71bbc..2aa17c57 100644 --- a/library/Zend/Form/Element/File.php +++ b/library/Zend/Form/Element/File.php @@ -319,7 +319,7 @@ public function clearValidators() /** * Add Filter; proxy to adapter. * - * @param array|string $filter Type of filter to add + * @param array|string|Zend_Filter_Interface $filter Type of filter to add * @param array|string $options Options to set for the filter * * @return Zend_Form_Element_File From b67f02845e86e2ccf2de959f24149548a2ff5385 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Tue, 10 Jun 2025 14:12:33 +0200 Subject: [PATCH 07/28] Drop Http, Rest and Service #11498 --- .../Zend/Application/Resource/UserAgent.php | 65 - library/Zend/Http/Client.php | 1554 ----------------- library/Zend/Http/Client/Adapter/Curl.php | 518 ------ .../Zend/Http/Client/Adapter/Exception.php | 30 - .../Zend/Http/Client/Adapter/Interface.php | 71 - library/Zend/Http/Client/Adapter/Proxy.php | 314 ---- library/Zend/Http/Client/Adapter/Socket.php | 530 ------ library/Zend/Http/Client/Adapter/Stream.php | 38 - library/Zend/Http/Client/Adapter/Test.php | 230 --- library/Zend/Http/Client/Exception.php | 29 - library/Zend/Http/Cookie.php | 423 ----- library/Zend/Http/CookieJar.php | 430 ----- library/Zend/Http/Exception.php | 29 - .../Exception/InvalidArgumentException.php | 29 - .../Header/Exception/RuntimeException.php | 29 - library/Zend/Http/Header/HeaderValue.php | 120 -- library/Zend/Http/Header/SetCookie.php | 568 ------ library/Zend/Http/Response.php | 706 -------- library/Zend/Http/Response/Stream.php | 238 --- library/Zend/Http/UserAgent.php | 871 --------- .../Zend/Http/UserAgent/AbstractDevice.php | 998 ----------- library/Zend/Http/UserAgent/Bot.php | 120 -- library/Zend/Http/UserAgent/Checker.php | 67 - library/Zend/Http/UserAgent/Console.php | 59 - library/Zend/Http/UserAgent/Desktop.php | 48 - library/Zend/Http/UserAgent/Device.php | 191 -- library/Zend/Http/UserAgent/Email.php | 57 - library/Zend/Http/UserAgent/Exception.php | 27 - .../Zend/Http/UserAgent/Features/Adapter.php | 33 - .../UserAgent/Features/Adapter/Browscap.php | 91 - .../Features/Adapter/DeviceAtlas.php | 69 - .../UserAgent/Features/Adapter/TeraWurfl.php | 94 - .../Http/UserAgent/Features/Exception.php | 27 - library/Zend/Http/UserAgent/Feed.php | 74 - library/Zend/Http/UserAgent/Mobile.php | 532 ------ library/Zend/Http/UserAgent/Offline.php | 62 - library/Zend/Http/UserAgent/Probe.php | 73 - library/Zend/Http/UserAgent/Spam.php | 72 - library/Zend/Http/UserAgent/Storage.php | 50 - .../Zend/Http/UserAgent/Storage/Exception.php | 27 - .../Http/UserAgent/Storage/NonPersistent.php | 78 - .../Zend/Http/UserAgent/Storage/Session.php | 142 -- library/Zend/Http/UserAgent/Text.php | 122 -- library/Zend/Http/UserAgent/Validator.php | 65 - library/Zend/Rest/Client.php | 287 --- library/Zend/Rest/Client/Exception.php | 31 - library/Zend/Rest/Client/Result.php | 239 --- library/Zend/Rest/Client/Result/Exception.php | 31 - library/Zend/Rest/Controller.php | 72 - library/Zend/Rest/Exception.php | 29 - library/Zend/Rest/Route.php | 403 ----- library/Zend/Service/Abstract.php | 59 - library/Zend/Service/Exception.php | 29 - library/Zend/View.php | 1 - library/Zend/View/Helper/UserAgent.php | 76 - .../Application/Resource/UseragentTest.php | 108 -- tests/Zend/Controller/Response/HttpTest.php | 2 +- tests/Zend/Controller/_files/routes.ini | 4 - tests/Zend/Rest/ClientTest.php | 353 ---- tests/Zend/Rest/ControllerTest.php | 117 -- tests/Zend/Rest/ResultTest.php | 177 -- tests/Zend/Rest/RouteTest.php | 962 ---------- tests/Zend/Rest/responses/returnArray.xml | 1 - .../Zend/Rest/responses/returnEmptyStatus.xml | 3 - tests/Zend/Rest/responses/returnError.xml | 1 - tests/Zend/Rest/responses/returnFalse.xml | 1 - tests/Zend/Rest/responses/returnInt.xml | 1 - .../Zend/Rest/responses/returnNestedArray.xml | 1 - tests/Zend/Rest/responses/returnObject.xml | 1 - tests/Zend/Rest/responses/returnString.xml | 1 - tests/Zend/Rest/responses/returnTrue.xml | 1 - tests/Zend/Rest/responses/returnVoid.xml | 1 - tests/Zend/View/Helper/UserAgentTest.php | 89 - 73 files changed, 1 insertion(+), 13080 deletions(-) delete mode 100644 library/Zend/Application/Resource/UserAgent.php delete mode 100644 library/Zend/Http/Client.php delete mode 100644 library/Zend/Http/Client/Adapter/Curl.php delete mode 100644 library/Zend/Http/Client/Adapter/Exception.php delete mode 100644 library/Zend/Http/Client/Adapter/Interface.php delete mode 100644 library/Zend/Http/Client/Adapter/Proxy.php delete mode 100644 library/Zend/Http/Client/Adapter/Socket.php delete mode 100755 library/Zend/Http/Client/Adapter/Stream.php delete mode 100644 library/Zend/Http/Client/Adapter/Test.php delete mode 100644 library/Zend/Http/Client/Exception.php delete mode 100644 library/Zend/Http/Cookie.php delete mode 100644 library/Zend/Http/CookieJar.php delete mode 100644 library/Zend/Http/Exception.php delete mode 100644 library/Zend/Http/Header/Exception/InvalidArgumentException.php delete mode 100644 library/Zend/Http/Header/Exception/RuntimeException.php delete mode 100644 library/Zend/Http/Header/HeaderValue.php delete mode 100644 library/Zend/Http/Header/SetCookie.php delete mode 100644 library/Zend/Http/Response.php delete mode 100755 library/Zend/Http/Response/Stream.php delete mode 100644 library/Zend/Http/UserAgent.php delete mode 100644 library/Zend/Http/UserAgent/AbstractDevice.php delete mode 100644 library/Zend/Http/UserAgent/Bot.php delete mode 100644 library/Zend/Http/UserAgent/Checker.php delete mode 100644 library/Zend/Http/UserAgent/Console.php delete mode 100644 library/Zend/Http/UserAgent/Desktop.php delete mode 100644 library/Zend/Http/UserAgent/Device.php delete mode 100644 library/Zend/Http/UserAgent/Email.php delete mode 100644 library/Zend/Http/UserAgent/Exception.php delete mode 100644 library/Zend/Http/UserAgent/Features/Adapter.php delete mode 100644 library/Zend/Http/UserAgent/Features/Adapter/Browscap.php delete mode 100644 library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php delete mode 100644 library/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php delete mode 100644 library/Zend/Http/UserAgent/Features/Exception.php delete mode 100644 library/Zend/Http/UserAgent/Feed.php delete mode 100644 library/Zend/Http/UserAgent/Mobile.php delete mode 100644 library/Zend/Http/UserAgent/Offline.php delete mode 100644 library/Zend/Http/UserAgent/Probe.php delete mode 100644 library/Zend/Http/UserAgent/Spam.php delete mode 100644 library/Zend/Http/UserAgent/Storage.php delete mode 100644 library/Zend/Http/UserAgent/Storage/Exception.php delete mode 100644 library/Zend/Http/UserAgent/Storage/NonPersistent.php delete mode 100644 library/Zend/Http/UserAgent/Storage/Session.php delete mode 100644 library/Zend/Http/UserAgent/Text.php delete mode 100644 library/Zend/Http/UserAgent/Validator.php delete mode 100644 library/Zend/Rest/Client.php delete mode 100644 library/Zend/Rest/Client/Exception.php delete mode 100644 library/Zend/Rest/Client/Result.php delete mode 100644 library/Zend/Rest/Client/Result/Exception.php delete mode 100644 library/Zend/Rest/Controller.php delete mode 100644 library/Zend/Rest/Exception.php delete mode 100644 library/Zend/Rest/Route.php delete mode 100644 library/Zend/Service/Abstract.php delete mode 100644 library/Zend/Service/Exception.php delete mode 100644 library/Zend/View/Helper/UserAgent.php delete mode 100644 tests/Zend/Application/Resource/UseragentTest.php delete mode 100644 tests/Zend/Rest/ClientTest.php delete mode 100644 tests/Zend/Rest/ControllerTest.php delete mode 100644 tests/Zend/Rest/ResultTest.php delete mode 100644 tests/Zend/Rest/RouteTest.php delete mode 100644 tests/Zend/Rest/responses/returnArray.xml delete mode 100644 tests/Zend/Rest/responses/returnEmptyStatus.xml delete mode 100644 tests/Zend/Rest/responses/returnError.xml delete mode 100644 tests/Zend/Rest/responses/returnFalse.xml delete mode 100644 tests/Zend/Rest/responses/returnInt.xml delete mode 100644 tests/Zend/Rest/responses/returnNestedArray.xml delete mode 100644 tests/Zend/Rest/responses/returnObject.xml delete mode 100644 tests/Zend/Rest/responses/returnString.xml delete mode 100644 tests/Zend/Rest/responses/returnTrue.xml delete mode 100644 tests/Zend/Rest/responses/returnVoid.xml delete mode 100644 tests/Zend/View/Helper/UserAgentTest.php diff --git a/library/Zend/Application/Resource/UserAgent.php b/library/Zend/Application/Resource/UserAgent.php deleted file mode 100644 index a163406a..00000000 --- a/library/Zend/Application/Resource/UserAgent.php +++ /dev/null @@ -1,65 +0,0 @@ -getUserAgent(); - - // Optionally seed the UserAgent view helper - $bootstrap = $this->getBootstrap(); - if ($bootstrap->hasResource('view') || $bootstrap->hasPluginResource('view')) { - $bootstrap->bootstrap('view'); - $view = $bootstrap->getResource('view'); - if (null !== $view) { - $view->userAgent($userAgent); - } - } - - return $userAgent; - } - - /** - * Get UserAgent instance. - * - * @return Zend_Http_UserAgent - */ - public function getUserAgent() - { - if (null === $this->_userAgent) { - $options = $this->getOptions(); - $this->_userAgent = new Zend_Http_UserAgent($options); - } - - return $this->_userAgent; - } -} diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php deleted file mode 100644 index cc63d845..00000000 --- a/library/Zend/Http/Client.php +++ /dev/null @@ -1,1554 +0,0 @@ - 5, - 'strictredirects' => false, - 'useragent' => \Zend_Http_Client::class, - 'timeout' => 10, - 'adapter' => \Zend_Http_Client_Adapter_Socket::class, - 'httpversion' => self::HTTP_1, - 'keepalive' => false, - 'storeresponse' => true, - 'strict' => true, - 'output_stream' => false, - 'encodecookies' => true, - 'rfc3986_strict' => false, - ]; - - /** - * The adapter used to perform the actual connection to the server. - * - * @var Zend_Http_Client_Adapter_Interface - */ - protected $adapter; - - /** - * Request URI. - * - * @var Zend_Uri_Http - */ - protected $uri; - - /** - * Associative array of request headers. - * - * @var array - */ - protected $headers = []; - - /** - * HTTP request method. - * - * @var string - */ - protected $method = self::GET; - - /** - * Associative array of GET parameters. - * - * @var array - */ - protected $paramsGet = []; - - /** - * Associative array of POST parameters. - * - * @var array - */ - protected $paramsPost = []; - - /** - * Request body content type (for POST requests). - * - * @var string - */ - protected $enctype; - - /** - * The raw post data to send. Could be set by setRawData($data, $enctype). - * - * @var string - */ - protected $raw_post_data; - - /** - * HTTP Authentication settings. - * - * Expected to be an associative array with this structure: - * $this->auth = array('user' => 'username', 'password' => 'password', 'type' => 'basic') - * Where 'type' should be one of the supported authentication types (see the AUTH_* - * constants), for example 'basic' or 'digest'. - * - * If null, no authentication will be used. - * - * @var null|array - */ - protected $auth; - - /** - * File upload arrays (used in POST requests). - * - * An associative array, where each element is of the format: - * 'name' => array('filename.txt', 'text/plain', 'This is the actual file contents') - * - * @var array - */ - protected $files = []; - - /** - * Ordered list of keys from key/value pair data to include in body. - * - * An associative array, where each element is of the format: - * '' => VTYPE_SCALAR | VTYPE_FILE - * - * @var array - */ - protected $body_field_order = []; - - /** - * The client's cookie jar. - * - * @var Zend_Http_CookieJar - */ - protected $cookiejar; - - /** - * The last HTTP request sent by the client, as string. - * - * @var string - */ - protected $last_request; - - /** - * The last HTTP response received by the client. - * - * @var Zend_Http_Response - */ - protected $last_response; - - /** - * Redirection counter. - * - * @var int - */ - protected $redirectCounter = 0; - - /** - * Status for unmasking GET array params. - * - * @var bool - */ - protected $_unmaskStatus = false; - - /** - * Status if the http_build_query function escapes brackets. - * - * @var bool - */ - protected $_queryBracketsEscaped = true; - - /** - * Fileinfo magic database resource. - * - * This variable is populated the first time _detectFileMimeType is called - * and is then reused on every call to this method - * - * @var resource - */ - protected static $_fileInfoDb; - - /** - * Constructor method. Will create a new HTTP client. Accepts the target - * URL and optionally configuration array. - * - * @param string|Zend_Uri_Http $uri - * @param array $config configuration key-value pairs - */ - public function __construct($uri = null, $config = null) - { - if ($uri !== null) { - $this->setUri($uri); - } - if ($config !== null) { - $this->setConfig($config); - } - - $this->_queryBracketsEscaped = version_compare(phpversion(), '5.1.3', '>='); - } - - /** - * Set the URI for the next request. - * - * @param string|Zend_Uri_Http $uri - * - * @return Zend_Http_Client - */ - public function setUri($uri) - { - if ($uri instanceof Zend_Uri_Http) { - // clone the URI in order to keep the passed parameter constant - $uri = clone $uri; - } elseif (is_string($uri)) { - $uri = Zend_Uri::factory($uri); - } - - if (!$uri instanceof Zend_Uri_Http) { - throw new Zend_Http_Client_Exception('Passed parameter is not a valid HTTP URI.'); - } - - // Set auth if username and password has been specified in the uri - if ($uri->getUsername() && $uri->getPassword()) { - $this->setAuth($uri->getUsername(), $uri->getPassword()); - } - - // We have no ports, set the defaults - if (!$uri->getPort()) { - $uri->setPort(($uri->getScheme() == 'https' ? 443 : 80)); - } - - $this->uri = $uri; - - return $this; - } - - /** - * Get the URI for the next request. - * - * @param bool $as_string If true, will return the URI as a string - * - * @return string|Zend_Uri_Http - */ - public function getUri($as_string = false) - { - if ($as_string && $this->uri instanceof Zend_Uri_Http) { - return $this->uri->__toString(); - } - - return $this->uri; - } - - /** - * Set configuration parameters for this HTTP client. - * - * @param array|Zend_Config $config - * - * @return Zend_Http_Client - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Zend_Http_Client_Exception('Array or Zend_Config object expected, got ' . gettype($config)); - } - - foreach ($config as $k => $v) { - $this->config[strtolower($k)] = $v; - } - - // Pass configuration options to the adapter if it exists - if ($this->adapter instanceof Zend_Http_Client_Adapter_Interface) { - $this->adapter->setConfig($config); - } - - return $this; - } - - /** - * Set the next request's method. - * - * Validated the passed method and sets it. If we have files set for - * POST requests, and the new method is not POST, the files are silently - * dropped. - * - * @param string $method - * - * @return Zend_Http_Client - */ - public function setMethod($method = self::GET) - { - if (!preg_match('/^[^\x00-\x1f\x7f-\xff\(\)<>@,;:\\\\"\/\[\]\?={}\s]+$/', $method)) { - throw new Zend_Http_Client_Exception("'{$method}' is not a valid HTTP request method."); - } - - if (($method == self::POST - || $method == self::PUT - || $method == self::DELETE - || $method == self::PATCH - || $method == self::OPTIONS) - && $this->enctype === null - ) { - $this->setEncType(self::ENC_URLENCODED); - } - - $this->method = $method; - - return $this; - } - - /** - * Set one or more request headers. - * - * This function can be used in several ways to set the client's request - * headers: - * 1. By providing two parameters: $name as the header to set (e.g. 'Host') - * and $value as it's value (e.g. 'www.example.com'). - * 2. By providing a single header string as the only parameter - * e.g. 'Host: www.example.com' - * 3. By providing an array of headers as the first parameter - * e.g. array('host' => 'www.example.com', 'x-foo: bar'). In This case - * the function will call itself recursively for each array item. - * - * @param array|string $name Header name, full header string ('Header: value') - * or an array of headers - * @param mixed $value Header value or null - * - * @return Zend_Http_Client - */ - public function setHeaders($name, $value = null) - { - // If we got an array, go recursive! - if (is_array($name)) { - foreach ($name as $k => $v) { - if (is_string($k)) { - $this->setHeaders($k, $v); - - continue; - } - $this->setHeaders($v, null); - } - - return $this; - } - - // Check if $name needs to be split - if ($value === null && (strpos($name, ':') > 0)) { - [$name, $value] = explode(':', $name, 2); - } - - // Make sure the name is valid if we are in strict mode - if ($this->config['strict'] && (!preg_match('/^[a-zA-Z0-9-]+$/', $name))) { - throw new Zend_Http_Client_Exception("{$name} is not a valid HTTP header name"); - } - - $normalized_name = strtolower($name); - - // If $value is null or false, unset the header - if ($value === null || $value === false) { - unset($this->headers[$normalized_name]); - - return $this; - } - - // Validate value - $this->_validateHeaderValue($value); - - // Header names are stored lowercase internally. - if (is_string($value)) { - $value = trim($value); - } - $this->headers[$normalized_name] = [$name, $value]; - - return $this; - } - - /** - * Get the value of a specific header. - * - * Note that if the header has more than one value, an array - * will be returned. - * - * @param string $key - * - * @return null|array|string The header value or null if it is not set - */ - public function getHeader($key) - { - $key = strtolower($key); - if (isset($this->headers[$key])) { - return $this->headers[$key][1]; - } - - return null; - } - - /** - * Set a GET parameter for the request. Wrapper around _setParameter. - * - * @param array|string $name - * @param string $value - * - * @return Zend_Http_Client - */ - public function setParameterGet($name, $value = null) - { - if (is_array($name)) { - foreach ($name as $k => $v) { - $this->_setParameter('GET', $k, $v); - } - } else { - $this->_setParameter('GET', $name, $value); - } - - return $this; - } - - /** - * Set a POST parameter for the request. Wrapper around _setParameter. - * - * @param array|string $name - * @param string $value - * - * @return Zend_Http_Client - */ - public function setParameterPost($name, $value = null) - { - if (is_array($name)) { - foreach ($name as $k => $v) { - $this->_setParameter('POST', $k, $v); - } - } else { - $this->_setParameter('POST', $name, $value); - } - - return $this; - } - - /** - * Set a GET or POST parameter - used by SetParameterGet and SetParameterPost. - * - * @param string $type GET or POST - * @param string $name - * @param string $value - */ - protected function _setParameter($type, $name, $value) - { - $parray = []; - $type = strtolower($type); - switch ($type) { - case 'get': - $parray = &$this->paramsGet; - - break; - case 'post': - $parray = &$this->paramsPost; - if ($value === null) { - if (isset($this->body_field_order[$name])) { - unset($this->body_field_order[$name]); - } - } else { - $this->body_field_order[$name] = self::VTYPE_SCALAR; - } - - break; - } - - if ($value === null) { - if (isset($parray[$name])) { - unset($parray[$name]); - } - } else { - $parray[$name] = $value; - } - } - - /** - * Get the number of redirections done on the last request. - * - * @return int - */ - public function getRedirectionsCount() - { - return $this->redirectCounter; - } - - /** - * Set HTTP authentication parameters. - * - * $type should be one of the supported types - see the self::AUTH_* - * constants. - * - * To enable authentication: - * - * $this->setAuth('shahar', 'secret', Zend_Http_Client::AUTH_BASIC); - * - * - * To disable authentication: - * - * $this->setAuth(false); - * - * - * @see http://www.faqs.org/rfcs/rfc2617.html - * - * @param false|string $user User name or false disable authentication - * @param string $password Password - * @param string $type Authentication type - * - * @return Zend_Http_Client - */ - public function setAuth($user, $password = '', $type = self::AUTH_BASIC) - { - // If we got false or null, disable authentication - if ($user === false || $user === null) { - $this->auth = null; - - // Clear the auth information in the uri instance as well - if ($this->uri instanceof Zend_Uri_Http) { - $this->getUri()->setUsername(''); - $this->getUri()->setPassword(''); - } - // Else, set up authentication - } else { - // Check we got a proper authentication type - if (!defined('self::AUTH_' . strtoupper($type))) { - throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '$type'"); - } - - $this->auth = [ - 'user' => (string) $user, - 'password' => (string) $password, - 'type' => $type, - ]; - } - - return $this; - } - - /** - * Set the HTTP client's cookie jar. - * - * A cookie jar is an object that holds and maintains cookies across HTTP requests - * and responses. - * - * @param bool|Zend_Http_CookieJar $cookiejar Existing cookiejar object, true to create a new one, false to disable - * - * @return Zend_Http_Client - */ - public function setCookieJar($cookiejar = true) - { - Zend_Loader::loadClass(\Zend_Http_CookieJar::class); - - if ($cookiejar instanceof Zend_Http_CookieJar) { - $this->cookiejar = $cookiejar; - } elseif ($cookiejar === true) { - $this->cookiejar = new Zend_Http_CookieJar(); - } elseif (!$cookiejar) { - $this->cookiejar = null; - } else { - throw new Zend_Http_Client_Exception('Invalid parameter type passed as CookieJar'); - } - - return $this; - } - - /** - * Return the current cookie jar or null if none. - * - * @return null|Zend_Http_CookieJar - */ - public function getCookieJar() - { - return $this->cookiejar; - } - - /** - * Add a cookie to the request. If the client has no Cookie Jar, the cookies - * will be added directly to the headers array as "Cookie" headers. - * - * @param string|Zend_Http_Cookie $cookie - * @param null|string $value if "cookie" is a string, this is the cookie value - * - * @return Zend_Http_Client - */ - public function setCookie($cookie, $value = null) - { - Zend_Loader::loadClass(\Zend_Http_Cookie::class); - - if (is_array($cookie)) { - foreach ($cookie as $c => $v) { - if (is_string($c)) { - $this->setCookie($c, $v); - } else { - $this->setCookie($v); - } - } - - return $this; - } - - if ($value !== null && $this->config['encodecookies']) { - $value = urlencode($value); - } - - if (isset($this->cookiejar)) { - if ($cookie instanceof Zend_Http_Cookie) { - $this->cookiejar->addCookie($cookie); - } elseif (is_string($cookie) && $value !== null) { - $cookie = Zend_Http_Cookie::fromString("{$cookie}={$value}", - $this->uri, - $this->config['encodecookies']); - $this->cookiejar->addCookie($cookie); - } - } else { - if ($cookie instanceof Zend_Http_Cookie) { - $name = $cookie->getName(); - $value = $cookie->getValue(); - $cookie = $name; - } - - if (preg_match("/[=,; \t\r\n\013\014]/", $cookie)) { - throw new Zend_Http_Client_Exception("Cookie name cannot contain these characters: =,; \t\r\n\013\014 ({$cookie})"); - } - - $value = addslashes($value); - - if (!isset($this->headers['cookie'])) { - $this->headers['cookie'] = ['Cookie', '']; - } - $this->headers['cookie'][1] .= $cookie . '=' . $value . '; '; - } - - return $this; - } - - /** - * Set a file to upload (using a POST request). - * - * Can be used in two ways: - * - * 1. $data is null (default): $filename is treated as the name if a local file which - * will be read and sent. Will try to guess the content type using mime_content_type(). - * 2. $data is set - $filename is sent as the file name, but $data is sent as the file - * contents and no file is read from the file system. In this case, you need to - * manually set the Content-Type ($ctype) or it will default to - * application/octet-stream. - * - * @param string $filename Name of file to upload, or name to save as - * @param string $formname Name of form element to send as - * @param string $data Data to send (if null, $filename is read and sent) - * @param string $ctype Content type to use (if $data is set and $ctype is - * null, will be application/octet-stream) - * - * @return Zend_Http_Client - */ - public function setFileUpload($filename, $formname, $data = null, $ctype = null) - { - if ($data === null) { - if (($data = @file_get_contents($filename)) === false) { - throw new Zend_Http_Client_Exception("Unable to read file '{$filename}' for upload"); - } - - if (!$ctype) { - $ctype = $this->_detectFileMimeType($filename); - } - } - - // Force enctype to multipart/form-data - $this->setEncType(self::ENC_FORMDATA); - - $this->files[] = [ - 'formname' => $formname, - 'filename' => basename($filename), - 'ctype' => $ctype, - 'data' => $data, - ]; - - $this->body_field_order[$formname] = self::VTYPE_FILE; - - return $this; - } - - /** - * Set the encoding type for POST data. - * - * @param string $enctype - * - * @return Zend_Http_Client - */ - public function setEncType($enctype = self::ENC_URLENCODED) - { - $this->enctype = $enctype; - - return $this; - } - - /** - * Set the raw (already encoded) POST data. - * - * This function is here for two reasons: - * 1. For advanced user who would like to set their own data, already encoded - * 2. For backwards compatibilty: If someone uses the old post($data) method. - * this method will be used to set the encoded data. - * - * $data can also be stream (such as file) from which the data will be read. - * - * @param resource|string $data - * @param string $enctype - * - * @return Zend_Http_Client - */ - public function setRawData($data, $enctype = null) - { - $this->raw_post_data = $data; - $this->setEncType($enctype); - if (is_resource($data)) { - // We've got stream data - $stat = @fstat($data); - if ($stat) { - $this->setHeaders(self::CONTENT_LENGTH, $stat['size']); - } - } - - return $this; - } - - /** - * Set the unmask feature for GET parameters as array. - * - * Example: - * foo%5B0%5D=a&foo%5B1%5D=b - * becomes - * foo=a&foo=b - * - * This is usefull for some services - * - * @param bool $status - * - * @return Zend_Http_Client - */ - public function setUnmaskStatus($status = true) - { - $this->_unmaskStatus = (BOOL) $status; - - return $this; - } - - /** - * Returns the currently configured unmask status. - * - * @return bool - */ - public function getUnmaskStatus() - { - return $this->_unmaskStatus; - } - - /** - * Clear all GET and POST parameters. - * - * Should be used to reset the request parameters if the client is - * used for several concurrent requests. - * - * clearAll parameter controls if we clean just parameters or also - * headers and last_* - * - * @param bool $clearAll Should all data be cleared? - * - * @return Zend_Http_Client - */ - public function resetParameters($clearAll = false) - { - // Reset parameter data - $this->paramsGet = []; - $this->paramsPost = []; - $this->files = []; - $this->raw_post_data = null; - $this->enctype = null; - - if ($clearAll) { - $this->headers = []; - $this->last_request = null; - $this->last_response = null; - } else { - // Clear outdated headers - if (isset($this->headers[strtolower(self::CONTENT_TYPE)])) { - unset($this->headers[strtolower(self::CONTENT_TYPE)]); - } - if (isset($this->headers[strtolower(self::CONTENT_LENGTH)])) { - unset($this->headers[strtolower(self::CONTENT_LENGTH)]); - } - } - - return $this; - } - - /** - * Get the last HTTP request as string. - * - * @return string - */ - public function getLastRequest() - { - return $this->last_request; - } - - /** - * Get the last HTTP response received by this client. - * - * If $config['storeresponse'] is set to false, or no response was - * stored yet, will return null - * - * @return Zend_Http_Response or null if none - */ - public function getLastResponse() - { - return $this->last_response; - } - - /** - * Load the connection adapter. - * - * While this method is not called more than one for a client, it is - * seperated from ->request() to preserve logic and readability - * - * @param string|Zend_Http_Client_Adapter_Interface $adapter - */ - public function setAdapter($adapter) - { - if (is_string($adapter)) { - try { - Zend_Loader::loadClass($adapter); - } catch (Zend_Exception $e) { - throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}", 0, $e); - } - - $adapter = new $adapter(); - } - - if (!$adapter instanceof Zend_Http_Client_Adapter_Interface) { - throw new Zend_Http_Client_Exception('Passed adapter is not a HTTP connection adapter'); - } - - $this->adapter = $adapter; - $config = $this->config; - unset($config['adapter']); - $this->adapter->setConfig($config); - } - - /** - * Load the connection adapter. - * - * @return Zend_Http_Client_Adapter_Interface $adapter - */ - public function getAdapter() - { - if (null === $this->adapter) { - $this->setAdapter($this->config['adapter']); - } - - return $this->adapter; - } - - /** - * Set streaming for received data. - * - * @param bool|string $streamfile Stream file, true for temp file, false/null for no streaming - * - * @return Zend_Http_Client - */ - public function setStream($streamfile = true) - { - $this->setConfig(['output_stream' => $streamfile]); - - return $this; - } - - /** - * Get status of streaming for received data. - * - * @return bool|string - */ - public function getStream() - { - return $this->config['output_stream']; - } - - /** - * Create temporary stream. - * - * @return resource - */ - protected function _openTempStream() - { - $this->_stream_name = $this->config['output_stream']; - if (!is_string($this->_stream_name)) { - // If name is not given, create temp name - $this->_stream_name = tempnam($this->config['stream_tmp_dir'] ?? sys_get_temp_dir(), - \Zend_Http_Client::class); - } - - if (false === ($fp = @fopen($this->_stream_name, 'w+b'))) { - if ($this->adapter instanceof Zend_Http_Client_Adapter_Interface) { - $this->adapter->close(); - } - - throw new Zend_Http_Client_Exception("Could not open temp file {$this->_stream_name}"); - } - - return $fp; - } - - /** - * Send the HTTP request and return an HTTP response object. - * - * @param string $method - * - * @return Zend_Http_Response - */ - public function request($method = null) - { - $stream = null; - if (!$this->uri instanceof Zend_Uri_Http) { - throw new Zend_Http_Client_Exception('No valid URI has been passed to the client'); - } - - if ($method) { - $this->setMethod($method); - } - $this->redirectCounter = 0; - $response = null; - - // Make sure the adapter is loaded - if ($this->adapter == null) { - $this->setAdapter($this->config['adapter']); - } - - // Send the first request. If redirected, continue. - do { - // Clone the URI and add the additional GET parameters to it - $uri = clone $this->uri; - if (!empty($this->paramsGet)) { - $query = $uri->getQuery(); - if (!empty($query)) { - $query .= '&'; - } - $query .= http_build_query($this->paramsGet, '', '&'); - if ($this->config['rfc3986_strict']) { - $query = str_replace('+', '%20', $query); - } - - // @see ZF-11671 to unmask for some services to foo=val1&foo=val2 - if ($this->getUnmaskStatus()) { - if ($this->_queryBracketsEscaped) { - $query = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $query); - } else { - $query = preg_replace('/\\[(?:[0-9]|[1-9][0-9]+)\\]=/', '=', $query); - } - } - - $uri->setQuery($query); - } - - $body = $this->_prepareBody(); - $headers = $this->_prepareHeaders(); - - // check that adapter supports streaming before using it - if (is_resource($body) && !($this->adapter instanceof Zend_Http_Client_Adapter_Stream)) { - throw new Zend_Http_Client_Exception('Adapter does not support streaming'); - } - - // Open the connection, send the request and read the response - $this->adapter->connect($uri->getHost(), $uri->getPort(), - ($uri->getScheme() == 'https' ? true : false)); - - if ($this->config['output_stream']) { - if ($this->adapter instanceof Zend_Http_Client_Adapter_Stream) { - $stream = $this->_openTempStream(); - $this->adapter->setOutputStream($stream); - } else { - throw new Zend_Http_Client_Exception('Adapter does not support streaming'); - } - } - - $this->last_request = $this->adapter->write($this->method, - $uri, $this->config['httpversion'], $headers, $body); - - $response = $this->adapter->read(); - if (!$response) { - throw new Zend_Http_Client_Exception('Unable to read response, or response is empty'); - } - - if ($this->config['output_stream']) { - $streamMetaData = stream_get_meta_data($stream); - if ($streamMetaData['seekable']) { - rewind($stream); - } - // cleanup the adapter - $this->adapter->setOutputStream(null); - $response = Zend_Http_Response_Stream::fromStream($response, $stream); - $response->setStreamName($this->_stream_name); - if (!is_string($this->config['output_stream'])) { - // we used temp name, will need to clean up - $response->setCleanup(true); - } - } else { - $response = Zend_Http_Response::fromString($response); - } - - if ($this->config['storeresponse']) { - $this->last_response = $response; - } - - // Load cookies into cookie jar - if (isset($this->cookiejar)) { - $this->cookiejar->addCookiesFromResponse($response, $uri, $this->config['encodecookies']); - } - - // If we got redirected, look for the Location header - if ($response->isRedirect() && ($location = $response->getHeader('location'))) { - // Avoid problems with buggy servers that add whitespace at the - // end of some headers (See ZF-11283) - $location = trim($location); - - // Check whether we send the exact same request again, or drop the parameters - // and send a GET request - if ($response->getStatus() == 303 - || ((!$this->config['strictredirects']) && ($response->getStatus() == 302 - || $response->getStatus() == 301))) { - $this->resetParameters(); - $this->setMethod(self::GET); - } - - // If we got a well formed absolute URI - if (($scheme = substr($location, 0, 6)) && ($scheme == 'http:/' || $scheme == 'https:')) { - $this->setHeaders('host', null); - $this->setUri($location); - } else { - // Split into path and query and set the query - if (strpos($location, '?') !== false) { - [$location, $query] = explode('?', $location, 2); - } else { - $query = ''; - } - $this->uri->setQuery($query); - - // Else, if we got just an absolute path, set it - if (strpos($location, '/') === 0) { - $this->uri->setPath($location); - - // Else, assume we have a relative path - } else { - // Get the current path directory, removing any trailing slashes - $path = $this->uri->getPath(); - $path = rtrim(substr($path, 0, strrpos($path, '/')), '/'); - $this->uri->setPath($path . '/' . $location); - } - } - ++$this->redirectCounter; - } else { - // If we didn't get any location, stop redirecting - break; - } - } while ($this->redirectCounter < $this->config['maxredirects']); - - return $response; - } - - /** - * Prepare the request headers. - * - * @return array - */ - protected function _prepareHeaders() - { - $headers = []; - - // Set the host header - if (!isset($this->headers['host'])) { - $host = $this->uri->getHost(); - - // If the port is not default, add it - if (!(($this->uri->getScheme() == 'http' && $this->uri->getPort() == 80) - || ($this->uri->getScheme() == 'https' && $this->uri->getPort() == 443))) { - $host .= ':' . $this->uri->getPort(); - } - - $headers[] = "Host: {$host}"; - } - - // Set the connection header - if (!isset($this->headers['connection'])) { - if (!$this->config['keepalive']) { - $headers[] = 'Connection: close'; - } - } - - // Set the Accept-encoding header if not set - depending on whether - // zlib is available or not. - if (!isset($this->headers['accept-encoding'])) { - if (function_exists('gzinflate')) { - $headers[] = 'Accept-encoding: gzip, deflate'; - } else { - $headers[] = 'Accept-encoding: identity'; - } - } - - // Set the Content-Type header - if (($this->method == self::POST || $this->method == self::PUT) - && (!isset($this->headers[strtolower(self::CONTENT_TYPE)]) && isset($this->enctype))) { - $headers[] = self::CONTENT_TYPE . ': ' . $this->enctype; - } - - // Set the user agent header - if (!isset($this->headers['user-agent']) && isset($this->config['useragent'])) { - $headers[] = "User-Agent: {$this->config['useragent']}"; - } - - // Set HTTP authentication if needed - if (is_array($this->auth)) { - $auth = self::encodeAuthHeader($this->auth['user'], $this->auth['password'], $this->auth['type']); - $headers[] = "Authorization: {$auth}"; - } - - // Load cookies from cookie jar - if (isset($this->cookiejar)) { - $cookstr = $this->cookiejar->getMatchingCookies($this->uri, - true, Zend_Http_CookieJar::COOKIE_STRING_CONCAT); - - if ($cookstr) { - $headers[] = "Cookie: {$cookstr}"; - } - } - - // Add all other user defined headers - foreach ($this->headers as $header) { - [$name, $value] = $header; - if (is_array($value)) { - $value = implode(', ', $value); - } - - $headers[] = "$name: $value"; - } - - return $headers; - } - - /** - * Prepare the request body (for POST and PUT requests). - * - * @return string - */ - protected function _prepareBody() - { - // According to RFC2616, a TRACE request should not have a body. - if ($this->method == self::TRACE) { - return ''; - } - - if (isset($this->raw_post_data) && is_resource($this->raw_post_data)) { - return $this->raw_post_data; - } - // If mbstring overloads substr and strlen functions, we have to - // override it's internal encoding - if (function_exists('mb_internal_encoding') - && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbIntEnc = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } - - // If we have raw_post_data set, just use it as the body. - if (isset($this->raw_post_data)) { - $this->setHeaders(self::CONTENT_LENGTH, strlen($this->raw_post_data)); - if (isset($mbIntEnc)) { - mb_internal_encoding($mbIntEnc); - } - - return $this->raw_post_data; - } - - $body = ''; - - // If we have files to upload, force enctype to multipart/form-data - if (count($this->files) > 0) { - $this->setEncType(self::ENC_FORMDATA); - } - - // If we have POST parameters or files, encode and add them to the body - if (count($this->paramsPost) > 0 || count($this->files) > 0) { - switch ($this->enctype) { - case self::ENC_FORMDATA: - // Encode body as multipart/form-data - $boundary = '---ZENDHTTPCLIENT-' . md5(microtime()); - $this->setHeaders(self::CONTENT_TYPE, self::ENC_FORMDATA . "; boundary={$boundary}"); - - // Encode all files and POST vars in the order they were given - foreach ($this->body_field_order as $fieldName => $fieldType) { - switch ($fieldType) { - case self::VTYPE_FILE: - foreach ($this->files as $file) { - if ($file['formname'] === $fieldName) { - $fhead = [self::CONTENT_TYPE => $file['ctype']]; - $body .= self::encodeFormData($boundary, $file['formname'], $file['data'], $file['filename'], $fhead); - } - } - - break; - case self::VTYPE_SCALAR: - if (isset($this->paramsPost[$fieldName])) { - if (is_array($this->paramsPost[$fieldName])) { - $flattened = self::_flattenParametersArray($this->paramsPost[$fieldName], $fieldName); - foreach ($flattened as $pp) { - $body .= self::encodeFormData($boundary, $pp[0], $pp[1]); - } - } else { - $body .= self::encodeFormData($boundary, $fieldName, $this->paramsPost[$fieldName]); - } - } - - break; - } - } - - $body .= "--{$boundary}--\r\n"; - - break; - - case self::ENC_URLENCODED: - // Encode body as application/x-www-form-urlencoded - $this->setHeaders(self::CONTENT_TYPE, self::ENC_URLENCODED); - $body = http_build_query($this->paramsPost, '', '&'); - - break; - - default: - if (isset($mbIntEnc)) { - mb_internal_encoding($mbIntEnc); - } - - throw new Zend_Http_Client_Exception("Cannot handle content type '{$this->enctype}' automatically." - . ' Please use Zend_Http_Client::setRawData to send this kind of content.'); - - break; - } - } - - // Set the Content-Length if we have a body or if request is POST/PUT - if ($body || $this->method == self::POST || $this->method == self::PUT) { - $this->setHeaders(self::CONTENT_LENGTH, strlen($body)); - } - - if (isset($mbIntEnc)) { - mb_internal_encoding($mbIntEnc); - } - - return $body; - } - - /** - * Helper method that gets a possibly multi-level parameters array (get or - * post) and flattens it. - * - * The method returns an array of (key, value) pairs (because keys are not - * necessarily unique. If one of the parameters in as array, it will also - * add a [] suffix to the key. - * - * This method is deprecated since Zend Framework 1.9 in favour of - * self::_flattenParametersArray() and will be dropped in 2.0 - * - * @deprecated since 1.9 - * - * @param array $parray The parameters array - * @param bool $urlencode Whether to urlencode the name and value - * - * @return array - */ - protected function _getParametersRecursive($parray, $urlencode = false) - { - // Issue a deprecated notice - trigger_error('The ' . __METHOD__ . ' method is deprecated and will be dropped in 2.0.', - E_USER_NOTICE); - - if (!is_array($parray)) { - return $parray; - } - $parameters = []; - - foreach ($parray as $name => $value) { - if ($urlencode) { - $name = urlencode($name); - } - - // If $value is an array, iterate over it - if (is_array($value)) { - $name .= ($urlencode ? '%5B%5D' : '[]'); - foreach ($value as $subval) { - if ($urlencode) { - $subval = urlencode($subval); - } - $parameters[] = [$name, $subval]; - } - } else { - if ($urlencode) { - $value = urlencode($value); - } - $parameters[] = [$name, $value]; - } - } - - return $parameters; - } - - /** - * Attempt to detect the MIME type of a file using available extensions. - * - * This method will try to detect the MIME type of a file. If the fileinfo - * extension is available, it will be used. If not, the mime_magic - * extension which is deprected but is still available in many PHP setups - * will be tried. - * - * If neither extension is available, the default application/octet-stream - * MIME type will be returned - * - * @param string $file File path - * - * @return string MIME type - */ - protected function _detectFileMimeType($file) - { - $type = null; - - // First try with fileinfo functions - if (function_exists('finfo_open')) { - if (self::$_fileInfoDb === null) { - self::$_fileInfoDb = @finfo_open(FILEINFO_MIME); - } - - if (self::$_fileInfoDb) { - $type = finfo_file(self::$_fileInfoDb, $file); - } - } elseif (function_exists('mime_content_type')) { - $type = mime_content_type($file); - } - - // Fallback to the default application/octet-stream - if (!$type) { - $type = 'application/octet-stream'; - } - - return $type; - } - - /** - * Encode data to a multipart/form-data part suitable for a POST request. - * - * @param string $boundary - * @param string $name - * @param mixed $value - * @param string $filename - * @param array $headers Associative array of optional headers @example ("Content-Transfer-Encoding" => "binary") - * - * @return string - */ - public static function encodeFormData($boundary, $name, $value, $filename = null, $headers = []) - { - $ret = "--{$boundary}\r\n" - . 'Content-Disposition: form-data; name="' . $name . '"'; - - if ($filename) { - $ret .= '; filename="' . $filename . '"'; - } - $ret .= "\r\n"; - - foreach ($headers as $hname => $hvalue) { - $ret .= "{$hname}: {$hvalue}\r\n"; - } - $ret .= "\r\n"; - - $ret .= "{$value}\r\n"; - - return $ret; - } - - /** - * Create a HTTP authentication "Authorization:" header according to the - * specified user, password and authentication method. - * - * @see http://www.faqs.org/rfcs/rfc2617.html - * - * @param string $user - * @param string $password - * @param string $type - * - * @return string - */ - public static function encodeAuthHeader($user, $password, $type = self::AUTH_BASIC) - { - $authHeader = null; - - switch ($type) { - case self::AUTH_BASIC: - // In basic authentication, the user name cannot contain ":" - if (strpos($user, ':') !== false) { - throw new Zend_Http_Client_Exception("The user name cannot contain ':' in 'Basic' HTTP authentication"); - } - - $authHeader = 'Basic ' . base64_encode($user . ':' . $password); - - break; - - //case self::AUTH_DIGEST: - // @todo Implement digest authentication - // break; - - default: - throw new Zend_Http_Client_Exception("Not a supported HTTP authentication type: '$type'"); - } - - return $authHeader; - } - - /** - * Convert an array of parameters into a flat array of (key, value) pairs. - * - * Will flatten a potentially multi-dimentional array of parameters (such - * as POST parameters) into a flat array of (key, value) paris. In case - * of multi-dimentional arrays, square brackets ([]) will be added to the - * key to indicate an array. - * - * @since 1.9 - * - * @param array $parray - * @param string $prefix - * - * @return array - */ - protected static function _flattenParametersArray($parray, $prefix = null) - { - if (!is_array($parray)) { - return $parray; - } - - $parameters = []; - - foreach ($parray as $name => $value) { - // Calculate array key - if ($prefix) { - if (is_int($name)) { - $key = $prefix . '[]'; - } else { - $key = $prefix . "[$name]"; - } - } else { - $key = $name; - } - - if (is_array($value)) { - $parameters = array_merge($parameters, self::_flattenParametersArray($value, $key)); - } else { - $parameters[] = [$key, $value]; - } - } - - return $parameters; - } - - /** - * Ensure a header value is valid per RFC 7230. - * - * @see http://tools.ietf.org/html/rfc7230#section-3.2 - * - * @param array|object|string $value - * @param bool $recurse - */ - protected function _validateHeaderValue($value, $recurse = true) - { - if (is_array($value) && $recurse) { - foreach ($value as $v) { - $this->_validateHeaderValue($v, false); - } - - return; - } - - // Cast integers and floats to strings for purposes of header representation. - if (is_int($value) || is_float($value)) { - $value = (string) $value; - } - - if (!is_string($value) && (!is_object($value) || !method_exists($value, '__toString'))) { - throw new Zend_Http_Exception('Invalid header value detected'); - } - - Zend_Http_Header_HeaderValue::assertValid($value); - } -} diff --git a/library/Zend/Http/Client/Adapter/Curl.php b/library/Zend/Http/Client/Adapter/Curl.php deleted file mode 100644 index b11fbdca..00000000 --- a/library/Zend/Http/Client/Adapter/Curl.php +++ /dev/null @@ -1,518 +0,0 @@ -_invalidOverwritableCurlOptions = [ - CURLOPT_HTTPGET, - CURLOPT_POST, - CURLOPT_PUT, - CURLOPT_CUSTOMREQUEST, - CURLOPT_HEADER, - CURLOPT_RETURNTRANSFER, - CURLOPT_HTTPHEADER, - CURLOPT_POSTFIELDS, - CURLOPT_INFILE, - CURLOPT_INFILESIZE, - CURLOPT_PORT, - CURLOPT_MAXREDIRS, - CURLOPT_CONNECTTIMEOUT, - CURL_HTTP_VERSION_1_1, - CURL_HTTP_VERSION_1_0, - ]; - } - - /** - * Set the configuration array for the adapter. - * - * @param array|Zend_Config $config - * - * @return Zend_Http_Client_Adapter_Curl - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Zend_Http_Client_Adapter_Exception( - 'Array or Zend_Config object expected, got ' . gettype($config) - ); - } - - if (isset($config['proxy_user'], $config['proxy_pass'])) { - $this->setCurlOption(CURLOPT_PROXYUSERPWD, $config['proxy_user'] . ':' . $config['proxy_pass']); - unset($config['proxy_user'], $config['proxy_pass']); - } - - foreach ($config as $k => $v) { - $option = strtolower($k); - switch ($option) { - case 'proxy_host': - $this->setCurlOption(CURLOPT_PROXY, $v); - - break; - case 'proxy_port': - $this->setCurlOption(CURLOPT_PROXYPORT, $v); - - break; - default: - $this->_config[$option] = $v; - - break; - } - } - - return $this; - } - - /** - * Retrieve the array of all configuration options. - * - * @return array - */ - public function getConfig() - { - return $this->_config; - } - - /** - * Direct setter for cURL adapter related options. - * - * @param int|string $option - * @param mixed $value - * - * @return Zend_Http_Adapter_Curl - */ - public function setCurlOption($option, $value) - { - if (!isset($this->_config['curloptions'])) { - $this->_config['curloptions'] = []; - } - $this->_config['curloptions'][$option] = $value; - - return $this; - } - - /** - * Initialize curl. - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - // If we're already connected, disconnect first - if ($this->_curl) { - $this->close(); - } - - // If we are connected to a different server or port, disconnect first - if ($this->_curl - && is_array($this->_connected_to) - && ($this->_connected_to[0] != $host - || $this->_connected_to[1] != $port) - ) { - $this->close(); - } - - // Do the actual connection - $this->_curl = curl_init(); - if ($port != 80) { - curl_setopt($this->_curl, CURLOPT_PORT, intval($port)); - } - - // Set connection timeout - $connectTimeout = $this->_config['timeout']; - $constant = CURLOPT_CONNECTTIMEOUT; - if (defined('CURLOPT_CONNECTTIMEOUT_MS')) { - $connectTimeout *= 1000; - $constant = constant('CURLOPT_CONNECTTIMEOUT_MS'); - } - curl_setopt($this->_curl, $constant, $connectTimeout); - - // Set request timeout (once connection is established) - if (array_key_exists('request_timeout', $this->_config)) { - $requestTimeout = $this->_config['request_timeout']; - $constant = CURLOPT_TIMEOUT; - if (defined('CURLOPT_TIMEOUT_MS')) { - $requestTimeout *= 1000; - $constant = constant('CURLOPT_TIMEOUT_MS'); - } - curl_setopt($this->_curl, $constant, $requestTimeout); - } - - // Set Max redirects - curl_setopt($this->_curl, CURLOPT_MAXREDIRS, $this->_config['maxredirects']); - - if (!$this->_curl) { - $this->close(); - - throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' . $host . ':' . $port); - } - - if ($secure !== false) { - // Behave the same like Zend_Http_Adapter_Socket on SSL options. - if (isset($this->_config['sslcert'])) { - curl_setopt($this->_curl, CURLOPT_SSLCERT, $this->_config['sslcert']); - } - if (isset($this->_config['sslpassphrase'])) { - curl_setopt($this->_curl, CURLOPT_SSLCERTPASSWD, $this->_config['sslpassphrase']); - } - } - - // Update connected_to - $this->_connected_to = [$host, $port]; - } - - /** - * Send request to the remote server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param array $headers - * @param string $body - * @param mixed $httpVersion - * - * @return string $request - */ - public function write($method, $uri, $httpVersion = 1.1, $headers = [], $body = '') - { - // Make sure we're properly connected - if (!$this->_curl) { - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected'); - } - - if ($this->_connected_to[0] != $uri->getHost() || $this->_connected_to[1] != $uri->getPort()) { - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host'); - } - - // set URL - curl_setopt($this->_curl, CURLOPT_URL, $uri->__toString()); - - // ensure correct curl call - $curlValue = true; - switch ($method) { - case Zend_Http_Client::GET: - $curlMethod = CURLOPT_HTTPGET; - - break; - - case Zend_Http_Client::POST: - $curlMethod = CURLOPT_POST; - - break; - - case Zend_Http_Client::PUT: - // There are two different types of PUT request, either a Raw Data string has been set - // or CURLOPT_INFILE and CURLOPT_INFILESIZE are used. - if (is_resource($body)) { - $this->_config['curloptions'][CURLOPT_INFILE] = $body; - } - if (isset($this->_config['curloptions'][CURLOPT_INFILE])) { - // Now we will probably already have Content-Length set, so that we have to delete it - // from $headers at this point: - foreach ($headers as $k => $header) { - if (preg_match('/Content-Length:\s*(\d+)/i', $header, $m)) { - if (is_resource($body)) { - $this->_config['curloptions'][CURLOPT_INFILESIZE] = (int) $m[1]; - } - unset($headers[$k]); - } - } - - if (!isset($this->_config['curloptions'][CURLOPT_INFILESIZE])) { - throw new Zend_Http_Client_Adapter_Exception('Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.'); - } - - if (is_resource($body)) { - $body = ''; - } - - $curlMethod = CURLOPT_PUT; - } else { - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'PUT'; - } - - break; - - case Zend_Http_Client::PATCH: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'PATCH'; - - break; - - case Zend_Http_Client::DELETE: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'DELETE'; - - break; - - case Zend_Http_Client::OPTIONS: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'OPTIONS'; - - break; - - case Zend_Http_Client::TRACE: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'TRACE'; - - break; - - case Zend_Http_Client::HEAD: - $curlMethod = CURLOPT_CUSTOMREQUEST; - $curlValue = 'HEAD'; - - break; - - default: - // For now, through an exception for unsupported request methods - throw new Zend_Http_Client_Adapter_Exception('Method currently not supported'); - } - - if (is_resource($body) && $curlMethod != CURLOPT_PUT) { - throw new Zend_Http_Client_Adapter_Exception('Streaming requests are allowed only with PUT'); - } - - // get http version to use - $curlHttp = ($httpVersion == 1.1) ? CURL_HTTP_VERSION_1_1 : CURL_HTTP_VERSION_1_0; - - // mark as HTTP request and set HTTP method - curl_setopt($this->_curl, CURLOPT_HTTP_VERSION, $curlHttp); - curl_setopt($this->_curl, $curlMethod, $curlValue); - - if ($this->out_stream) { - // headers will be read into the response - curl_setopt($this->_curl, CURLOPT_HEADER, false); - curl_setopt($this->_curl, CURLOPT_HEADERFUNCTION, [$this, 'readHeader']); - // and data will be written into the file - curl_setopt($this->_curl, CURLOPT_FILE, $this->out_stream); - } else { - // ensure headers are also returned - curl_setopt($this->_curl, CURLOPT_HEADER, true); - curl_setopt($this->_curl, CURLINFO_HEADER_OUT, true); - - // ensure actual response is returned - curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true); - } - - // set additional headers - $headers['Accept'] = ''; - curl_setopt($this->_curl, CURLOPT_HTTPHEADER, $headers); - - /* - * Make sure POSTFIELDS is set after $curlMethod is set: - * @link http://de2.php.net/manual/en/function.curl-setopt.php#81161 - */ - if ($method == Zend_Http_Client::POST) { - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } elseif ($curlMethod == CURLOPT_PUT) { - // this covers a PUT by file-handle: - // Make the setting of this options explicit (rather than setting it through the loop following a bit lower) - // to group common functionality together. - curl_setopt($this->_curl, CURLOPT_INFILE, $this->_config['curloptions'][CURLOPT_INFILE]); - curl_setopt($this->_curl, CURLOPT_INFILESIZE, $this->_config['curloptions'][CURLOPT_INFILESIZE]); - unset($this->_config['curloptions'][CURLOPT_INFILE], $this->_config['curloptions'][CURLOPT_INFILESIZE]); - } elseif ($method == Zend_Http_Client::PUT) { - // This is a PUT by a setRawData string, not by file-handle - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } elseif ($method == Zend_Http_Client::PATCH) { - // This is a PATCH by a setRawData string - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } elseif ($method == Zend_Http_Client::DELETE) { - // This is a DELETE by a setRawData string - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } elseif ($method == Zend_Http_Client::OPTIONS) { - // This is an OPTIONS by a setRawData string - curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body); - } - - // set additional curl options - if (isset($this->_config['curloptions'])) { - foreach ((array) $this->_config['curloptions'] as $k => $v) { - if (!in_array($k, $this->_invalidOverwritableCurlOptions)) { - if (curl_setopt($this->_curl, $k, $v) == false) { - throw new Zend_Http_Client_Exception(sprintf("Unknown or erroreous cURL option '%s' set", $k)); - } - } - } - } - - // send the request - $response = curl_exec($this->_curl); - - // if we used streaming, headers are already there - if (!is_resource($this->out_stream)) { - $this->_response = $response; - } - - $request = curl_getinfo($this->_curl, CURLINFO_HEADER_OUT); - $request .= $body; - - if (empty($this->_response)) { - throw new Zend_Http_Client_Exception('Error in cURL request: ' . curl_error($this->_curl)); - } - - // cURL automatically decodes chunked-messages, this means we have to disallow the Zend_Http_Response to do it again - if (stripos($this->_response, "Transfer-Encoding: chunked\r\n")) { - $this->_response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $this->_response); - } - - // Eliminate multiple HTTP responses. - do { - $parts = preg_split('|(?:\r?\n){2}|m', $this->_response, 2); - $again = false; - - if (isset($parts[1]) && preg_match("|^HTTP/1\.[01](.*?)\r\n|mi", $parts[1])) { - $this->_response = $parts[1]; - $again = true; - } - } while ($again); - - // cURL automatically handles Proxy rewrites, remove the "HTTP/1.0 200 Connection established" string: - if (stripos($this->_response, "HTTP/1.0 200 Connection established\r\n\r\n") !== false) { - $this->_response = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $this->_response); - } - - return $request; - } - - /** - * Return read response from server. - * - * @return string - */ - public function read() - { - return $this->_response; - } - - /** - * Close the connection to the server. - */ - public function close() - { - if (is_resource($this->_curl)) { - curl_close($this->_curl); - } - $this->_curl = null; - $this->_connected_to = [null, null]; - } - - /** - * Get cUrl Handle. - * - * @return resource - */ - public function getHandle() - { - return $this->_curl; - } - - /** - * Set output stream for the response. - * - * @param resource $stream - * - * @return Zend_Http_Client_Adapter_Socket - */ - public function setOutputStream($stream) - { - $this->out_stream = $stream; - - return $this; - } - - /** - * Header reader function for CURL. - * - * @param resource $curl - * @param string $header - * - * @return int - */ - public function readHeader($curl, $header) - { - $this->_response .= $header; - - return strlen($header); - } -} diff --git a/library/Zend/Http/Client/Adapter/Exception.php b/library/Zend/Http/Client/Adapter/Exception.php deleted file mode 100644 index e8c58262..00000000 --- a/library/Zend/Http/Client/Adapter/Exception.php +++ /dev/null @@ -1,30 +0,0 @@ - 'ssl', - 'sslcert' => null, - 'sslpassphrase' => null, - 'sslusecontext' => false, - 'proxy_host' => '', - 'proxy_port' => 8080, - 'proxy_user' => '', - 'proxy_pass' => '', - 'proxy_auth' => Zend_Http_Client::AUTH_BASIC, - 'persistent' => false, - ]; - - /** - * Whether HTTPS CONNECT was already negotiated with the proxy or not. - * - * @var bool - */ - protected $negotiated = false; - - /** - * Stores the last CONNECT handshake request. - * - * @var string - */ - protected $connectHandshakeRequest; - - /** - * Connect to the remote server. - * - * Will try to connect to the proxy server. If no proxy was set, will - * fall back to the target server (behave like regular Socket adapter) - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - // If no proxy is set, fall back to Socket adapter - if (!$this->config['proxy_host']) { - return parent::connect($host, $port, $secure); - } - - // Url might require stream context even if proxy connection doesn't - if ($secure) { - $this->config['sslusecontext'] = true; - } - - // Connect (a non-secure connection) to the proxy server - return parent::connect( - $this->config['proxy_host'], - $this->config['proxy_port'], - false - ); - } - - /** - * Send request to the proxy server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param string $http_ver - * @param array $headers - * @param string $body - * - * @return string Request as string - */ - public function write( - $method, $uri, $http_ver = '1.1', $headers = [], $body = '' - ) { - // If no proxy is set, fall back to default Socket adapter - if (!$this->config['proxy_host']) { - return parent::write($method, $uri, $http_ver, $headers, $body); - } - - // Make sure we're properly connected - if (!$this->socket) { - throw new Zend_Http_Client_Adapter_Exception( - 'Trying to write but we are not connected' - ); - } - - $host = $this->config['proxy_host']; - $port = $this->config['proxy_port']; - - if ($this->connected_to[0] != "tcp://$host" - || $this->connected_to[1] != $port - ) { - throw new Zend_Http_Client_Adapter_Exception( - 'Trying to write but we are connected to the wrong proxy server' - ); - } - - // Add Proxy-Authorization header - if ($this->config['proxy_user']) { - // Check to see if one already exists - $hasProxyAuthHeader = false; - foreach ($headers as $k => $v) { - if ((string) $k == 'proxy-authorization' - || preg_match('/^proxy-authorization:/i', $v) - ) { - $hasProxyAuthHeader = true; - - break; - } - } - if (!$hasProxyAuthHeader) { - $headers[] = 'Proxy-authorization: ' - . Zend_Http_Client::encodeAuthHeader( - $this->config['proxy_user'], - $this->config['proxy_pass'], $this->config['proxy_auth'] - ); - } - } - - // if we are proxying HTTPS, preform CONNECT handshake with the proxy - if ($uri->getScheme() == 'https' && (!$this->negotiated)) { - $this->connectHandshake( - $uri->getHost(), $uri->getPort(), $http_ver, $headers - ); - $this->negotiated = true; - } - - // Save request method for later - $this->method = $method; - - // Build request headers - if ($this->negotiated) { - $path = $uri->getPath(); - if ($uri->getQuery()) { - $path .= '?' . $uri->getQuery(); - } - $request = "$method $path HTTP/$http_ver\r\n"; - } else { - $request = "$method $uri HTTP/$http_ver\r\n"; - } - - // Add all headers to the request string - foreach ($headers as $k => $v) { - if (is_string($k)) { - $v = "$k: $v"; - } - $request .= "$v\r\n"; - } - - if (is_resource($body)) { - $request .= "\r\n"; - } else { - // Add the request body - $request .= "\r\n" . $body; - } - - // Send the request - if (!@fwrite($this->socket, $request)) { - throw new Zend_Http_Client_Adapter_Exception( - 'Error writing request to proxy server' - ); - } - - if (is_resource($body)) { - if (stream_copy_to_stream($body, $this->socket) == 0) { - throw new Zend_Http_Client_Adapter_Exception( - 'Error writing request to server' - ); - } - } - - return $request; - } - - /** - * Preform handshaking with HTTPS proxy using CONNECT method. - * - * @param string $host - * @param int $port - * @param string $http_ver - */ - protected function connectHandshake( - $host, $port = 443, $http_ver = '1.1', array &$headers = [] - ) { - $request = "CONNECT $host:$port HTTP/$http_ver\r\n" - . 'Host: ' . $host . "\r\n"; - - // Process provided headers, including important ones to CONNECT request - foreach ($headers as $k => $v) { - switch (strtolower(substr($v,0,strpos($v,':')))) { - case 'proxy-authorization': - // break intentionally omitted - - case 'user-agent': - $request .= $v . "\r\n"; - - break; - - default: - break; - } - } - $request .= "\r\n"; - - // @see ZF-3189 - $this->connectHandshakeRequest = $request; - - // Send the request - if (!@fwrite($this->socket, $request)) { - throw new Zend_Http_Client_Adapter_Exception( - 'Error writing request to proxy server' - ); - } - - // Read response headers only - $response = ''; - $gotStatus = false; - while ($line = @fgets($this->socket)) { - $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false); - if ($gotStatus) { - $response .= $line; - if (!chop($line)) { - break; - } - } - } - - // Check that the response from the proxy is 200 - if (Zend_Http_Response::extractCode($response) != 200) { - throw new Zend_Http_Client_Adapter_Exception( - 'Unable to connect to HTTPS proxy. Server response: ' . $response - ); - } - - // If all is good, switch socket to secure mode. We have to fall back - // through the different modes - $modes = [ - STREAM_CRYPTO_METHOD_TLS_CLIENT, - STREAM_CRYPTO_METHOD_SSLv3_CLIENT, - STREAM_CRYPTO_METHOD_SSLv23_CLIENT, - STREAM_CRYPTO_METHOD_SSLv2_CLIENT, - ]; - - $success = false; - foreach ($modes as $mode) { - $success = stream_socket_enable_crypto($this->socket, true, $mode); - if ($success) { - break; - } - } - - if (!$success) { - throw new Zend_Http_Client_Adapter_Exception( - 'Unable to connect to HTTPS server through proxy: could not ' - . 'negotiate secure connection.' - ); - } - } - - /** - * Close the connection to the server. - */ - public function close() - { - parent::close(); - $this->negotiated = false; - } - - /** - * Destructor: make sure the socket is disconnected. - */ - public function __destruct() - { - if ($this->socket) { - $this->close(); - } - } -} diff --git a/library/Zend/Http/Client/Adapter/Socket.php b/library/Zend/Http/Client/Adapter/Socket.php deleted file mode 100644 index efce3dc6..00000000 --- a/library/Zend/Http/Client/Adapter/Socket.php +++ /dev/null @@ -1,530 +0,0 @@ - false, - 'ssltransport' => 'ssl', - 'sslcert' => null, - 'sslpassphrase' => null, - 'sslusecontext' => false, - ]; - - /** - * Request method - will be set by write() and might be used by read(). - * - * @var string - */ - protected $method; - - /** - * Stream context. - * - * @var resource - */ - protected $_context; - - /** - * Adapter constructor, currently empty. Config is set using setConfig(). - */ - public function __construct() - { - } - - /** - * Set the configuration array for the adapter. - * - * @param array|Zend_Config $config - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Zend_Http_Client_Adapter_Exception( - 'Array or Zend_Config object expected, got ' . gettype($config) - ); - } - - foreach ($config as $k => $v) { - $this->config[strtolower($k)] = $v; - } - } - - /** - * Retrieve the array of all configuration options. - * - * @return array - */ - public function getConfig() - { - return $this->config; - } - - /** - * Set the stream context for the TCP connection to the server. - * - * Can accept either a pre-existing stream context resource, or an array - * of stream options, similar to the options array passed to the - * stream_context_create() PHP function. In such case a new stream context - * will be created using the passed options. - * - * @since Zend Framework 1.9 - * - * @param mixed $context Stream context or array of context options - * - * @return Zend_Http_Client_Adapter_Socket - */ - public function setStreamContext($context) - { - if (is_resource($context) && get_resource_type($context) == 'stream-context') { - $this->_context = $context; - } elseif (is_array($context)) { - $this->_context = stream_context_create($context); - } else { - // Invalid parameter - throw new Zend_Http_Client_Adapter_Exception( - 'Expecting either a stream context resource or array, got ' . gettype($context) - ); - } - - return $this; - } - - /** - * Get the stream context for the TCP connection to the server. - * - * If no stream context is set, will create a default one. - * - * @return resource - */ - public function getStreamContext() - { - if (!$this->_context) { - $this->_context = stream_context_create(); - } - - return $this->_context; - } - - /** - * Connect to the remote server. - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - // If the URI should be accessed via SSL, prepend the Hostname with ssl:// - $host = ($secure ? $this->config['ssltransport'] : 'tcp') . '://' . $host; - - // If we are connected to the wrong host, disconnect first - if (($this->connected_to[0] != $host || $this->connected_to[1] != $port)) { - if (is_resource($this->socket)) { - $this->close(); - } - } - - // Now, if we are not connected, connect - if (!is_resource($this->socket) || !$this->config['keepalive']) { - $context = $this->getStreamContext(); - if ($secure || $this->config['sslusecontext']) { - if ($this->config['sslcert'] !== null) { - if (!stream_context_set_option($context, 'ssl', 'local_cert', - $this->config['sslcert'])) { - throw new Zend_Http_Client_Adapter_Exception('Unable to set sslcert option'); - } - } - if ($this->config['sslpassphrase'] !== null) { - if (!stream_context_set_option($context, 'ssl', 'passphrase', - $this->config['sslpassphrase'])) { - throw new Zend_Http_Client_Adapter_Exception('Unable to set sslpassphrase option'); - } - } - } - - $flags = STREAM_CLIENT_CONNECT; - if ($this->config['persistent']) { - $flags |= STREAM_CLIENT_PERSISTENT; - } - - $this->socket = @stream_socket_client($host . ':' . $port, - $errno, - $errstr, - (int) $this->config['timeout'], - $flags, - $context); - - if (!$this->socket) { - $this->close(); - - throw new Zend_Http_Client_Adapter_Exception( - 'Unable to Connect to ' . $host . ':' . $port . '. Error #' . $errno . ': ' . $errstr); - } - - // Set the stream timeout - if (!stream_set_timeout($this->socket, (int) $this->config['timeout'])) { - throw new Zend_Http_Client_Adapter_Exception('Unable to set the connection timeout'); - } - - // Update connected_to - $this->connected_to = [$host, $port]; - } - } - - /** - * Send request to the remote server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param string $http_ver - * @param array $headers - * @param string $body - * - * @return string Request as string - */ - public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') - { - // Make sure we're properly connected - if (!$this->socket) { - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected'); - } - - $host = $uri->getHost(); - $host = (strtolower($uri->getScheme()) == 'https' ? $this->config['ssltransport'] : 'tcp') . '://' . $host; - if ($this->connected_to[0] != $host || $this->connected_to[1] != $uri->getPort()) { - throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host'); - } - - // Save request method for later - $this->method = $method; - - // Build request headers - $path = $uri->getPath(); - if ($uri->getQuery()) { - $path .= '?' . $uri->getQuery(); - } - $request = "{$method} {$path} HTTP/{$http_ver}\r\n"; - foreach ($headers as $k => $v) { - if (is_string($k)) { - $v = ucfirst($k) . ": $v"; - } - $request .= "$v\r\n"; - } - - if (is_resource($body)) { - $request .= "\r\n"; - } else { - // Add the request body - $request .= "\r\n" . $body; - } - - // Send the request - if (!@fwrite($this->socket, $request)) { - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); - } - - if (is_resource($body)) { - if (stream_copy_to_stream($body, $this->socket) == 0) { - throw new Zend_Http_Client_Adapter_Exception('Error writing request to server'); - } - } - - return $request; - } - - /** - * Read response from server. - * - * @return string - */ - public function read() - { - // First, read headers only - $response = ''; - $gotStatus = false; - - while (($line = @fgets($this->socket)) !== false) { - $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false); - if ($gotStatus) { - $response .= $line; - if (rtrim($line) === '') { - break; - } - } - } - - $this->_checkSocketReadTimeout(); - - $statusCode = Zend_Http_Response::extractCode($response); - - // Handle 100 and 101 responses internally by restarting the read again - if ($statusCode == 100 || $statusCode == 101) { - return $this->read(); - } - - // Check headers to see what kind of connection / transfer encoding we have - $headers = Zend_Http_Response::extractHeaders($response); - - /* - * Responses to HEAD requests and 204 or 304 responses are not expected - * to have a body - stop reading here - */ - if ($statusCode == 304 || $statusCode == 204 - || $this->method == Zend_Http_Client::HEAD) { - // Close the connection if requested to do so by the server - if (isset($headers['connection']) && $headers['connection'] == 'close') { - $this->close(); - } - - return $response; - } - - // If we got a 'transfer-encoding: chunked' header - if (isset($headers['transfer-encoding'])) { - if (strtolower($headers['transfer-encoding']) == 'chunked') { - do { - $line = @fgets($this->socket); - $this->_checkSocketReadTimeout(); - - $chunk = $line; - - // Figure out the next chunk size - $chunksize = trim($line); - if (!ctype_xdigit($chunksize)) { - $this->close(); - - throw new Zend_Http_Client_Adapter_Exception('Invalid chunk size "' - . $chunksize . '" unable to read chunked body'); - } - - // Convert the hexadecimal value to plain integer - $chunksize = hexdec($chunksize); - - // Read next chunk - $read_to = ftell($this->socket) + $chunksize; - - do { - $current_pos = ftell($this->socket); - if ($current_pos >= $read_to) { - break; - } - - if ($this->out_stream) { - if (stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) { - $this->_checkSocketReadTimeout(); - - break; - } - } else { - $line = @fread($this->socket, $read_to - $current_pos); - if ($line === false || strlen($line) === 0) { - $this->_checkSocketReadTimeout(); - - break; - } - $chunk .= $line; - } - } while (!feof($this->socket)); - - $chunk .= @fgets($this->socket); - $this->_checkSocketReadTimeout(); - - if (!$this->out_stream) { - $response .= $chunk; - } - } while ($chunksize > 0); - } else { - $this->close(); - - throw new Zend_Http_Client_Adapter_Exception('Cannot handle "' - . $headers['transfer-encoding'] . '" transfer encoding'); - } - - // We automatically decode chunked-messages when writing to a stream - // this means we have to disallow the Zend_Http_Response to do it again - if ($this->out_stream) { - $response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $response); - } - // Else, if we got the content-length header, read this number of bytes - } elseif (isset($headers['content-length'])) { - // If we got more than one Content-Length header (see ZF-9404) use - // the last value sent - if (is_array($headers['content-length'])) { - $contentLength = $headers['content-length'][count($headers['content-length']) - 1]; - } else { - $contentLength = $headers['content-length']; - } - - $current_pos = ftell($this->socket); - $chunk = ''; - - for ($read_to = $current_pos + $contentLength; - $read_to > $current_pos; - $current_pos = ftell($this->socket)) { - if ($this->out_stream) { - if (@stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) { - $this->_checkSocketReadTimeout(); - - break; - } - } else { - $chunk = @fread($this->socket, $read_to - $current_pos); - if ($chunk === false || strlen($chunk) === 0) { - $this->_checkSocketReadTimeout(); - - break; - } - - $response .= $chunk; - } - - // Break if the connection ended prematurely - if (feof($this->socket)) { - break; - } - } - - // Fallback: just read the response until EOF - } else { - do { - if ($this->out_stream) { - if (@stream_copy_to_stream($this->socket, $this->out_stream) == 0) { - $this->_checkSocketReadTimeout(); - - break; - } - } else { - $buff = @fread($this->socket, 8192); - if ($buff === false || strlen($buff) === 0) { - $this->_checkSocketReadTimeout(); - - break; - } - $response .= $buff; - } - } while (feof($this->socket) === false); - - $this->close(); - } - - // Close the connection if requested to do so by the server - if (isset($headers['connection']) && $headers['connection'] == 'close') { - $this->close(); - } - - return $response; - } - - /** - * Close the connection to the server. - */ - public function close() - { - if (is_resource($this->socket)) { - @fclose($this->socket); - } - $this->socket = null; - $this->connected_to = [null, null]; - } - - /** - * Check if the socket has timed out - if so close connection and throw - * an exception. - */ - protected function _checkSocketReadTimeout() - { - if ($this->socket) { - $info = stream_get_meta_data($this->socket); - $timedout = $info['timed_out']; - if ($timedout) { - $this->close(); - - throw new Zend_Http_Client_Adapter_Exception( - "Read timed out after {$this->config['timeout']} seconds", - Zend_Http_Client_Adapter_Exception::READ_TIMEOUT - ); - } - } - } - - /** - * Set output stream for the response. - * - * @param resource $stream - * - * @return Zend_Http_Client_Adapter_Socket - */ - public function setOutputStream($stream) - { - $this->out_stream = $stream; - - return $this; - } - - /** - * Destructor: make sure the socket is disconnected. - * - * If we are in persistent TCP mode, will not close the connection - */ - public function __destruct() - { - if (!$this->config['persistent']) { - if ($this->socket) { - $this->close(); - } - } - } -} diff --git a/library/Zend/Http/Client/Adapter/Stream.php b/library/Zend/Http/Client/Adapter/Stream.php deleted file mode 100755 index 27da2b94..00000000 --- a/library/Zend/Http/Client/Adapter/Stream.php +++ /dev/null @@ -1,38 +0,0 @@ -_nextRequestWillFail = (bool) $flag; - - return $this; - } - - /** - * Set the configuration array for the adapter. - * - * @param array|Zend_Config $config - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Zend_Http_Client_Adapter_Exception( - 'Array or Zend_Config object expected, got ' . gettype($config) - ); - } - - foreach ($config as $k => $v) { - $this->config[strtolower($k)] = $v; - } - } - - /** - * Connect to the remote server. - * - * @param string $host - * @param int $port - * @param bool $secure - */ - public function connect($host, $port = 80, $secure = false) - { - if ($this->_nextRequestWillFail) { - $this->_nextRequestWillFail = false; - - throw new Zend_Http_Client_Adapter_Exception('Request failed'); - } - } - - /** - * Send request to the remote server. - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param string $http_ver - * @param array $headers - * @param string $body - * - * @return string Request as string - */ - public function write($method, $uri, $http_ver = '1.1', $headers = [], $body = '') - { - $host = $uri->getHost(); - $host = (strtolower($uri->getScheme()) == 'https' ? 'sslv2://' . $host : $host); - - // Build request headers - $path = $uri->getPath(); - if ($uri->getQuery()) { - $path .= '?' . $uri->getQuery(); - } - $request = "{$method} {$path} HTTP/{$http_ver}\r\n"; - foreach ($headers as $k => $v) { - if (is_string($k)) { - $v = ucfirst($k) . ": $v"; - } - $request .= "$v\r\n"; - } - - // Add the request body - $request .= "\r\n" . $body; - - // Do nothing - just return the request as string - - return $request; - } - - /** - * Return the response set in $this->setResponse(). - * - * @return string - */ - public function read() - { - if ($this->responseIndex >= count($this->responses)) { - $this->responseIndex = 0; - } - - return $this->responses[$this->responseIndex++]; - } - - /** - * Close the connection (dummy). - */ - public function close() - { - } - - /** - * Set the HTTP response(s) to be returned by this adapter. - * - * @param array|string|Zend_Http_Response $response - */ - public function setResponse($response) - { - if ($response instanceof Zend_Http_Response) { - $response = $response->asString("\r\n"); - } - - $this->responses = (array) $response; - $this->responseIndex = 0; - } - - /** - * Add another response to the response buffer. - * - * @param string Zend_Http_Response|$response - */ - public function addResponse($response) - { - if ($response instanceof Zend_Http_Response) { - $response = $response->asString("\r\n"); - } - - $this->responses[] = $response; - } - - /** - * Sets the position of the response buffer. Selects which - * response will be returned on the next call to read(). - * - * @param int $index - */ - public function setResponseIndex($index) - { - if ($index < 0 || $index >= count($this->responses)) { - throw new Zend_Http_Client_Adapter_Exception( - 'Index out of range of response buffer size'); - } - $this->responseIndex = $index; - } - - /** - * Retrieve the array of all configuration options. - * - * @return array - */ - public function getConfig() - { - return $this->config; - } -} diff --git a/library/Zend/Http/Client/Exception.php b/library/Zend/Http/Client/Exception.php deleted file mode 100644 index 52104601..00000000 --- a/library/Zend/Http/Client/Exception.php +++ /dev/null @@ -1,29 +0,0 @@ -name = (string) $name) { - throw new Zend_Http_Exception('Cookies must have a name'); - } - - if (!$this->domain = (string) $domain) { - throw new Zend_Http_Exception('Cookies must have a domain'); - } - - $this->value = (string) $value; - $this->expires = ($expires === null ? null : (int) $expires); - $this->path = ($path ?: '/'); - $this->secure = $secure; - } - - /** - * Get Cookie name. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Get cookie value. - * - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Get cookie domain. - * - * @return string - */ - public function getDomain() - { - return $this->domain; - } - - /** - * Get the cookie path. - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Get the expiry time of the cookie, or null if no expiry time is set. - * - * @return null|int - */ - public function getExpiryTime() - { - return $this->expires; - } - - /** - * Check whether the cookie should only be sent over secure connections. - * - * @return bool - */ - public function isSecure() - { - return $this->secure; - } - - /** - * Check whether the cookie has expired. - * - * Always returns false if the cookie is a session cookie (has no expiry time) - * - * @param int $now Timestamp to consider as "now" - * - * @return bool - */ - public function isExpired($now = null) - { - if ($now === null) { - $now = time(); - } - if (is_int($this->expires) && $this->expires < $now) { - return true; - } - - return false; - } - - /** - * Check whether the cookie is a session cookie (has no expiry time set). - * - * @return bool - */ - public function isSessionCookie() - { - return $this->expires === null; - } - - /** - * Checks whether the cookie should be sent or not in a specific scenario. - * - * @param string|Zend_Uri_Http $uri URI to check against (secure, domain, path) - * @param bool $matchSessionCookies Whether to send session cookies - * @param int $now Override the current time when checking for expiry time - * - * @return bool - */ - public function match($uri, $matchSessionCookies = true, $now = null) - { - if (is_string($uri)) { - $uri = Zend_Uri_Http::factory($uri); - } - - // Make sure we have a valid Zend_Uri_Http object - if (!($uri->valid() && ($uri->getScheme() == 'http' || $uri->getScheme() == 'https'))) { - throw new Zend_Http_Exception('Passed URI is not a valid HTTP or HTTPS URI'); - } - - // Check that the cookie is secure (if required) and not expired - if ($this->secure && $uri->getScheme() != 'https') { - return false; - } - if ($this->isExpired($now)) { - return false; - } - if ($this->isSessionCookie() && !$matchSessionCookies) { - return false; - } - - // Check if the domain matches - if (!self::matchCookieDomain($this->getDomain(), $uri->getHost())) { - return false; - } - - // Check that path matches using prefix match - if (!self::matchCookiePath($this->getPath(), $uri->getPath())) { - return false; - } - - // If we didn't die until now, return true. - return true; - } - - /** - * Get the cookie as a string, suitable for sending as a "Cookie" header in an - * HTTP request. - * - * @return string - */ - public function __toString() - { - if ($this->encodeValue) { - return $this->name . '=' . urlencode($this->value) . ';'; - } - - return $this->name . '=' . $this->value . ';'; - } - - /** - * Generate a new Cookie object from a cookie string - * (for example the value of the Set-Cookie HTTP header). - * - * @param string $cookieStr - * @param string|Zend_Uri_Http $refUri Reference URI for default values (domain, path) - * @param bool $encodeValue Whether or not the cookie's value should be - * passed through urlencode/urldecode - * - * @return Zend_Http_Cookie a new Zend_Http_Cookie object or false on failure - */ - public static function fromString($cookieStr, $refUri = null, $encodeValue = true) - { - // Set default values - if (is_string($refUri)) { - $refUri = Zend_Uri_Http::factory($refUri); - } - - $name = ''; - $value = ''; - $domain = ''; - $path = ''; - $expires = null; - $secure = false; - $parts = explode(';', $cookieStr); - - // If first part does not include '=', fail - if (strpos($parts[0], '=') === false) { - return false; - } - - // Get the name and value of the cookie - [$name, $value] = explode('=', trim(array_shift($parts)), 2); - $name = trim($name); - if ($encodeValue) { - $value = urldecode(trim($value)); - } - - // Set default domain and path - if ($refUri instanceof Zend_Uri_Http) { - $domain = $refUri->getHost(); - $path = $refUri->getPath(); - $path = substr($path, 0, strrpos($path, '/')); - } - - // Set other cookie parameters - foreach ($parts as $part) { - $part = trim($part); - if (strtolower($part) == 'secure') { - $secure = true; - - continue; - } - - $keyValue = explode('=', $part, 2); - if (count($keyValue) == 2) { - [$k, $v] = $keyValue; - switch (strtolower($k)) { - case 'expires': - if (($expires = strtotime($v)) === false) { - /** - * The expiration is past Tue, 19 Jan 2038 03:14:07 UTC - * the maximum for 32-bit signed integer. Zend_Date - * can get around that limit. - * - * @see Zend_Date - */ - $expireDate = new Zend_Date($v); - $expires = $expireDate->getTimestamp(); - } - - break; - - case 'path': - $path = $v; - - break; - - case 'domain': - $domain = $v; - - break; - - default: - break; - } - } - } - - if ($name !== '') { - $ret = new self($name, $value, $domain, $expires, $path, $secure); - $ret->encodeValue = ($encodeValue) ? true : false; - - return $ret; - } - - return false; - } - - /** - * Check if a cookie's domain matches a host name. - * - * Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching - * - * @param string $cookieDomain - * @param string $host - * - * @return bool - */ - public static function matchCookieDomain($cookieDomain, $host) - { - if (!$cookieDomain) { - throw new Zend_Http_Exception('$cookieDomain is expected to be a cookie domain'); - } - - if (!$host) { - throw new Zend_Http_Exception('$host is expected to be a host name'); - } - - $cookieDomain = strtolower($cookieDomain); - $host = strtolower($host); - - if ($cookieDomain[0] == '.') { - $cookieDomain = substr($cookieDomain, 1); - } - - // Check for either exact match or suffix match - return $cookieDomain == $host - || preg_match('/\.' . preg_quote($cookieDomain) . '$/', $host); - } - - /** - * Check if a cookie's path matches a URL path. - * - * Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching - * - * @param string $cookiePath - * @param string $path - * - * @return bool - */ - public static function matchCookiePath($cookiePath, $path) - { - if (!$cookiePath) { - throw new Zend_Http_Exception('$cookiePath is expected to be a cookie path'); - } - - if (!$path) { - throw new Zend_Http_Exception('$path is expected to be a host name'); - } - - return strpos($path, $cookiePath) === 0; - } -} diff --git a/library/Zend/Http/CookieJar.php b/library/Zend/Http/CookieJar.php deleted file mode 100644 index 74437fff..00000000 --- a/library/Zend/Http/CookieJar.php +++ /dev/null @@ -1,430 +0,0 @@ -getDomain(); - $path = $cookie->getPath(); - if (!isset($this->cookies[$domain])) { - $this->cookies[$domain] = []; - } - if (!isset($this->cookies[$domain][$path])) { - $this->cookies[$domain][$path] = []; - } - $this->cookies[$domain][$path][$cookie->getName()] = $cookie; - $this->_rawCookies[] = $cookie; - } else { - throw new Zend_Http_Exception('Supplient argument is not a valid cookie string or object'); - } - } - - /** - * Parse an HTTP response, adding all the cookies set in that response - * to the cookie jar. - * - * @param Zend_Http_Response $response - * @param string|Zend_Uri_Http $ref_uri Requested URI - * @param bool $encodeValue - */ - public function addCookiesFromResponse($response, $ref_uri, $encodeValue = true) - { - if (!$response instanceof Zend_Http_Response) { - throw new Zend_Http_Exception('$response is expected to be a Response object, ' - . gettype($response) . ' was passed'); - } - - $cookie_hdrs = $response->getHeader('Set-Cookie'); - - if (is_array($cookie_hdrs)) { - foreach ($cookie_hdrs as $cookie) { - $this->addCookie($cookie, $ref_uri, $encodeValue); - } - } elseif (is_string($cookie_hdrs)) { - $this->addCookie($cookie_hdrs, $ref_uri, $encodeValue); - } - } - - /** - * Get all cookies in the cookie jar as an array. - * - * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings - * - * @return array|string - */ - public function getAllCookies($ret_as = self::COOKIE_OBJECT) - { - $cookies = $this->_flattenCookiesArray($this->cookies, $ret_as); - if ($ret_as == self::COOKIE_STRING_CONCAT_STRICT) { - $cookies = rtrim(trim($cookies), ';'); - } - - return $cookies; - } - - /** - * Return an array of all cookies matching a specific request according to the request URI, - * whether session cookies should be sent or not, and the time to consider as "now" when - * checking cookie expiry time. - * - * @param string|Zend_Uri_Http $uri URI to check against (secure, domain, path) - * @param bool $matchSessionCookies Whether to send session cookies - * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings - * @param int $now Override the current time when checking for expiry time - * - * @return array|string - */ - public function getMatchingCookies($uri, $matchSessionCookies = true, - $ret_as = self::COOKIE_OBJECT, $now = null) - { - if (is_string($uri)) { - $uri = Zend_Uri::factory($uri); - } - if (!$uri instanceof Zend_Uri_Http) { - throw new Zend_Http_Exception('Invalid URI string or object passed'); - } - - // First, reduce the array of cookies to only those matching domain and path - $cookies = $this->_matchDomain($uri->getHost()); - $cookies = $this->_matchPath($cookies, $uri->getPath()); - $cookies = $this->_flattenCookiesArray($cookies, self::COOKIE_OBJECT); - - // Next, run Cookie->match on all cookies to check secure, time and session mathcing - $ret = []; - foreach ($cookies as $cookie) { - if ($cookie->match($uri, $matchSessionCookies, $now)) { - $ret[] = $cookie; - } - } - - // Now, use self::_flattenCookiesArray again - only to convert to the return format ;) - $ret = $this->_flattenCookiesArray($ret, $ret_as); - if ($ret_as == self::COOKIE_STRING_CONCAT_STRICT) { - $ret = rtrim(trim($ret), ';'); - } - - return $ret; - } - - /** - * Get a specific cookie according to a URI and name. - * - * @param string|Zend_Uri_Http $uri The uri (domain and path) to match - * @param string $cookie_name The cookie's name - * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings - * - * @return string|Zend_Http_Cookie - */ - public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT) - { - if (is_string($uri)) { - $uri = Zend_Uri::factory($uri); - } - - if (!$uri instanceof Zend_Uri_Http) { - throw new Zend_Http_Exception('Invalid URI specified'); - } - - // Get correct cookie path - $path = $uri->getPath(); - $path = substr($path, 0, strrpos($path, '/')); - if (!$path) { - $path = '/'; - } - - if (isset($this->cookies[$uri->getHost()][$path][$cookie_name])) { - $cookie = $this->cookies[$uri->getHost()][$path][$cookie_name]; - - switch ($ret_as) { - case self::COOKIE_OBJECT: - return $cookie; - - break; - - case self::COOKIE_STRING_CONCAT_STRICT: - return rtrim(trim($cookie->__toString()), ';'); - - break; - - case self::COOKIE_STRING_ARRAY: - case self::COOKIE_STRING_CONCAT: - return $cookie->__toString(); - - break; - - default: - throw new Zend_Http_Exception("Invalid value passed for \$ret_as: {$ret_as}"); - - break; - } - } else { - return false; - } - } - - /** - * Helper function to recursivly flatten an array. Shoud be used when exporting the - * cookies array (or parts of it). - * - * @param array|Zend_Http_Cookie $ptr - * @param int $ret_as What value to return - * - * @return array|string - */ - protected function _flattenCookiesArray($ptr, $ret_as = self::COOKIE_OBJECT) - { - if (is_array($ptr)) { - $ret = ($ret_as == self::COOKIE_STRING_CONCAT || $ret_as == self::COOKIE_STRING_CONCAT_STRICT) ? '' : []; - foreach ($ptr as $item) { - if ($ret_as == self::COOKIE_STRING_CONCAT_STRICT) { - $postfix_combine = (!is_array($item) ? ' ' : ''); - $ret .= $this->_flattenCookiesArray($item, $ret_as) . $postfix_combine; - } elseif ($ret_as == self::COOKIE_STRING_CONCAT) { - $ret .= $this->_flattenCookiesArray($item, $ret_as); - } else { - $ret = array_merge($ret, $this->_flattenCookiesArray($item, $ret_as)); - } - } - - return $ret; - } - if ($ptr instanceof Zend_Http_Cookie) { - switch ($ret_as) { - case self::COOKIE_STRING_ARRAY: - return [$ptr->__toString()]; - - break; - - case self::COOKIE_STRING_CONCAT_STRICT: - // break intentionally omitted - - case self::COOKIE_STRING_CONCAT: - return $ptr->__toString(); - - break; - - case self::COOKIE_OBJECT: - default: - return [$ptr]; - - break; - } - } - - return null; - } - - /** - * Return a subset of the cookies array matching a specific domain. - * - * @param string $domain - * - * @return array - */ - protected function _matchDomain($domain) - { - $ret = []; - - foreach (array_keys($this->cookies) as $cdom) { - if (Zend_Http_Cookie::matchCookieDomain($cdom, $domain)) { - $ret[$cdom] = $this->cookies[$cdom]; - } - } - - return $ret; - } - - /** - * Return a subset of a domain-matching cookies that also match a specified path. - * - * @param string $path - * @param mixed $domains - * - * @return array - */ - protected function _matchPath($domains, $path) - { - $ret = []; - - foreach ($domains as $dom => $paths_array) { - foreach (array_keys($paths_array) as $cpath) { - if (Zend_Http_Cookie::matchCookiePath($cpath, $path)) { - if (!isset($ret[$dom])) { - $ret[$dom] = []; - } - - $ret[$dom][$cpath] = $paths_array[$cpath]; - } - } - } - - return $ret; - } - - /** - * Create a new CookieJar object and automatically load into it all the - * cookies set in an Http_Response object. If $uri is set, it will be - * considered as the requested URI for setting default domain and path - * of the cookie. - * - * @param Zend_Http_Response $response HTTP Response object - * @param mixed $ref_uri - * - * @return Zend_Http_CookieJar - * - * @todo Add the $uri functionality. - */ - public static function fromResponse(Zend_Http_Response $response, $ref_uri) - { - $jar = new self(); - $jar->addCookiesFromResponse($response, $ref_uri); - - return $jar; - } - - /** - * Required by Countable interface. - */ - public function count(): int - { - return count($this->_rawCookies); - } - - /** - * Required by IteratorAggregate interface. - * - * @return ArrayIterator - */ - public function getIterator(): Traversable - { - return new ArrayIterator($this->_rawCookies); - } - - /** - * Tells if the jar is empty of any cookie. - * - * @return bool - */ - public function isEmpty() - { - return count($this) == 0; - } - - /** - * Empties the cookieJar of any cookie. - * - * @return Zend_Http_CookieJar - */ - public function reset() - { - $this->cookies = $this->_rawCookies = []; - - return $this; - } -} diff --git a/library/Zend/Http/Exception.php b/library/Zend/Http/Exception.php deleted file mode 100644 index 67da9797..00000000 --- a/library/Zend/Http/Exception.php +++ /dev/null @@ -1,29 +0,0 @@ - 254 - ) { - continue; - } - - $string .= $value[$i]; - } - - return $string; - } - - /** - * Validate a header value. - * - * Per RFC 7230, only VISIBLE ASCII characters, spaces, and horizontal - * tabs are allowed in values; only one whitespace character is allowed - * between visible characters. - * - * @see http://en.wikipedia.org/wiki/HTTP_response_splitting - * - * @param string $value - * - * @return bool - */ - public static function isValid($value) - { - $value = (string) $value; - $length = strlen($value); - for ($i = 0; $i < $length; ++$i) { - $ascii = ord($value[$i]); - - // Non-visible, non-whitespace characters - // 9 === horizontal tab - // 32-126, 128-254 === visible - // 127 === DEL - // 255 === null byte - if (($ascii < 32 && $ascii !== 9) - || $ascii === 127 - || $ascii > 254 - ) { - return false; - } - } - - return true; - } - - /** - * Assert a header value is valid. - * - * @param string $value - */ - public static function assertValid($value) - { - if (!self::isValid($value)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid header value'); - } - } -} diff --git a/library/Zend/Http/Header/SetCookie.php b/library/Zend/Http/Header/SetCookie.php deleted file mode 100644 index 7bba0891..00000000 --- a/library/Zend/Http/Header/SetCookie.php +++ /dev/null @@ -1,568 +0,0 @@ -getName() === null) { - $header->setName($headerKey); - $header->setValue($headerValue); - - continue; - } - - // Process the remanining elements - switch (str_replace(['-', '_'], '', strtolower($headerKey))) { - case 'expires' : $header->setExpires($headerValue); - - break; - case 'domain' : $header->setDomain($headerValue); - - break; - case 'path' : $header->setPath($headerValue); - - break; - case 'secure' : $header->setSecure(true); - - break; - case 'httponly': $header->setHttponly(true); - - break; - case 'version' : $header->setVersion((int) $headerValue); - - break; - case 'maxage' : $header->setMaxAge((int) $headerValue); - - break; - default: - // Intentionally omitted - } - } - $headers[] = $header; - } - - return count($headers) == 1 ? array_pop($headers) : $headers; - } - - /** - * Cookie object constructor. - * - * @todo Add validation of each one of the parameters (legal domain, etc.) - * - * @param string $name - * @param string $value - * @param int $expires - * @param string $path - * @param string $domain - * @param bool $secure - * @param bool $httponly - * @param string $maxAge - * @param int $version - * - * @return SetCookie - */ - public function __construct($name = null, $value = null, $expires = null, $path = null, $domain = null, $secure = false, $httponly = false, $maxAge = null, $version = null) - { - $this->type = 'Cookie'; - - if ($name) { - $this->setName($name); - } - - if ($value) { - $this->setValue($value); // in parent - } - - if ($version) { - $this->setVersion($version); - } - - if ($maxAge) { - $this->setMaxAge($maxAge); - } - - if ($domain) { - $this->setDomain($domain); - } - - if ($expires) { - $this->setExpires($expires); - } - - if ($path) { - $this->setPath($path); - } - - if ($secure) { - $this->setSecure($secure); - } - - if ($httponly) { - $this->setHttponly($httponly); - } - } - - /** - * @return string 'Set-Cookie' - */ - public function getFieldName() - { - return 'Set-Cookie'; - } - - /** - * @return string - */ - public function getFieldValue() - { - if ($this->getName() == '') { - throw new Zend_Http_Header_Exception_RuntimeException('A cookie name is required to generate a field value for this cookie'); - } - - $value = $this->getValue(); - if (strpos($value,'"') !== false) { - $value = '"' . urlencode(str_replace('"', '', $value)) . '"'; - } else { - $value = urlencode($value); - } - $fieldValue = $this->getName() . '=' . $value; - - $version = $this->getVersion(); - if ($version !== null) { - $fieldValue .= '; Version=' . $version; - } - - $maxAge = $this->getMaxAge(); - if ($maxAge !== null) { - $fieldValue .= '; Max-Age=' . $maxAge; - } - - $expires = $this->getExpires(); - if ($expires) { - $fieldValue .= '; Expires=' . $expires; - } - - $domain = $this->getDomain(); - if ($domain) { - $fieldValue .= '; Domain=' . $domain; - } - - $path = $this->getPath(); - if ($path) { - $fieldValue .= '; Path=' . $path; - } - - if ($this->isSecure()) { - $fieldValue .= '; Secure'; - } - - if ($this->isHttponly()) { - $fieldValue .= '; HttpOnly'; - } - - return $fieldValue; - } - - /** - * @param string $name - * - * @return SetCookie - */ - public function setName($name) - { - if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException("Cookie name cannot contain these characters: =,; \\t\\r\\n\\013\\014 ({$name})"); - } - - $this->name = $name; - - return $this; - } - - /** - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * @param string $value - */ - public function setValue($value) - { - Zend_Http_Header_HeaderValue::assertValid($value); - $this->value = $value; - - return $this; - } - - /** - * @return string - */ - public function getValue() - { - return $this->value; - } - - /** - * Set version. - * - * @param int $version - */ - public function setVersion($version) - { - if (!is_int($version)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid Version number specified'); - } - $this->version = $version; - } - - /** - * Get version. - * - * @return int - */ - public function getVersion() - { - return $this->version; - } - - /** - * Set Max-Age. - * - * @param int $maxAge - */ - public function setMaxAge($maxAge) - { - if (!is_int($maxAge) || ($maxAge < 0)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid Max-Age number specified'); - } - $this->maxAge = $maxAge; - } - - /** - * Get Max-Age. - * - * @return int - */ - public function getMaxAge() - { - return $this->maxAge; - } - - /** - * @param int $expires - * - * @return SetCookie - */ - public function setExpires($expires) - { - if (!empty($expires)) { - if (is_string($expires)) { - $expires = strtotime($expires); - } elseif (!is_int($expires)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid expires time specified'); - } - $this->expires = (int) $expires; - } - - return $this; - } - - /** - * @param mixed $inSeconds - * - * @return int - */ - public function getExpires($inSeconds = false) - { - if ($this->expires == null) { - return; - } - if ($inSeconds) { - return $this->expires; - } - - return gmdate('D, d-M-Y H:i:s', $this->expires) . ' GMT'; - } - - /** - * @param string $domain - */ - public function setDomain($domain) - { - Zend_Http_Header_HeaderValue::assertValid($domain); - $this->domain = $domain; - - return $this; - } - - /** - * @return string - */ - public function getDomain() - { - return $this->domain; - } - - /** - * @param string $path - */ - public function setPath($path) - { - Zend_Http_Header_HeaderValue::assertValid($path); - $this->path = $path; - - return $this; - } - - /** - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * @param bool $secure - */ - public function setSecure($secure) - { - $this->secure = $secure; - - return $this; - } - - /** - * @return bool - */ - public function isSecure() - { - return $this->secure; - } - - /** - * @param bool $httponly - */ - public function setHttponly($httponly) - { - $this->httponly = $httponly; - - return $this; - } - - /** - * @return bool - */ - public function isHttponly() - { - return $this->httponly; - } - - /** - * Check whether the cookie has expired. - * - * Always returns false if the cookie is a session cookie (has no expiry time) - * - * @param int $now Timestamp to consider as "now" - * - * @return bool - */ - public function isExpired($now = null) - { - if ($now === null) { - $now = time(); - } - - if (is_int($this->expires) && $this->expires < $now) { - return true; - } - - return false; - } - - /** - * Check whether the cookie is a session cookie (has no expiry time set). - * - * @return bool - */ - public function isSessionCookie() - { - return $this->expires === null; - } - - public function isValidForRequest($requestDomain, $path, $isSecure = false) - { - if ($this->getDomain() && (strrpos($requestDomain, $this->getDomain()) !== false)) { - return false; - } - - if ($this->getPath() && (strpos($path, $this->getPath()) !== 0)) { - return false; - } - - if ($this->secure && $this->isSecure() !== $isSecure) { - return false; - } - - return true; - } - - public function toString() - { - return $this->getFieldName() . ': ' . $this->getFieldValue(); - } - - public function __toString() - { - return $this->toString(); - } - - public function toStringMultipleHeaders(array $headers) - { - $headerLine = $this->toString(); - // @var $header SetCookie - foreach ($headers as $header) { - if (!$header instanceof Zend_Http_Header_SetCookie) { - throw new Zend_Http_Header_Exception_RuntimeException( - 'The SetCookie multiple header implementation can only accept an array of SetCookie headers' - ); - } - $headerLine .= ', ' . $header->getFieldValue(); - } - - return $headerLine; - } -} diff --git a/library/Zend/Http/Response.php b/library/Zend/Http/Response.php deleted file mode 100644 index 426932d8..00000000 --- a/library/Zend/Http/Response.php +++ /dev/null @@ -1,706 +0,0 @@ - 'Continue', - 101 => 'Switching Protocols', - - // Success 2xx - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - - // Redirection 3xx - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', // 1.1 - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - // 306 is deprecated but reserved - 307 => 'Temporary Redirect', - - // Client Error 4xx - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - - // Server Error 5xx - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported', - 509 => 'Bandwidth Limit Exceeded', - ]; - - /** - * The HTTP version (1.0, 1.1). - * - * @var string - */ - protected $version; - - /** - * The HTTP response code. - * - * @var int - */ - protected $code; - - /** - * The HTTP response code as string - * (e.g. 'Not Found' for 404 or 'Internal Server Error' for 500). - * - * @var string - */ - protected $message; - - /** - * The HTTP response headers array. - * - * @var array - */ - protected $headers = []; - - /** - * The HTTP response body. - * - * @var string - */ - protected $body; - - /** - * HTTP response constructor. - * - * In most cases, you would use Zend_Http_Response::fromString to parse an HTTP - * response string and create a new Zend_Http_Response object. - * - * NOTE: The constructor no longer accepts nulls or empty values for the code and - * headers and will throw an exception if the passed values do not form a valid HTTP - * responses. - * - * If no message is passed, the message will be guessed according to the response code. - * - * @param int $code Response code (200, 404, ...) - * @param array $headers Headers array - * @param string $body Response body - * @param string $version HTTP version - * @param string $message Response code as text - */ - public function __construct($code, array $headers, $body = null, $version = '1.1', $message = null) - { - // Make sure the response code is valid and set it - if (self::responseCodeAsText($code) === null) { - throw new Zend_Http_Exception("{$code} is not a valid HTTP response code"); - } - - $this->code = $code; - - foreach ($headers as $name => $value) { - if (is_int($name)) { - $header = explode(':', $value, 2); - if (count($header) != 2) { - throw new Zend_Http_Exception("'{$value}' is not a valid HTTP header"); - } - - $name = trim($header[0]); - $value = trim($header[1]); - } - - $this->headers[ucwords(strtolower($name))] = $value; - } - - // Set the body - $this->body = $body; - - // Set the HTTP version - if (!preg_match('|^\d\.\d$|', $version)) { - throw new Zend_Http_Exception("Invalid HTTP response version: $version"); - } - - $this->version = $version; - - // If we got the response message, set it. Else, set it according to - // the response code - if (is_string($message)) { - $this->message = $message; - } else { - $this->message = self::responseCodeAsText($code); - } - } - - /** - * Check whether the response is an error. - * - * @return bool - */ - public function isError() - { - $restype = floor($this->code / 100); - if ($restype == 4 || $restype == 5) { - return true; - } - - return false; - } - - /** - * Check whether the response in successful. - * - * @return bool - */ - public function isSuccessful() - { - $restype = floor($this->code / 100); - if ($restype == 2 || $restype == 1) { // Shouldn't 3xx count as success as well ??? - return true; - } - - return false; - } - - /** - * Check whether the response is a redirection. - * - * @return bool - */ - public function isRedirect() - { - $restype = floor($this->code / 100); - if ($restype == 3) { - return true; - } - - return false; - } - - /** - * Get the response body as string. - * - * This method returns the body of the HTTP response (the content), as it - * should be in it's readable version - that is, after decoding it (if it - * was decoded), deflating it (if it was gzip compressed), etc. - * - * If you want to get the raw body (as transfered on wire) use - * $this->getRawBody() instead. - * - * @return string - */ - public function getBody() - { - $body = ''; - - // Decode the body if it was transfer-encoded - switch (strtolower($this->getHeader('transfer-encoding') ?? '')) { - // Handle chunked body - case 'chunked': - $body = self::decodeChunkedBody($this->body); - - break; - - // No transfer encoding, or unknown encoding extension: - // return body as is - default: - $body = $this->body; - - break; - } - - // Decode any content-encoding (gzip or deflate) if needed - switch (strtolower($this->getHeader('content-encoding') ?? '')) { - // Handle gzip encoding - case 'gzip': - $body = self::decodeGzip($body); - - break; - - // Handle deflate encoding - case 'deflate': - $body = self::decodeDeflate($body); - - break; - - default: - break; - } - - return $body; - } - - /** - * Get the raw response body (as transfered "on wire") as string. - * - * If the body is encoded (with Transfer-Encoding, not content-encoding - - * IE "chunked" body), gzip compressed, etc. it will not be decoded. - * - * @return string - */ - public function getRawBody() - { - return $this->body; - } - - /** - * Get the HTTP version of the response. - * - * @return string - */ - public function getVersion() - { - return $this->version; - } - - /** - * Get the HTTP response status code. - * - * @return int - */ - public function getStatus() - { - return $this->code; - } - - /** - * Return a message describing the HTTP response code - * (Eg. "OK", "Not Found", "Moved Permanently"). - * - * @return string - */ - public function getMessage() - { - return $this->message; - } - - /** - * Get the response headers. - * - * @return array - */ - public function getHeaders() - { - return $this->headers; - } - - /** - * Get a specific header as string, or null if it is not set. - * - * @param string$header - * - * @return null|array|string - */ - public function getHeader($header) - { - $header = ucwords(strtolower($header)); - if (!is_string($header) || !isset($this->headers[$header])) { - return null; - } - - return $this->headers[$header]; - } - - /** - * Get all headers as string. - * - * @param bool $status_line Whether to return the first status line (IE "HTTP 200 OK") - * @param string $br Line breaks (eg. "\n", "\r\n", "
") - * - * @return string - */ - public function getHeadersAsString($status_line = true, $br = "\n") - { - $str = ''; - - if ($status_line) { - $str = "HTTP/{$this->version} {$this->code} {$this->message}{$br}"; - } - - // Iterate over the headers and stringify them - foreach ($this->headers as $name => $value) { - if (is_string($value)) { - $str .= "{$name}: {$value}{$br}"; - } elseif (is_array($value)) { - foreach ($value as $subval) { - $str .= "{$name}: {$subval}{$br}"; - } - } - } - - return $str; - } - - /** - * Get the entire response as string. - * - * @param string $br Line breaks (eg. "\n", "\r\n", "
") - * - * @return string - */ - public function asString($br = "\r\n") - { - return $this->getHeadersAsString(true, $br) . $br . $this->getRawBody(); - } - - /** - * Implements magic __toString(). - * - * @return string - */ - public function __toString() - { - return $this->asString(); - } - - /** - * A convenience function that returns a text representation of - * HTTP response codes. Returns 'Unknown' for unknown codes. - * Returns array of all codes, if $code is not specified. - * - * Conforms to HTTP/1.1 as defined in RFC 2616 (except for 'Unknown') - * See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10 for reference - * - * @param int $code HTTP response code - * @param bool $http11 Use HTTP version 1.1 - * - * @return string - */ - public static function responseCodeAsText($code = null, $http11 = true) - { - $messages = self::$messages; - if (!$http11) { - $messages[302] = 'Moved Temporarily'; - } - - if ($code === null) { - return $messages; - } - if (isset($messages[$code])) { - return $messages[$code]; - } - - return 'Unknown'; - } - - /** - * Extract the response code from a response string. - * - * @param string $response_str - * - * @return int - */ - public static function extractCode($response_str) - { - preg_match("|^HTTP/[\d\.x]+ (\d+)|", $response_str, $m); - - if (isset($m[1])) { - return (int) $m[1]; - } - - return false; - } - - /** - * Extract the HTTP message from a response. - * - * @param string $response_str - * - * @return string - */ - public static function extractMessage($response_str) - { - preg_match("|^HTTP/[\d\.x]+ \d+ ([^\r\n]+)|", $response_str, $m); - - if (isset($m[1])) { - return $m[1]; - } - - return false; - } - - /** - * Extract the HTTP version from a response. - * - * @param string $response_str - * - * @return string - */ - public static function extractVersion($response_str) - { - preg_match("|^HTTP/([\d\.x]+) \d+|", $response_str, $m); - - if (isset($m[1])) { - return $m[1]; - } - - return false; - } - - /** - * Extract the headers from a response string. - * - * @param string $response_str - * - * @return array - */ - public static function extractHeaders($response_str) - { - $headers = []; - - // First, split body and headers. Headers are separated from the - // message at exactly the sequence "\r\n\r\n" - $parts = preg_split('|(?:\r\n){2}|m', $response_str, 2); - if (!$parts[0]) { - return $headers; - } - - // Split headers part to lines; "\r\n" is the only valid line separator. - $lines = explode("\r\n", $parts[0]); - unset($parts); - $last_header = null; - - foreach ($lines as $index => $line) { - if ($index === 0 && preg_match('#^HTTP/\d+(?:\.\d+) [1-5]\d+#', $line)) { - // Status line; ignore - continue; - } - - if ($line == '') { - // Done processing headers - break; - } - - // Locate headers like 'Location: ...' and 'Location:...' (note the missing space) - if (preg_match("|^([a-zA-Z0-9\'`#$%&*+.^_\|\~!-]+):\s*(.*)|s", $line, $m)) { - unset($last_header); - $h_name = strtolower($m[1]); - $h_value = $m[2]; - Zend_Http_Header_HeaderValue::assertValid($h_value); - - if (isset($headers[$h_name])) { - if (!is_array($headers[$h_name])) { - $headers[$h_name] = [$headers[$h_name]]; - } - - $headers[$h_name][] = ltrim($h_value); - $last_header = $h_name; - - continue; - } - - $headers[$h_name] = ltrim($h_value); - $last_header = $h_name; - - continue; - } - - // Identify header continuations - if (preg_match("|^[ \t](.+)$|s", $line, $m) && $last_header !== null) { - $h_value = trim($m[1]); - if (is_array($headers[$last_header])) { - $last_header_key = array_key_last($headers[$last_header]); - - $h_value = $headers[$last_header][$last_header_key] . $h_value; - Zend_Http_Header_HeaderValue::assertValid($h_value); - - $headers[$last_header][$last_header_key] = $h_value; - - continue; - } - - $h_value = $headers[$last_header] . $h_value; - Zend_Http_Header_HeaderValue::assertValid($h_value); - - $headers[$last_header] = $h_value; - - continue; - } - - // Anything else is an error condition - throw new Zend_Http_Exception('Invalid header line detected'); - } - - return $headers; - } - - /** - * Extract the body from a response string. - * - * @param string $response_str - * - * @return string - */ - public static function extractBody($response_str) - { - $parts = preg_split('|(?:\r\n){2}|m', $response_str, 2); - if (isset($parts[1])) { - return $parts[1]; - } - - return ''; - } - - /** - * Decode a "chunked" transfer-encoded body and return the decoded text. - * - * @param string $body - * - * @return string - */ - public static function decodeChunkedBody($body) - { - $decBody = ''; - - // If mbstring overloads substr and strlen functions, we have to - // override it's internal encoding - if (function_exists('mb_internal_encoding') - && ((int) ini_get('mbstring.func_overload')) & 2) { - $mbIntEnc = mb_internal_encoding(); - mb_internal_encoding('ASCII'); - } - - while (trim($body)) { - if (!preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) { - throw new Zend_Http_Exception("Error parsing body - doesn't seem to be a chunked message"); - } - - $length = hexdec(trim($m[1])); - $cut = strlen($m[0]); - $decBody .= substr($body, $cut, $length); - $body = substr($body, $cut + $length + 2); - } - - if (isset($mbIntEnc)) { - mb_internal_encoding($mbIntEnc); - } - - return $decBody; - } - - /** - * Decode a gzip encoded message (when Content-encoding = gzip). - * - * Currently requires PHP with zlib support - * - * @param string $body - * - * @return string - */ - public static function decodeGzip($body) - { - if (!function_exists('gzinflate')) { - throw new Zend_Http_Exception( - 'zlib extension is required in order to decode "gzip" encoding' - ); - } - - return gzinflate(substr($body, 10)); - } - - /** - * Decode a zlib deflated message (when Content-encoding = deflate). - * - * Currently requires PHP with zlib support - * - * @param string $body - * - * @return string - */ - public static function decodeDeflate($body) - { - if (!function_exists('gzuncompress')) { - throw new Zend_Http_Exception( - 'zlib extension is required in order to decode "deflate" encoding' - ); - } - - /** - * Some servers (IIS ?) send a broken deflate response, without the - * RFC-required zlib header. - * - * We try to detect the zlib header, and if it does not exsit we - * teat the body is plain DEFLATE content. - * - * This method was adapted from PEAR HTTP_Request2 by (c) Alexey Borzov - * - * @see http://framework.zend.com/issues/browse/ZF-6040 - */ - $zlibHeader = unpack('n', substr($body, 0, 2)); - if ($zlibHeader[1] % 31 == 0 && ord($body[0]) == 0x78 && in_array(ord($body[1]), [0x01, 0x5E, 0x9C, 0xDA])) { - return gzuncompress($body); - } - - return gzinflate($body); - } - - /** - * Create a new Zend_Http_Response object from a string. - * - * @param string $response_str - * - * @return Zend_Http_Response - */ - public static function fromString($response_str) - { - $code = self::extractCode($response_str); - $headers = self::extractHeaders($response_str); - $body = self::extractBody($response_str); - $version = self::extractVersion($response_str); - $message = self::extractMessage($response_str); - - return new Zend_Http_Response($code, $headers, $body, $version, $message); - } -} diff --git a/library/Zend/Http/Response/Stream.php b/library/Zend/Http/Response/Stream.php deleted file mode 100755 index 47b60678..00000000 --- a/library/Zend/Http/Response/Stream.php +++ /dev/null @@ -1,238 +0,0 @@ -stream; - } - - /** - * Set the response stream. - * - * @param resourse $stream - * - * @return Zend_Http_Response_Stream - */ - public function setStream($stream) - { - $this->stream = $stream; - - return $this; - } - - /** - * Get the cleanup trigger. - * - * @return bool - */ - public function getCleanup() - { - return $this->_cleanup; - } - - /** - * Set the cleanup trigger. - * - * @param bool $cleanup Set cleanup trigger - */ - public function setCleanup($cleanup = true) - { - $this->_cleanup = $cleanup; - } - - /** - * Get file name associated with the stream. - * - * @return string - */ - public function getStreamName() - { - return $this->stream_name; - } - - /** - * Set file name associated with the stream. - * - * @param string $stream_name Name to set - * - * @return Zend_Http_Response_Stream - */ - public function setStreamName($stream_name) - { - $this->stream_name = $stream_name; - - return $this; - } - - /** - * HTTP response constructor. - * - * In most cases, you would use Zend_Http_Response::fromString to parse an HTTP - * response string and create a new Zend_Http_Response object. - * - * NOTE: The constructor no longer accepts nulls or empty values for the code and - * headers and will throw an exception if the passed values do not form a valid HTTP - * responses. - * - * If no message is passed, the message will be guessed according to the response code. - * - * @param int $code Response code (200, 404, ...) - * @param array $headers Headers array - * @param string $body Response body - * @param string $version HTTP version - * @param string $message Response code as text - */ - public function __construct($code, $headers, $body = null, $version = '1.1', $message = null) - { - if (is_resource($body)) { - $this->setStream($body); - $body = ''; - } - parent::__construct($code, $headers, $body, $version, $message); - } - - /** - * Create a new Zend_Http_Response_Stream object from a string. - * - * @param string $response_str - * @param resource $stream - * - * @return Zend_Http_Response_Stream - */ - public static function fromStream($response_str, $stream) - { - $code = self::extractCode($response_str); - $headers = self::extractHeaders($response_str); - $version = self::extractVersion($response_str); - $message = self::extractMessage($response_str); - - return new self($code, $headers, $stream, $version, $message); - } - - /** - * Get the response body as string. - * - * This method returns the body of the HTTP response (the content), as it - * should be in it's readable version - that is, after decoding it (if it - * was decoded), deflating it (if it was gzip compressed), etc. - * - * If you want to get the raw body (as transfered on wire) use - * $this->getRawBody() instead. - * - * @return string - */ - public function getBody() - { - if ($this->stream != null) { - $this->readStream(); - } - - return parent::getBody(); - } - - /** - * Get the raw response body (as transfered "on wire") as string. - * - * If the body is encoded (with Transfer-Encoding, not content-encoding - - * IE "chunked" body), gzip compressed, etc. it will not be decoded. - * - * @return string - */ - public function getRawBody() - { - if ($this->stream) { - $this->readStream(); - } - - return $this->body; - } - - /** - * Read stream content and return it as string. - * - * Function reads the remainder of the body from the stream and closes the stream. - * - * @return string - */ - protected function readStream() - { - $headers = []; - if (!is_resource($this->stream)) { - return ''; - } - - if (isset($headers['content-length'])) { - $this->body = stream_get_contents($this->stream, $headers['content-length']); - } else { - $this->body = stream_get_contents($this->stream); - } - fclose($this->stream); - $this->stream = null; - } - - public function __destruct() - { - if (is_resource($this->stream)) { - fclose($this->stream); - $this->stream = null; - } - if ($this->_cleanup) { - @unlink($this->stream_name); - } - } -} diff --git a/library/Zend/Http/UserAgent.php b/library/Zend/Http/UserAgent.php deleted file mode 100644 index 67cebc34..00000000 --- a/library/Zend/Http/UserAgent.php +++ /dev/null @@ -1,871 +0,0 @@ - self::DEFAULT_IDENTIFICATION_SEQUENCE, - 'storage' => [ - 'adapter' => self::DEFAULT_PERSISTENT_STORAGE_ADAPTER, - ], - ]; - - /** - * Identified device. - * - * @var Zend_Http_UserAgent_Device - */ - protected $_device; - - /** - * Whether or not this instance is immutable. - * - * If true, none of the following may be modified: - * - $_server - * - $_browserType - * - User-Agent (defined in $_server) - * - HTTP Accept value (defined in $_server) - * - $_storage - * - * @var bool - */ - protected $_immutable = false; - - /** - * Plugin loaders. - * - * @var array - */ - protected $_loaders = []; - - /** - * Valid plugin loader types. - * - * @var array - */ - protected $_loaderTypes = ['storage', 'device']; - - /** - * Trace of items matched to identify the browser type. - * - * @var array - */ - protected $_matchLog = []; - - /** - * Server variable. - * - * @var array - */ - protected $_server; - - /** - * Persistent storage handler. - * - * @var Zend_Http_UserAgent_Storage - */ - protected $_storage; - - /** - * Constructor. - * - * @param null|array|ArrayAccess|Zend_Config $options - */ - public function __construct($options = null) - { - if (null !== $options) { - $this->setOptions($options); - } - } - - /** - * Serialized representation of the object. - * - * @return string - */ - public function serialize() - { - $spec = $this->__serialize(); - - return serialize($spec); - } - - public function __serialize(): array - { - $device = $this->getDevice(); - - return [ - 'browser_type' => $this->_browserType, - 'config' => $this->_config, - 'device_class' => get_class($device), - 'device' => $device->serialize(), - 'user_agent' => $this->getServerValue('http_user_agent'), - 'http_accept' => $this->getServerValue('http_accept'), - ]; - } - - /** - * Unserialize a previous representation of the object. - * - * @param string $serialized - */ - public function unserialize($serialized) - { - $spec = unserialize($serialized); - $this->__unserialize($spec); - } - - public function __unserialize(array $spec): void - { - $this->setOptions($spec); - - // Determine device class and ensure the class is loaded - $deviceClass = $spec['device_class']; - if (!class_exists($deviceClass)) { - $this->_getUserAgentDevice($this->getBrowserType()); - } - - // Get device specification and instantiate - $deviceSpec = unserialize($spec['device']); - $deviceSpec['_config'] = $this->getConfig(); - $deviceSpec['_server'] = $this->getServer(); - $this->_device = new $deviceClass($deviceSpec); - } - - /** - * Configure instance. - * - * @param array|ArrayAccess|Zend_Config $options - * - * @return Zend_Http_UserAgent - */ - public function setOptions($options) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - - if (!is_array($options) - && !$options instanceof ArrayAccess - && !$options instanceof Traversable - ) { - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Invalid argument; expected array, Zend_Config object, or object implementing ArrayAccess and Traversable; received %s', - (is_object($options) ? get_class($options) : gettype($options)) - )); - } - - // Set $_SERVER first - if (isset($options['server'])) { - $this->setServer($options['server']); - unset($options['server']); - } - - // Get plugin loaders sorted - if (isset($options['plugin_loader'])) { - $plConfig = $options['plugin_loader']; - if (is_iterable($plConfig)) { - foreach ($plConfig as $type => $class) { - $this->setPluginLoader($type, $class); - } - } - unset($plConfig, $options['plugin_loader']); - } - - // And then loop through the remaining options - $config = []; - foreach ($options as $key => $value) { - switch (strtolower($key)) { - case 'browser_type': - $this->setBrowserType($value); - - break; - case 'http_accept': - $this->setHttpAccept($value); - - break; - case 'user_agent': - $this->setUserAgent($value); - - break; - default: - // Cache remaining options for $_config - $config[$key] = $value; - - break; - } - } - $this->setConfig($config); - - return $this; - } - - /** - * Comparison of the UserAgent chain and browser signatures. - * - * The comparison is case-insensitive : the browser signatures must be in lower - * case - * - * @param string $deviceClass Name of class against which a match will be attempted - * - * @return bool - */ - protected function _match($deviceClass) - { - // Validate device class - $r = new ReflectionClass($deviceClass); - if (!$r->implementsInterface(\Zend_Http_UserAgent_Device::class)) { - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Invalid device class provided ("%s"); must implement Zend_Http_UserAgent_Device', - $deviceClass - )); - } - - $userAgent = $this->getUserAgent(); - - // Call match method on device class - return call_user_func( - [$deviceClass, 'match'], - $userAgent, - $this->getServer() - ); - } - - /** - * Loads class for a user agent device. - * - * @param string $browserType Browser type - * - * @return string - */ - protected function _getUserAgentDevice($browserType) - { - $browserType = strtolower($browserType); - if (isset($this->_browserTypeClass[$browserType])) { - return $this->_browserTypeClass[$browserType]; - } - - if (isset($this->_config[$browserType], $this->_config[$browserType]['device']) - - ) { - $deviceConfig = $this->_config[$browserType]['device']; - if (is_array($deviceConfig) && isset($deviceConfig['classname'])) { - $device = (string) $deviceConfig['classname']; - if (!class_exists($device)) { - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Invalid classname "%s" provided in device configuration for browser type "%s"', - $device, - $browserType - )); - } - } elseif (is_array($deviceConfig) && isset($deviceConfig['path'])) { - $loader = $this->getPluginLoader('device'); - $path = $deviceConfig['path']; - $prefix = $deviceConfig['prefix'] ?? \Zend_Http_UserAgent::class; - $loader->addPrefixPath($prefix, $path); - - $device = $loader->load($browserType); - } else { - $loader = $this->getPluginLoader('device'); - $device = $loader->load($browserType); - } - } else { - $loader = $this->getPluginLoader('device'); - $device = $loader->load($browserType); - } - - $this->_browserTypeClass[$browserType] = $device; - - return $device; - } - - /** - * Returns the User Agent value. - * - * If $userAgent param is null, the value of $_server['HTTP_USER_AGENT'] is - * returned. - * - * @return string - */ - public function getUserAgent() - { - if (null === ($ua = $this->getServerValue('http_user_agent'))) { - $ua = self::DEFAULT_HTTP_USER_AGENT; - $this->setUserAgent($ua); - } - - return $ua; - } - - /** - * Force or replace the UA chain in $_server variable. - * - * @param string $userAgent Forced UserAgent chain - * - * @return Zend_Http_UserAgent - */ - public function setUserAgent($userAgent) - { - $this->setServerValue('http_user_agent', $userAgent); - - return $this; - } - - /** - * Returns the HTTP Accept server param. - * - * @param string $httpAccept (option) forced HTTP Accept chain - * - * @return string - */ - public function getHttpAccept($httpAccept = null) - { - if (null === ($accept = $this->getServerValue('http_accept'))) { - $accept = self::DEFAULT_HTTP_ACCEPT; - $this->setHttpAccept($accept); - } - - return $accept; - } - - /** - * Force or replace the HTTP_ACCEPT chain in self::$_server variable. - * - * @param string $httpAccept Forced HTTP Accept chain - * - * @return Zend_Http_UserAgent - */ - public function setHttpAccept($httpAccept) - { - $this->setServerValue('http_accept', $httpAccept); - - return $this; - } - - /** - * Returns the persistent storage handler. - * - * Session storage is used by default unless a different storage adapter - * has been set via the "persistent_storage_adapter" key. That key should - * contain either a fully qualified class name, or a short name that - * resolves via the plugin loader. - * - * @param string $browser Browser identifier (User Agent chain) - * - * @return Zend_Http_UserAgent_Storage - */ - public function getStorage($browser = null) - { - if (null === $browser) { - $browser = $this->getUserAgent(); - } - if (null === $this->_storage) { - $config = $this->_config['storage']; - $adapter = $config['adapter']; - if (!class_exists($adapter)) { - $loader = $this->getPluginLoader('storage'); - $adapter = $loader->load($adapter); - $loader = $this->getPluginLoader('storage'); - } - $options = ['browser_type' => $browser]; - if (isset($config['options'])) { - $options = array_merge($options, $config['options']); - } - $this->setStorage(new $adapter($options)); - } - - return $this->_storage; - } - - /** - * Sets the persistent storage handler. - * - * @return Zend_Http_UserAgent - */ - public function setStorage(Zend_Http_UserAgent_Storage $storage) - { - if ($this->_immutable) { - throw new Zend_Http_UserAgent_Exception( - 'The User-Agent device object has already been retrieved; the storage object is now immutable' - ); - } - - $this->_storage = $storage; - - return $this; - } - - /** - * Clean the persistent storage. - * - * @param string $browser Browser identifier (User Agent chain) - */ - public function clearStorage($browser = null) - { - $this->getStorage($browser)->clear(); - } - - /** - * Get user configuration. - * - * @return array - */ - public function getConfig() - { - return $this->_config; - } - - /** - * Config parameters is an Array or a Zend_Config object. - * - * The allowed parameters are : - * - the identification sequence (can be empty) => desktop browser type is the - * default browser type returned - * $config['identification_sequence'] : ',' separated browser types - * - the persistent storage adapter - * $config['persistent_storage_adapter'] = "Session" or "NonPersistent" - * - to add or replace a browser type device - * $config[(type)]['device']['path'] - * $config[(type)]['device']['classname'] - * - to add or replace a browser type features adapter - * $config[(type)]['features']['path'] - * $config[(type)]['features']['classname'] - * - * @param mixed $config (option) Config array - * - * @return Zend_Http_UserAgent - */ - public function setConfig($config = []) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } - - // Verify that Config parameters are in an array. - if (!is_array($config) && !$config instanceof Traversable) { - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Config parameters must be in an array or a Traversable object; received "%s"', - (is_object($config) ? get_class($config) : gettype($config)) - )); - } - - if ($config instanceof Traversable) { - $tmp = []; - foreach ($config as $key => $value) { - $tmp[$key] = $value; - } - $config = $tmp; - unset($tmp); - } - - $this->_config = array_merge($this->_config, $config); - - return $this; - } - - /** - * Returns the device object. - * - * This is the object that will contain the various discovered device - * capabilities. - * - * @return Zend_Http_UserAgent_Device $device - */ - public function getDevice() - { - if (null !== $this->_device) { - return $this->_device; - } - - $userAgent = $this->getUserAgent(); - - // search an existing identification in the session - $storage = $this->getStorage($userAgent); - - if (!$storage->isEmpty()) { - // If the user agent and features are already existing, the - // Zend_Http_UserAgent object is serialized in the session - $object = $storage->read(); - $this->unserialize($object); - } else { - // Otherwise, the identification is made and stored in the session. - // Find the browser type: - $this->setBrowserType($this->_matchUserAgent()); - $this->_createDevice(); - - // put the result in storage: - $this->getStorage($userAgent) - ->write($this->serialize()); - } - - // Mark the object as immutable - $this->_immutable = true; - - // Return the device instance - return $this->_device; - } - - /** - * Retrieve the browser type. - * - * @return string $browserType - */ - public function getBrowserType() - { - return $this->_browserType; - } - - /** - * Set the browser "type". - * - * @param string $browserType - * - * @return Zend_Http_UserAgent - */ - public function setBrowserType($browserType) - { - if ($this->_immutable) { - throw new Zend_Http_UserAgent_Exception( - 'The User-Agent device object has already been retrieved; the browser type is now immutable' - ); - } - - $this->_browserType = $browserType; - - return $this; - } - - /** - * Retrieve the "$_SERVER" array. - * - * Basically, the $_SERVER array or an equivalent container storing the - * data that will be introspected. - * - * If the value has not been previously set, it sets itself from the - * $_SERVER superglobal. - * - * @return array - */ - public function getServer() - { - if (null === $this->_server) { - $this->setServer($_SERVER); - } - - return $this->_server; - } - - /** - * Set the "$_SERVER" array. - * - * Basically, the $_SERVER array or an equivalent container storing the - * data that will be introspected. - * - * @param array|ArrayAccess $server - */ - public function setServer($server) - { - if ($this->_immutable) { - throw new Zend_Http_UserAgent_Exception( - 'The User-Agent device object has already been retrieved; the server array is now immutable' - ); - } - - if (!is_array($server) && !$server instanceof Traversable) { - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Expected an array or object implementing Traversable; received %s', - (is_object($server) ? get_class($server) : gettype($server)) - )); - } - - // Get an array if we don't have one - if ($server instanceof ArrayObject) { - $server = $server->getArrayCopy(); - } elseif ($server instanceof Traversable) { - $tmp = []; - foreach ($server as $key => $value) { - $tmp[$key] = $value; - } - $server = $tmp; - unset($tmp); - } - - // Normalize key case - $server = array_change_key_case($server, CASE_LOWER); - - $this->_server = $server; - - return $this; - } - - /** - * Retrieve a server value. - * - * @param string $key - * - * @return mixed - */ - public function getServerValue($key) - { - $key = strtolower($key); - $server = $this->getServer(); - $return = null; - if (isset($server[$key])) { - $return = $server[$key]; - } - unset($server); - - return $return; - } - - /** - * Set a server value. - * - * @param float|int|string $key - * @param mixed $value - */ - public function setServerValue($key, $value) - { - if ($this->_immutable) { - throw new Zend_Http_UserAgent_Exception( - 'The User-Agent device object has already been retrieved; the server array is now immutable' - ); - } - - $server = $this->getServer(); // ensure it's been initialized - $key = strtolower($key); - $this->_server[$key] = $value; - - return $this; - } - - /** - * Set plugin loader. - * - * @param string $type Type of plugin loader; one of 'storage', (?) - * @param string|Zend_Loader_PluginLoader $loader - * - * @return Zend_Http_UserAgent - */ - public function setPluginLoader($type, $loader) - { - $prefix = null; - $path = null; - $type = $this->_validateLoaderType($type); - - if (is_string($loader)) { - if (!class_exists($loader)) { - Zend_Loader::loadClass($loader); - } - $loader = new $loader(); - } elseif (!is_object($loader)) { - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Expected a plugin loader class or object; received %s', - gettype($loader) - )); - } - if (!$loader instanceof Zend_Loader_PluginLoader) { - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Expected an object extending Zend_Loader_PluginLoader; received %s', - get_class($loader) - )); - } - - $basePrefix = 'Zend_Http_UserAgent_'; - $basePath = 'Zend/Http/UserAgent/'; - switch ($type) { - case 'storage': - $prefix = $basePrefix . 'Storage'; - $path = $basePath . 'Storage'; - - break; - case 'device': - $prefix = $basePrefix; - $path = $basePath; - - break; - } - $loader->addPrefixPath($prefix, $path); - $this->_loaders[$type] = $loader; - - return $this; - } - - /** - * Get a plugin loader. - * - * @param string $type A valid plugin loader type; see {@link $_loaderTypes} - * - * @return Zend_Loader_PluginLoader - */ - public function getPluginLoader($type) - { - $type = $this->_validateLoaderType($type); - if (!isset($this->_loaders[$type])) { - $this->setPluginLoader($type, new Zend_Loader_PluginLoader()); - } - - return $this->_loaders[$type]; - } - - /** - * Validate a plugin loader type. - * - * Verifies that it is in {@link $_loaderTypes}, and returns a normalized - * version of the type. - * - * @param string $type - * - * @return string - */ - protected function _validateLoaderType($type) - { - $type = strtolower($type); - if (!in_array($type, $this->_loaderTypes)) { - $types = implode(', ', $this->_loaderTypes); - - throw new Zend_Http_UserAgent_Exception(sprintf( - 'Expected one of "%s" for plugin loader type; received "%s"', - $types, - (string) $type - )); - } - - return $type; - } - - /** - * Run the identification sequence to match the right browser type according to the - * user agent. - * - * @return Zend_Http_UserAgent_Result - */ - protected function _matchUserAgent() - { - $type = self::DEFAULT_BROWSER_TYPE; - - // If we have no identification sequence, just return the default type - if (empty($this->_config['identification_sequence'])) { - return $type; - } - - // Get sequence against which to match - $sequence = explode(',', $this->_config['identification_sequence']); - - // If a browser type is already configured, push that to the front of the list - if (null !== ($browserType = $this->getBrowserType())) { - array_unshift($sequence, $browserType); - } - - // Append the default browser type to the list if not alread in the list - if (!in_array($type, $sequence)) { - $sequence[] = $type; - } - - // Test each type until we find a match - foreach ($sequence as $browserType) { - $browserType = trim($browserType); - $className = $this->_getUserAgentDevice($browserType); - - // Attempt to match this device class - if ($this->_match($className)) { - $type = $browserType; - $this->_browserTypeClass[$type] = $className; - - break; - } - } - - return $type; - } - - /** - * Creates device object instance. - */ - protected function _createDevice() - { - $browserType = $this->getBrowserType(); - $classname = $this->_getUserAgentDevice($browserType); - $this->_device = new $classname($this->getUserAgent(), $this->getServer(), $this->getConfig()); - } -} diff --git a/library/Zend/Http/UserAgent/AbstractDevice.php b/library/Zend/Http/UserAgent/AbstractDevice.php deleted file mode 100644 index 437d27ee..00000000 --- a/library/Zend/Http/UserAgent/AbstractDevice.php +++ /dev/null @@ -1,998 +0,0 @@ -_restoreFromArray($userAgent); - } else { - // Constructing new object - $this->setUserAgent($userAgent); - $this->_server = $server; - $this->_config = $config; - $this->_getDefaultFeatures(); - $this->_defineFeatures(); - } - } - - /** - * Serialize object. - * - * @return string - */ - public function serialize() - { - $spec = $this->__serialize(); - - return serialize($spec); - } - - public function __serialize(): array - { - return [ - '_aFeatures' => $this->_aFeatures, - '_aGroup' => $this->_aGroup, - '_browser' => $this->_browser, - '_browserVersion' => $this->_browserVersion, - '_userAgent' => $this->_userAgent, - '_images' => $this->_images, - ]; - } - - /** - * Unserialize. - * - * @param string $serialized - */ - public function unserialize($serialized) - { - $spec = unserialize($serialized); - $this->__unserialize($spec); - } - - public function __unserialize(array $data): void - { - $this->_restoreFromArray($data); - } - - /** - * Restore object state from array. - */ - protected function _restoreFromArray(array $spec) - { - foreach ($spec as $key => $value) { - if (property_exists($this, $key)) { - $this->{$key} = $value; - } - } - } - - /** - * Look for features. - * - * @return null|array - */ - protected function _defineFeatures() - { - $features = $this->_loadFeaturesAdapter(); - - if (is_array($features)) { - $this->_aFeatures = array_merge($this->_aFeatures, $features); - } - - return $this->_aFeatures; - } - - /** - * Gets the browser type identifier. - * - * @return string - */ - abstract public function getType(); - - /** - * Check a feature for the current browser/device. - * - * @param string $feature the feature to check - * - * @return bool - */ - public function hasFeature($feature) - { - return isset($this->_aFeatures[$feature]) && !is_null($this->_aFeatures[$feature]); - } - - /** - * Gets the value of the current browser/device feature. - * - * @param string $feature Feature to search - * - * @return null|string - */ - public function getFeature($feature) - { - if ($this->hasFeature($feature)) { - return $this->_aFeatures[$feature]; - } - } - - /** - * Set a feature for the current browser/device. - * - * @param string $feature the feature to set - * @param string $value (option) feature value - * @param string $group (option) Group to associate with the feature - * - * @return Zend_Http_UserAgent_AbstractDevice - */ - public function setFeature($feature, $value = false, $group = '') - { - $this->_aFeatures[$feature] = $value; - if (!empty($group)) { - $this->setGroup($group, $feature); - } - - return $this; - } - - /** - * Affects a feature to a group. - * - * @param string $group Group name - * @param string $feature Feature name - * - * @return Zend_Http_UserAgent_AbstractDevice - */ - public function setGroup($group, $feature) - { - if (!isset($this->_aGroup[$group])) { - $this->_aGroup[$group] = []; - } - if (!in_array($feature, $this->_aGroup[$group])) { - $this->_aGroup[$group][] = $feature; - } - - return $this; - } - - /** - * Gets an array of features associated to a group. - * - * @param string $group Group param - * - * @return array - */ - public function getGroup($group) - { - return $this->_aGroup[$group]; - } - - /** - * Gets all the browser/device features. - * - * @return array - */ - public function getAllFeatures() - { - return $this->_aFeatures; - } - - /** - * Gets all the browser/device features' groups. - * - * @return array - */ - public function getAllGroups() - { - return $this->_aGroup; - } - - /** - * Sets all the standard features extracted from the User Agent chain and $this->_server - * vars. - */ - protected function _getDefaultFeatures() - { - $server = []; - - // gets info from user agent chain - $uaExtract = static::extractFromUserAgent($this->getUserAgent()); - - if (is_array($uaExtract)) { - foreach ($uaExtract as $key => $info) { - $this->setFeature($key, $info, 'product_info'); - } - } - - if (isset($uaExtract['browser_name'])) { - $this->_browser = $uaExtract['browser_name']; - } - if (isset($uaExtract['browser_version'])) { - $this->_browserVersion = $uaExtract['browser_version']; - } - if (isset($uaExtract['device_os'])) { - $this->device_os = $uaExtract['device_os_name']; - } - - // browser & device info - $this->setFeature('is_wireless_device', false, 'product_info'); - $this->setFeature('is_mobile', false, 'product_info'); - $this->setFeature('is_desktop', false, 'product_info'); - $this->setFeature('is_tablet', false, 'product_info'); - $this->setFeature('is_bot', false, 'product_info'); - $this->setFeature('is_email', false, 'product_info'); - $this->setFeature('is_text', false, 'product_info'); - $this->setFeature('device_claims_web_support', false, 'product_info'); - - $this->setFeature('is_' . strtolower($this->getType()), true, 'product_info'); - - // sets the browser name - if (isset($this->list) && empty($this->_browser)) { - $lowerUserAgent = strtolower($this->getUserAgent()); - foreach ($this->list as $browser_signature) { - if (strpos($lowerUserAgent, (string) $browser_signature) !== false) { - $this->_browser = strtolower($browser_signature); - $this->setFeature('browser_name', $this->_browser, 'product_info'); - } - } - } - - // sets the client IP - if (isset($this->_server['remote_addr'])) { - $this->setFeature('client_ip', $this->_server['remote_addr'], 'product_info'); - } elseif (isset($this->_server['http_x_forwarded_for'])) { - $this->setFeature('client_ip', $this->_server['http_x_forwarded_for'], 'product_info'); - } elseif (isset($this->_server['http_client_ip'])) { - $this->setFeature('client_ip', $this->_server['http_client_ip'], 'product_info'); - } - - // sets the server infos - if (isset($this->_server['server_software'])) { - if (strpos($this->_server['server_software'], 'Apache') !== false || strpos($this->_server['server_software'], 'LiteSpeed') !== false) { - $server['version'] = 1; - if (strpos($this->_server['server_software'], 'Apache/2') !== false) { - $server['version'] = 2; - } - $server['server'] = 'apache'; - } - - if (strpos($this->_server['server_software'], 'Microsoft-IIS') !== false) { - $server['server'] = 'iis'; - } - - if (strpos($this->_server['server_software'], 'Unix') !== false) { - $server['os'] = 'unix'; - if (isset($_ENV['MACHTYPE'])) { - if (strpos($_ENV['MACHTYPE'], 'linux') !== false) { - $server['os'] = 'linux'; - } - } - } elseif (strpos($this->_server['server_software'], 'Win') !== false) { - $server['os'] = 'windows'; - } - - if (preg_match('/Apache\/([0-9\.]*)/', $this->_server['server_software'], $arr)) { - if ($arr[1]) { - $server['version'] = $arr[1]; - $server['server'] = 'apache'; - } - } - } - - $this->setFeature('php_version', phpversion(), 'server_info'); - if (isset($server['server'])) { - $this->setFeature('server_os', $server['server'], 'server_info'); - } - if (isset($server['version'])) { - $this->setFeature('server_os_version', $server['version'], 'server_info'); - } - if (isset($this->_server['http_accept'])) { - $this->setFeature('server_http_accept', $this->_server['http_accept'], 'server_info'); - } - if (isset($this->_server['http_accept_language'])) { - $this->setFeature('server_http_accept_language', $this->_server['http_accept_language'], 'server_info'); - } - if (isset($this->_server['server_addr'])) { - $this->setFeature('server_ip', $this->_server['server_addr'], 'server_info'); - } - if (isset($this->_server['server_name'])) { - $this->setFeature('server_name', $this->_server['server_name'], 'server_info'); - } - } - - /** - * Extract and sets informations from the User Agent chain. - * - * @param string $userAgent User Agent chain - * - * @return array - */ - public static function extractFromUserAgent($userAgent) - { - $result = []; - $real = []; - $compatibility = []; - $userAgent = trim($userAgent); - - /** - * @see http://www.texsoft.it/index.php?c=software&m=sw.php.useragent&l=it - */ - $pattern = "(([^/\s]*)(/(\S*))?)(\s*\[[a-zA-Z][a-zA-Z]\])?\s*(\\((([^()]|(\\([^()]*\\)))*)\\))?\s*"; - preg_match("#^$pattern#", $userAgent, $match); - - $comment = []; - if (isset($match[7])) { - $comment = explode(';', $match[7]); - } - - // second part if exists - $end = substr($userAgent, strlen($match[0])); - if (!empty($end)) { - $result['others']['full'] = $end; - } - - $match2 = []; - if (isset($result['others'])) { - preg_match_all('/(([^\/\s]*)(\/)?([^\/\(\)\s]*)?)(\s\((([^\)]*)*)\))?/i', $result['others']['full'], $match2); - } - $result['user_agent'] = trim($match[1]); - $result['product_name'] = isset($match[2]) ? trim($match[2]) : ''; - $result['browser_name'] = $result['product_name']; - if (isset($match[4]) && trim($match[4])) { - $result['product_version'] = trim($match[4]); - $result['browser_version'] = trim($match[4]); - } - if (count($comment) && !empty($comment[0])) { - $result['comment']['full'] = trim($match[7]); - $result['comment']['detail'] = $comment; - $result['compatibility_flag'] = trim($comment[0]); - if (isset($comment[1])) { - $result['browser_token'] = trim($comment[1]); - } - if (isset($comment[2])) { - $result['device_os_token'] = trim($comment[2]); - } - } - if (empty($result['device_os_token']) && !empty($result['compatibility_flag'])) { - // some browsers do not have a platform token - $result['device_os_token'] = $result['compatibility_flag']; - } - if ($match2) { - $i = 0; - $max = is_countable($match2[0]) ? count($match2[0]) : 0; - for ($i = 0; $i < $max; ++$i) { - if (!empty($match2[0][$i])) { - $result['others']['detail'][] = [ - $match2[0][$i], - $match2[2][$i], - $match2[4][$i], - ]; - } - } - } - - /** Security level */ - $security = [ - 'N' => 'no security', - 'U' => 'strong security', - 'I' => 'weak security', - ]; - if (!empty($result['browser_token'])) { - if (isset($security[$result['browser_token']])) { - $result['security_level'] = $security[$result['browser_token']]; - unset($result['browser_token']); - } - } - - $product = strtolower($result['browser_name']); - - // Mozilla : true && false - $compatibleOrIe = false; - if (isset($result['compatibility_flag'], $result['comment'])) { - $compatibleOrIe = ($result['compatibility_flag'] == 'compatible' || strpos($result['comment']['full'], 'MSIE') !== false); - } - if ($product == 'mozilla' && $compatibleOrIe) { - if (!empty($result['browser_token'])) { - // Classic Mozilla chain - preg_match_all('/([^\/\s].*)(\/|\s)(.*)/i', $result['browser_token'], $real); - } else { - // MSIE specific chain with 'Windows' compatibility flag - foreach ($result['comment']['detail'] as $v) { - if (strpos($v, 'MSIE') !== false) { - $real[0][1] = trim($v); - $result['browser_engine'] = 'MSIE'; - $real[1][0] = 'Internet Explorer'; - $temp = explode(' ', trim($v)); - $real[3][0] = $temp[1]; - } - if (strpos($v, 'Win') !== false) { - $result['device_os_token'] = trim($v); - } - } - } - - if (!empty($real[0])) { - $result['browser_name'] = $real[1][0]; - $result['browser_version'] = $real[3][0]; - } else { - if (isset($result['browser_token'])) { - $result['browser_name'] = $result['browser_token']; - } - $result['browser_version'] = '??'; - } - } elseif ($product == 'mozilla' && isset($result['browser_version']) - && $result['browser_version'] < 5.0 - ) { - // handles the real Mozilla (or old Netscape if version < 5.0) - $result['browser_name'] = 'Netscape'; - } - - // windows - if ($result['browser_name'] == 'MSIE') { - $result['browser_engine'] = 'MSIE'; - $result['browser_name'] = 'Internet Explorer'; - } - if (isset($result['device_os_token'])) { - if (strpos($result['device_os_token'], 'Win') !== false) { - $windows = [ - 'Windows NT 6.1' => 'Windows 7', - 'Windows NT 6.0' => 'Windows Vista', - 'Windows NT 5.2' => 'Windows Server 2003', - 'Windows NT 5.1' => 'Windows XP', - 'Windows NT 5.01' => 'Windows 2000 SP1', - 'Windows NT 5.0' => 'Windows 2000', - 'Windows NT 4.0' => 'Microsoft Windows NT 4.0', - 'WinNT' => 'Microsoft Windows NT 4.0', - 'Windows 98; Win 9x 4.90' => 'Windows Me', - 'Windows 98' => 'Windows 98', - 'Win98' => 'Windows 98', - 'Windows 95' => 'Windows 95', - 'Win95' => 'Windows 95', - 'Windows CE' => 'Windows CE', - ]; - if (isset($windows[$result['device_os_token']])) { - $result['device_os_name'] = $windows[$result['device_os_token']]; - } else { - $result['device_os_name'] = $result['device_os_token']; - } - } - } - - // iphone - $apple_device = [ - 'iPhone', - 'iPod', - 'iPad', - ]; - if (isset($result['compatibility_flag'])) { - if (in_array($result['compatibility_flag'], $apple_device)) { - $result['device'] = strtolower($result['compatibility_flag']); - $result['device_os_token'] = 'iPhone OS'; - if (isset($comment[3])) { - $result['browser_language'] = trim($comment[3]); - } - if (isset($result['others']['detail'][1])) { - $result['browser_version'] = $result['others']['detail'][1][2]; - } elseif (isset($result['others']['detail']) && count($result['others']['detail'])) { - $result['browser_version'] = $result['others']['detail'][0][2]; - } - if (!empty($result['others']['detail'][2])) { - $result['firmware'] = $result['others']['detail'][2][2]; - } - if (!empty($result['others']['detail'][3])) { - $result['browser_name'] = $result['others']['detail'][3][1]; - $result['browser_build'] = $result['others']['detail'][3][2]; - } - } - } - - // Safari - if (isset($result['others'])) { - if ($result['others']['detail'][0][1] == 'AppleWebKit') { - $result['browser_engine'] = 'AppleWebKit'; - if (isset($result['others']['detail'][1]) && $result['others']['detail'][1][1] == 'Version') { - $result['browser_version'] = $result['others']['detail'][1][2]; - } else { - $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][2]; - } - if (isset($comment[3])) { - $result['browser_language'] = trim($comment[3]); - } - - $last = $result['others']['detail'][count($result['others']['detail']) - 1][1]; - - if (empty($result['others']['detail'][2][1]) || $result['others']['detail'][2][1] == 'Safari') { - if (isset($result['others']['detail'][1])) { - $result['browser_name'] = ($result['others']['detail'][1][1] && $result['others']['detail'][1][1] != 'Version' ? $result['others']['detail'][1][1] : 'Safari'); - $result['browser_version'] = ($result['others']['detail'][1][2] ?: $result['others']['detail'][0][2]); - } else { - $result['browser_name'] = ($result['others']['detail'][0][1] && $result['others']['detail'][0][1] != 'Version' ? $result['others']['detail'][0][1] : 'Safari'); - $result['browser_version'] = $result['others']['detail'][0][2]; - } - } else { - $result['browser_name'] = $result['others']['detail'][2][1]; - $result['browser_version'] = $result['others']['detail'][2][2]; - - // mobile version - if ($result['browser_name'] == 'Mobile') { - $result['browser_name'] = 'Safari ' . $result['browser_name']; - if ($result['others']['detail'][1][1] == 'Version') { - $result['browser_version'] = $result['others']['detail'][1][2]; - } - } - } - - // For Safari < 2.2, AppleWebKit version gives the Safari version - if (strpos($result['browser_version'], '.') > 2 || (int) $result['browser_version'] > 20) { - $temp = explode('.', $result['browser_version']); - $build = (int) $temp[0]; - $awkVersion = [ - 48 => '0.8', - 73 => '0.9', - 85 => '1.0', - 103 => '1.1', - 124 => '1.2', - 300 => '1.3', - 400 => '2.0', - ]; - foreach ($awkVersion as $k => $v) { - if ($build >= $k) { - $result['browser_version'] = $v; - } - } - } - } - - // Gecko (Firefox or compatible) - if ($result['others']['detail'][0][1] == 'Gecko') { - $searchRV = true; - if (!empty($result['others']['detail'][1][1]) && !empty($result['others']['detail'][count($result['others']['detail']) - 1][2]) || strpos(strtolower($result['others']['full']), 'opera') !== false) { - $searchRV = false; - $result['browser_engine'] = $result['others']['detail'][0][1]; - - // the name of the application is at the end indepenently - // of quantity of information in $result['others']['detail'] - $last = count($result['others']['detail']) - 1; - - // exception : if the version of the last information is - // empty we take the previous one - if (empty($result['others']['detail'][$last][2])) { - --$last; - } - - // exception : if the last one is 'Red Hat' or 'Debian' => - // use rv: to find browser_version */ - if (in_array($result['others']['detail'][$last][1], [ - 'Debian', - 'Hat', - ])) { - $searchRV = true; - } - $result['browser_name'] = $result['others']['detail'][$last][1]; - $result['browser_version'] = $result['others']['detail'][$last][2]; - if (isset($comment[4])) { - $result['browser_build'] = trim($comment[4]); - } - if (isset($comment[3])) { - $result['browser_language'] = trim($comment[3]); - } - - // Netscape - if ($result['browser_name'] == 'Navigator' || $result['browser_name'] == 'Netscape6') { - $result['browser_name'] = 'Netscape'; - } - } - if ($searchRV) { - // Mozilla alone : the version is identified by rv: - $result['browser_name'] = 'Mozilla'; - if (isset($result['comment']['detail'])) { - foreach ($result['comment']['detail'] as $rv) { - if (strpos($rv, 'rv:') !== false) { - $result['browser_version'] = trim(str_replace('rv:', '', $rv)); - } - } - } - } - } - - // Netscape - if ($result['others']['detail'][0][1] == 'Netscape') { - $result['browser_name'] = 'Netscape'; - $result['browser_version'] = $result['others']['detail'][0][2]; - } - - // Opera - // Opera: engine Presto - if ($result['others']['detail'][0][1] == 'Presto') { - $result['browser_engine'] = 'Presto'; - if (!empty($result['others']['detail'][1][2])) { - $result['browser_version'] = $result['others']['detail'][1][2]; - } - } - - // UA ends with 'Opera X.XX' or 'Opera/X.XX' - if ($result['others']['detail'][0][1] == 'Opera') { - $result['browser_name'] = $result['others']['detail'][0][1]; - // Opera X.XX - if (isset($result['others']['detail'][1][1])) { - $result['browser_version'] = $result['others']['detail'][1][1]; - // Opera/X.XX - } elseif (isset($result['others']['detail'][0][2])) { - $result['browser_version'] = $result['others']['detail'][0][2]; - } - } - - // Opera Mini - if (isset($result['browser_token'])) { - if (strpos($result['browser_token'], 'Opera Mini') !== false) { - $result['browser_name'] = 'Opera Mini'; - } - } - - // Symbian - if ($result['others']['detail'][0][1] == 'SymbianOS') { - $result['device_os_token'] = 'SymbianOS'; - } - } - - // UA ends with 'Opera X.XX' - if (isset($result['browser_name'], $result['browser_engine'])) { - if ($result['browser_name'] == 'Opera' && $result['browser_engine'] == 'Gecko' && empty($result['browser_version'])) { - $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][1]; - } - } - - // cleanup - if (isset($result['browser_version'], $result['browser_build'])) { - if ($result['browser_version'] == $result['browser_build']) { - unset($result['browser_build']); - } - } - - // compatibility - $compatibility['AppleWebKit'] = 'Safari'; - $compatibility['Gecko'] = 'Firefox'; - $compatibility['MSIE'] = 'Internet Explorer'; - $compatibility['Presto'] = 'Opera'; - if (!empty($result['browser_engine'])) { - if (isset($compatibility[$result['browser_engine']])) { - $result['browser_compatibility'] = $compatibility[$result['browser_engine']]; - } - } - - ksort($result); - - return $result; - } - - /** - * Loads the Features Adapter if it's defined in the $config array - * Otherwise, nothing is done. - * - * @return array - */ - protected function _loadFeaturesAdapter() - { - $config = $this->_config; - $browserType = $this->getType(); - if (!isset($config[$browserType]) || !isset($config[$browserType]['features'])) { - return []; - } - $config = $config[$browserType]['features']; - - if (empty($config['classname'])) { - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "classname" config parameter defined'); - } - - $className = $config['classname']; - if (!class_exists($className)) { - if (isset($config['path'])) { - $path = $config['path']; - } else { - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "path" config parameter defined'); - } - - if (false === include_once($path)) { - throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter path that does not exist'); - } - } - - return call_user_func([$className, 'getFromRequest'], $this->_server, $this->_config); - } - - /** - * Retrieve image format support. - * - * @return array - */ - public function getImageFormatSupport() - { - return $this->_images; - } - - /** - * Get maximum image height supported by this device. - * - * @return int - */ - public function getMaxImageHeight() - { - return null; - } - - /** - * Get maximum image width supported by this device. - * - * @return int - */ - public function getMaxImageWidth() - { - return null; - } - - /** - * Get physical screen height of this device. - * - * @return int - */ - public function getPhysicalScreenHeight() - { - return null; - } - - /** - * Get physical screen width of this device. - * - * @return int - */ - public function getPhysicalScreenWidth() - { - return null; - } - - /** - * Get preferred markup type. - * - * @return string - */ - public function getPreferredMarkup() - { - return 'xhtml'; - } - - /** - * Get supported X/HTML version. - * - * @return int - */ - public function getXhtmlSupportLevel() - { - return 4; - } - - /** - * Does the device support Flash? - * - * @return bool - */ - public function hasFlashSupport() - { - return true; - } - - /** - * Does the device support PDF? - * - * @return bool - */ - public function hasPdfSupport() - { - return true; - } - - /** - * Does the device have a phone number associated with it? - * - * @return bool - */ - public function hasPhoneNumber() - { - return false; - } - - /** - * Does the device support HTTPS? - * - * @return bool - */ - public function httpsSupport() - { - return true; - } - - /** - * Get the browser type. - * - * @return string - */ - public function getBrowser() - { - return $this->_browser; - } - - /** - * Get the browser version. - * - * @return string - */ - public function getBrowserVersion() - { - return $this->_browserVersion; - } - - /** - * Get the user agent string. - * - * @return string - */ - public function getUserAgent() - { - return $this->_userAgent; - } - - /** - * @return the $_images - */ - public function getImages() - { - return $this->_images; - } - - /** - * @param string $browser - */ - public function setBrowser($browser) - { - $this->_browser = $browser; - } - - /** - * @param string $browserVersion - */ - public function setBrowserVersion($browserVersion) - { - $this->_browserVersion = $browserVersion; - } - - /** - * @param string $userAgent - */ - public function setUserAgent($userAgent) - { - $this->_userAgent = $userAgent; - - return $this; - } - - /** - * @param array $_images - */ - public function setImages($_images) - { - $this->_images = $_images; - } - - /** - * Match a user agent string against a list of signatures. - * - * @param string $userAgent - * @param array $signatures - * - * @return bool - */ - protected static function _matchAgentAgainstSignatures($userAgent, $signatures) - { - $userAgent = strtolower($userAgent); - foreach ($signatures as $signature) { - if (!empty($signature)) { - if (strpos($userAgent, (string) $signature) !== false) { - // Browser signature was found in user agent string - return true; - } - } - } - - return false; - } -} diff --git a/library/Zend/Http/UserAgent/Bot.php b/library/Zend/Http/UserAgent/Bot.php deleted file mode 100644 index 2d4ca3db..00000000 --- a/library/Zend/Http/UserAgent/Bot.php +++ /dev/null @@ -1,120 +0,0 @@ - $value) { - // For a few keys, we need to munge a bit for the device object - switch ($key) { - case 'browser': - $features['mobile_browser'] = $value; - - break; - - case 'version': - $features['mobile_browser_version'] = $value; - - break; - - case 'platform': - $features['device_os'] = $value; - - break; - - default: - $features[$key] = $value; - - break; - } - } - } - - return $features; - } -} diff --git a/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php b/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php deleted file mode 100644 index de59a4c7..00000000 --- a/library/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php +++ /dev/null @@ -1,69 +0,0 @@ -getDeviceCapabilitiesFromRequest(array_change_key_case($request, CASE_UPPER)); - - return self::getAllCapabilities($wurflObj); - } - - /*** - * Builds an array with all capabilities - * - * @param TeraWurfl $wurflObj TeraWurfl object - */ - public static function getAllCapabilities(TeraWurfl $wurflObj) - { - $features = []; - foreach ($wurflObj->capabilities as $group) { - if (!is_array($group)) { - continue; - } - foreach ($group as $key => $value) { - if (is_bool($value)) { - // to have the same type than the official WURFL API - $features[$key] = ($value ? 'true' : 'false'); - } else { - $features[$key] = $value; - } - } - } - - return $features; - } -} diff --git a/library/Zend/Http/UserAgent/Features/Exception.php b/library/Zend/Http/UserAgent/Features/Exception.php deleted file mode 100644 index a4c6fc39..00000000 --- a/library/Zend/Http/UserAgent/Features/Exception.php +++ /dev/null @@ -1,27 +0,0 @@ -setFeature('iframes', false, 'product_capability'); - $this->setFeature('frames', false, 'product_capability'); - $this->setFeature('javascript', false, 'product_capability'); - - return parent::_defineFeatures(); - } -} diff --git a/library/Zend/Http/UserAgent/Mobile.php b/library/Zend/Http/UserAgent/Mobile.php deleted file mode 100644 index e866dd3f..00000000 --- a/library/Zend/Http/UserAgent/Mobile.php +++ /dev/null @@ -1,532 +0,0 @@ -setFeature('is_wireless_device', false, 'product_info'); - - parent::_defineFeatures(); - - if (isset($this->_aFeatures['mobile_browser'])) { - $this->setFeature('browser_name', $this->_aFeatures['mobile_browser']); - $this->_browser = $this->_aFeatures['mobile_browser']; - } - if (isset($this->_aFeatures['mobile_browser_version'])) { - $this->setFeature('browser_version', $this->_aFeatures['mobile_browser_version']); - $this->_browserVersion = $this->_aFeatures['mobile_browser_version']; - } - - // markup - if ($this->getFeature('device_os') == 'iPhone OS' - || $this->getFeature('device_os_token') == 'iPhone OS' - ) { - $this->setFeature('markup', 'iphone'); - } else { - $this->setFeature('markup', $this->getMarkupLanguage($this->getFeature('preferred_markup'))); - } - - // image format - $this->_images = []; - - if ($this->getFeature('png')) { - $this->_images[] = 'png'; - } - if ($this->getFeature('jpg')) { - $this->_images[] = 'jpg'; - } - if ($this->getFeature('gif')) { - $this->_images[] = 'gif'; - } - if ($this->getFeature('wbmp')) { - $this->_images[] = 'wbmp'; - } - - return $this->_aFeatures; - } - - /** - * Determine markup language expected. - * - * @param null|mixed $preferredMarkup - * - * @return __TYPE__ - */ - public function getMarkupLanguage($preferredMarkup = null) - { - $return = ''; - switch ($preferredMarkup) { - case 'wml_1_1': - case 'wml_1_2': - case 'wml_1_3': - $return = 'wml'; //text/vnd.wap.wml encoding="ISO-8859-15" - // no break - case 'html_wi_imode_compact_generic': - case 'html_wi_imode_html_1': - case 'html_wi_imode_html_2': - case 'html_wi_imode_html_3': - case 'html_wi_imode_html_4': - case 'html_wi_imode_html_5': - $return = 'chtml'; //text/html - // no break - case 'html_wi_oma_xhtmlmp_1_0': //application/vnd.wap.xhtml+xml - case 'html_wi_w3_xhtmlbasic': //application/xhtml+xml DTD XHTML Basic 1.0 - $return = 'xhtml'; - // no break - case 'html_web_3_2': //text/html DTD Html 3.2 Final - case 'html_web_4_0': //text/html DTD Html 4.01 Transitional - $return = ''; - } - - return $return; - } - - /** - * Determine image format support. - * - * @return array - */ - public function getImageFormatSupport() - { - return $this->_images; - } - - /** - * Determine maximum image height supported. - * - * @return int - */ - public function getMaxImageHeight() - { - return $this->getFeature('max_image_height'); - } - - /** - * Determine maximum image width supported. - * - * @return int - */ - public function getMaxImageWidth() - { - return $this->getFeature('max_image_width'); - } - - /** - * Determine physical screen height. - * - * @return int - */ - public function getPhysicalScreenHeight() - { - return $this->getFeature('physical_screen_height'); - } - - /** - * Determine physical screen width. - * - * @return int - */ - public function getPhysicalScreenWidth() - { - return $this->getFeature('physical_screen_width'); - } - - /** - * Determine preferred markup. - * - * @return string - */ - public function getPreferredMarkup() - { - return $this->getFeature('markup'); - } - - /** - * Determine X/HTML support level. - * - * @return int - */ - public function getXhtmlSupportLevel() - { - return $this->getFeature('xhtml_support_level'); - } - - /** - * Does the device support Flash? - * - * @return bool - */ - public function hasFlashSupport() - { - return $this->getFeature('fl_browser'); - } - - /** - * Does the device support PDF? - * - * @return bool - */ - public function hasPdfSupport() - { - return $this->getFeature('pdf_support'); - } - - /** - * Does the device have an associated phone number? - * - * @return bool - */ - public function hasPhoneNumber() - { - return $this->getFeature('can_assign_phone_number'); - } - - /** - * Does the device support HTTPS? - * - * @return bool - */ - public function httpsSupport() - { - return $this->getFeature('https_support') == 'supported'; - } -} diff --git a/library/Zend/Http/UserAgent/Offline.php b/library/Zend/Http/UserAgent/Offline.php deleted file mode 100644 index ecfc1a68..00000000 --- a/library/Zend/Http/UserAgent/Offline.php +++ /dev/null @@ -1,62 +0,0 @@ -setFeature('images', false, 'product_capability'); - $this->setFeature('iframes', false, 'product_capability'); - $this->setFeature('frames', false, 'product_capability'); - $this->setFeature('javascript', false, 'product_capability'); - - return parent::_defineFeatures(); - } -} diff --git a/library/Zend/Http/UserAgent/Spam.php b/library/Zend/Http/UserAgent/Spam.php deleted file mode 100644 index c1c43f94..00000000 --- a/library/Zend/Http/UserAgent/Spam.php +++ /dev/null @@ -1,72 +0,0 @@ -setFeature('images', false, 'product_capability'); - $this->setFeature('iframes', false, 'product_capability'); - $this->setFeature('frames', false, 'product_capability'); - $this->setFeature('javascript', false, 'product_capability'); - - return parent::_defineFeatures(); - } -} diff --git a/library/Zend/Http/UserAgent/Storage.php b/library/Zend/Http/UserAgent/Storage.php deleted file mode 100644 index 5034e057..00000000 --- a/library/Zend/Http/UserAgent/Storage.php +++ /dev/null @@ -1,50 +0,0 @@ -_data); - } - - /** - * Returns the contents of storage. - * - * Behavior is undefined when storage is empty. - * - * @return mixed - */ - public function read() - { - return $this->_data; - } - - /** - * Writes $contents to storage. - * - * @param mixed $contents - */ - public function write($contents) - { - $this->_data = $contents; - } - - /** - * Clears contents from storage. - */ - public function clear() - { - $this->_data = null; - } -} diff --git a/library/Zend/Http/UserAgent/Storage/Session.php b/library/Zend/Http/UserAgent/Storage/Session.php deleted file mode 100644 index 4bb384ee..00000000 --- a/library/Zend/Http/UserAgent/Storage/Session.php +++ /dev/null @@ -1,142 +0,0 @@ -toArray(); - } elseif (is_object($options)) { - $options = (array) $options; - } - if (null !== $options && !is_array($options)) { - throw new Zend_Http_UserAgent_Storage_Exception(sprintf( - 'Expected array or object options; "%s" provided', - gettype($options) - )); - } - - // add '.' to prevent the message ''Session namespace must not start with a number' - $this->_namespace = '.' - . ($options['browser_type'] ?? self::NAMESPACE_DEFAULT); - $this->_member = $options['member'] ?? self::MEMBER_DEFAULT; - $this->_session = new Zend_Session_Namespace($this->_namespace); - } - - /** - * Returns the session namespace name. - * - * @return string - */ - public function getNamespace() - { - return $this->_namespace; - } - - /** - * Returns the name of the session object member. - * - * @return string - */ - public function getMember() - { - return $this->_member; - } - - /** - * Defined by Zend_Http_UserAgent_Storage. - * - * @return bool - */ - public function isEmpty() - { - return empty($this->_session->{$this->_member}); - } - - /** - * Defined by Zend_Http_UserAgent_Storage. - * - * @return mixed - */ - public function read() - { - return $this->_session->{$this->_member}; - } - - /** - * Defined by Zend_Http_UserAgent_Storage. - * - * @param mixed $content - */ - public function write($content) - { - $this->_session->{$this->_member} = $content; - } - - /** - * Defined by Zend_Http_UserAgent_Storage. - */ - public function clear() - { - unset($this->_session->{$this->_member}); - } -} diff --git a/library/Zend/Http/UserAgent/Text.php b/library/Zend/Http/UserAgent/Text.php deleted file mode 100644 index 28498d09..00000000 --- a/library/Zend/Http/UserAgent/Text.php +++ /dev/null @@ -1,122 +0,0 @@ -setFeature('images', false, 'product_capability'); - $this->setFeature('iframes', false, 'product_capability'); - $this->setFeature('frames', false, 'product_capability'); - $this->setFeature('javascript', false, 'product_capability'); - - return parent::_defineFeatures(); - } - - /** - * Determine supported image formats. - */ - public function getImageFormatSupport() - { - return null; - } - - /** - * Get preferred markup format. - * - * @return string - */ - public function getPreferredMarkup() - { - return 'xhtml'; - } - - /** - * Get supported X/HTML markup level. - * - * @return int - */ - public function getXhtmlSupportLevel() - { - return 1; - } - - /** - * Does the device support Flash? - * - * @return bool - */ - public function hasFlashSupport() - { - return false; - } - - /** - * Does the device support PDF? - * - * @return bool - */ - public function hasPdfSupport() - { - return false; - } -} diff --git a/library/Zend/Http/UserAgent/Validator.php b/library/Zend/Http/UserAgent/Validator.php deleted file mode 100644 index c7f9f0df..00000000 --- a/library/Zend/Http/UserAgent/Validator.php +++ /dev/null @@ -1,65 +0,0 @@ -setUri($uri); - } - } - - /** - * Set the URI to use in the request. - * - * @param string|Zend_Uri_Http $uri URI for the web service - * - * @return Zend_Rest_Client - */ - public function setUri($uri) - { - if ($uri instanceof Zend_Uri_Http) { - $this->_uri = $uri; - } else { - $this->_uri = Zend_Uri::factory($uri); - } - - return $this; - } - - /** - * Retrieve the current request URI object. - * - * @return Zend_Uri_Http - */ - public function getUri() - { - return $this->_uri; - } - - /** - * Call a remote REST web service URI and return the Zend_Http_Response object. - * - * @param string $path The path to append to the URI - */ - private function _prepareRest($path) - { - // Get the URI object and configure it - if (!$this->_uri instanceof Zend_Uri_Http) { - throw new Zend_Rest_Client_Exception('URI object must be set before performing call'); - } - - $uri = $this->_uri->getUri(); - - if ($path[0] != '/' && $uri[strlen($uri) - 1] != '/') { - $path = '/' . $path; - } - - $this->_uri->setPath($path); - - /* - * Get the HTTP client and configure it for the endpoint URI. Do this each time - * because the Zend_Http_Client instance is shared among all Zend_Service_Abstract subclasses. - */ - if ($this->_noReset) { - // if $_noReset we do not want to reset on this request, - // but we do on any subsequent request - $this->_noReset = false; - } else { - self::getHttpClient()->resetParameters(); - } - - self::getHttpClient()->setUri($this->_uri); - } - - /** - * Tells Zend_Rest_Client not to reset all parameters on it's - * Zend_Http_Client. If you want no reset, this must be called explicitly - * before every request for which you do not want to reset the parameters. - * Parameters will accumulate between requests, but as soon as you do not - * call this function prior to any request, all preset parameters will be reset - * as by default. - * - * @param bool $bool - */ - public function setNoReset($bool = true) - { - $this->_noReset = $bool; - } - - /** - * Performs an HTTP GET request to the $path. - * - * @param string $path - * @param array $query Array of GET parameters - * - * @return Zend_Http_Response - */ - public function restGet($path, ?array $query = null) - { - $this->_prepareRest($path); - $client = self::getHttpClient(); - $client->setParameterGet($query); - - return $client->request('GET'); - } - - /** - * Perform a POST or PUT. - * - * Performs a POST or PUT request. Any data provided is set in the HTTP - * client. String data is pushed in as raw POST data; array or object data - * is pushed in as POST parameters. - * - * @param mixed $method - * @param mixed $data - * - * @return Zend_Http_Response - */ - protected function _performPost($method, $data = null) - { - $client = self::getHttpClient(); - if (is_string($data)) { - $client->setRawData($data); - } elseif (is_array($data) || is_object($data)) { - $client->setParameterPost((array) $data); - } - - return $client->request($method); - } - - /** - * Performs an HTTP POST request to $path. - * - * @param string $path - * @param mixed $data Raw data to send - * - * @return Zend_Http_Response - */ - public function restPost($path, $data = null) - { - $this->_prepareRest($path); - - return $this->_performPost('POST', $data); - } - - /** - * Performs an HTTP PUT request to $path. - * - * @param string $path - * @param mixed $data Raw data to send in request - * - * @return Zend_Http_Response - */ - public function restPut($path, $data = null) - { - $this->_prepareRest($path); - - return $this->_performPost('PUT', $data); - } - - /** - * Performs an HTTP DELETE request to $path. - * - * @param string $path - * @param null|mixed $data - * - * @return Zend_Http_Response - */ - public function restDelete($path, $data = null) - { - $this->_prepareRest($path); - - return $this->_performPost('DELETE', $data); - } - - /** - * Method call overload. - * - * Allows calling REST actions as object methods; however, you must - * follow-up by chaining the request with a request to an HTTP request - * method (post, get, delete, put): - * - * $response = $rest->sayHello('Foo', 'Manchu')->get(); - * - * - * Or use them together, but in sequential calls: - * - * $rest->sayHello('Foo', 'Manchu'); - * $response = $rest->get(); - * - * - * @param string $method Method name - * @param array $args Method args - * - * @return Zend_Rest_Client|Zend_Rest_Client_Result Zend_Rest_Client if using - * a remote method, Zend_Rest_Client_Result if using an HTTP request method - */ - public function __call($method, $args) - { - $methods = ['post', 'get', 'delete', 'put']; - - if (in_array(strtolower($method), $methods)) { - if (!isset($args[0])) { - $args[0] = $this->_uri->getPath(); - } - $this->_data['rest'] = 1; - $data = array_slice($args, 1) + $this->_data; - $response = $this->{'rest' . $method}($args[0], $data); - $this->_data = []; //Initializes for next Rest method. - - return new Zend_Rest_Client_Result($response->getBody()); - } - // More than one arg means it's definitely a Zend_Rest_Server - if (sizeof($args) == 1) { - // Uses first called function name as method name - if (!isset($this->_data['method'])) { - $this->_data['method'] = $method; - $this->_data['arg1'] = $args[0]; - } - $this->_data[$method] = $args[0]; - } else { - $this->_data['method'] = $method; - if (sizeof($args) > 0) { - foreach ($args as $key => $arg) { - $key = 'arg' . $key; - $this->_data[$key] = $arg; - } - } - } - - return $this; - } -} diff --git a/library/Zend/Rest/Client/Exception.php b/library/Zend/Rest/Client/Exception.php deleted file mode 100644 index c82bc466..00000000 --- a/library/Zend/Rest/Client/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ -_sxml = Zend_Xml_Security::scan($data); - restore_error_handler(); - if ($this->_sxml === false) { - if ($this->_errstr === null) { - $message = 'An error occured while parsing the REST response with simplexml.'; - } else { - $message = 'REST Response Error: ' . $this->_errstr; - $this->_errstr = null; - } - - throw new Zend_Rest_Client_Result_Exception($message); - } - } - - /** - * Temporary error handler for parsing REST responses. - * - * @param int $errno - * @param string $errstr - * @param string $errfile - * @param string $errline - * - * @return true - */ - public function handleXmlErrors($errno, $errstr, $errfile = null, $errline = null) - { - $this->_errstr = $errstr; - - return true; - } - - /** - * Casts a SimpleXMLElement to its appropriate PHP value. - * - * @return mixed - */ - public function toValue(SimpleXMLElement $value) - { - $node = dom_import_simplexml($value); - - return $node->nodeValue; - } - - /** - * Get Property Overload. - * - * @param string $name - * - * @return null|array|SimpleXMLElement Null if not found, SimpleXMLElement if only one value found, array of Zend_Rest_Client_Result objects otherwise - */ - public function __get($name) - { - if (isset($this->_sxml->{$name})) { - return $this->_sxml->{$name}; - } - - $result = $this->_sxml->xpath("//$name"); - $count = is_countable($result) ? count($result) : 0; - - if ($count == 0) { - return null; - } - if ($count == 1) { - return $result[0]; - } - - return $result; - } - - /** - * Cast properties to PHP values. - * - * For arrays, loops through each element and casts to a value as well. - * - * @param string $method - * @param array $args - * - * @return mixed - */ - public function __call($method, $args) - { - if (null !== ($value = $this->__get($method))) { - if (!is_array($value)) { - return $this->toValue($value); - } - $return = []; - foreach ($value as $element) { - $return[] = $this->toValue($element); - } - - return $return; - } - - return null; - } - - /** - * Isset Overload. - * - * @param string $name - * - * @return bool - */ - public function __isset($name) - { - if (isset($this->_sxml->{$name})) { - return true; - } - - $result = $this->_sxml->xpath("//$name"); - - if (sizeof($result) > 0) { - return true; - } - - return false; - } - - /** - * Implement IteratorAggregate::getIterator(). - * - * @return SimpleXMLIterator - */ - public function getIterator(): Traversable - { - return $this->_sxml; - } - - /** - * Get Request Status. - * - * @return bool - */ - public function getStatus() - { - $status = $this->_sxml->xpath('//status/text()'); - if (!isset($status[0])) { - return false; - } - - $status = strtolower($status[0]); - - if (ctype_alpha($status) && $status == 'success') { - return true; - } - if (ctype_alpha($status) && $status != 'success') { - return false; - } - - return (bool) $status; - } - - public function isError() - { - $status = $this->getStatus(); - if ($status) { - return false; - } - - return true; - } - - public function isSuccess() - { - $status = $this->getStatus(); - if ($status) { - return true; - } - - return false; - } - - /** - * toString overload. - * - * Be sure to only call this when the result is a single value! - * - * @return string - */ - public function __toString() - { - if (!$this->getStatus()) { - $message = $this->_sxml->xpath('//message'); - - return (string) $message[0]; - } - $result = $this->_sxml->xpath('//response'); - if (sizeof($result) > 1) { - return (string) 'An error occured.'; - } - - return (string) $result[0]; - } -} diff --git a/library/Zend/Rest/Client/Result/Exception.php b/library/Zend/Rest/Client/Result/Exception.php deleted file mode 100644 index 0e017ab0..00000000 --- a/library/Zend/Rest/Client/Result/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ -Controllers to receive RESTful routes. - * - * @var array - */ - protected $_restfulControllers; - - /** - * @var Zend_Controller_Front - */ - protected $_front; - - /** - * Constructor. - * - * @param Zend_Controller_Front $front Front Controller object - * @param array $defaults Defaults for map variables with keys as variable names - * @param array $responders Modules or controllers to receive RESTful routes - */ - public function __construct(Zend_Controller_Front $front, - array $defaults = [], - array $responders = [] - ) { - $this->_defaults = $defaults; - - if ($responders) { - $this->_parseResponders($responders); - } - - $this->_front = $front; - $this->_dispatcher = $front->getDispatcher(); - } - - /** - * Instantiates route based on passed Zend_Config structure. - */ - public static function getInstance(Zend_Config $config) - { - $frontController = Zend_Controller_Front::getInstance(); - $defaultsArray = []; - $restfulConfigArray = []; - foreach ($config as $key => $values) { - if ($key == 'type') { - // do nothing - } elseif ($key == 'defaults') { - $defaultsArray = $values->toArray(); - } else { - $restfulConfigArray[$key] = explode(',', $values); - } - } - $instance = new self($frontController, $defaultsArray, $restfulConfigArray); - - return $instance; - } - - /** - * Matches a user submitted request. Assigns and returns an array of variables - * on a successful match. - * - * If a request object is registered, it uses its setModuleName(), - * setControllerName(), and setActionName() accessors to set those values. - * Always returns the values as an array. - * - * @param Zend_Controller_Request_Http $request Request used to match against this routing ruleset - * @param mixed $partial - * - * @return array An array of assigned values or a false on a mismatch - */ - public function match($request, $partial = false) - { - if (!$request instanceof Zend_Controller_Request_Http) { - $request = $this->_front->getRequest(); - } - $this->_request = $request; - $this->_setRequestKeys(); - - $path = $request->getPathInfo(); - $params = $request->getParams(); - $values = []; - $path = trim($path, self::URI_DELIMITER); - - if ($path != '') { - $path = explode(self::URI_DELIMITER, $path); - // Determine Module - $moduleName = $this->_defaults[$this->_moduleKey]; - $dispatcher = $this->_front->getDispatcher(); - if ($dispatcher && $dispatcher->isValidModule($path[0])) { - $moduleName = $path[0]; - if ($this->_checkRestfulModule($moduleName)) { - $values[$this->_moduleKey] = array_shift($path); - $this->_moduleValid = true; - } - } - - // Determine Controller - $controllerName = $this->_defaults[$this->_controllerKey]; - if (count($path) && !empty($path[0])) { - if ($this->_checkRestfulController($moduleName, $path[0])) { - $controllerName = $path[0]; - $values[$this->_controllerKey] = array_shift($path); - $values[$this->_actionKey] = 'get'; - } else { - // If Controller in URI is not found to be a RESTful - // Controller, return false to fall back to other routes - return false; - } - } elseif ($this->_checkRestfulController($moduleName, $controllerName)) { - $values[$this->_controllerKey] = $controllerName; - $values[$this->_actionKey] = 'get'; - } else { - return false; - } - - //Store path count for method mapping - $pathElementCount = count($path); - - // Check for "special get" URI's - $specialGetTarget = false; - if ($pathElementCount && array_search($path[0], ['index', 'new']) > -1) { - $specialGetTarget = array_shift($path); - } elseif ($pathElementCount && $path[$pathElementCount - 1] == 'edit') { - $specialGetTarget = 'edit'; - $params['id'] = urldecode($path[$pathElementCount - 2]); - } elseif ($pathElementCount == 1) { - $params['id'] = urldecode(array_shift($path)); - } elseif ($pathElementCount == 0 && !isset($params['id'])) { - $specialGetTarget = 'index'; - } - - // Digest URI params - if ($numSegs = count($path)) { - for ($i = 0; $i < $numSegs; $i = $i + 2) { - $key = urldecode($path[$i]); - $val = $path[$i + 1] ?? null; - $params[$key] = urldecode($val); - } - } - - // Determine Action - $requestMethod = strtolower($request->getMethod()); - if ($requestMethod != 'get') { - if ($request->getParam('_method')) { - $values[$this->_actionKey] = strtolower($request->getParam('_method')); - } elseif ($request->getHeader('X-HTTP-Method-Override')) { - $values[$this->_actionKey] = strtolower($request->getHeader('X-HTTP-Method-Override')); - } else { - $values[$this->_actionKey] = $requestMethod; - } - - // Map PUT and POST to actual create/update actions - // based on parameter count (posting to resource or collection) - switch ($values[$this->_actionKey]) { - case 'post': - if ($pathElementCount > 0) { - $values[$this->_actionKey] = 'put'; - } else { - $values[$this->_actionKey] = 'post'; - } - - break; - case 'put': - $values[$this->_actionKey] = 'put'; - - break; - } - } elseif ($specialGetTarget) { - $values[$this->_actionKey] = $specialGetTarget; - } - } - $this->_values = $values + $params; - - $result = $this->_values + $this->_defaults; - - if ($partial && $result) { - $this->setMatchedPath($request->getPathInfo()); - } - - return $result; - } - - /** - * Assembles user submitted parameters forming a URL path defined by this route. - * - * @param array $data An array of variable and value pairs used as parameters - * @param bool $reset Weither to reset the current params - * @param bool $encode Weither to return urlencoded string - * @param mixed $partial - * - * @return string Route path with user submitted parameters - */ - public function assemble($data = [], $reset = false, $encode = true, $partial = false) - { - if (!$this->_keysSet) { - if (null === $this->_request) { - $this->_request = $this->_front->getRequest(); - } - $this->_setRequestKeys(); - } - - $params = (!$reset) ? $this->_values : []; - - foreach ($data as $key => $value) { - if ($value !== null) { - $params[$key] = $value; - } elseif (isset($params[$key])) { - unset($params[$key]); - } - } - - $params += $this->_defaults; - - $url = ''; - - if ($this->_moduleValid || array_key_exists($this->_moduleKey, $data)) { - if ($params[$this->_moduleKey] != $this->_defaults[$this->_moduleKey]) { - $module = $params[$this->_moduleKey]; - } - } - unset($params[$this->_moduleKey]); - - $controller = $params[$this->_controllerKey]; - unset($params[$this->_controllerKey]); - - // set $action if value given is 'new' or 'edit' - if (in_array($params[$this->_actionKey], ['new', 'edit'])) { - $action = $params[$this->_actionKey]; - } - unset($params[$this->_actionKey]); - - if (isset($params['index']) && $params['index']) { - unset($params['index']); - $url .= '/index'; - if (isset($params['id'])) { - $url .= '/' . $params['id']; - unset($params['id']); - } - foreach ($params as $key => $value) { - if ($encode) { - $value = urlencode($value); - } - $url .= '/' . $key . '/' . $value; - } - } elseif (!empty($action) && isset($params['id'])) { - $url .= sprintf('/%s/%s', $params['id'], $action); - } elseif (!empty($action)) { - $url .= sprintf('/%s', $action); - } elseif (isset($params['id'])) { - $url .= '/' . $params['id']; - } - - if (!empty($url) || $controller !== $this->_defaults[$this->_controllerKey]) { - $url = '/' . $controller . $url; - } - - if (isset($module)) { - $url = '/' . $module . $url; - } - - return ltrim($url, self::URI_DELIMITER); - } - - /** - * Tells Rewrite Router which version this Route is. - * - * @return int Route "version" - */ - public function getVersion() - { - return 2; - } - - /** - * Parses the responders array sent to constructor to know - * which modules and/or controllers are RESTful. - * - * @param array $responders - */ - protected function _parseResponders($responders) - { - $modulesOnly = true; - foreach ($responders as $responder) { - if (is_array($responder)) { - $modulesOnly = false; - - break; - } - } - if ($modulesOnly) { - $this->_restfulModules = $responders; - } else { - $this->_restfulControllers = $responders; - } - } - - /** - * Determine if a specified module supports RESTful routing. - * - * @param string $moduleName - * - * @return bool - */ - protected function _checkRestfulModule($moduleName) - { - if ($this->_allRestful()) { - return true; - } - if ($this->_fullRestfulModule($moduleName)) { - return true; - } - if ($this->_restfulControllers && array_key_exists($moduleName, $this->_restfulControllers)) { - return true; - } - - return false; - } - - /** - * Determine if a specified module + controller combination supports - * RESTful routing. - * - * @param string $moduleName - * @param string $controllerName - * - * @return bool - */ - protected function _checkRestfulController($moduleName, $controllerName) - { - if ($this->_allRestful()) { - return true; - } - if ($this->_fullRestfulModule($moduleName)) { - return true; - } - if ($this->_checkRestfulModule($moduleName) - && $this->_restfulControllers - && (false !== array_search($controllerName, $this->_restfulControllers[$moduleName])) - ) { - return true; - } - - return false; - } - - /** - * Determines if RESTful routing applies to the entire app. - * - * @return bool - */ - protected function _allRestful() - { - return !$this->_restfulModules && !$this->_restfulControllers; - } - - /** - * Determines if RESTful routing applies to an entire module. - * - * @param string $moduleName - * - * @return bool - */ - protected function _fullRestfulModule($moduleName) - { - return - $this->_restfulModules - && (false !== array_search($moduleName, $this->_restfulModules)); - } -} diff --git a/library/Zend/Service/Abstract.php b/library/Zend/Service/Abstract.php deleted file mode 100644 index 554bc3c2..00000000 --- a/library/Zend/Service/Abstract.php +++ /dev/null @@ -1,59 +0,0 @@ -setUserAgent($userAgent); - } - - return $this->getUserAgent(); - } - - /** - * Set UserAgent instance. - * - * @return Zend_View_Helper_UserAgent - */ - public function setUserAgent(Zend_Http_UserAgent $userAgent) - { - $this->_userAgent = $userAgent; - - return $this; - } - - /** - * Retrieve UserAgent instance. - * - * If none set, instantiates one using no configuration - * - * @return Zend_Http_UserAgent - */ - public function getUserAgent() - { - if (null === $this->_userAgent) { - $this->setUserAgent(new Zend_Http_UserAgent()); - } - - return $this->_userAgent; - } -} diff --git a/tests/Zend/Application/Resource/UseragentTest.php b/tests/Zend/Application/Resource/UseragentTest.php deleted file mode 100644 index 6b9b1bc1..00000000 --- a/tests/Zend/Application/Resource/UseragentTest.php +++ /dev/null @@ -1,108 +0,0 @@ -run($suite); - } - - public function setUp(): void - { - // Store original autoloaders - $this->loaders = spl_autoload_functions(); - if (!is_array($this->loaders)) { - // spl_autoload_functions does not return empty array when no - // autoloaders registered... - $this->loaders = []; - } - - Zend_Loader_Autoloader::resetInstance(); - $this->autoloader = Zend_Loader_Autoloader::getInstance(); - - $this->application = new Zend_Application('testing'); - - require_once __DIR__ . '/../_files/ZfAppBootstrap.php'; - $this->bootstrap = new ZfAppBootstrap($this->application); - - Zend_Controller_Action_HelperBroker::resetHelpers(); - } - - public function tearDown(): void - { - // Restore original autoloaders - $loaders = spl_autoload_functions(); - foreach ($loaders as $loader) { - spl_autoload_unregister($loader); - } - - foreach ($this->loaders as $loader) { - spl_autoload_register($loader); - } - - // Reset autoloader instance so it doesn't affect other tests - Zend_Loader_Autoloader::resetInstance(); - } - - public function testInitializationInitializesUserAgentObject() - { - $resource = new Zend_Application_Resource_Useragent([]); - $resource->setBootstrap($this->bootstrap); - $resource->init(); - $this->assertTrue($resource->getUserAgent() instanceof Zend_Http_UserAgent); - } - - public function testOptionsPassedToResourceAreUsedToSetUserAgentState() - { - $options = [ - 'storage' => ['adapter' => 'NonPersistent'], - ]; - $resource = new Zend_Application_Resource_Useragent($options); - $resource->setBootstrap($this->bootstrap); - $resource->init(); - $ua = $resource->getUserAgent(); - $storage = $ua->getStorage(); - $this->assertTrue($storage instanceof Zend_Http_UserAgent_Storage_NonPersistent); - } - - public function testInjectsUserAgentIntoViewHelperWhenViewResourcePresent() - { - $this->bootstrap->registerPluginResource('view', []); - $resource = new Zend_Application_Resource_Useragent([]); - $resource->setBootstrap($this->bootstrap); - $resource->init(); - - $view = $this->bootstrap->getResource('view'); - $helper = $view->getHelper('userAgent'); - - $expected = $resource->getUserAgent(); - $this->assertSame($expected, $helper->getUserAgent()); - } -} diff --git a/tests/Zend/Controller/Response/HttpTest.php b/tests/Zend/Controller/Response/HttpTest.php index 401ab147..f1e5509e 100644 --- a/tests/Zend/Controller/Response/HttpTest.php +++ b/tests/Zend/Controller/Response/HttpTest.php @@ -29,7 +29,7 @@ class Zend_Controller_Response_HttpTest extends \PHPUnit\Framework\TestCase { /** - * @var Zend_Http_Response + * @var Zend_Controller_Response_Http */ protected $_response; diff --git a/tests/Zend/Controller/_files/routes.ini b/tests/Zend/Controller/_files/routes.ini index d8a49ba5..38b804b8 100644 --- a/tests/Zend/Controller/_files/routes.ini +++ b/tests/Zend/Controller/_files/routes.ini @@ -10,7 +10,3 @@ routes.news.type = "Zend_Controller_Router_Route_Static" routes.news.route = "news" routes.news.defaults.controller = "news" routes.news.defaults.action = "list" - -routes.rest.type = Zend_Rest_Route -routes.rest.defaults.controller = object -routes.rest.mod = project,user diff --git a/tests/Zend/Rest/ClientTest.php b/tests/Zend/Rest/ClientTest.php deleted file mode 100644 index c95320cd..00000000 --- a/tests/Zend/Rest/ClientTest.php +++ /dev/null @@ -1,353 +0,0 @@ -path = __DIR__ . '/responses/'; - - $this->adapter = new Zend_Http_Client_Adapter_Test(); - $client = new Zend_Http_Client(null, [ - 'adapter' => $this->adapter, - ]); - Zend_Rest_Client::setHttpClient($client); - - $this->rest = new Zend_Rest_Client('http://framework.zend.com/'); - } - - /** - * @group ZF-10664 - * - * Test that you can post a file using a preset - * Zend_Http_Client that has a file to post, - * by calling $restClient->setNoReset() prior to issuing the - * restPost() call. - */ - public function testCanPostFileInPresetHttpClient() - { - if (!defined('TESTS_ZEND_REST_ONLINE_ENABLED') - || !constant('TESTS_ZEND_REST_ONLINE_ENABLED') - ) { - $this->markTestSkipped('Define TESTS_ZEND_REST_ONLINE_ENABLED to test Zend_Rest_ClientTest online.'); - } - - $client = new Zend_Rest_Client('http://framework.zend.com'); - $httpClient = new Zend_Http_Client(); - $text = 'this is some plain text'; - $httpClient->setFileUpload('some_text.txt', 'upload', $text, 'text/plain'); - $client->setHttpClient($httpClient); - $client->setNoReset(); - $client->restPost('/file'); - $request = $httpClient->getLastRequest(); - $this->assertTrue(strpos($request, $text) !== false, 'The file is not in the request'); - } - - public function testUri() - { - if (!defined('TESTS_ZEND_REST_ONLINE_ENABLED') - || !constant('TESTS_ZEND_REST_ONLINE_ENABLED') - ) { - $this->markTestSkipped('Define TESTS_ZEND_REST_ONLINE_ENABLED to test Zend_Rest_ClientTest online.'); - } - - $client = new Zend_Rest_Client('http://framework.zend.com/rest/'); - $uri = $client->getUri(); - $this->assertTrue($uri instanceof Zend_Uri_Http); - $this->assertEquals('http://framework.zend.com/rest/', $uri->getUri()); - - $client->setUri(Zend_Uri::factory('http://framework.zend.com/soap/')); - $uri = $client->getUri(); - $this->assertTrue($uri instanceof Zend_Uri_Http); - $this->assertEquals('http://framework.zend.com/soap/', $uri->getUri()); - - $client->setUri('http://framework.zend.com/xmlrpc/'); - $uri = $client->getUri(); - $this->assertTrue($uri instanceof Zend_Uri_Http); - $this->assertEquals('http://framework.zend.com/xmlrpc/', $uri->getUri()); - } - - public function testRestGetThrowsExceptionWithNoUri() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $rest = new Zend_Rest_Client(); - - try { - $response = $rest->restGet('/rest/'); - $this->fail('Should throw exception if no URI in object'); - } catch (Exception $e) { - self::assertTrue(true); - } - } - - public function testRestFixesPathWithMissingSlashes() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $rest = new Zend_Rest_Client('http://framework.zend.com'); - - $response = $rest->restGet('rest'); - $this->assertTrue($response instanceof Zend_Http_Response); - $this->assertStringContainsString($expXml, $response->getBody()); - } - - public function testRestGet() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $response = $this->rest->restGet('/rest/'); - $this->assertTrue($response instanceof Zend_Http_Response); - $this->assertStringContainsString($expXml, $response->getBody()); - } - - public function testRestPost() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $reqXml = file_get_contents($this->path . 'returnInt.xml'); - $response = $this->rest->restPost('/rest/', $reqXml); - $this->assertTrue($response instanceof Zend_Http_Response); - $body = $response->getBody(); - $this->assertStringContainsString($expXml, $response->getBody()); - - $request = Zend_Rest_Client::getHttpClient()->getLastRequest(); - $this->assertStringContainsString($reqXml, $request, $request); - } - - public function testRestPostWithArrayData() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $response = $this->rest->restPost('/rest/', ['foo' => 'bar', 'baz' => 'bat']); - $this->assertTrue($response instanceof Zend_Http_Response); - $body = $response->getBody(); - $this->assertStringContainsString($expXml, $response->getBody()); - - $request = Zend_Rest_Client::getHttpClient()->getLastRequest(); - $this->assertStringContainsString('foo=bar&baz=bat', $request, $request); - } - - public function testRestPut() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $reqXml = file_get_contents($this->path . 'returnInt.xml'); - $response = $this->rest->restPut('/rest/', $reqXml); - $this->assertTrue($response instanceof Zend_Http_Response); - $body = $response->getBody(); - $this->assertStringContainsString($expXml, $response->getBody()); - - $request = Zend_Rest_Client::getHttpClient()->getLastRequest(); - $this->assertStringContainsString($reqXml, $request, $request); - } - - public function testRestDelete() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $reqXml = file_get_contents($this->path . 'returnInt.xml'); - $response = $this->rest->restDelete('/rest/', $reqXml); - $this->assertTrue($response instanceof Zend_Http_Response); - $body = $response->getBody(); - $this->assertStringContainsString($expXml, $response->getBody()); - - $request = Zend_Rest_Client::getHttpClient()->getLastRequest(); - $this->assertStringContainsString($reqXml, $request, $request); - } - - public function testCallWithHttpMethod() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $response = $this->rest->get('/rest/'); - $this->assertTrue($response instanceof Zend_Rest_Client_Result); - $this->assertTrue($response->isSuccess()); - $this->assertEquals('string', $response->response()); - } - - public function testCallAsObjectMethodReturnsClient() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $response = $this->rest->doStuff('why', 'not'); - $this->assertTrue($response instanceof Zend_Rest_Client); - $this->assertSame($this->rest, $response); - } - - public function testCallAsObjectMethodChainPerformsRequest() - { - $expXml = file_get_contents($this->path . 'returnString.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $response = $this->rest->doStuff('why', 'not')->get(); - $this->assertTrue($response instanceof Zend_Rest_Client_Result); - $this->assertEquals('string', $response->response()); - } - - /** - * @group ZF-3705 - * @group ZF-3647 - */ - public function testInvalidXmlInClientResultLeadsToException() - { - try { - $result = new Zend_Rest_Client_Result('invalidxml'); - $this->fail(); - } catch (Zend_Rest_Client_Result_Exception $e) { - } - self::assertTrue(true); - } - - /** - * @group ZF-11281 - */ - public function testCallStatusGetterOnResponseObjectWhenServerResponseHasNoStatusXmlElement() - { - $expXml = file_get_contents($this->path . 'returnEmptyStatus.xml'); - $response = "HTTP/1.0 200 OK\r\n" - . "X-powered-by: PHP/5.2.0\r\n" - . "Content-type: text/xml\r\n" - . 'Content-length: ' . strlen($expXml) . "\r\n" - . "Server: Apache/1.3.34 (Unix) PHP/5.2.0)\r\n" - . "Date: Tue, 06 Feb 2007 15:01:47 GMT\r\n" - . "Connection: close\r\n" - . "\r\n" - . $expXml; - $this->adapter->setResponse($response); - - $response = $this->rest->get('/rest/'); - $this->assertTrue($response instanceof Zend_Rest_Client_Result); - $this->assertFalse($response->getStatus()); - } -} diff --git a/tests/Zend/Rest/ControllerTest.php b/tests/Zend/Rest/ControllerTest.php deleted file mode 100644 index 59947a6d..00000000 --- a/tests/Zend/Rest/ControllerTest.php +++ /dev/null @@ -1,117 +0,0 @@ -testValue = ''; - } - - public function indexAction() - { - $this->testValue = 'indexAction'; - } - - public function getAction() - { - $this->testValue = 'getAction'; - } - - public function headAction() - { - $this->testValue = 'headAction'; - } - - public function postAction() - { - $this->testValue = 'postAction'; - } - - public function putAction() - { - $this->testValue = 'putAction'; - } - - public function deleteAction() - { - $this->testValue = 'deleteAction'; - } -} -/** - * @license http://framework.zend.com/license/new-bsd New BSD License - * - * @group Zend_Rest - */ -#[AllowDynamicProperties] -class Zend_Rest_ControllerTest extends \PHPUnit\Framework\TestCase -{ - protected $_testController; - - /** - * Runs the test methods of this class. - * - * @static - */ - public static function main() - { - $suite = new \PHPUnit\Framework\TestSuite('Zend_Rest_ControllerTest'); - $result = \PHPUnit\TextUI\TestRunner::run($suite); - } - - public function setUp(): void - { - $request = new Zend_Controller_Request_HttpTestCase(); - $response = new Zend_Controller_Response_HttpTestCase(); - $this->_testController = new Zend_Rest_TestController($request, $response); - } - - public function test_action_methods() - { - $this->_testController->indexAction(); - $this->assertEquals('indexAction', $this->_testController->testValue); - $this->_testController->getAction(); - $this->assertEquals('getAction', $this->_testController->testValue); - $this->_testController->headAction(); - $this->assertEquals('headAction', $this->_testController->testValue); - $this->_testController->postAction(); - $this->assertEquals('postAction', $this->_testController->testValue); - $this->_testController->putAction(); - $this->assertEquals('putAction', $this->_testController->testValue); - $this->_testController->deleteAction(); - $this->assertEquals('deleteAction', $this->_testController->testValue); - } -} diff --git a/tests/Zend/Rest/ResultTest.php b/tests/Zend/Rest/ResultTest.php deleted file mode 100644 index 4aa00f34..00000000 --- a/tests/Zend/Rest/ResultTest.php +++ /dev/null @@ -1,177 +0,0 @@ -assertTrue($client->isSuccess()); - } - - public function testResponseIsError() - { - $xml = file_get_contents(self::$path . 'returnError.xml'); - $client = new Zend_Rest_Client_Result($xml); - $this->assertTrue($client->isError()); - } - - public function testResponseString() - { - $xml = file_get_contents(self::$path . 'returnString.xml'); - $client = new Zend_Rest_Client_Result($xml); - $this->assertEquals('string', $client->__toString()); - } - - public function testResponseInt() - { - $xml = file_get_contents(self::$path . 'returnInt.xml'); - $client = new Zend_Rest_Client_Result($xml); - $this->assertEquals('123', $client->__toString()); - } - - public function testResponseArray() - { - $result_array = []; - $xml = file_get_contents(self::$path . 'returnArray.xml'); - // bar10123 - $client = new Zend_Rest_Client_Result($xml); - foreach ($client as $key => $value) { - $result_array[$key] = (string) $value; - } - $this->assertEquals(['foo' => 'bar', 'baz' => '1', 'key_1' => '0', 'bat' => '123', 'status' => 'success'], $result_array); - } - - public function testResponseObject() - { - $xml = file_get_contents(self::$path . 'returnObject.xml'); - // bar11230success - $client = new Zend_Rest_Client_Result($xml); - $this->assertEquals('bar', $client->foo()); - $this->assertEquals(1, $client->baz()); - $this->assertEquals(123, $client->bat()); - $this->assertEquals(0, $client->qux()); - $this->assertEquals('success', $client->status()); - } - - public function testResponseTrue() - { - $xml = file_get_contents(self::$path . 'returnTrue.xml'); - $client = new Zend_Rest_Client_Result($xml); - $this->assertTrue((bool) $client->response); - } - - public function testResponseFalse() - { - $xml = file_get_contents(self::$path . 'returnFalse.xml'); - $client = new Zend_Rest_Client_Result($xml); - $this->assertFalse((bool) $client->response()); - } - - public function testResponseVoid() - { - $xml = file_get_contents(self::$path . 'returnVoid.xml'); - $client = new Zend_Rest_Client_Result($xml); - $this->assertEquals(null, $client->response()); - } - - public function testResponseException() - { - $xml = file_get_contents(self::$path . 'returnError.xml'); - $client = new Zend_Rest_Client_Result($xml); - $this->assertTrue($client->isError()); - } - - public function testGetXpathValue() - { - $xml = file_get_contents(self::$path . DIRECTORY_SEPARATOR . 'returnNestedArray.xml'); - $result = new Zend_Rest_Client_Result($xml); - $key_1 = $result->key_1(); - $this->assertEquals(0, $key_1); - } - - public function testGetXpathValueMissing() - { - $xml = file_get_contents(self::$path . DIRECTORY_SEPARATOR . 'returnNestedArray.xml'); - $result = new Zend_Rest_Client_Result($xml); - $lola = $result->lola; - $this->assertNull($lola); - } - - public function testGetXpathValueArray() - { - $xml = file_get_contents(self::$path . DIRECTORY_SEPARATOR . 'returnNestedArray.xml'); - $result = new Zend_Rest_Client_Result($xml); - $baz = $result->baz; - $this->assertTrue(is_array($baz), var_export($baz, 1)); - $this->assertEquals('1', (string) $baz[0]); - $this->assertEquals('farama', (string) $baz[1]); - } - - public function testIsset() - { - $xml = file_get_contents(self::$path . DIRECTORY_SEPARATOR . 'returnNestedArray.xml'); - $result = new Zend_Rest_Client_Result($xml); - $this->assertTrue(isset($result->bar)); - } - - public function testIssetXpathValue() - { - $xml = file_get_contents(self::$path . DIRECTORY_SEPARATOR . 'returnNestedArray.xml'); - $result = new Zend_Rest_Client_Result($xml); - $this->assertTrue(isset($result->baz)); - } - - public function testIssetInvalidValue() - { - $xml = file_get_contents(self::$path . DIRECTORY_SEPARATOR . 'returnNestedArray.xml'); - $result = new Zend_Rest_Client_Result($xml); - $this->assertFalse(isset($result->lola)); - } - - public function testCall() - { - $xml = file_get_contents(self::$path . DIRECTORY_SEPARATOR . 'returnNestedArray.xml'); - $result = new Zend_Rest_Client_Result($xml); - $returned = $result->key_1(); - $this->assertEquals(0, $returned); - } -} diff --git a/tests/Zend/Rest/RouteTest.php b/tests/Zend/Rest/RouteTest.php deleted file mode 100644 index 541aa4e5..00000000 --- a/tests/Zend/Rest/RouteTest.php +++ /dev/null @@ -1,962 +0,0 @@ -_front = Zend_Controller_Front::getInstance(); - $this->_front->resetInstance(); - $this->_front->setParam('noErrorHandler', true) - ->setParam('noViewRenderer', true); - - $this->_dispatcher = $this->_front->getDispatcher(); - - $this->_dispatcher->setControllerDirectory([ - 'default' => __DIR__ . DIRECTORY_SEPARATOR - . '..' . DIRECTORY_SEPARATOR - . 'Controller' . DIRECTORY_SEPARATOR - . '_files', - 'mod' => __DIR__ . DIRECTORY_SEPARATOR - . '..' . DIRECTORY_SEPARATOR - . 'Controller' . DIRECTORY_SEPARATOR - . '_files' . DIRECTORY_SEPARATOR - . 'Admin', - ]); - } - - protected function tearDown(): void - { - $_GET = []; - $_POST = []; - } - - public function test_getVersion() - { - $route = new Zend_Rest_Route($this->_front); - $this->assertEquals(2, $route->getVersion()); - } - - public function test_getInstance_fromINIConfig() - { - require_once('Zend/Config/Ini.php'); - $config = new Zend_Config_Ini(__DIR__ . '/../Controller/_files/routes.ini', 'testing'); - require_once('Zend/Controller/Router/Rewrite.php'); - $router = new Zend_Controller_Router_Rewrite(); - $router->addConfig($config, 'routes'); - $route = $router->getRoute('rest'); - $this->assertTrue($route instanceof Zend_Rest_Route); - $this->assertEquals('object', $route->getDefault('controller')); - - $request = $this->_buildRequest('GET', '/mod/project'); - $values = $this->_invokeRouteMatch($request, [], $route); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('index', $values['action']); - - $request = $this->_buildRequest('POST', '/mod/user'); - $values = $this->_invokeRouteMatch($request, [], $route); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('post', $values['action']); - - $request = $this->_buildRequest('GET', '/other'); - $values = $this->_invokeRouteMatch($request, [], $route); - $this->assertFalse($values); - } - - public function test_RESTfulApp_defaults() - { - $request = $this->_buildRequest('GET', '/'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('index', $values['controller']); - $this->assertEquals('index', $values['action']); - } - - // @group ZF-7437 - public function test_RESTfulApp_GET_user_defaults() - { - $request = $this->_buildRequest('GET', '/user'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('index', $values['action']); - } - - public function test_RESTfulApp_GET_user_index() - { - $request = $this->_buildRequest('GET', '/user/index'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('index', $values['action']); - } - - public function test_RESTfulApp_GET_user_index_withParams() - { - $request = $this->_buildRequest('GET', '/user/index/changedSince/123456789/status/active'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('index', $values['action']); - $this->assertEquals(123_456_789, $values['changedSince']); - $this->assertEquals('active', $values['status']); - } - - public function test_RESTfulApp_GET_user_index_withQueryParams() - { - $request = $this->_buildRequest('GET', '/user/?changedSince=123456789&status=active'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('index', $values['action']); - $this->assertEquals(123_456_789, $values['changedSince']); - $this->assertEquals('active', $values['status']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_GET_user_index_withParam_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('GET', '/user/index/the%2Bemail%40address/email%2Btest%40example.com'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('index', $values['action']); - $this->assertEquals('email+test@example.com', $values['the+email@address']); - } - - public function test_RESTfulApp_GET_project_byIdentifier() - { - $request = $this->_buildRequest('GET', '/project/zendframework'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('get', $values['action']); - $this->assertEquals('zendframework', $values['id']); - } - - public function test_RESTfulApp_GET_project_byIdQueryParam() - { - $request = $this->_buildRequest('GET', '/project/?id=zendframework'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('get', $values['action']); - $this->assertEquals('zendframework', $values['id']); - } - - public function test_RESTfulApp_GET_project_byIdentifier_urlencoded() - { - $request = $this->_buildRequest('GET', '/project/zend+framework'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('get', $values['action']); - $this->assertEquals('zend framework', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_GET_project_byIdentifier_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('GET', '/project/email%2Btest%40example.com'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('get', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulApp_HEAD_project_byIdentifier() - { - $request = $this->_buildRequest('HEAD', '/project/lcrouch'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('head', $values['action']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_HEAD_project_byIdentifier_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('HEAD', '/project/email%2Btest%40example.com'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('head', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulApp_GET_project_edit() - { - $request = $this->_buildRequest('GET', '/project/zendframework/edit'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('edit', $values['action']); - $this->assertEquals('zendframework', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_GET_project_edit_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('GET', '/project/email%2Btest%40example.com/edit'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('default', $values['module']); - $this->assertEquals('project', $values['controller']); - $this->assertEquals('edit', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulApp_PUT_user_byIdentifier() - { - $request = $this->_buildRequest('PUT', '/mod/user/lcrouch'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - $this->assertEquals('lcrouch', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_PUT_user_byIdentifier_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('PUT', '/mod/user/email%2Btest%40example.com'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulApp_POST_user() - { - $request = $this->_buildRequest('POST', '/mod/user'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('post', $values['action']); - } - - public function test_RESTfulApp_DELETE_user_byIdentifier() - { - $request = $this->_buildRequest('DELETE', '/mod/user/lcrouch'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('delete', $values['action']); - $this->assertEquals('lcrouch', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_DELETE_user_byIdentifier_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('DELETE', '/mod/user/email%2Btest%40example.com'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('delete', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulApp_POST_user_with_identifier_doesPUT() - { - $request = $this->_buildRequest('POST', '/mod/user/lcrouch'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - $this->assertEquals('lcrouch', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_POST_user_with_identifier_urlencodedWithPlusSymbol_doesPUT() - { - $request = $this->_buildRequest('POST', '/mod/user/email%2Btest%40example.com'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulApp_overload_POST_with_method_param_PUT() - { - $request = $this->_buildRequest('POST', '/mod/user'); - $request->setParam('_method', 'PUT'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - } - - public function test_RESTfulApp_overload_POST_with_http_header_DELETE() - { - $request = $this->_buildRequest('POST', '/mod/user/lcrouch'); - $request->setHeader('X-HTTP-Method-Override', 'DELETE'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('delete', $values['action']); - $this->assertEquals('lcrouch', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_overload_POST_with_http_header_DELETE_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('POST', '/mod/user/email%2Btest%40example.com'); - $request->setHeader('X-HTTP-Method-Override', 'DELETE'); - $values = $this->_invokeRouteMatch($request); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('delete', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulApp_route_chaining() - { - $request = $this->_buildRequest('GET', '/api/user/lcrouch'); - $this->_front->setRequest($request); - - $router = $this->_front->getRouter(); - $router->removeDefaultRoutes(); - - $nonRESTRoute = new Zend_Controller_Router_Route('api'); - $RESTRoute = new Zend_Rest_Route($this->_front); - $router->addRoute('api', $nonRESTRoute->chain($RESTRoute)); - - $routedRequest = $router->route($request); - - $this->assertEquals('default', $routedRequest->getParam('module')); - $this->assertEquals('user', $routedRequest->getParam('controller')); - $this->assertEquals('get', $routedRequest->getParam('action')); - $this->assertEquals('lcrouch', $routedRequest->getParam('id')); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulApp_route_chaining_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('GET', '/api/user/email%2Btest%40example.com'); - $this->_front->setRequest($request); - - $router = $this->_front->getRouter(); - $router->removeDefaultRoutes(); - - $nonRESTRoute = new Zend_Controller_Router_Route('api'); - $RESTRoute = new Zend_Rest_Route($this->_front); - $router->addRoute('api', $nonRESTRoute->chain($RESTRoute)); - - $routedRequest = $router->route($request); - - $this->assertEquals('default', $routedRequest->getParam('module')); - $this->assertEquals('user', $routedRequest->getParam('controller')); - $this->assertEquals('get', $routedRequest->getParam('action')); - $this->assertEquals('email+test@example.com', $routedRequest->getParam('id')); - } - - public function test_RESTfulModule_GET_user_index() - { - $request = $this->_buildRequest('GET', '/mod/user/index'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('index', $values['action']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulModule_GET_user_index_withParam_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('GET', '/mod/user/index/the%2Bemail%40address/email%2Btest%40example.com'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('index', $values['action']); - $this->assertEquals('email+test@example.com', $values['the+email@address']); - } - - public function test_RESTfulModule_GET_user() - { - $request = $this->_buildRequest('GET', '/mod/user/1234'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('get', $values['action']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulModule_GET_user_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('GET', '/mod/user/email%2Btest%40example.com'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('get', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulModule_POST_user() - { - $request = $this->_buildRequest('POST', '/mod/user'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('post', $values['action']); - } - - public function test_RESTfulModule_POST_user_inNonRESTModule_returnsFalse() - { - $request = $this->_buildRequest('POST', '/default/user'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertFalse($values); - } - - public function test_RESTfulModule_PUT_user_byIdentifier() - { - $request = $this->_buildRequest('PUT', '/mod/user/lcrouch'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - $this->assertEquals('lcrouch', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulModule_PUT_user_byIdentifier_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('PUT', '/mod/user/email%2Btest%40example.com'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulModule_DELETE_user_byIdentifier() - { - $request = $this->_buildRequest('DELETE', '/mod/user/lcrouch'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('delete', $values['action']); - $this->assertEquals('lcrouch', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulModule_DELETE_user_byIdentifier_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('DELETE', '/mod/user/email%2Btest%40example.com'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('delete', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulController_GET_user_index() - { - $request = $this->_buildRequest('GET', '/mod/user/index'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('index', $values['action']); - } - - public function test_RESTfulController_GET_default_controller_returns_false() - { - $request = $this->_buildRequest('GET', '/mod/index/index'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertFalse($values); - } - - public function test_RESTfulController_GET_other_index_returns_false() - { - $request = $this->_buildRequest('GET', '/mod/project/index'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertFalse($values); - } - - public function test_RESTfulController_GET_user() - { - $request = $this->_buildRequest('GET', '/mod/user/1234'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('get', $values['action']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulController_GET_user_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('GET', '/mod/user/email%2Btest%40example.com'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('get', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulController_POST_user() - { - $request = $this->_buildRequest('POST', '/mod/user'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('post', $values['action']); - } - - public function test_RESTfulController_POST_user_inNonRESTModule_returnsFalse() - { - $request = $this->_buildRequest('POST', '/default/user'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertFalse($values); - } - - public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_defaultControllerInURL_returnsFalse() - { - $request = $this->_buildRequest('POST', '/mod/index'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertFalse($values); - } - - public function test_postToNonRESTfulDefaultController_moduleHasAnotherRESTfulController_noDefaultControllerInURL_returnsFalse() - { - $request = $this->_buildRequest('POST', '/mod'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertFalse($values); - } - - public function test_RESTfulController_PUT_user_byIdentifier() - { - $request = $this->_buildRequest('PUT', '/mod/user/lcrouch'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - $this->assertEquals('lcrouch', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulController_PUT_user_byIdentifier_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('PUT', '/mod/user/email%2Btest%40example.com'); - $config = ['mod' => ['user']]; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('put', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_RESTfulController_DELETE_user_byIdentifier() - { - $request = $this->_buildRequest('DELETE', '/mod/user/lcrouch'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('delete', $values['action']); - $this->assertEquals('lcrouch', $values['id']); - } - - /** - * @group ZF-10964 - */ - public function test_RESTfulController_DELETE_user_byIdentifier_urlencodedWithPlusSymbol() - { - $request = $this->_buildRequest('DELETE', '/mod/user/email%2Btest%40example.com'); - $config = ['mod']; - $values = $this->_invokeRouteMatch($request, $config); - - $this->assertTrue(is_array($values)); - $this->assertTrue(isset($values['module'])); - $this->assertEquals('mod', $values['module']); - $this->assertEquals('user', $values['controller']); - $this->assertEquals('delete', $values['action']); - $this->assertEquals('email+test@example.com', $values['id']); - } - - public function test_assemble_plain_ignores_action() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'user', 'action' => 'get']; - $url = $route->assemble($params); - $this->assertEquals('mod/user', $url); - } - - public function test_assemble_id_after_controller() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'user', 'id' => 'lcrouch']; - $url = $route->assemble($params); - $this->assertEquals('mod/user/lcrouch', $url); - } - - public function test_assemble_index_after_controller_with_params() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'user', 'index' => true, 'foo' => 'bar']; - $url = $route->assemble($params); - $this->assertEquals('mod/user/index/foo/bar', $url); - } - - public function test_assemble_encode_param_values() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'user', 'index' => true, 'foo' => 'bar is n!ice']; - $url = $route->assemble($params); - $this->assertEquals('mod/user/index/foo/bar+is+n%21ice', $url); - } - - public function test_assemble_does_NOT_encode_param_values() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'user', 'index' => true, 'foo' => 'bar is n!ice']; - $url = $route->assemble($params, false, false); - $this->assertEquals('mod/user/index/foo/bar is n!ice', $url); - } - - /** - * @group ZF-9823 - */ - public function test_assemble_edit_with_module_appends_action_after_id() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'users', 'action' => 'edit', 'id' => 1]; - $url = $route->assemble($params); - $this->assertEquals('mod/users/1/edit', $url); - } - - /** - * @group ZF-9823 - */ - public function test_assemble_edit_without_module_appends_action_after_id() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['controller' => 'users', 'action' => 'edit', 'id' => 1]; - $url = $route->assemble($params); - $this->assertEquals('users/1/edit', $url); - } - - /** - * @group ZF-9823 - */ - public function test_assemble_new_with_module_appends_action() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'users', 'action' => 'new']; - $url = $route->assemble($params); - $this->assertEquals('mod/users/new', $url); - } - - /** - * @group ZF-9823 - */ - public function test_assemble_new_without_module_appends_action() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['controller' => 'users', 'action' => 'new']; - $url = $route->assemble($params); - $this->assertEquals('users/new', $url); - } - - /** - * @group ZF-9823 - */ - public function test_assemble_random_action_with_module_removes_action() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'users', 'action' => 'newbar']; - $url = $route->assemble($params); - $this->assertNotEquals('mod/users/newbar', $url); - } - - /** - * @group ZF-9823 - */ - public function test_assemble_random_action_without_module_removes_action() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['controller' => 'users', 'action' => 'newbar']; - $url = $route->assemble($params); - $this->assertNotEquals('users/newbar', $url); - } - - /** - * @group ZF-9823 - */ - public function test_assemble_with_module_honors_index_parameter_with_resource_id_and_extra_parameters() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['module' => 'mod', 'controller' => 'users', 'id' => 1, 'extra' => 'parameter', 'another' => 'parameter', 'index' => true]; - $url = $route->assemble($params, false, false); - $this->assertEquals('mod/users/index/1/extra/parameter/another/parameter', $url); - } - - /** - * @group ZF-9823 - */ - public function test_assemble_without_module_honors_index_parameter_with_resource_id_and_extra_parameters() - { - $route = new Zend_Rest_Route($this->_front, [], []); - $params = ['controller' => 'users', 'id' => 1, 'extra' => 'parameter', 'another' => 'parameter', 'index' => true]; - $url = $route->assemble($params, false, false); - $this->assertEquals('users/index/1/extra/parameter/another/parameter', $url); - } - - /** - * @group ZF-9115 - */ - public function test_request_get_user_params() - { - $uri = Zend_Uri::factory('http://localhost.com/user/index?a=1&b=2'); - $request = new Zend_Controller_Request_Http($uri); - $request->setParam('test', 5); - $config = ['mod' => ['user']]; - $this->_invokeRouteMatch($request, $config); - $this->assertEquals(['test' => 5], $request->getUserParams()); - $this->assertEquals(['test' => 5, 'a' => '1', 'b' => '2'], $request->getParams()); - } - - private function _buildRequest($method, $uri) - { - $request = new Zend_Controller_Request_HttpTestCase(); - $request->setMethod($method)->setRequestUri($uri); - - return $request; - } - - private function _invokeRouteMatch($request, $config = [], $route = null) - { - $this->_front->setRequest($request); - if ($route == null) { - $route = new Zend_Rest_Route($this->_front, [], $config); - } - $values = $route->match($request); - - return $values; - } -} diff --git a/tests/Zend/Rest/responses/returnArray.xml b/tests/Zend/Rest/responses/returnArray.xml deleted file mode 100644 index 2d9e1a46..00000000 --- a/tests/Zend/Rest/responses/returnArray.xml +++ /dev/null @@ -1 +0,0 @@ -bar10123success \ No newline at end of file diff --git a/tests/Zend/Rest/responses/returnEmptyStatus.xml b/tests/Zend/Rest/responses/returnEmptyStatus.xml deleted file mode 100644 index 4ab60943..00000000 --- a/tests/Zend/Rest/responses/returnEmptyStatus.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/tests/Zend/Rest/responses/returnError.xml b/tests/Zend/Rest/responses/returnError.xml deleted file mode 100644 index c95b7118..00000000 --- a/tests/Zend/Rest/responses/returnError.xml +++ /dev/null @@ -1 +0,0 @@ -An error occurred.failed \ No newline at end of file diff --git a/tests/Zend/Rest/responses/returnFalse.xml b/tests/Zend/Rest/responses/returnFalse.xml deleted file mode 100644 index bb66cd8c..00000000 --- a/tests/Zend/Rest/responses/returnFalse.xml +++ /dev/null @@ -1 +0,0 @@ -0success \ No newline at end of file diff --git a/tests/Zend/Rest/responses/returnInt.xml b/tests/Zend/Rest/responses/returnInt.xml deleted file mode 100644 index 62bfd936..00000000 --- a/tests/Zend/Rest/responses/returnInt.xml +++ /dev/null @@ -1 +0,0 @@ -123success \ No newline at end of file diff --git a/tests/Zend/Rest/responses/returnNestedArray.xml b/tests/Zend/Rest/responses/returnNestedArray.xml deleted file mode 100644 index 39bee5d6..00000000 --- a/tests/Zend/Rest/responses/returnNestedArray.xml +++ /dev/null @@ -1 +0,0 @@ -10faramabazsuccess diff --git a/tests/Zend/Rest/responses/returnObject.xml b/tests/Zend/Rest/responses/returnObject.xml deleted file mode 100644 index 01d2acff..00000000 --- a/tests/Zend/Rest/responses/returnObject.xml +++ /dev/null @@ -1 +0,0 @@ -bar11230success \ No newline at end of file diff --git a/tests/Zend/Rest/responses/returnString.xml b/tests/Zend/Rest/responses/returnString.xml deleted file mode 100644 index fb7127b0..00000000 --- a/tests/Zend/Rest/responses/returnString.xml +++ /dev/null @@ -1 +0,0 @@ -stringsuccess \ No newline at end of file diff --git a/tests/Zend/Rest/responses/returnTrue.xml b/tests/Zend/Rest/responses/returnTrue.xml deleted file mode 100644 index 43c5763b..00000000 --- a/tests/Zend/Rest/responses/returnTrue.xml +++ /dev/null @@ -1 +0,0 @@ -1success \ No newline at end of file diff --git a/tests/Zend/Rest/responses/returnVoid.xml b/tests/Zend/Rest/responses/returnVoid.xml deleted file mode 100644 index 37a8fca1..00000000 --- a/tests/Zend/Rest/responses/returnVoid.xml +++ /dev/null @@ -1 +0,0 @@ -success \ No newline at end of file diff --git a/tests/Zend/View/Helper/UserAgentTest.php b/tests/Zend/View/Helper/UserAgentTest.php deleted file mode 100644 index 214ef434..00000000 --- a/tests/Zend/View/Helper/UserAgentTest.php +++ /dev/null @@ -1,89 +0,0 @@ -helper = new Zend_View_Helper_UserAgent(); - $this->userAgent = new Zend_Http_UserAgent(); - } - - public function testHelperMethod() - { - $this->assertTrue( - $this->helper->userAgent() instanceof Zend_Http_UserAgent - ); - $this->helper->userAgent($this->userAgent); - $this->assertEquals( - spl_object_hash($this->userAgent), - spl_object_hash($this->helper->getUserAgent()) - ); - } - - public function testGetUserAgentDefault() - { - $this->assertTrue( - $this->helper->getUserAgent() instanceof Zend_Http_UserAgent - ); - } - - public function testSetAndGetUserAgent() - { - $this->helper->setUserAgent($this->userAgent); - $this->assertEquals( - spl_object_hash($this->userAgent), - spl_object_hash($this->helper->getUserAgent()) - ); - } -} From 5fe483568c1d56b65f3f6359835f648f509df6ee Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Tue, 10 Jun 2025 14:23:36 +0200 Subject: [PATCH 08/28] Drop Date #11498 --- library/Zend/Date.php | 5109 ------------------------ library/Zend/Date/Cities.php | 318 -- library/Zend/Date/DateObject.php | 1135 ------ library/Zend/Date/Exception.php | 41 - library/Zend/Locale/Format.php | 1 - library/Zend/Validate/Date.php | 256 -- tests/TestConfiguration.php.dist | 1 - tests/Zend/Date/DateObjectTest.php | 594 --- tests/Zend/DateTest.php | 5849 ---------------------------- tests/Zend/Locale/MathTest.php | 5 - tests/Zend/LocaleTest.php | 2 - tests/Zend/Validate/DateTest.php | 241 -- 12 files changed, 13552 deletions(-) delete mode 100644 library/Zend/Date.php delete mode 100644 library/Zend/Date/Cities.php delete mode 100644 library/Zend/Date/DateObject.php delete mode 100644 library/Zend/Date/Exception.php delete mode 100644 library/Zend/Validate/Date.php delete mode 100644 tests/Zend/Date/DateObjectTest.php delete mode 100644 tests/Zend/DateTest.php delete mode 100644 tests/Zend/Validate/DateTest.php diff --git a/library/Zend/Date.php b/library/Zend/Date.php deleted file mode 100644 index c9ef9860..00000000 --- a/library/Zend/Date.php +++ /dev/null @@ -1,5109 +0,0 @@ - 'iso', // format for date strings 'iso' or 'php' - 'fix_dst' => true, // fix dst on summer/winter time change - 'extend_month' => false, // false - addMonth like SQL, true like excel - 'cache' => null, // cache to set - 'timesync' => null, // timesync server to set - ]; - - // Class wide Date Constants - public const DAY = 'dd'; - public const DAY_SHORT = 'd'; - public const DAY_SUFFIX = 'SS'; - public const DAY_OF_YEAR = 'D'; - public const WEEKDAY = 'EEEE'; - public const WEEKDAY_SHORT = 'EEE'; - public const WEEKDAY_NARROW = 'E'; - public const WEEKDAY_NAME = 'EE'; - public const WEEKDAY_8601 = 'eee'; - public const WEEKDAY_DIGIT = 'e'; - public const WEEK = 'ww'; - public const MONTH = 'MM'; - public const MONTH_SHORT = 'M'; - public const MONTH_DAYS = 'ddd'; - public const MONTH_NAME = 'MMMM'; - public const MONTH_NAME_SHORT = 'MMM'; - public const MONTH_NAME_NARROW = 'MMMMM'; - public const YEAR = 'y'; - public const YEAR_SHORT = 'yy'; - public const YEAR_8601 = 'Y'; - public const YEAR_SHORT_8601 = 'YY'; - public const LEAPYEAR = 'l'; - public const MERIDIEM = 'a'; - public const SWATCH = 'B'; - public const HOUR = 'HH'; - public const HOUR_SHORT = 'H'; - public const HOUR_AM = 'hh'; - public const HOUR_SHORT_AM = 'h'; - public const MINUTE = 'mm'; - public const MINUTE_SHORT = 'm'; - public const SECOND = 'ss'; - public const SECOND_SHORT = 's'; - public const MILLISECOND = 'S'; - public const TIMEZONE_NAME = 'zzzz'; - public const DAYLIGHT = 'I'; - public const GMT_DIFF = 'Z'; - public const GMT_DIFF_SEP = 'ZZZZ'; - public const TIMEZONE = 'z'; - public const TIMEZONE_SECS = 'X'; - public const ISO_8601 = 'c'; - public const RFC_2822 = 'r'; - public const TIMESTAMP = 'U'; - public const ERA = 'G'; - public const ERA_NAME = 'GGGG'; - public const ERA_NARROW = 'GGGGG'; - public const DATES = 'F'; - public const DATE_FULL = 'FFFFF'; - public const DATE_LONG = 'FFFF'; - public const DATE_MEDIUM = 'FFF'; - public const DATE_SHORT = 'FF'; - public const TIMES = 'WW'; - public const TIME_FULL = 'TTTTT'; - public const TIME_LONG = 'TTTT'; - public const TIME_MEDIUM = 'TTT'; - public const TIME_SHORT = 'TT'; - public const DATETIME = 'K'; - public const DATETIME_FULL = 'KKKKK'; - public const DATETIME_LONG = 'KKKK'; - public const DATETIME_MEDIUM = 'KKK'; - public const DATETIME_SHORT = 'KK'; - public const ATOM = 'OOO'; - public const COOKIE = 'CCC'; - public const RFC_822 = 'R'; - public const RFC_850 = 'RR'; - public const RFC_1036 = 'RRR'; - public const RFC_1123 = 'RRRR'; - public const RFC_3339 = 'RRRRR'; - public const RSS = 'SSS'; - public const W3C = 'WWW'; - - /** - * Generates the standard date object, could be a unix timestamp, localized date, - * string, integer, array and so on. Also parts of dates or time are supported - * Always set the default timezone: http://php.net/date_default_timezone_set - * For example, in your bootstrap: date_default_timezone_set('America/Los_Angeles'); - * For detailed instructions please look in the docu. - * - * @param array|int|string|Zend_Date $date OPTIONAL Date value or value of date part to set - * ,depending on $part. If null the actual time is set - * @param string $part OPTIONAL Defines the input format of $date - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function __construct($date = null, $part = null, $locale = null) - { - if (is_object($date) and !($date instanceof Zend_TimeSync_Protocol) - and !($date instanceof Zend_Date)) { - if ($locale instanceof Zend_Locale) { - $locale = $date; - $date = null; - $part = null; - } else { - $date = (string) $date; - } - } - - if (($date !== null) and !is_array($date) and !($date instanceof Zend_TimeSync_Protocol) - and !($date instanceof Zend_Date) and !defined($date) and Zend_Locale::isLocale($date, true, false)) { - $locale = $date; - $date = null; - $part = null; - } elseif (($part !== null) and !defined($part) and Zend_Locale::isLocale($part, true, false)) { - $locale = $part; - $part = null; - } - - $this->setLocale($locale); - if (is_string($date) && ($part === null) && (strlen($date) <= 5)) { - $part = $date; - $date = null; - } - - if ($date === null) { - if ($part === null) { - $date = time(); - } elseif ($part !== self::TIMESTAMP) { - $date = self::now($locale); - $date = $date->get($part); - } - } - - if ($date instanceof Zend_TimeSync_Protocol) { - $date = $date->getInfo(); - $date = $this->_getTime($date['offset']); - $part = null; - } elseif (parent::$_defaultOffset != 0) { - $date = $this->_getTime(parent::$_defaultOffset); - } - - // set the timezone and offset for $this - $zone = @date_default_timezone_get(); - $this->setTimezone($zone); - - // try to get timezone from date-string - if (!is_int($date)) { - $zone = $this->getTimezoneFromString($date); - $this->setTimezone($zone); - } - - // set datepart - if (($part !== null && $part !== self::TIMESTAMP) or (!is_numeric($date))) { - // switch off dst handling for value setting - $this->setUnixTimestamp($this->getGmtOffset()); - $this->set($date, $part, $this->_locale); - - // DST fix - if (is_array($date) === true) { - if (!isset($date['hour'])) { - $date['hour'] = 0; - } - - $hour = $this->toString('H', 'iso', true); - $hour = $date['hour'] - $hour; - switch ($hour) { - case 1: - case -23: - $this->addTimestamp(3600); - - break; - case -1: - case 23: - $this->subTimestamp(3600); - - break; - case 2: - case -22: - $this->addTimestamp(7200); - - break; - case -2: - case 22: - $this->subTimestamp(7200); - - break; - } - } - } else { - $this->setUnixTimestamp($date); - } - } - - /** - * Sets class wide options, if no option was given, the actual set options will be returned. - * - * @param array $options Options to set - * - * @return Options array if no option was given - */ - public static function setOptions(array $options = []) - { - if (empty($options)) { - return self::$_options; - } - - foreach ($options as $name => $value) { - $name = strtolower($name); - - if (array_key_exists($name, self::$_options)) { - switch ($name) { - case 'format_type': - if ((strtolower($value) != 'php') && (strtolower($value) != 'iso')) { - throw new Zend_Date_Exception("Unknown format type ($value) for dates, only 'iso' and 'php' supported", 0, null, $value); - } - - break; - case 'fix_dst': - if (!is_bool($value)) { - throw new Zend_Date_Exception("'fix_dst' has to be boolean", 0, null, $value); - } - - break; - case 'extend_month': - if (!is_bool($value)) { - throw new Zend_Date_Exception("'extend_month' has to be boolean", 0, null, $value); - } - - break; - case 'cache': - if ($value === null) { - parent::$_cache = null; - } else { - if (!$value instanceof Zend_Cache_Core) { - throw new Zend_Date_Exception('Instance of Zend_Cache expected'); - } - - parent::$_cache = $value; - parent::$_cacheTags = Zend_Date_DateObject::_getTagSupportForCache(); - Zend_Locale_Data::setCache($value); - } - - break; - case 'timesync': - if ($value === null) { - parent::$_defaultOffset = 0; - } else { - if (!$value instanceof Zend_TimeSync_Protocol) { - throw new Zend_Date_Exception('Instance of Zend_TimeSync expected'); - } - - $date = $value->getInfo(); - parent::$_defaultOffset = $date['offset']; - } - - break; - } - self::$_options[$name] = $value; - } else { - throw new Zend_Date_Exception("Unknown option: $name = $value"); - } - } - } - - /** - * Returns this object's internal UNIX timestamp (equivalent to Zend_Date::TIMESTAMP). - * If the timestamp is too large for integers, then the return value will be a string. - * This function does not return the timestamp as an object. - * Use clone() or copyPart() instead. - * - * @return int|string UNIX timestamp - */ - public function getTimestamp() - { - return $this->getUnixTimestamp(); - } - - /** - * Returns the calculated timestamp - * HINT: timestamps are always GMT. - * - * @param string $calc Type of calculation to make - * @param array|int|string|Zend_Date $stamp Timestamp to calculate, when null the actual timestamp is calculated - * - * @return int|Zend_Date - */ - private function _timestamp($calc, $stamp) - { - if ($stamp instanceof Zend_Date) { - // extract timestamp from object - $stamp = $stamp->getTimestamp(); - } - - if (is_array($stamp)) { - if (isset($stamp['timestamp']) === true) { - $stamp = $stamp['timestamp']; - } else { - throw new Zend_Date_Exception('no timestamp given in array'); - } - } - - if ($calc === 'set') { - $return = $this->setUnixTimestamp($stamp); - } else { - $return = $this->_calcdetail($calc, $stamp, self::TIMESTAMP, null); - } - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new timestamp. - * - * @param array|int|string|Zend_Date $timestamp Timestamp to set - * - * @return Zend_Date Provides a fluent interface - */ - public function setTimestamp($timestamp) - { - return $this->_timestamp('set', $timestamp); - } - - /** - * Adds a timestamp. - * - * @param array|int|string|Zend_Date $timestamp Timestamp to add - * - * @return Zend_Date Provides a fluent interface - */ - public function addTimestamp($timestamp) - { - return $this->_timestamp('add', $timestamp); - } - - /** - * Subtracts a timestamp. - * - * @param array|int|string|Zend_Date $timestamp Timestamp to sub - * - * @return Zend_Date Provides a fluent interface - */ - public function subTimestamp($timestamp) - { - return $this->_timestamp('sub', $timestamp); - } - - /** - * Compares two timestamps, returning the difference as integer. - * - * @param array|int|string|Zend_Date $timestamp Timestamp to compare - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareTimestamp($timestamp) - { - return $this->_timestamp('cmp', $timestamp); - } - - /** - * Returns a string representation of the object - * Supported format tokens are: - * G - era, y - year, Y - ISO year, M - month, w - week of year, D - day of year, d - day of month - * E - day of week, e - number of weekday (1-7), h - hour 1-12, H - hour 0-23, m - minute, s - second - * A - milliseconds of day, z - timezone, Z - timezone offset, S - fractional second, a - period of day. - * - * Additionally format tokens but non ISO conform are: - * SS - day suffix, eee - php number of weekday(0-6), ddd - number of days per month - * l - Leap year, B - swatch internet time, I - daylight saving time, X - timezone offset in seconds - * r - RFC2822 format, U - unix timestamp - * - * Not supported ISO tokens are - * u - extended year, Q - quarter, q - quarter, L - stand alone month, W - week of month - * F - day of week of month, g - modified julian, c - stand alone weekday, k - hour 0-11, K - hour 1-24 - * v - wall zone - * - * @param string $format OPTIONAL Rule for formatting output. If null the default date format is used - * @param string $type OPTIONAL Type for the format string which overrides the standard setting - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return string - */ - public function toString($format = null, $type = null, $locale = null) - { - if (is_object($format)) { - if ($format instanceof Zend_Locale) { - $locale = $format; - $format = null; - } else { - $format = (string) $format; - } - } - - if (is_object($type)) { - if ($type instanceof Zend_Locale) { - $locale = $type; - $type = null; - } else { - $type = (string) $type; - } - } - - if (($format !== null) && !defined($format) - && ($format != 'ee') && ($format != 'ss') && ($format != 'GG') && ($format != 'MM') && ($format != 'EE') && ($format != 'TT') - && Zend_Locale::isLocale($format, null, false)) { - $locale = $format; - $format = null; - } - - if (($type !== null) and ($type != 'php') and ($type != 'iso') - and Zend_Locale::isLocale($type, null, false)) { - $locale = $type; - $type = null; - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($format === null) { - $format = Zend_Locale_Format::getDateFormat($locale) . ' ' . Zend_Locale_Format::getTimeFormat($locale); - } elseif (((self::$_options['format_type'] == 'php') && ($type === null)) or ($type == 'php')) { - $format = Zend_Locale_Format::convertPhpToIsoFormat($format); - } - - return $this->date($this->_toToken($format, $locale), $this->getUnixTimestamp(), false); - } - - /** - * Returns a string representation of the date which is equal with the timestamp. - * - * @return string - */ - public function __toString() - { - return $this->toString(null, $this->_locale); - } - - /** - * Returns a integer representation of the object - * But returns false when the given part is no value f.e. Month-Name. - * - * @param int|string|Zend_Date $part OPTIONAL Defines the date or datepart to return as integer - * - * @return false|int - */ - public function toValue($part = null) - { - $result = $this->get($part); - if (is_numeric($result)) { - return intval("$result"); - } - - return false; - } - - /** - * Returns an array representation of the object. - * - * @return array - */ - public function toArray() - { - return ['day' => $this->toString(self::DAY_SHORT, 'iso'), - 'month' => $this->toString(self::MONTH_SHORT, 'iso'), - 'year' => $this->toString(self::YEAR, 'iso'), - 'hour' => $this->toString(self::HOUR_SHORT, 'iso'), - 'minute' => $this->toString(self::MINUTE_SHORT, 'iso'), - 'second' => $this->toString(self::SECOND_SHORT, 'iso'), - 'timezone' => $this->toString(self::TIMEZONE, 'iso'), - 'timestamp' => $this->toString(self::TIMESTAMP, 'iso'), - 'weekday' => $this->toString(self::WEEKDAY_8601, 'iso'), - 'dayofyear' => $this->toString(self::DAY_OF_YEAR, 'iso'), - 'week' => $this->toString(self::WEEK, 'iso'), - 'gmtsecs' => $this->toString(self::TIMEZONE_SECS, 'iso'), ]; - } - - /** - * Returns a representation of a date or datepart - * This could be for example a localized monthname, the time without date, - * the era or only the fractional seconds. There are about 50 different supported date parts. - * For a complete list of supported datepart values look into the docu. - * - * @param string $part OPTIONAL Part of the date to return, if null the timestamp is returned - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return string date or datepart - */ - public function get($part = null, $locale = null) - { - if ($locale === null) { - $locale = $this->getLocale(); - } - - if (($part !== null) && !defined($part) - && ($part != 'ee') && ($part != 'ss') && ($part != 'GG') && ($part != 'MM') && ($part != 'EE') && ($part != 'TT') - && Zend_Locale::isLocale($part, null, false)) { - $locale = $part; - $part = null; - } - - if ($part === null) { - $part = self::TIMESTAMP; - } elseif (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - return $this->date($this->_toToken($part, $locale), $this->getUnixTimestamp(), false); - } - - /** - * Internal method to apply tokens. - * - * @param string $part - * @param string $locale - * - * @return string - */ - private function _toToken($part, $locale) - { - // get format tokens - $comment = false; - $format = ''; - $orig = ''; - for ($i = 0; isset($part[$i]); ++$i) { - if ($part[$i] == "'") { - $comment = $comment ? false : true; - if (isset($part[$i + 1]) && ($part[$i + 1] == "'")) { - $comment = $comment ? false : true; - $format .= "\\'"; - ++$i; - } - - $orig = ''; - - continue; - } - - if ($comment) { - $format .= '\\' . $part[$i]; - $orig = ''; - } else { - $orig .= $part[$i]; - if (!isset($part[$i + 1]) || (isset($orig[0]) && ($orig[0] != $part[$i + 1]))) { - $format .= $this->_parseIsoToDate($orig, $locale); - $orig = ''; - } - } - } - - return $format; - } - - /** - * Internal parsing method. - * - * @param string $token - * @param string $locale - * - * @return string - */ - private function _parseIsoToDate($token, $locale) - { - switch ($token) { - case self::DAY: - return 'd'; - - break; - - case self::WEEKDAY_SHORT: - $weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false)); - $day = Zend_Locale_Data::getContent($locale, 'day', ['gregorian', 'format', 'wide', $weekday]); - - return $this->_toComment(iconv_substr($day, 0, 3, 'UTF-8')); - - break; - - case self::DAY_SHORT: - return 'j'; - - break; - - case self::WEEKDAY: - $weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false)); - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'day', ['gregorian', 'format', 'wide', $weekday])); - - break; - - case self::WEEKDAY_8601: - return 'N'; - - break; - - case 'ee': - return $this->_toComment(str_pad($this->date('N', $this->getUnixTimestamp(), false), 2, '0', STR_PAD_LEFT)); - - break; - - case self::DAY_SUFFIX: - return 'S'; - - break; - - case self::WEEKDAY_DIGIT: - return 'w'; - - break; - - case self::DAY_OF_YEAR: - return 'z'; - - break; - - case 'DDD': - return $this->_toComment(str_pad($this->date('z', $this->getUnixTimestamp(), false), 3, '0', STR_PAD_LEFT)); - - break; - - case 'DD': - return $this->_toComment(str_pad($this->date('z', $this->getUnixTimestamp(), false), 2, '0', STR_PAD_LEFT)); - - break; - - case self::WEEKDAY_NARROW: - case 'EEEEE': - $weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false)); - $day = Zend_Locale_Data::getContent($locale, 'day', ['gregorian', 'format', 'abbreviated', $weekday]); - - return $this->_toComment(iconv_substr($day, 0, 1, 'UTF-8')); - - break; - - case self::WEEKDAY_NAME: - $weekday = strtolower($this->date('D', $this->getUnixTimestamp(), false)); - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'day', ['gregorian', 'format', 'abbreviated', $weekday])); - - break; - - case 'w': - $week = $this->date('W', $this->getUnixTimestamp(), false); - - return $this->_toComment(($week[0] == '0') ? $week[1] : $week); - - break; - - case self::WEEK: - return 'W'; - - break; - - case self::MONTH_NAME: - $month = $this->date('n', $this->getUnixTimestamp(), false); - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'month', ['gregorian', 'format', 'wide', $month])); - - break; - - case self::MONTH: - return 'm'; - - break; - - case self::MONTH_NAME_SHORT: - $month = $this->date('n', $this->getUnixTimestamp(), false); - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'month', ['gregorian', 'format', 'abbreviated', $month])); - - break; - - case self::MONTH_SHORT: - return 'n'; - - break; - - case self::MONTH_DAYS: - return 't'; - - break; - - case self::MONTH_NAME_NARROW: - $month = $this->date('n', $this->getUnixTimestamp(), false); - $mon = Zend_Locale_Data::getContent($locale, 'month', ['gregorian', 'format', 'abbreviated', $month]); - - return $this->_toComment(iconv_substr($mon, 0, 1, 'UTF-8')); - - break; - - case self::LEAPYEAR: - return 'L'; - - break; - - case self::YEAR_8601: - return 'o'; - - break; - - case self::YEAR: - return 'Y'; - - break; - - case self::YEAR_SHORT: - return 'y'; - - break; - - case self::YEAR_SHORT_8601: - return $this->_toComment(substr($this->date('o', $this->getUnixTimestamp(), false), -2, 2)); - - break; - - case self::MERIDIEM: - $am = $this->date('a', $this->getUnixTimestamp(), false); - if ($am == 'am') { - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'am')); - } - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'pm')); - - break; - - case self::SWATCH: - return 'B'; - - break; - - case self::HOUR_SHORT_AM: - return 'g'; - - break; - - case self::HOUR_SHORT: - return 'G'; - - break; - - case self::HOUR_AM: - return 'h'; - - break; - - case self::HOUR: - return 'H'; - - break; - - case self::MINUTE: - return $this->_toComment(str_pad($this->date('i', $this->getUnixTimestamp(), false), 2, '0', STR_PAD_LEFT)); - - break; - - case self::SECOND: - return $this->_toComment(str_pad($this->date('s', $this->getUnixTimestamp(), false), 2, '0', STR_PAD_LEFT)); - - break; - - case self::MINUTE_SHORT: - return 'i'; - - break; - - case self::SECOND_SHORT: - return 's'; - - break; - - case self::MILLISECOND: - return $this->_toComment($this->getMilliSecond()); - - break; - - case self::TIMEZONE_NAME: - case 'vvvv': - return 'e'; - - break; - - case self::DAYLIGHT: - return 'I'; - - break; - - case self::GMT_DIFF: - case 'ZZ': - case 'ZZZ': - return 'O'; - - break; - - case self::GMT_DIFF_SEP: - return 'P'; - - break; - - case self::TIMEZONE: - case 'v': - case 'zz': - case 'zzz': - return 'T'; - - break; - - case self::TIMEZONE_SECS: - return 'Z'; - - break; - - case self::ISO_8601: - return 'c'; - - break; - - case self::RFC_2822: - return 'r'; - - break; - - case self::TIMESTAMP: - return 'U'; - - break; - - case self::ERA: - case 'GG': - case 'GGG': - $year = $this->date('Y', $this->getUnixTimestamp(), false); - if ($year < 0) { - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Abbr', '0'])); - } - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Abbr', '1'])); - - break; - - case self::ERA_NARROW: - $year = $this->date('Y', $this->getUnixTimestamp(), false); - if ($year < 0) { - return $this->_toComment(iconv_substr(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Abbr', '0']), 0, 1, 'UTF-8')) . '.'; - } - - return $this->_toComment(iconv_substr(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Abbr', '1']), 0, 1, 'UTF-8')) . '.'; - - break; - - case self::ERA_NAME: - $year = $this->date('Y', $this->getUnixTimestamp(), false); - if ($year < 0) { - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Names', '0'])); - } - - return $this->_toComment(Zend_Locale_Data::getContent($locale, 'era', ['gregorian', 'Names', '1'])); - - break; - - case self::DATES: - return $this->_toToken(Zend_Locale_Format::getDateFormat($locale), $locale); - - break; - - case self::DATE_FULL: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'full']), $locale); - - break; - - case self::DATE_LONG: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'long']), $locale); - - break; - - case self::DATE_MEDIUM: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'medium']), $locale); - - break; - - case self::DATE_SHORT: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'short']), $locale); - - break; - - case self::TIMES: - return $this->_toToken(Zend_Locale_Format::getTimeFormat($locale), $locale); - - break; - - case self::TIME_FULL: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'time', 'full'), $locale); - - break; - - case self::TIME_LONG: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'time', 'long'), $locale); - - break; - - case self::TIME_MEDIUM: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'time', 'medium'), $locale); - - break; - - case self::TIME_SHORT: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'time', 'short'), $locale); - - break; - - case self::DATETIME: - return $this->_toToken(Zend_Locale_Format::getDateTimeFormat($locale), $locale); - - break; - - case self::DATETIME_FULL: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'full']), $locale); - - break; - - case self::DATETIME_LONG: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'long']), $locale); - - break; - - case self::DATETIME_MEDIUM: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'medium']), $locale); - - break; - - case self::DATETIME_SHORT: - return $this->_toToken(Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'short']), $locale); - - break; - - case self::ATOM: - return 'Y\-m\-d\TH\:i\:sP'; - - break; - - case self::COOKIE: - return 'l\, d\-M\-y H\:i\:s e'; - - break; - - case self::RFC_822: - return 'D\, d M y H\:i\:s O'; - - break; - - case self::RFC_850: - return 'l\, d\-M\-y H\:i\:s e'; - - break; - - case self::RFC_1036: - return 'D\, d M y H\:i\:s O'; - - break; - - case self::RFC_1123: - return 'D\, d M Y H\:i\:s O'; - - break; - - case self::RFC_3339: - return 'Y\-m\-d\TH\:i\:sP'; - - break; - - case self::RSS: - return 'D\, d M Y H\:i\:s O'; - - break; - - case self::W3C: - return 'Y\-m\-d\TH\:i\:sP'; - - break; - } - - if ($token == '') { - return ''; - } - - switch ($token[0]) { - case 'y': - if ((strlen($token) == 4) && (abs($this->getUnixTimestamp()) <= 0x7FFFFFFF)) { - return 'Y'; - } - - $length = iconv_strlen($token, 'UTF-8'); - - return $this->_toComment(str_pad($this->date('Y', $this->getUnixTimestamp(), false), $length, '0', STR_PAD_LEFT)); - - break; - - case 'Y': - if ((strlen($token) == 4) && (abs($this->getUnixTimestamp()) <= 0x7FFFFFFF)) { - return 'o'; - } - - $length = iconv_strlen($token, 'UTF-8'); - - return $this->_toComment(str_pad($this->date('o', $this->getUnixTimestamp(), false), $length, '0', STR_PAD_LEFT)); - - break; - - case 'A': - $length = iconv_strlen($token, 'UTF-8'); - $result = substr($this->getMilliSecond(), 0, 3); - $result += $this->date('s', $this->getUnixTimestamp(), false) * 1000; - $result += $this->date('i', $this->getUnixTimestamp(), false) * 60000; - $result += $this->date('H', $this->getUnixTimestamp(), false) * 3_600_000; - - return $this->_toComment(str_pad($result, $length, '0', STR_PAD_LEFT)); - - break; - } - - return $this->_toComment($token); - } - - /** - * Private function to make a comment of a token. - * - * @param string $token - * - * @return string - */ - private function _toComment($token) - { - $token = str_split($token); - $result = ''; - foreach ($token as $tok) { - $result .= '\\' . $tok; - } - - return $result; - } - - /** - * Return digit from standard names (english) - * Faster implementation than locale aware searching. - * - * @param string $name - * - * @return int Number of this month - */ - private function _getDigitFromName($name) - { - switch ($name) { - case 'Jan': - return 1; - - case 'Feb': - return 2; - - case 'Mar': - return 3; - - case 'Apr': - return 4; - - case 'May': - return 5; - - case 'Jun': - return 6; - - case 'Jul': - return 7; - - case 'Aug': - return 8; - - case 'Sep': - return 9; - - case 'Oct': - return 10; - - case 'Nov': - return 11; - - case 'Dec': - return 12; - - default: - throw new Zend_Date_Exception('Month ($name) is not a known month'); - } - } - - /** - * Counts the exact year number - * < 70 - 2000 added, >70 < 100 - 1900, others just returned. - * - * @param int $value year number - * - * @return int Number of year - */ - public static function getFullYear($value) - { - if ($value >= 0) { - if ($value < 70) { - $value += 2000; - } elseif ($value < 100) { - $value += 1900; - } - } - - return $value; - } - - /** - * Sets the given date as new date or a given datepart as new datepart returning the new datepart - * This could be for example a localized dayname, the date without time, - * the month or only the seconds. There are about 50 different supported date parts. - * For a complete list of supported datepart values look into the docu. - * - * @param array|int|string|Zend_Date $date Date or datepart to set - * @param string $part OPTIONAL Part of the date to set, if null the timestamp is set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function set($date, $part = null, $locale = null) - { - if (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - $zone = $this->getTimezoneFromString($date); - $this->setTimezone($zone); - - $this->_calculate('set', $date, $part, $locale); - - return $this; - } - - /** - * Adds a date or datepart to the existing date, by extracting $part from $date, - * and modifying this object by adding that part. The $part is then extracted from - * this object and returned as an integer or numeric string (for large values, or $part's - * corresponding to pre-defined formatted date strings). - * This could be for example a ISO 8601 date, the hour the monthname or only the minute. - * There are about 50 different supported date parts. - * For a complete list of supported datepart values look into the docu. - * - * @param array|int|string|Zend_Date $date Date or datepart to add - * @param string $part OPTIONAL Part of the date to add, if null the timestamp is added - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function add($date, $part = self::TIMESTAMP, $locale = null) - { - if (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - $this->_calculate('add', $date, $part, $locale); - - return $this; - } - - /** - * Subtracts a date from another date. - * This could be for example a RFC2822 date, the time, - * the year or only the timestamp. There are about 50 different supported date parts. - * For a complete list of supported datepart values look into the docu - * Be aware: Adding -2 Months is not equal to Subtracting 2 Months !!! - * - * @param array|int|string|Zend_Date $date Date or datepart to subtract - * @param string $part OPTIONAL Part of the date to sub, if null the timestamp is subtracted - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function sub($date, $part = self::TIMESTAMP, $locale = null) - { - if (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - $this->_calculate('sub', $date, $part, $locale); - - return $this; - } - - /** - * Compares a date or datepart with the existing one. - * Returns -1 if earlier, 0 if equal and 1 if later. - * - * @param array|int|string|Zend_Date $date Date or datepart to compare with the date object - * @param string $part OPTIONAL Part of the date to compare, if null the timestamp is subtracted - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compare($date, $part = self::TIMESTAMP, $locale = null) - { - if (self::$_options['format_type'] == 'php') { - $part = Zend_Locale_Format::convertPhpToIsoFormat($part); - } - - $compare = $this->_calculate('cmp', $date, $part, $locale); - - if ($compare > 0) { - return 1; - } - if ($compare < 0) { - return -1; - } - - return 0; - } - - /** - * Returns a new instance of Zend_Date with the selected part copied. - * To make an exact copy, use PHP's clone keyword. - * For a complete list of supported date part values look into the docu. - * If a date part is copied, all other date parts are set to standard values. - * For example: If only YEAR is copied, the returned date object is equal to - * 01-01-YEAR 00:00:00 (01-01-1970 00:00:00 is equal to timestamp 0) - * If only HOUR is copied, the returned date object is equal to - * 01-01-1970 HOUR:00:00 (so $this contains a timestamp equal to a timestamp of 0 plus HOUR). - * - * @param string $part Part of the date to compare, if null the timestamp is subtracted - * @param string|Zend_Locale $locale OPTIONAL New object's locale. No adjustments to timezone are made. - * - * @return Zend_Date New clone with requested part - */ - public function copyPart($part, $locale = null) - { - $clone = clone $this; // copy all instance variables - $clone->setUnixTimestamp(0); // except the timestamp - if ($locale != null) { - $clone->setLocale($locale); // set an other locale if selected - } - $clone->set($this, $part); - - return $clone; - } - - /** - * Internal function, returns the offset of a given timezone. - * - * @param string $zone - * - * @return int - */ - public function getTimezoneFromString($zone) - { - if (is_array($zone)) { - return $this->getTimezone(); - } - - if ($zone instanceof Zend_Date) { - return $zone->getTimezone(); - } - - $match = []; - preg_match('/\dZ$/', $zone, $match); - if (!empty($match)) { - return 'Etc/UTC'; - } - - preg_match('/([+-]\d{2}):{0,1}\d{2}/', $zone, $match); - if (!empty($match) and ($match[count($match) - 1] <= 14) and ($match[count($match) - 1] >= -12)) { - $zone = 'Etc/GMT'; - $zone .= ($match[count($match) - 1] < 0) ? '+' : '-'; - $zone .= (int) abs($match[count($match) - 1]); - - return $zone; - } - - preg_match('/([[:alpha:]\/_]{3,30})(?!.*([[:alpha:]\/]{3,30}))/', $zone, $match); - - try { - if (!empty($match) and (!is_int($match[count($match) - 1]))) { - $oldzone = $this->getTimezone(); - $this->setTimezone($match[count($match) - 1]); - $result = $this->getTimezone(); - $this->setTimezone($oldzone); - if ($result !== $oldzone) { - return $match[count($match) - 1]; - } - } - } catch (Exception $e) { - // fall through - } - - return $this->getTimezone(); - } - - /** - * Calculates the date or object. - * - * @param string $calc Calculation to make - * @param int|string $date Date for calculation - * @param int|string $comp Second date for calculation - * @param bool|int $dst Use dst correction if option is set - * - * @return int|string|Zend_Date new timestamp or Zend_Date depending on calculation - */ - private function _assign($calc, $date, $comp = 0, $dst = false) - { - switch ($calc) { - case 'set': - if (!empty($comp)) { - $this->setUnixTimestamp(call_user_func(Zend_Locale_Math::$sub, $this->getUnixTimestamp(), $comp)); - } - $this->setUnixTimestamp(call_user_func(Zend_Locale_Math::$add, $this->getUnixTimestamp(), $date)); - $value = $this->getUnixTimestamp(); - - break; - case 'add': - $this->setUnixTimestamp(call_user_func(Zend_Locale_Math::$add, $this->getUnixTimestamp(), $date)); - $value = $this->getUnixTimestamp(); - - break; - case 'sub': - $this->setUnixTimestamp(call_user_func(Zend_Locale_Math::$sub, $this->getUnixTimestamp(), $date)); - $value = $this->getUnixTimestamp(); - - break; - default: - // cmp - compare - return call_user_func(Zend_Locale_Math::$comp, $comp, $date); - - break; - } - - // dst-correction if 'fix_dst' = true and dst !== false but only for non UTC and non GMT - if ((self::$_options['fix_dst'] === true) and ($dst !== false) and ($this->_dst === true)) { - $hour = $this->toString(self::HOUR, 'iso'); - if ($hour != $dst) { - if (($dst == ($hour + 1)) or ($dst == ($hour - 23))) { - $value += 3600; - } elseif (($dst == ($hour - 1)) or ($dst == ($hour + 23))) { - $value -= 3600; - } - $this->setUnixTimestamp($value); - } - } - - return $this->getUnixTimestamp(); - } - - /** - * Calculates the date or object. - * - * @param string $calc Calculation to make, one of: 'add'|'sub'|'cmp'|'copy'|'set' - * @param array|int|string|Zend_Date $date Date or datepart to calculate with - * @param string $part Part of the date to calculate, if null the timestamp is used - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|string|Zend_Date new timestamp - */ - private function _calculate($calc, $date, $part, $locale) - { - $found = null; - if ($date === null) { - throw new Zend_Date_Exception('parameter $date must be set, null is not allowed'); - } - - if (($part !== null) && (strlen($part) !== 2) && (Zend_Locale::isLocale($part, null, false))) { - $locale = $part; - $part = null; - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - $locale = (string) $locale; - - // Create date parts - $year = $this->toString(self::YEAR, 'iso'); - $month = $this->toString(self::MONTH_SHORT, 'iso'); - $day = $this->toString(self::DAY_SHORT, 'iso'); - $hour = $this->toString(self::HOUR_SHORT, 'iso'); - $minute = $this->toString(self::MINUTE_SHORT, 'iso'); - $second = $this->toString(self::SECOND_SHORT, 'iso'); - // If object extract value - if ($date instanceof Zend_Date) { - $date = $date->toString($part, 'iso', $locale); - } - - if (is_array($date) === true) { - if (empty($part) === false) { - switch ($part) { - // Fall through - case self::DAY: - case self::DAY_SHORT: - if (isset($date['day']) === true) { - $date = $date['day']; - } - - break; - // Fall through - case self::WEEKDAY_SHORT: - case self::WEEKDAY: - case self::WEEKDAY_8601: - case self::WEEKDAY_DIGIT: - case self::WEEKDAY_NARROW: - case self::WEEKDAY_NAME: - if (isset($date['weekday']) === true) { - $date = $date['weekday']; - $part = self::WEEKDAY_DIGIT; - } - - break; - case self::DAY_OF_YEAR: - if (isset($date['day_of_year']) === true) { - $date = $date['day_of_year']; - } - - break; - // Fall through - case self::MONTH: - case self::MONTH_SHORT: - case self::MONTH_NAME: - case self::MONTH_NAME_SHORT: - case self::MONTH_NAME_NARROW: - if (isset($date['month']) === true) { - $date = $date['month']; - } - - break; - // Fall through - case self::YEAR: - case self::YEAR_SHORT: - case self::YEAR_8601: - case self::YEAR_SHORT_8601: - if (isset($date['year']) === true) { - $date = $date['year']; - } - - break; - // Fall through - case self::HOUR: - case self::HOUR_AM: - case self::HOUR_SHORT: - case self::HOUR_SHORT_AM: - if (isset($date['hour']) === true) { - $date = $date['hour']; - } - - break; - // Fall through - case self::MINUTE: - case self::MINUTE_SHORT: - if (isset($date['minute']) === true) { - $date = $date['minute']; - } - - break; - // Fall through - case self::SECOND: - case self::SECOND_SHORT: - if (isset($date['second']) === true) { - $date = $date['second']; - } - - break; - // Fall through - case self::TIMEZONE: - case self::TIMEZONE_NAME: - if (isset($date['timezone']) === true) { - $date = $date['timezone']; - } - - break; - case self::TIMESTAMP: - if (isset($date['timestamp']) === true) { - $date = $date['timestamp']; - } - - break; - case self::WEEK: - if (isset($date['week']) === true) { - $date = $date['week']; - } - - break; - case self::TIMEZONE_SECS: - if (isset($date['gmtsecs']) === true) { - $date = $date['gmtsecs']; - } - - break; - default: - throw new Zend_Date_Exception("datepart for part ($part) not found in array"); - - break; - } - } else { - $hours = 0; - if (isset($date['hour']) === true) { - $hours = $date['hour']; - } - $minutes = 0; - if (isset($date['minute']) === true) { - $minutes = $date['minute']; - } - $seconds = 0; - if (isset($date['second']) === true) { - $seconds = $date['second']; - } - $months = 0; - if (isset($date['month']) === true) { - $months = $date['month']; - } - $days = 0; - if (isset($date['day']) === true) { - $days = $date['day']; - } - $years = 0; - if (isset($date['year']) === true) { - $years = $date['year']; - } - - return $this->_assign($calc, $this->mktime($hours, $minutes, $seconds, $months, $days, $years, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), $hour); - } - } - - // $date as object, part of foreign date as own date - switch ($part) { - // day formats - case self::DAY: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true), - $this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); - - break; - - case self::WEEKDAY_SHORT: - $daylist = Zend_Locale_Data::getList($locale, 'day'); - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - $cnt = 0; - - foreach ($daylist as $key => $value) { - if (strtoupper(iconv_substr($value, 0, 3, 'UTF-8')) == strtoupper($date)) { - $found = $cnt; - - break; - } - ++$cnt; - } - - // Weekday found - if ($cnt < 7) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::DAY_SHORT: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true), - $this->mktime(0, 0, 0, 1, 1 + intval($day), 1970, true), $hour); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); - - break; - - case self::WEEKDAY: - $daylist = Zend_Locale_Data::getList($locale, 'day'); - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - $cnt = 0; - - foreach ($daylist as $key => $value) { - if (strtoupper($value) == strtoupper($date)) { - $found = $cnt; - - break; - } - ++$cnt; - } - - // Weekday found - if ($cnt < 7) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::WEEKDAY_8601: - $weekday = (int) $this->toString(self::WEEKDAY_8601, 'iso', $locale); - if ((intval($date) > 0) and (intval($date) < 8)) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + intval($date), 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::DAY_SUFFIX: - throw new Zend_Date_Exception('day suffix not supported', 0, null, $date); - - break; - - case self::WEEKDAY_DIGIT: - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - if (is_numeric($date) and (intval($date) >= 0) and (intval($date) < 7)) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $date, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::DAY_OF_YEAR: - if (is_numeric($date)) { - if (($calc == 'add') || ($calc == 'sub')) { - $year = 1970; - ++$date; - ++$day; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, $date, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, day expected", 0, null, $date); - - break; - - case self::WEEKDAY_NARROW: - $daylist = Zend_Locale_Data::getList($locale, 'day', ['gregorian', 'format', 'abbreviated']); - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - $cnt = 0; - foreach ($daylist as $key => $value) { - if (strtoupper(iconv_substr($value, 0, 1, 'UTF-8')) == strtoupper($date)) { - $found = $cnt; - - break; - } - ++$cnt; - } - - // Weekday found - if ($cnt < 7) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - case self::WEEKDAY_NAME: - $daylist = Zend_Locale_Data::getList($locale, 'day', ['gregorian', 'format', 'abbreviated']); - $weekday = (int) $this->toString(self::WEEKDAY_DIGIT, 'iso', $locale); - $cnt = 0; - foreach ($daylist as $key => $value) { - if (strtoupper($value) == strtoupper($date)) { - $found = $cnt; - - break; - } - ++$cnt; - } - - // Weekday found - if ($cnt < 7) { - return $this->_assign($calc, $this->mktime(0, 0, 0, 1, 1 + $found, 1970, true), - $this->mktime(0, 0, 0, 1, 1 + $weekday, 1970, true), $hour); - } - - // Weekday not found - throw new Zend_Date_Exception("invalid date ($date) operand, weekday expected", 0, null, $date); - - break; - - // week formats - case self::WEEK: - if (is_numeric($date)) { - $week = (int) $this->toString(self::WEEK, 'iso', $locale); - - return $this->_assign($calc, parent::mktime(0, 0, 0, 1, 1 + ($date * 7), 1970, true), - parent::mktime(0, 0, 0, 1, 1 + ($week * 7), 1970, true), $hour); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, week expected", 0, null, $date); - - break; - - // month formats - case self::MONTH_NAME: - $monthlist = Zend_Locale_Data::getList($locale, 'month'); - $cnt = 0; - foreach ($monthlist as $key => $value) { - if (strtoupper($value) == strtoupper($date)) { - $found = $key; - - break; - } - ++$cnt; - } - $date = array_search($date, $monthlist); - - // Monthname found - if ($cnt < 12) { - $fixday = 0; - if ($calc == 'add') { - $date += $found; - $calc = 'set'; - if (self::$_options['extend_month'] == false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc == 'sub') { - $date = $month - $found; - $calc = 'set'; - if (self::$_options['extend_month'] == false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - // Monthname not found - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - case self::MONTH: - if (is_numeric($date)) { - $fixday = 0; - if ($calc == 'add') { - $date += $month; - $calc = 'set'; - if (self::$_options['extend_month'] == false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc == 'sub') { - $date = $month - $date; - $calc = 'set'; - if (self::$_options['extend_month'] == false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - case self::MONTH_NAME_SHORT: - $monthlist = Zend_Locale_Data::getList($locale, 'month', ['gregorian', 'format', 'abbreviated']); - $cnt = 0; - foreach ($monthlist as $key => $value) { - if (strtoupper($value) == strtoupper($date)) { - $found = $key; - - break; - } - ++$cnt; - } - $date = array_search($date, $monthlist); - - // Monthname found - if ($cnt < 12) { - $fixday = 0; - if ($calc == 'add') { - $date += $found; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc == 'sub') { - $date = $month - $found; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - // Monthname not found - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - case self::MONTH_SHORT: - if (is_numeric($date) === true) { - $fixday = 0; - if ($calc === 'add') { - $date += $month; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc === 'sub') { - $date = $month - $date; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - case self::MONTH_DAYS: - throw new Zend_Date_Exception('month days not supported', 0, null, $date); - - break; - - case self::MONTH_NAME_NARROW: - $monthlist = Zend_Locale_Data::getList($locale, 'month', ['gregorian', 'stand-alone', 'narrow']); - $cnt = 0; - foreach ($monthlist as $key => $value) { - if (strtoupper($value) === strtoupper($date)) { - $found = $key; - - break; - } - ++$cnt; - } - $date = array_search($date, $monthlist); - - // Monthname found - if ($cnt < 12) { - $fixday = 0; - if ($calc === 'add') { - $date += $found; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } elseif ($calc === 'sub') { - $date = $month - $found; - $calc = 'set'; - if (self::$_options['extend_month'] === false) { - $parts = $this->getDateParts($this->mktime($hour, $minute, $second, $date, $day, $year, false)); - if ($parts['mday'] != $day) { - $fixday = ($parts['mday'] < $day) ? -$parts['mday'] : ($parts['mday'] - $day); - } - } - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $date, $day + $fixday, $year, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), $hour); - } - - // Monthname not found - throw new Zend_Date_Exception("invalid date ($date) operand, month expected", 0, null, $date); - - break; - - // year formats - case self::LEAPYEAR: - throw new Zend_Date_Exception('leap year not supported', 0, null, $date); - - break; - - case self::YEAR_8601: - if (is_numeric($date)) { - if ($calc === 'add') { - $date += $year; - $calc = 'set'; - } elseif ($calc === 'sub') { - $date = $year - $date; - $calc = 'set'; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, intval($date), true), - $this->mktime(0, 0, 0, $month, $day, $year, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); - - break; - - case self::YEAR: - if (is_numeric($date)) { - if ($calc === 'add') { - $date += $year; - $calc = 'set'; - } elseif ($calc === 'sub') { - $date = $year - $date; - $calc = 'set'; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, intval($date), true), - $this->mktime(0, 0, 0, $month, $day, $year, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); - - break; - - case self::YEAR_SHORT: - if (is_numeric($date)) { - $date = intval($date); - if (($calc == 'set') || ($calc == 'cmp')) { - $date = self::getFullYear($date); - } - if ($calc === 'add') { - $date += $year; - $calc = 'set'; - } elseif ($calc === 'sub') { - $date = $year - $date; - $calc = 'set'; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, $date, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); - - break; - - case self::YEAR_SHORT_8601: - if (is_numeric($date)) { - $date = intval($date); - if (($calc === 'set') || ($calc === 'cmp')) { - $date = self::getFullYear($date); - } - if ($calc === 'add') { - $date += $year; - $calc = 'set'; - } elseif ($calc === 'sub') { - $date = $year - $date; - $calc = 'set'; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, $month, $day, $date, true), - $this->mktime(0, 0, 0, $month, $day, $year, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, year expected", 0, null, $date); - - break; - - // time formats - case self::MERIDIEM: - throw new Zend_Date_Exception('meridiem not supported', 0, null, $date); - - break; - - case self::SWATCH: - if (is_numeric($date)) { - $rest = intval($date); - $hours = floor($rest * 24 / 1000); - $rest = $rest - ($hours * 1000 / 24); - $minutes = floor($rest * 1440 / 1000); - $rest = $rest - ($minutes * 1000 / 1440); - $seconds = floor($rest * 86400 / 1000); - - return $this->_assign($calc, $this->mktime($hours, $minutes, $seconds, 1, 1, 1970, true), - $this->mktime($hour, $minute, $second, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, swatchstamp expected", 0, null, $date); - - break; - - case self::HOUR_SHORT_AM: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true), - $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); - - break; - - case self::HOUR_SHORT: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true), - $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); - - break; - - case self::HOUR_AM: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true), - $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); - - break; - - case self::HOUR: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(intval($date), 0, 0, 1, 1, 1970, true), - $this->mktime($hour, 0, 0, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, hour expected", 0, null, $date); - - break; - - case self::MINUTE: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, intval($date), 0, 1, 1, 1970, true), - $this->mktime(0, $minute, 0, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, minute expected", 0, null, $date); - - break; - - case self::SECOND: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, 0, intval($date), 1, 1, 1970, true), - $this->mktime(0, 0, $second, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, second expected", 0, null, $date); - - break; - - case self::MILLISECOND: - if (is_numeric($date)) { - switch ($calc) { - case 'set': - return $this->setMillisecond($date); - - break; - case 'add': - return $this->addMillisecond($date); - - break; - case 'sub': - return $this->subMillisecond($date); - - break; - } - - return $this->compareMillisecond($date); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, milliseconds expected", 0, null, $date); - - break; - - case self::MINUTE_SHORT: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, intval($date), 0, 1, 1, 1970, true), - $this->mktime(0, $minute, 0, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, minute expected", 0, null, $date); - - break; - - case self::SECOND_SHORT: - if (is_numeric($date)) { - return $this->_assign($calc, $this->mktime(0, 0, intval($date), 1, 1, 1970, true), - $this->mktime(0, 0, $second, 1, 1, 1970, true), false); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, second expected", 0, null, $date); - - break; - - // timezone formats - // break intentionally omitted - case self::TIMEZONE_NAME: - case self::TIMEZONE: - case self::TIMEZONE_SECS: - throw new Zend_Date_Exception('timezone not supported', 0, null, $date); - - break; - - case self::DAYLIGHT: - throw new Zend_Date_Exception('daylight not supported', 0, null, $date); - - break; - - case self::GMT_DIFF: - case self::GMT_DIFF_SEP: - throw new Zend_Date_Exception('gmtdiff not supported', 0, null, $date); - - break; - - // date strings - case self::ISO_8601: - // (-)YYYY-MM-dd - preg_match('/^(-{0,1}\d{4})-(\d{2})-(\d{2})/', $date, $datematch); - // (-)YY-MM-dd - if (empty($datematch)) { - preg_match('/^(-{0,1}\d{2})-(\d{2})-(\d{2})/', $date, $datematch); - } - // (-)YYYYMMdd - if (empty($datematch)) { - preg_match('/^(-{0,1}\d{4})(\d{2})(\d{2})/', $date, $datematch); - } - // (-)YYMMdd - if (empty($datematch)) { - preg_match('/^(-{0,1}\d{2})(\d{2})(\d{2})/', $date, $datematch); - } - $tmpdate = $date; - if (!empty($datematch)) { - $dateMatchCharCount = iconv_strlen($datematch[0], 'UTF-8'); - $tmpdate = iconv_substr($date, - $dateMatchCharCount, - iconv_strlen($date, 'UTF-8') - $dateMatchCharCount, - 'UTF-8'); - } - // (T)hh:mm:ss - preg_match('/[T,\s]{0,1}(\d{2}):(\d{2}):(\d{2})/', $tmpdate, $timematch); - // (T)hhmmss - if (empty($timematch)) { - preg_match('/[T,\s]{0,1}(\d{2})(\d{2})(\d{2})/', $tmpdate, $timematch); - } - // (T)hh:mm - if (empty($timematch)) { - preg_match('/[T,\s]{0,1}(\d{2}):(\d{2})/', $tmpdate, $timematch); - } - // (T)hhmm - if (empty($timematch)) { - preg_match('/[T,\s]{0,1}(\d{2})(\d{2})/', $tmpdate, $timematch); - } - if (empty($datematch) and empty($timematch)) { - throw new Zend_Date_Exception("unsupported ISO8601 format ($date)", 0, null, $date); - } - if (!empty($timematch)) { - $timeMatchCharCount = iconv_strlen($timematch[0], 'UTF-8'); - $tmpdate = iconv_substr($tmpdate, - $timeMatchCharCount, - iconv_strlen($tmpdate, 'UTF-8') - $timeMatchCharCount, - 'UTF-8'); - } - if (empty($datematch)) { - $datematch[1] = 1970; - $datematch[2] = 1; - $datematch[3] = 1; - } elseif (iconv_strlen($datematch[1], 'UTF-8') == 2) { - $datematch[1] = self::getFullYear($datematch[1]); - } - if (empty($timematch)) { - $timematch[1] = 0; - $timematch[2] = 0; - $timematch[3] = 0; - } - if (!isset($timematch[3])) { - $timematch[3] = 0; - } - - if (($calc == 'set') || ($calc == 'cmp')) { - --$datematch[2]; - --$month; - --$datematch[3]; - --$day; - $datematch[1] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($timematch[1], $timematch[2], $timematch[3], 1 + $datematch[2], 1 + $datematch[3], 1970 + $datematch[1], false), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, false), false); - - break; - - case self::RFC_2822: - $result = preg_match('/^\w{3},\s(\d{1,2})\s(\w{3})\s(\d{4})\s' - . '(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]' - . '{1}\d{4}|\w{1,20})$/', $date, $match); - - if (!$result) { - throw new Zend_Date_Exception("no RFC 2822 format ($date)", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], false), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, false), false); - - break; - - case self::TIMESTAMP: - if (is_numeric($date)) { - return $this->_assign($calc, $date, $this->getUnixTimestamp()); - } - - throw new Zend_Date_Exception("invalid date ($date) operand, timestamp expected", 0, null, $date); - - break; - - // additional formats - // break intentionally omitted - case self::ERA: - case self::ERA_NAME: - throw new Zend_Date_Exception('era not supported', 0, null, $date); - - break; - - case self::DATES: - try { - $parsed = Zend_Locale_Format::getDate($date, ['locale' => $locale, 'format_type' => 'iso', 'fix_date' => true]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATE_FULL: - try { - $format = Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'full']); - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATE_LONG: - try { - $format = Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'long']); - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATE_MEDIUM: - try { - $format = Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'medium']); - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATE_SHORT: - try { - $format = Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'short']); - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - $parsed['year'] = self::getFullYear($parsed['year']); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime(0, 0, 0, 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime(0, 0, 0, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIMES: - try { - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - $parsed = Zend_Locale_Format::getTime($date, ['locale' => $locale, 'format_type' => 'iso', 'fix_date' => true]); - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIME_FULL: - try { - $format = Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'full']); - $parsed = Zend_Locale_Format::getTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - - if (!isset($parsed['second'])) { - $parsed['second'] = 0; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIME_LONG: - try { - $format = Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'long']); - $parsed = Zend_Locale_Format::getTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIME_MEDIUM: - try { - $format = Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'medium']); - $parsed = Zend_Locale_Format::getTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::TIME_SHORT: - try { - $format = Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'short']); - $parsed = Zend_Locale_Format::getTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if ($calc != 'set') { - $month = 1; - $day = 1; - $year = 1970; - } - - if (!isset($parsed['second'])) { - $parsed['second'] = 0; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], $month, $day, $year, true), - $this->mktime($hour, $minute, $second, $month, $day, $year, true), false); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME: - try { - $parsed = Zend_Locale_Format::getDateTime($date, ['locale' => $locale, 'format_type' => 'iso', 'fix_date' => true]); - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME_FULL: - try { - $format = Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'full']); - $parsed = Zend_Locale_Format::getDateTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - if (!isset($parsed['second'])) { - $parsed['second'] = 0; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME_LONG: - try { - $format = Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'long']); - $parsed = Zend_Locale_Format::getDateTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME_MEDIUM: - try { - $format = Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'medium']); - $parsed = Zend_Locale_Format::getDateTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - case self::DATETIME_SHORT: - try { - $format = Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'short']); - $parsed = Zend_Locale_Format::getDateTime($date, ['date_format' => $format, 'format_type' => 'iso', 'locale' => $locale]); - - $parsed['year'] = self::getFullYear($parsed['year']); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$parsed['month']; - --$month; - --$parsed['day']; - --$day; - $parsed['year'] -= 1970; - $year -= 1970; - } - - if (!isset($parsed['second'])) { - $parsed['second'] = 0; - } - - return $this->_assign($calc, $this->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], 1 + $parsed['month'], 1 + $parsed['day'], 1970 + $parsed['year'], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), $hour); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - - break; - - // ATOM and RFC_3339 are identical - case self::ATOM: - case self::RFC_3339: - $result = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\d{0,4}([+-]{1}\d{2}:\d{2}|Z)$/', $date, $match); - if (!$result) { - throw new Zend_Date_Exception("invalid date ($date) operand, ATOM format expected", 0, null, $date); - } - - if (($calc == 'set') || ($calc == 'cmp')) { - --$match[2]; - --$month; - --$match[3]; - --$day; - $match[1] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $match[2], 1 + $match[3], 1970 + $match[1], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::COOKIE: - $result = preg_match("/^\w{6,9},\s(\d{2})-(\w{3})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})\s.{3,20}$/", $date, $match); - if (!$result) { - throw new Zend_Date_Exception("invalid date ($date) operand, COOKIE format expected", 0, null, $date); - } - $matchStartPos = iconv_strpos($match[0], ' ', 0, 'UTF-8') + 1; - $match[0] = iconv_substr($match[0], - $matchStartPos, - iconv_strlen($match[0], 'UTF-8') - $matchStartPos, - 'UTF-8'); - - $months = $this->_getDigitFromName($match[2]); - $match[3] = self::getFullYear($match[3]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::RFC_822: - case self::RFC_1036: - // new RFC 822 format, identical to RFC 1036 standard - $result = preg_match('/^\w{0,3},{0,1}\s{0,1}(\d{1,2})\s(\w{3})\s(\d{2})\s(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]{1}\d{4}|\w{1,20})$/', $date, $match); - if (!$result) { - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 822 date format expected", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - $match[3] = self::getFullYear($match[3]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], false), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, false), false); - - break; - - case self::RFC_850: - $result = preg_match('/^\w{6,9},\s(\d{2})-(\w{3})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})\s.{3,21}$/', $date, $match); - if (!$result) { - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 850 date format expected", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - $match[3] = self::getFullYear($match[3]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::RFC_1123: - $result = preg_match('/^\w{0,3},{0,1}\s{0,1}(\d{1,2})\s(\w{3})\s(\d{2,4})\s(\d{2}):(\d{2}):{0,1}(\d{0,2})\s([+-]{1}\d{4}|\w{1,20})$/', $date, $match); - if (!$result) { - throw new Zend_Date_Exception("invalid date ($date) operand, RFC 1123 date format expected", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::RSS: - $result = preg_match('/^\w{3},\s(\d{2})\s(\w{3})\s(\d{2,4})\s(\d{1,2}):(\d{2}):(\d{2})\s.{1,21}$/', $date, $match); - if (!$result) { - throw new Zend_Date_Exception("invalid date ($date) operand, RSS date format expected", 0, null, $date); - } - - $months = $this->_getDigitFromName($match[2]); - $match[3] = self::getFullYear($match[3]); - - if (($calc == 'set') || ($calc == 'cmp')) { - --$months; - --$month; - --$match[1]; - --$day; - $match[3] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $months, 1 + $match[1], 1970 + $match[3], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - case self::W3C: - $result = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})[+-]{1}\d{2}:\d{2}$/', $date, $match); - if (!$result) { - throw new Zend_Date_Exception("invalid date ($date) operand, W3C date format expected", 0, null, $date); - } - - if (($calc == 'set') || ($calc == 'cmp')) { - --$match[2]; - --$month; - --$match[3]; - --$day; - $match[1] -= 1970; - $year -= 1970; - } - - return $this->_assign($calc, $this->mktime($match[4], $match[5], $match[6], 1 + $match[2], 1 + $match[3], 1970 + $match[1], true), - $this->mktime($hour, $minute, $second, 1 + $month, 1 + $day, 1970 + $year, true), false); - - break; - - default: - if (!is_numeric($date) || !empty($part)) { - try { - if (empty($part)) { - $part = Zend_Locale_Format::getDateFormat($locale) . ' '; - $part .= Zend_Locale_Format::getTimeFormat($locale); - } - - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $part, 'locale' => $locale, 'fix_date' => true, 'format_type' => 'iso']); - if ((strpos(strtoupper($part), 'YY') !== false) and (strpos(strtoupper($part), 'YYYY') === false)) { - $parsed['year'] = self::getFullYear($parsed['year']); - } - - if (($calc == 'set') || ($calc == 'cmp')) { - if (isset($parsed['month'])) { - --$parsed['month']; - } else { - $parsed['month'] = 0; - } - - if (isset($parsed['day'])) { - --$parsed['day']; - } else { - $parsed['day'] = 0; - } - - if (!isset($parsed['year'])) { - $parsed['year'] = 1970; - } - } - - return $this->_assign($calc, $this->mktime( - $parsed['hour'] ?? 0, - $parsed['minute'] ?? 0, - $parsed['second'] ?? 0, - isset($parsed['month']) ? (1 + $parsed['month']) : 1, - isset($parsed['day']) ? (1 + $parsed['day']) : 1, - $parsed['year'], - false), $this->getUnixTimestamp(), false); - } catch (Zend_Locale_Exception $e) { - if (!is_numeric($date)) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e, $date); - } - } - } - - return $this->_assign($calc, $date, $this->getUnixTimestamp(), false); - - break; - } - } - - /** - * Returns true when both date objects or date parts are equal. - * For example: - * 15.May.2000 <-> 15.June.2000 Equals only for Day or Year... all other will return false. - * - * @param array|int|string|Zend_Date $date Date or datepart to equal with - * @param string $part OPTIONAL Part of the date to compare, if null the timestamp is used - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return bool - */ - public function equals($date, $part = self::TIMESTAMP, $locale = null) - { - $result = $this->compare($date, $part, $locale); - - if ($result == 0) { - return true; - } - - return false; - } - - /** - * Returns if the given date or datepart is earlier - * For example: - * 15.May.2000 <-> 13.June.1999 will return true for day, year and date, but not for month. - * - * @param array|int|string|Zend_Date $date Date or datepart to compare with - * @param string $part OPTIONAL Part of the date to compare, if null the timestamp is used - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return bool - */ - public function isEarlier($date, $part = null, $locale = null) - { - $result = $this->compare($date, $part, $locale); - - if ($result == -1) { - return true; - } - - return false; - } - - /** - * Returns if the given date or datepart is later - * For example: - * 15.May.2000 <-> 13.June.1999 will return true for month but false for day, year and date - * Returns if the given date is later. - * - * @param array|int|string|Zend_Date $date Date or datepart to compare with - * @param string $part OPTIONAL Part of the date to compare, if null the timestamp is used - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return bool - */ - public function isLater($date, $part = null, $locale = null) - { - $result = $this->compare($date, $part, $locale); - - if ($result == 1) { - return true; - } - - return false; - } - - /** - * Returns only the time of the date as new Zend_Date object - * For example: - * 15.May.2000 10:11:23 will return a dateobject equal to 01.Jan.1970 10:11:23. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getTime($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'H:i:s'; - } else { - $format = self::TIME_MEDIUM; - } - - return $this->copyPart($format, $locale); - } - - /** - * Returns the calculated time. - * - * @param string $calc Calculation to make - * @param array|int|string|Zend_Date $time Time to calculate with, if null the actual time is taken - * @param string $format Timeformat for parsing input - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date new time - */ - private function _time($calc, $time, $format, $locale) - { - if ($time === null) { - throw new Zend_Date_Exception('parameter $time must be set, null is not allowed'); - } - - if ($time instanceof Zend_Date) { - // extract time from object - $time = $time->toString('HH:mm:ss', 'iso'); - } else { - if (is_array($time)) { - if ((isset($time['hour']) === true) or (isset($time['minute']) === true) - or (isset($time['second']) === true)) { - $parsed = $time; - } else { - throw new Zend_Date_Exception('no hour, minute or second given in array'); - } - } else { - if (self::$_options['format_type'] == 'php') { - $format = Zend_Locale_Format::convertPhpToIsoFormat($format); - } - - try { - if ($locale === null) { - $locale = $this->getLocale(); - } - - $parsed = Zend_Locale_Format::getTime($time, ['date_format' => $format, 'locale' => $locale, 'format_type' => 'iso']); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e); - } - } - - if (!array_key_exists('hour', $parsed)) { - $parsed['hour'] = 0; - } - - if (!array_key_exists('minute', $parsed)) { - $parsed['minute'] = 0; - } - - if (!array_key_exists('second', $parsed)) { - $parsed['second'] = 0; - } - - $time = str_pad($parsed['hour'], 2, '0', STR_PAD_LEFT) . ':'; - $time .= str_pad($parsed['minute'], 2, '0', STR_PAD_LEFT) . ':'; - $time .= str_pad($parsed['second'], 2, '0', STR_PAD_LEFT); - } - - $return = $this->_calcdetail($calc, $time, self::TIMES, 'de'); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new time for the date object. Format defines how to parse the time string. - * Also a complete date can be given, but only the time is used for setting. - * For example: dd.MMMM.yyTHH:mm' and 'ss sec'-> 10.May.07T25:11 and 44 sec => 1h11min44sec + 1 day - * Returned is the new date object and the existing date is left as it was before. - * - * @param array|int|string|Zend_Date $time Time to set - * @param string $format OPTIONAL Timeformat for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setTime($time, $format = null, $locale = null) - { - return $this->_time('set', $time, $format, $locale); - } - - /** - * Adds a time to the existing date. Format defines how to parse the time string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: HH:mm:ss -> 10 -> +10 hours. - * - * @param array|int|string|Zend_Date $time Time to add - * @param string $format OPTIONAL Timeformat for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addTime($time, $format = null, $locale = null) - { - return $this->_time('add', $time, $format, $locale); - } - - /** - * Subtracts a time from the existing date. Format defines how to parse the time string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: HH:mm:ss -> 10 -> -10 hours. - * - * @param array|int|string|Zend_Date $time Time to sub - * @param string $format OPTIONAL Timeformat for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent inteface - */ - public function subTime($time, $format = null, $locale = null) - { - return $this->_time('sub', $time, $format, $locale); - } - - /** - * Compares the time from the existing date. Format defines how to parse the time string. - * If only parts are given the other parts are set to default. - * If no format us given, the standardformat of this locale is used. - * For example: HH:mm:ss -> 10 -> 10 hours. - * - * @param array|int|string|Zend_Date $time Time to compare - * @param string $format OPTIONAL Timeformat for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareTime($time, $format = null, $locale = null) - { - return $this->_time('cmp', $time, $format, $locale); - } - - /** - * Returns a clone of $this, with the time part set to 00:00:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getDate($locale = null) - { - $orig = self::$_options['format_type']; - if (self::$_options['format_type'] == 'php') { - self::$_options['format_type'] = 'iso'; - } - - $date = $this->copyPart(self::DATE_MEDIUM, $locale); - $date->addTimestamp($this->getGmtOffset()); - self::$_options['format_type'] = $orig; - - return $date; - } - - /** - * Returns the calculated date. - * - * @param string $calc Calculation to make - * @param array|int|string|Zend_Date $date Date to calculate with, if null the actual date is taken - * @param string $format Date format for parsing - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date new date - */ - private function _date($calc, $date, $format, $locale) - { - if ($date === null) { - throw new Zend_Date_Exception('parameter $date must be set, null is not allowed'); - } - - if ($date instanceof Zend_Date) { - // extract date from object - $date = $date->toString('d.M.y', 'iso'); - } else { - if (is_array($date)) { - if ((isset($date['year']) === true) or (isset($date['month']) === true) - or (isset($date['day']) === true)) { - $parsed = $date; - } else { - throw new Zend_Date_Exception('no day,month or year given in array'); - } - } else { - if ((self::$_options['format_type'] == 'php') && !defined($format)) { - $format = Zend_Locale_Format::convertPhpToIsoFormat($format); - } - - try { - if ($locale === null) { - $locale = $this->getLocale(); - } - - $parsed = Zend_Locale_Format::getDate($date, ['date_format' => $format, 'locale' => $locale, 'format_type' => 'iso']); - if ((strpos(strtoupper($format), 'YY') !== false) and (strpos(strtoupper($format), 'YYYY') === false)) { - $parsed['year'] = self::getFullYear($parsed['year']); - } - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e); - } - } - - if (!array_key_exists('day', $parsed)) { - $parsed['day'] = 1; - } - - if (!array_key_exists('month', $parsed)) { - $parsed['month'] = 1; - } - - if (!array_key_exists('year', $parsed)) { - $parsed['year'] = 0; - } - - $date = $parsed['day'] . '.' . $parsed['month'] . '.' . $parsed['year']; - } - - $return = $this->_calcdetail($calc, $date, self::DATE_MEDIUM, 'de'); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new date for the date object. Format defines how to parse the date string. - * Also a complete date with time can be given, but only the date is used for setting. - * For example: MMMM.yy HH:mm-> May.07 22:11 => 01.May.07 00:00 - * Returned is the new date object and the existing time is left as it was before. - * - * @param array|int|string|Zend_Date $date Date to set - * @param string $format OPTIONAL Date format for parsing - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setDate($date, $format = null, $locale = null) - { - return $this->_date('set', $date, $format, $locale); - } - - /** - * Adds a date to the existing date object. Format defines how to parse the date string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: MM.dd.YYYY -> 10 -> +10 months. - * - * @param array|int|string|Zend_Date $date Date to add - * @param string $format OPTIONAL Date format for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addDate($date, $format = null, $locale = null) - { - return $this->_date('add', $date, $format, $locale); - } - - /** - * Subtracts a date from the existing date object. Format defines how to parse the date string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: MM.dd.YYYY -> 10 -> -10 months - * Be aware: Subtracting 2 months is not equal to Adding -2 months !!! - * - * @param array|int|string|Zend_Date $date Date to sub - * @param string $format OPTIONAL Date format for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subDate($date, $format = null, $locale = null) - { - return $this->_date('sub', $date, $format, $locale); - } - - /** - * Compares the date from the existing date object, ignoring the time. - * Format defines how to parse the date string. - * If only parts are given the other parts are set to 0. - * If no format is given, the standardformat of this locale is used. - * For example: 10.01.2000 => 10.02.1999 -> false. - * - * @param array|int|string|Zend_Date $date Date to compare - * @param string $format OPTIONAL Date format for parsing input - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareDate($date, $format = null, $locale = null) - { - return $this->_date('cmp', $date, $format, $locale); - } - - /** - * Returns the full ISO 8601 date from the date object. - * Always the complete ISO 8601 specifiction is used. If an other ISO date is needed - * (ISO 8601 defines several formats) use toString() instead. - * This function does not return the ISO date as object. Use copy() instead. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return string - */ - public function getIso($locale = null) - { - return $this->toString(self::ISO_8601, 'iso', $locale); - } - - /** - * Sets a new date for the date object. Not given parts are set to default. - * Only supported ISO 8601 formats are accepted. - * For example: 050901 -> 01.Sept.2005 00:00:00, 20050201T10:00:30 -> 01.Feb.2005 10h00m30s - * Returned is the new date object. - * - * @param int|string|Zend_Date $date ISO Date to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setIso($date, $locale = null) - { - return $this->_calcvalue('set', $date, 'iso', self::ISO_8601, $locale); - } - - /** - * Adds a ISO date to the date object. Not given parts are set to default. - * Only supported ISO 8601 formats are accepted. - * For example: 050901 -> + 01.Sept.2005 00:00:00, 10:00:00 -> +10h - * Returned is the new date object. - * - * @param int|string|Zend_Date $date ISO Date to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addIso($date, $locale = null) - { - return $this->_calcvalue('add', $date, 'iso', self::ISO_8601, $locale); - } - - /** - * Subtracts a ISO date from the date object. Not given parts are set to default. - * Only supported ISO 8601 formats are accepted. - * For example: 050901 -> - 01.Sept.2005 00:00:00, 10:00:00 -> -10h - * Returned is the new date object. - * - * @param int|string|Zend_Date $date ISO Date to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subIso($date, $locale = null) - { - return $this->_calcvalue('sub', $date, 'iso', self::ISO_8601, $locale); - } - - /** - * Compares a ISO date with the date object. Not given parts are set to default. - * Only supported ISO 8601 formats are accepted. - * For example: 050901 -> - 01.Sept.2005 00:00:00, 10:00:00 -> -10h - * Returns if equal, earlier or later. - * - * @param int|string|Zend_Date $date ISO Date to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareIso($date, $locale = null) - { - return $this->_calcvalue('cmp', $date, 'iso', self::ISO_8601, $locale); - } - - /** - * Returns a RFC 822 compilant datestring from the date object. - * This function does not return the RFC date as object. Use copy() instead. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return string - */ - public function getArpa($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'D\, d M y H\:i\:s O'; - } else { - $format = self::RFC_822; - } - - return $this->toString($format, 'iso', $locale); - } - - /** - * Sets a RFC 822 date as new date for the date object. - * Only RFC 822 compilant date strings are accepted. - * For example: Sat, 14 Feb 09 00:31:30 +0100 - * Returned is the new date object. - * - * @param int|string|Zend_Date $date RFC 822 to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setArpa($date, $locale = null) - { - return $this->_calcvalue('set', $date, 'arpa', self::RFC_822, $locale); - } - - /** - * Adds a RFC 822 date to the date object. - * ARPA messages are used in emails or HTTP Headers. - * Only RFC 822 compilant date strings are accepted. - * For example: Sat, 14 Feb 09 00:31:30 +0100 - * Returned is the new date object. - * - * @param int|string|Zend_Date $date RFC 822 Date to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addArpa($date, $locale = null) - { - return $this->_calcvalue('add', $date, 'arpa', self::RFC_822, $locale); - } - - /** - * Subtracts a RFC 822 date from the date object. - * ARPA messages are used in emails or HTTP Headers. - * Only RFC 822 compilant date strings are accepted. - * For example: Sat, 14 Feb 09 00:31:30 +0100 - * Returned is the new date object. - * - * @param int|string|Zend_Date $date RFC 822 Date to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subArpa($date, $locale = null) - { - return $this->_calcvalue('sub', $date, 'arpa', self::RFC_822, $locale); - } - - /** - * Compares a RFC 822 compilant date with the date object. - * ARPA messages are used in emails or HTTP Headers. - * Only RFC 822 compilant date strings are accepted. - * For example: Sat, 14 Feb 09 00:31:30 +0100 - * Returns if equal, earlier or later. - * - * @param int|string|Zend_Date $date RFC 822 Date to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareArpa($date, $locale = null) - { - return $this->_calcvalue('cmp', $date, 'arpa', self::RFC_822, $locale); - } - - /** - * Check if location is supported. - * - * @param array $location locations array - * - * @return float $horizon float - */ - private function _checkLocation($location) - { - if (!isset($location['longitude']) or !isset($location['latitude'])) { - throw new Zend_Date_Exception('Location must include \'longitude\' and \'latitude\'', 0, null, $location); - } - if (($location['longitude'] > 180) or ($location['longitude'] < -180)) { - throw new Zend_Date_Exception('Longitude must be between -180 and 180', 0, null, $location); - } - if (($location['latitude'] > 90) or ($location['latitude'] < -90)) { - throw new Zend_Date_Exception('Latitude must be between -90 and 90', 0, null, $location); - } - - if (!isset($location['horizon'])) { - $location['horizon'] = 'effective'; - } - - switch ($location['horizon']) { - case 'civil': - return -0.104528; - - break; - case 'nautic': - return -0.207912; - - break; - case 'astronomic': - return -0.309017; - - break; - default: - return -0.0145439; - - break; - } - } - - /** - * Returns the time of sunrise for this date and a given location as new date object - * For a list of cities and correct locations use the class Zend_Date_Cities. - * - * @param array $location location of sunrise - * ['horizon'] -> civil, nautic, astronomical, effective (default) - * ['longitude'] -> longitude of location - * ['latitude'] -> latitude of location - * - * @return Zend_Date - */ - public function getSunrise($location) - { - $horizon = $this->_checkLocation($location); - $result = clone $this; - $result->set($this->calcSun($location, $horizon, true), self::TIMESTAMP); - - return $result; - } - - /** - * Returns the time of sunset for this date and a given location as new date object - * For a list of cities and correct locations use the class Zend_Date_Cities. - * - * @param array $location location of sunset - * ['horizon'] -> civil, nautic, astronomical, effective (default) - * ['longitude'] -> longitude of location - * ['latitude'] -> latitude of location - * - * @return Zend_Date - */ - public function getSunset($location) - { - $horizon = $this->_checkLocation($location); - $result = clone $this; - $result->set($this->calcSun($location, $horizon, false), self::TIMESTAMP); - - return $result; - } - - /** - * Returns an array with the sunset and sunrise dates for all horizon types - * For a list of cities and correct locations use the class Zend_Date_Cities. - * - * @param array $location location of suninfo - * ['horizon'] -> civil, nautic, astronomical, effective (default) - * ['longitude'] -> longitude of location - * ['latitude'] -> latitude of location - * - * @return array - [sunset|sunrise][effective|civil|nautic|astronomic] - */ - public function getSunInfo($location) - { - $suninfo = []; - for ($i = 0; $i < 4; ++$i) { - switch ($i) { - case 0: - $location['horizon'] = 'effective'; - - break; - case 1: - $location['horizon'] = 'civil'; - - break; - case 2: - $location['horizon'] = 'nautic'; - - break; - case 3: - $location['horizon'] = 'astronomic'; - - break; - } - $horizon = $this->_checkLocation($location); - $result = clone $this; - $result->set($this->calcSun($location, $horizon, true), self::TIMESTAMP); - $suninfo['sunrise'][$location['horizon']] = $result; - $result = clone $this; - $result->set($this->calcSun($location, $horizon, false), self::TIMESTAMP); - $suninfo['sunset'][$location['horizon']] = $result; - } - - return $suninfo; - } - - /** - * Check a given year for leap year. - * - * @param array|int|Zend_Date $year Year to check - * - * @return bool - */ - public static function checkLeapYear($year) - { - if ($year instanceof Zend_Date) { - $year = (int) $year->toString(self::YEAR, 'iso'); - } - - if (is_array($year)) { - if (isset($year['year']) === true) { - $year = $year['year']; - } else { - throw new Zend_Date_Exception('no year given in array'); - } - } - - if (!is_numeric($year)) { - throw new Zend_Date_Exception("year ($year) has to be integer for checkLeapYear()", 0, null, $year); - } - - return (bool) parent::isYearLeapYear($year); - } - - /** - * Returns true, if the year is a leap year. - * - * @return bool - */ - public function isLeapYear() - { - return self::checkLeapYear($this); - } - - /** - * Returns if the set date is todays date. - * - * @return bool - */ - public function isToday() - { - $today = $this->date('Ymd', $this->_getTime()); - $day = $this->date('Ymd', $this->getUnixTimestamp()); - - return $today == $day; - } - - /** - * Returns if the set date is yesterdays date. - * - * @return bool - */ - public function isYesterday() - { - [$year, $month, $day] = explode('-', $this->date('Y-m-d', $this->_getTime())); - // adjusts for leap days and DST changes that are timezone specific - $yesterday = $this->date('Ymd', $this->mktime(0, 0, 0, $month, $day - 1, $year)); - $day = $this->date('Ymd', $this->getUnixTimestamp()); - - return $day == $yesterday; - } - - /** - * Returns if the set date is tomorrows date. - * - * @return bool - */ - public function isTomorrow() - { - [$year, $month, $day] = explode('-', $this->date('Y-m-d', $this->_getTime())); - // adjusts for leap days and DST changes that are timezone specific - $tomorrow = $this->date('Ymd', $this->mktime(0, 0, 0, $month, $day + 1, $year)); - $day = $this->date('Ymd', $this->getUnixTimestamp()); - - return $day == $tomorrow; - } - - /** - * Returns the actual date as new date object. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public static function now($locale = null) - { - return new Zend_Date(time(), self::TIMESTAMP, $locale); - } - - /** - * Calculate date details. - * - * @param string $calc Calculation to make - * @param array|int|string|Zend_Date $date Date or Part to calculate - * @param string $type Datepart for Calculation - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|string new date - */ - private function _calcdetail($calc, $date, $type, $locale) - { - $old = false; - if (self::$_options['format_type'] == 'php') { - self::$_options['format_type'] = 'iso'; - $old = true; - } - - switch ($calc) { - case 'set': - $return = $this->set($date, $type, $locale); - - break; - case 'add': - $return = $this->add($date, $type, $locale); - - break; - case 'sub': - $return = $this->sub($date, $type, $locale); - - break; - default: - $return = $this->compare($date, $type, $locale); - - break; - } - - if ($old) { - self::$_options['format_type'] = 'php'; - } - - return $return; - } - - /** - * Internal calculation, returns the requested date type. - * - * @param string $calc Calculation to make - * @param int|string|Zend_Date $value Datevalue to calculate with, if null the actual value is taken - * @param string $type - * @param string $parameter - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date new date - */ - private function _calcvalue($calc, $value, $type, $parameter, $locale) - { - if ($value === null) { - throw new Zend_Date_Exception("parameter $type must be set, null is not allowed"); - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($value instanceof Zend_Date) { - // extract value from object - $value = $value->toString($parameter, 'iso', $locale); - } elseif (!is_array($value) && !is_numeric($value) && ($type != 'iso') && ($type != 'arpa')) { - throw new Zend_Date_Exception("invalid $type ($value) operand", 0, null, $value); - } - - $return = $this->_calcdetail($calc, $value, $parameter, $locale); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Returns only the year from the date object as new object. - * For example: 10.May.2000 10:30:00 -> 01.Jan.2000 00:00:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getYear($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'Y'; - } else { - $format = self::YEAR; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets a new year - * If the year is between 0 and 69, 2000 will be set (2000-2069) - * If the year if between 70 and 99, 1999 will be set (1970-1999) - * 3 or 4 digit years are set as expected. If you need to set year 0-99 - * use set() instead. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $year Year to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setYear($year, $locale = null) - { - return $this->_calcvalue('set', $year, 'year', self::YEAR, $locale); - } - - /** - * Adds the year to the existing date object - * If the year is between 0 and 69, 2000 will be added (2000-2069) - * If the year if between 70 and 99, 1999 will be added (1970-1999) - * 3 or 4 digit years are added as expected. If you need to add years from 0-99 - * use add() instead. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $year Year to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addYear($year, $locale = null) - { - return $this->_calcvalue('add', $year, 'year', self::YEAR, $locale); - } - - /** - * Subs the year from the existing date object - * If the year is between 0 and 69, 2000 will be subtracted (2000-2069) - * If the year if between 70 and 99, 1999 will be subtracted (1970-1999) - * 3 or 4 digit years are subtracted as expected. If you need to subtract years from 0-99 - * use sub() instead. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $year Year to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subYear($year, $locale = null) - { - return $this->_calcvalue('sub', $year, 'year', self::YEAR, $locale); - } - - /** - * Compares the year with the existing date object, ignoring other date parts. - * For example: 10.03.2000 -> 15.02.2000 -> true - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $year Year to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareYear($year, $locale = null) - { - return $this->_calcvalue('cmp', $year, 'year', self::YEAR, $locale); - } - - /** - * Returns only the month from the date object as new object. - * For example: 10.May.2000 10:30:00 -> 01.May.1970 00:00:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getMonth($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'm'; - } else { - $format = self::MONTH; - } - - return $this->copyPart($format, $locale); - } - - /** - * Returns the calculated month. - * - * @param string $calc Calculation to make - * @param array|int|string|Zend_Date $month Month to calculate with, if null the actual month is taken - * @param string|Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date new time - */ - private function _month($calc, $month, $locale) - { - $found = null; - if ($month === null) { - throw new Zend_Date_Exception('parameter $month must be set, null is not allowed'); - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($month instanceof Zend_Date) { - // extract month from object - $found = $month->toString(self::MONTH_SHORT, 'iso', $locale); - } else { - if (is_numeric($month)) { - $found = $month; - } elseif (is_array($month)) { - if (isset($month['month']) === true) { - $month = $month['month']; - } else { - throw new Zend_Date_Exception('no month given in array'); - } - } else { - $monthlist = Zend_Locale_Data::getList($locale, 'month'); - $monthlist2 = Zend_Locale_Data::getList($locale, 'month', ['gregorian', 'format', 'abbreviated']); - - $monthlist = array_merge($monthlist, $monthlist2); - $found = 0; - $cnt = 0; - foreach ($monthlist as $key => $value) { - if (strtoupper($value) == strtoupper($month)) { - $found = ($key % 12) + 1; - - break; - } - ++$cnt; - } - if ($found == 0) { - foreach ($monthlist2 as $key => $value) { - if (strtoupper(iconv_substr($value, 0, 1, 'UTF-8')) == strtoupper($month)) { - $found = $key + 1; - - break; - } - ++$cnt; - } - } - if ($found == 0) { - throw new Zend_Date_Exception("unknown month name ($month)", 0, null, $month); - } - } - } - $return = $this->_calcdetail($calc, $found, self::MONTH_SHORT, $locale); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new month - * The month can be a number or a string. Setting months lower then 0 and greater then 12 - * will result in adding or subtracting the relevant year. (12 months equal one year) - * If a localized monthname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $month Month to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setMonth($month, $locale = null) - { - return $this->_month('set', $month, $locale); - } - - /** - * Adds months to the existing date object. - * The month can be a number or a string. Adding months lower then 0 and greater then 12 - * will result in adding or subtracting the relevant year. (12 months equal one year) - * If a localized monthname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $month Month to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addMonth($month, $locale = null) - { - return $this->_month('add', $month, $locale); - } - - /** - * Subtracts months from the existing date object. - * The month can be a number or a string. Subtracting months lower then 0 and greater then 12 - * will result in adding or subtracting the relevant year. (12 months equal one year) - * If a localized monthname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object. - * - * @param array|int|string|Zend_Date $month Month to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subMonth($month, $locale = null) - { - return $this->_month('sub', $month, $locale); - } - - /** - * Compares the month with the existing date object, ignoring other date parts. - * For example: 10.03.2000 -> 15.03.1950 -> true - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $month Month to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareMonth($month, $locale = null) - { - return $this->_month('cmp', $month, $locale); - } - - /** - * Returns the day as new date object - * Example: 20.May.1986 -> 20.Jan.1970 00:00:00. - * - * @param Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getDay($locale = null) - { - return $this->copyPart(self::DAY_SHORT, $locale); - } - - /** - * Returns the calculated day. - * - * @param string $calc Type of calculation to make - * @param Zend_Date $day Day to calculate, when null the actual day is calculated - * @param Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date - */ - private function _day($calc, $day, $locale) - { - if ($day === null) { - throw new Zend_Date_Exception('parameter $day must be set, null is not allowed'); - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($day instanceof Zend_Date) { - $day = $day->toString(self::DAY_SHORT, 'iso', $locale); - } - - if (is_numeric($day)) { - $type = self::DAY_SHORT; - } elseif (is_array($day)) { - if (isset($day['day']) === true) { - $day = $day['day']; - $type = self::WEEKDAY; - } else { - throw new Zend_Date_Exception('no day given in array'); - } - } else { - switch (iconv_strlen($day, 'UTF-8')) { - case 1 : - $type = self::WEEKDAY_NARROW; - - break; - case 2: - $type = self::WEEKDAY_NAME; - - break; - case 3: - $type = self::WEEKDAY_SHORT; - - break; - default: - $type = self::WEEKDAY; - - break; - } - } - $return = $this->_calcdetail($calc, $day, $type, $locale); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new day - * The day can be a number or a string. Setting days lower then 0 or greater than the number of this months days - * will result in adding or subtracting the relevant month. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object - * Example: setDay('Montag', 'de_AT'); will set the monday of this week as day. - * - * @param array|int|string|Zend_Date $day Day to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setDay($day, $locale = null) - { - return $this->_day('set', $day, $locale); - } - - /** - * Adds days to the existing date object. - * The day can be a number or a string. Adding days lower then 0 or greater than the number of this months days - * will result in adding or subtracting the relevant month. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * - * @param array|int|string|Zend_Date $day Day to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addDay($day, $locale = null) - { - return $this->_day('add', $day, $locale); - } - - /** - * Subtracts days from the existing date object. - * The day can be a number or a string. Subtracting days lower then 0 or greater than the number of this months days - * will result in adding or subtracting the relevant month. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * - * @param array|int|string|Zend_Date $day Day to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subDay($day, $locale = null) - { - return $this->_day('sub', $day, $locale); - } - - /** - * Compares the day with the existing date object, ignoring other date parts. - * For example: 'Monday', 'en' -> 08.Jan.2007 -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $day Day to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareDay($day, $locale = null) - { - return $this->_day('cmp', $day, $locale); - } - - /** - * Returns the weekday as new date object - * Weekday is always from 1-7 - * Example: 09-Jan-2007 -> 2 = Tuesday -> 02-Jan-1970 (when 02.01.1970 is also Tuesday). - * - * @param Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getWeekday($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'l'; - } else { - $format = self::WEEKDAY; - } - - return $this->copyPart($format, $locale); - } - - /** - * Returns the calculated weekday. - * - * @param string $calc Type of calculation to make - * @param Zend_Date $weekday Weekday to calculate, when null the actual weekday is calculated - * @param Zend_Locale $locale Locale for parsing input - * - * @return int|Zend_Date - */ - private function _weekday($calc, $weekday, $locale) - { - if ($weekday === null) { - throw new Zend_Date_Exception('parameter $weekday must be set, null is not allowed'); - } - - if ($locale === null) { - $locale = $this->getLocale(); - } - - if ($weekday instanceof Zend_Date) { - $weekday = $weekday->toString(self::WEEKDAY_8601, 'iso', $locale); - } - - if (is_numeric($weekday)) { - $type = self::WEEKDAY_8601; - } elseif (is_array($weekday)) { - if (isset($weekday['weekday']) === true) { - $weekday = $weekday['weekday']; - $type = self::WEEKDAY; - } else { - throw new Zend_Date_Exception('no weekday given in array'); - } - } else { - switch (iconv_strlen($weekday, 'UTF-8')) { - case 1: - $type = self::WEEKDAY_NARROW; - - break; - case 2: - $type = self::WEEKDAY_NAME; - - break; - case 3: - $type = self::WEEKDAY_SHORT; - - break; - default: - $type = self::WEEKDAY; - - break; - } - } - $return = $this->_calcdetail($calc, $weekday, $type, $locale); - if ($calc != 'cmp') { - return $this; - } - - return $return; - } - - /** - * Sets a new weekday - * The weekday can be a number or a string. If a localized weekday name is given, - * then it will be parsed as a date in $locale (defaults to the same locale as $this). - * Returned is the new date object. - * Example: setWeekday(3); will set the wednesday of this week as day. - * - * @param array|int|string|Zend_Date $weekday Weekday to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setWeekday($weekday, $locale = null) - { - return $this->_weekday('set', $weekday, $locale); - } - - /** - * Adds weekdays to the existing date object. - * The weekday can be a number or a string. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object - * Example: addWeekday(3); will add the difference of days from the begining of the month until - * wednesday. - * - * @param array|int|string|Zend_Date $weekday Weekday to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addWeekday($weekday, $locale = null) - { - return $this->_weekday('add', $weekday, $locale); - } - - /** - * Subtracts weekdays from the existing date object. - * The weekday can be a number or a string. - * If a localized dayname is given it will be parsed with the default locale or the optional - * set locale. - * Returned is the new date object - * Example: subWeekday(3); will subtract the difference of days from the begining of the month until - * wednesday. - * - * @param array|int|string|Zend_Date $weekday Weekday to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subWeekday($weekday, $locale = null) - { - return $this->_weekday('sub', $weekday, $locale); - } - - /** - * Compares the weekday with the existing date object, ignoring other date parts. - * For example: 'Monday', 'en' -> 08.Jan.2007 -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $weekday Weekday to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareWeekday($weekday, $locale = null) - { - return $this->_weekday('cmp', $weekday, $locale); - } - - /** - * Returns the day of year as new date object - * Example: 02.Feb.1986 10:00:00 -> 02.Feb.1970 00:00:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getDayOfYear($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'D'; - } else { - $format = self::DAY_OF_YEAR; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets a new day of year - * The day of year is always a number. - * Returned is the new date object - * Example: 04.May.2004 -> setDayOfYear(10) -> 10.Jan.2004. - * - * @param array|int|string|Zend_Date $day Day of Year to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setDayOfYear($day, $locale = null) - { - return $this->_calcvalue('set', $day, 'day of year', self::DAY_OF_YEAR, $locale); - } - - /** - * Adds a day of year to the existing date object. - * The day of year is always a number. - * Returned is the new date object - * Example: addDayOfYear(10); will add 10 days to the existing date object. - * - * @param array|int|string|Zend_Date $day Day of Year to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addDayOfYear($day, $locale = null) - { - return $this->_calcvalue('add', $day, 'day of year', self::DAY_OF_YEAR, $locale); - } - - /** - * Subtracts a day of year from the existing date object. - * The day of year is always a number. - * Returned is the new date object - * Example: subDayOfYear(10); will subtract 10 days from the existing date object. - * - * @param array|int|string|Zend_Date $day Day of Year to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subDayOfYear($day, $locale = null) - { - return $this->_calcvalue('sub', $day, 'day of year', self::DAY_OF_YEAR, $locale); - } - - /** - * Compares the day of year with the existing date object. - * For example: compareDayOfYear(33) -> 02.Feb.2007 -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $day Day of Year to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareDayOfYear($day, $locale = null) - { - return $this->_calcvalue('cmp', $day, 'day of year', self::DAY_OF_YEAR, $locale); - } - - /** - * Returns the hour as new date object - * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 10:00:00. - * - * @param Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getHour($locale = null) - { - return $this->copyPart(self::HOUR, $locale); - } - - /** - * Sets a new hour - * The hour is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> setHour(7); -> 04.May.1993 07:07:25. - * - * @param array|int|string|Zend_Date $hour Hour to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setHour($hour, $locale = null) - { - return $this->_calcvalue('set', $hour, 'hour', self::HOUR_SHORT, $locale); - } - - /** - * Adds hours to the existing date object. - * The hour is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> addHour(12); -> 05.May.1993 01:07:25. - * - * @param array|int|string|Zend_Date $hour Hour to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addHour($hour, $locale = null) - { - return $this->_calcvalue('add', $hour, 'hour', self::HOUR_SHORT, $locale); - } - - /** - * Subtracts hours from the existing date object. - * The hour is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> subHour(6); -> 05.May.1993 07:07:25. - * - * @param array|int|string|Zend_Date $hour Hour to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subHour($hour, $locale = null) - { - return $this->_calcvalue('sub', $hour, 'hour', self::HOUR_SHORT, $locale); - } - - /** - * Compares the hour with the existing date object. - * For example: 10:30:25 -> compareHour(10) -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $hour Hour to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareHour($hour, $locale = null) - { - return $this->_calcvalue('cmp', $hour, 'hour', self::HOUR_SHORT, $locale); - } - - /** - * Returns the minute as new date object - * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 00:30:00. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getMinute($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'i'; - } else { - $format = self::MINUTE; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets a new minute - * The minute is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> setMinute(29); -> 04.May.1993 13:29:25. - * - * @param array|int|string|Zend_Date $minute Minute to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setMinute($minute, $locale = null) - { - return $this->_calcvalue('set', $minute, 'minute', self::MINUTE_SHORT, $locale); - } - - /** - * Adds minutes to the existing date object. - * The minute is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> addMinute(65); -> 04.May.1993 13:12:25. - * - * @param array|int|string|Zend_Date $minute Minute to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addMinute($minute, $locale = null) - { - return $this->_calcvalue('add', $minute, 'minute', self::MINUTE_SHORT, $locale); - } - - /** - * Subtracts minutes from the existing date object. - * The minute is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> subMinute(9); -> 04.May.1993 12:58:25. - * - * @param array|int|string|Zend_Date $minute Minute to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subMinute($minute, $locale = null) - { - return $this->_calcvalue('sub', $minute, 'minute', self::MINUTE_SHORT, $locale); - } - - /** - * Compares the minute with the existing date object. - * For example: 10:30:25 -> compareMinute(30) -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $minute Hour to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareMinute($minute, $locale = null) - { - return $this->_calcvalue('cmp', $minute, 'minute', self::MINUTE_SHORT, $locale); - } - - /** - * Returns the second as new date object - * Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 00:00:25. - * - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getSecond($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 's'; - } else { - $format = self::SECOND; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets new seconds to the existing date object. - * The second is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> setSecond(100); -> 04.May.1993 13:08:40. - * - * @param array|int|string|Zend_Date $second Second to set - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setSecond($second, $locale = null) - { - return $this->_calcvalue('set', $second, 'second', self::SECOND_SHORT, $locale); - } - - /** - * Adds seconds to the existing date object. - * The second is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> addSecond(65); -> 04.May.1993 13:08:30. - * - * @param array|int|string|Zend_Date $second Second to add - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addSecond($second, $locale = null) - { - return $this->_calcvalue('add', $second, 'second', self::SECOND_SHORT, $locale); - } - - /** - * Subtracts seconds from the existing date object. - * The second is always a number. - * Returned is the new date object - * Example: 04.May.1993 13:07:25 -> subSecond(10); -> 04.May.1993 13:07:15. - * - * @param array|int|string|Zend_Date $second Second to sub - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subSecond($second, $locale = null) - { - return $this->_calcvalue('sub', $second, 'second', self::SECOND_SHORT, $locale); - } - - /** - * Compares the second with the existing date object. - * For example: 10:30:25 -> compareSecond(25) -> 0 - * Returns if equal, earlier or later. - * - * @param array|int|string|Zend_Date $second Second to compare - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareSecond($second, $locale = null) - { - return $this->_calcvalue('cmp', $second, 'second', self::SECOND_SHORT, $locale); - } - - /** - * Returns the precision for fractional seconds. - * - * @return int - */ - public function getFractionalPrecision() - { - return $this->_precision; - } - - /** - * Sets a new precision for fractional seconds. - * - * @param int $precision Precision for the fractional datepart 3 = milliseconds - * - * @return Zend_Date Provides a fluent interface - */ - public function setFractionalPrecision($precision) - { - if (!intval($precision) or ($precision < 0) or ($precision > 9)) { - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); - } - - $this->_precision = (int) $precision; - if ($this->_precision < strlen($this->_fractional)) { - $this->_fractional = substr($this->_fractional, 0, $this->_precision); - } else { - $this->_fractional = str_pad($this->_fractional, $this->_precision, '0', STR_PAD_RIGHT); - } - - return $this; - } - - /** - * Returns the milliseconds of the date object. - * - * @return string - */ - public function getMilliSecond() - { - return $this->_fractional; - } - - /** - * Sets new milliseconds for the date object - * Example: setMilliSecond(550, 2) -> equals +5 Sec +50 MilliSec. - * - * @param int|Zend_Date $milli (Optional) Millisecond to set, when null the actual millisecond is set - * @param int $precision (Optional) Fraction precision of the given milliseconds - * - * @return Zend_Date Provides a fluent interface - */ - public function setMilliSecond($milli = null, $precision = null) - { - if ($milli === null) { - [$milli, $time] = explode(' ', microtime()); - $milli = intval($milli); - $precision = 6; - } elseif (!is_numeric($milli)) { - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); - } - - if ($precision === null) { - $precision = $this->_precision; - } - - if (!is_int($precision) || $precision < 1 || $precision > 9) { - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); - } - - $this->_fractional = 0; - $this->addMilliSecond($milli, $precision); - - return $this; - } - - /** - * Adds milliseconds to the date object. - * - * @param int|Zend_Date $milli (Optional) Millisecond to add, when null the actual millisecond is added - * @param int $precision (Optional) Fractional precision for the given milliseconds - * - * @return Zend_Date Provides a fluent interface - */ - public function addMilliSecond($milli = null, $precision = null) - { - if ($milli === null) { - [$milli, $time] = explode(' ', microtime()); - $milli = intval($milli); - } elseif (!is_numeric($milli)) { - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); - } - - if ($precision === null) { - // Use internal default precision - // Is not as logic as using the length of the input. But this would break tests and maybe other things - // as an input value of integer 10, which is used in tests, must be parsed as 10 milliseconds (real milliseconds, precision 3) - // but with auto-detect of precision, 100 milliseconds would be added. - $precision = $this->_precision; - } - - if (!is_int($precision) || $precision < 1 || $precision > 9) { - throw new Zend_Date_Exception( - "precision ($precision) must be a positive integer less than 10", 0, null, $precision - ); - } - - if ($this->_precision > $precision) { - $milli = $milli * 10 ** ($this->_precision - $precision); - } elseif ($this->_precision < $precision) { - $milli = round($milli / 10 ** ($precision - $this->_precision)); - } - - $this->_fractional += $milli; - - // Add/sub milliseconds + add/sub seconds - $max = 10 ** $this->_precision; - // Milli includes seconds - if ($this->_fractional >= $max) { - while ($this->_fractional >= $max) { - $this->addSecond(1); - $this->_fractional -= $max; - } - } - - if ($this->_fractional < 0) { - while ($this->_fractional < 0) { - $this->subSecond(1); - $this->_fractional += $max; - } - } - - if ($this->_precision > strlen($this->_fractional)) { - $this->_fractional = str_pad($this->_fractional, $this->_precision, '0', STR_PAD_LEFT); - } - - return $this; - } - - /** - * Subtracts a millisecond. - * - * @param int|Zend_Date $milli (Optional) Millisecond to sub, when null the actual millisecond is subtracted - * @param int $precision (Optional) Fractional precision for the given milliseconds - * - * @return Zend_Date Provides a fluent interface - */ - public function subMilliSecond($milli = null, $precision = null) - { - $this->addMilliSecond(0 - $milli, $precision); - - return $this; - } - - /** - * Compares only the millisecond part, returning the difference. - * - * @param int|Zend_Date $milli OPTIONAL Millisecond to compare, when null the actual millisecond is compared - * @param int $precision OPTIONAL Fractional precision for the given milliseconds - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareMilliSecond($milli = null, $precision = null) - { - if ($milli === null) { - [$milli, $time] = explode(' ', microtime()); - $milli = intval($milli); - } elseif (is_numeric($milli) === false) { - throw new Zend_Date_Exception("invalid milli second ($milli) operand", 0, null, $milli); - } - - if ($precision === null) { - $precision = strlen($milli); - } elseif (!is_int($precision) || $precision < 1 || $precision > 9) { - throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); - } - - if ($precision === 0) { - throw new Zend_Date_Exception('precision is 0'); - } - - if ($precision != $this->_precision) { - if ($precision > $this->_precision) { - $diff = $precision - $this->_precision; - $milli = (int) ($milli / (10 * $diff)); - } else { - $diff = $this->_precision - $precision; - $milli = (int) ($milli * (10 * $diff)); - } - } - - $comp = $this->_fractional - $milli; - if ($comp < 0) { - return -1; - } - if ($comp > 0) { - return 1; - } - - return 0; - } - - /** - * Returns the week as new date object using monday as begining of the week - * Example: 12.Jan.2007 -> 08.Jan.1970 00:00:00. - * - * @param Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date - */ - public function getWeek($locale = null) - { - if (self::$_options['format_type'] == 'php') { - $format = 'W'; - } else { - $format = self::WEEK; - } - - return $this->copyPart($format, $locale); - } - - /** - * Sets a new week. The week is always a number. The day of week is not changed. - * Returned is the new date object - * Example: 09.Jan.2007 13:07:25 -> setWeek(1); -> 02.Jan.2007 13:07:25. - * - * @param array|int|string|Zend_Date $week Week to set - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function setWeek($week, $locale = null) - { - return $this->_calcvalue('set', $week, 'week', self::WEEK, $locale); - } - - /** - * Adds a week. The week is always a number. The day of week is not changed. - * Returned is the new date object - * Example: 09.Jan.2007 13:07:25 -> addWeek(1); -> 16.Jan.2007 13:07:25. - * - * @param array|int|string|Zend_Date $week Week to add - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function addWeek($week, $locale = null) - { - return $this->_calcvalue('add', $week, 'week', self::WEEK, $locale); - } - - /** - * Subtracts a week. The week is always a number. The day of week is not changed. - * Returned is the new date object - * Example: 09.Jan.2007 13:07:25 -> subWeek(1); -> 02.Jan.2007 13:07:25. - * - * @param array|int|string|Zend_Date $week Week to sub - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return Zend_Date Provides a fluent interface - */ - public function subWeek($week, $locale = null) - { - return $this->_calcvalue('sub', $week, 'week', self::WEEK, $locale); - } - - /** - * Compares only the week part, returning the difference - * Returned is the new date object - * Returns if equal, earlier or later - * Example: 09.Jan.2007 13:07:25 -> compareWeek(2); -> 0. - * - * @param array|int|string|Zend_Date $week Week to compare - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing input - * - * @return int 0 = equal, 1 = later, -1 = earlier - */ - public function compareWeek($week, $locale = null) - { - return $this->_calcvalue('cmp', $week, 'week', self::WEEK, $locale); - } - - /** - * Sets a new standard locale for the date object. - * This locale will be used for all functions - * Returned is the really set locale. - * Example: 'de_XX' will be set to 'de' because 'de_XX' does not exist - * 'xx_YY' will be set to 'root' because 'xx' does not exist. - * - * @param string|Zend_Locale $locale (Optional) Locale for parsing input - * - * @return Zend_Date Provides fluent interface - */ - public function setLocale($locale = null) - { - try { - $this->_locale = Zend_Locale::findLocale($locale); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Date_Exception($e->getMessage(), 0, $e); - } - - return $this; - } - - /** - * Returns the actual set locale. - * - * @return string - */ - public function getLocale() - { - return $this->_locale; - } - - /** - * Checks if the given date is a real date or datepart. - * Returns false if a expected datepart is missing or a datepart exceeds its possible border. - * But the check will only be done for the expected dateparts which are given by format. - * If no format is given the standard dateformat for the actual locale is used. - * f.e. 30.February.2007 will return false if format is 'dd.MMMM.YYYY'. - * - * @param array|string|Zend_Date $date Date to parse for correctness - * @param string $format (Optional) Format for parsing the date string - * @param string|Zend_Locale $locale (Optional) Locale for parsing date parts - * - * @return bool True when all date parts are correct - */ - public static function isDate($date, $format = null, $locale = null) - { - if (!is_string($date) && !is_numeric($date) && !($date instanceof Zend_Date) - && !is_array($date)) { - return false; - } - - if (($format !== null) && ($format != 'ee') && ($format != 'ss') && ($format != 'GG') && ($format != 'MM') && ($format != 'EE') && ($format != 'TT') - && (Zend_Locale::isLocale($format, null, false))) { - $locale = $format; - $format = null; - } - - $locale = Zend_Locale::findLocale($locale); - - if ($format === null) { - $format = Zend_Locale_Format::getDateFormat($locale); - } elseif ((self::$_options['format_type'] == 'php') && !defined($format)) { - $format = Zend_Locale_Format::convertPhpToIsoFormat($format); - } - - $format = self::_getLocalizedToken($format, $locale); - if (!is_array($date)) { - try { - $parsed = Zend_Locale_Format::getDate($date, ['locale' => $locale, - 'date_format' => $format, 'format_type' => 'iso', - 'fix_date' => false, ]); - } catch (Zend_Locale_Exception $e) { - // Date can not be parsed - return false; - } - } else { - $parsed = $date; - } - - if (((strpos($format, 'Y') !== false) or (strpos($format, 'y') !== false)) - and (!isset($parsed['year']))) { - // Year expected but not found - return false; - } - - if ((strpos($format, 'M') !== false) and (!isset($parsed['month']))) { - // Month expected but not found - return false; - } - - if ((strpos($format, 'd') !== false) and (!isset($parsed['day']))) { - // Day expected but not found - return false; - } - - if (((strpos($format, 'H') !== false) or (strpos($format, 'h') !== false)) - and (!isset($parsed['hour']))) { - // Hour expected but not found - return false; - } - - if ((strpos($format, 'm') !== false) and (!isset($parsed['minute']))) { - // Minute expected but not found - return false; - } - - if ((strpos($format, 's') !== false) and (!isset($parsed['second']))) { - // Second expected but not found - return false; - } - - // Set not given dateparts - if (isset($parsed['hour']) === false) { - $parsed['hour'] = 12; - } - - if (isset($parsed['minute']) === false) { - $parsed['minute'] = 0; - } - - if (isset($parsed['second']) === false) { - $parsed['second'] = 0; - } - - if (isset($parsed['month']) === false) { - $parsed['month'] = 1; - } - - if (isset($parsed['day']) === false) { - $parsed['day'] = 1; - } - - if (isset($parsed['year']) === false) { - $parsed['year'] = 1970; - } - - if (self::isYearLeapYear($parsed['year'])) { - $parsed['year'] = 1972; - } else { - $parsed['year'] = 1971; - } - - $date = new self($parsed, null, $locale); - $timestamp = $date->mktime($parsed['hour'], $parsed['minute'], $parsed['second'], - $parsed['month'], $parsed['day'], $parsed['year']); - - if ($parsed['year'] != $date->date('Y', $timestamp)) { - // Given year differs from parsed year - return false; - } - - if ($parsed['month'] != $date->date('n', $timestamp)) { - // Given month differs from parsed month - return false; - } - - if ($parsed['day'] != $date->date('j', $timestamp)) { - // Given day differs from parsed day - return false; - } - - if ($parsed['hour'] != $date->date('G', $timestamp)) { - // Given hour differs from parsed hour - return false; - } - - if ($parsed['minute'] != $date->date('i', $timestamp)) { - // Given minute differs from parsed minute - return false; - } - - if ($parsed['second'] != $date->date('s', $timestamp)) { - // Given second differs from parsed second - return false; - } - - return true; - } - - /** - * Returns the ISO Token for all localized constants. - * - * @param string $token Token to normalize - * @param string $locale Locale to search - * - * @return string - */ - protected static function _getLocalizedToken($token, $locale) - { - switch ($token) { - case self::ISO_8601: - return 'yyyy-MM-ddThh:mm:ss'; - - break; - case self::RFC_2822: - return 'EEE, dd MMM yyyy HH:mm:ss'; - - break; - case self::DATES: - return Zend_Locale_Data::getContent($locale, 'date'); - - break; - case self::DATE_FULL: - return Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'full']); - - break; - case self::DATE_LONG: - return Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'long']); - - break; - case self::DATE_MEDIUM: - return Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'medium']); - - break; - case self::DATE_SHORT: - return Zend_Locale_Data::getContent($locale, 'date', ['gregorian', 'short']); - - break; - case self::TIMES: - return Zend_Locale_Data::getContent($locale, 'time'); - - break; - case self::TIME_FULL: - return Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'full']); - - break; - case self::TIME_LONG: - return Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'long']); - - break; - case self::TIME_MEDIUM: - return Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'medium']); - - break; - case self::TIME_SHORT: - return Zend_Locale_Data::getContent($locale, 'time', ['gregorian', 'short']); - - break; - case self::DATETIME: - return Zend_Locale_Data::getContent($locale, 'datetime'); - - break; - case self::DATETIME_FULL: - return Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'full']); - - break; - case self::DATETIME_LONG: - return Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'long']); - - break; - case self::DATETIME_MEDIUM: - return Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'medium']); - - break; - case self::DATETIME_SHORT: - return Zend_Locale_Data::getContent($locale, 'datetime', ['gregorian', 'short']); - - break; - case self::ATOM: - case self::RFC_3339: - case self::W3C: - return 'yyyy-MM-DD HH:mm:ss'; - - break; - case self::COOKIE: - case self::RFC_850: - return 'EEEE, dd-MM-yyyy HH:mm:ss'; - - break; - case self::RFC_822: - case self::RFC_1036: - case self::RFC_1123: - case self::RSS: - return 'EEE, dd MM yyyy HH:mm:ss'; - - break; - } - - return $token; - } -} diff --git a/library/Zend/Date/Cities.php b/library/Zend/Date/Cities.php deleted file mode 100644 index dd245bd3..00000000 --- a/library/Zend/Date/Cities.php +++ /dev/null @@ -1,318 +0,0 @@ - ['latitude' => 5.3411111, 'longitude' => -4.0280556], - 'Abu Dhabi' => ['latitude' => 24.4666667, 'longitude' => 54.3666667], - 'Abuja' => ['latitude' => 9.1758333, 'longitude' => 7.1808333], - 'Accra' => ['latitude' => 5.55, 'longitude' => -0.2166667], - 'Adamstown' => ['latitude' => -25.0666667, 'longitude' => -130.0833333], - 'Addis Ababa' => ['latitude' => 9.0333333, 'longitude' => 38.7], - 'Adelaide' => ['latitude' => -34.9333333, 'longitude' => 138.6], - 'Algiers' => ['latitude' => 36.7630556, 'longitude' => 3.0505556], - 'Alofi' => ['latitude' => -19.0166667, 'longitude' => -169.9166667], - 'Amman' => ['latitude' => 31.95, 'longitude' => 35.9333333], - 'Amsterdam' => ['latitude' => 52.35, 'longitude' => 4.9166667], - 'Andorra la Vella' => ['latitude' => 42.5, 'longitude' => 1.5166667], - 'Ankara' => ['latitude' => 39.9272222, 'longitude' => 32.8644444], - 'Antananarivo' => ['latitude' => -18.9166667, 'longitude' => 47.5166667], - 'Apia' => ['latitude' => -13.8333333, 'longitude' => -171.7333333], - 'Ashgabat' => ['latitude' => 37.95, 'longitude' => 58.3833333], - 'Asmara' => ['latitude' => 15.3333333, 'longitude' => 38.9333333], - 'Astana' => ['latitude' => 51.1811111, 'longitude' => 71.4277778], - 'Asunción' => ['latitude' => -25.2666667, 'longitude' => -57.6666667], - 'Athens' => ['latitude' => 37.9833333, 'longitude' => 23.7333333], - 'Auckland' => ['latitude' => -36.8666667, 'longitude' => 174.7666667], - 'Avarua' => ['latitude' => -21.2, 'longitude' => -159.7666667], - 'Baghdad' => ['latitude' => 33.3386111, 'longitude' => 44.3938889], - 'Baku' => ['latitude' => 40.3952778, 'longitude' => 49.8822222], - 'Bamako' => ['latitude' => 12.65, 'longitude' => -8], - 'Bandar Seri Begawan' => ['latitude' => 4.8833333, 'longitude' => 114.9333333], - 'Bankok' => ['latitude' => 13.5833333, 'longitude' => 100.2166667], - 'Bangui' => ['latitude' => 4.3666667, 'longitude' => 18.5833333], - 'Banjul' => ['latitude' => 13.4530556, 'longitude' => -16.5775], - 'Basel' => ['latitude' => 47.5666667, 'longitude' => 7.6], - 'Basseterre' => ['latitude' => 17.3, 'longitude' => -62.7166667], - 'Beijing' => ['latitude' => 39.9288889, 'longitude' => 116.3883333], - 'Beirut' => ['latitude' => 33.8719444, 'longitude' => 35.5097222], - 'Belgrade' => ['latitude' => 44.8186111, 'longitude' => 20.4680556], - 'Belmopan' => ['latitude' => 17.25, 'longitude' => -88.7666667], - 'Berlin' => ['latitude' => 52.5166667, 'longitude' => 13.4], - 'Bern' => ['latitude' => 46.9166667, 'longitude' => 7.4666667], - 'Bishkek' => ['latitude' => 42.8730556, 'longitude' => 74.6002778], - 'Bissau' => ['latitude' => 11.85, 'longitude' => -15.5833333], - 'Bloemfontein' => ['latitude' => -29.1333333, 'longitude' => 26.2], - 'Bogotá' => ['latitude' => 4.6, 'longitude' => -74.0833333], - 'Brasilia' => ['latitude' => -15.7833333, 'longitude' => -47.9166667], - 'Bratislava' => ['latitude' => 48.15, 'longitude' => 17.1166667], - 'Brazzaville' => ['latitude' => -4.2591667, 'longitude' => 15.2847222], - 'Bridgetown' => ['latitude' => 13.1, 'longitude' => -59.6166667], - 'Brisbane' => ['latitude' => -27.5, 'longitude' => 153.0166667], - 'Brussels' => ['latitude' => 50.8333333, 'longitude' => 4.3333333], - 'Bucharest' => ['latitude' => 44.4333333, 'longitude' => 26.1], - 'Budapest' => ['latitude' => 47.5, 'longitude' => 19.0833333], - 'Buenos Aires' => ['latitude' => -34.5875, 'longitude' => -58.6725], - 'Bujumbura' => ['latitude' => -3.3761111, 'longitude' => 29.36], - 'Cairo' => ['latitude' => 30.05, 'longitude' => 31.25], - 'Calgary' => ['latitude' => 51.0833333, 'longitude' => -114.0833333], - 'Canberra' => ['latitude' => -35.2833333, 'longitude' => 149.2166667], - 'Cape Town' => ['latitude' => -33.9166667, 'longitude' => 18.4166667], - 'Caracas' => ['latitude' => 10.5, 'longitude' => -66.9166667], - 'Castries' => ['latitude' => 14, 'longitude' => -61], - 'Charlotte Amalie' => ['latitude' => 18.34389, 'longitude' => -64.93111], - 'Chicago' => ['latitude' => 41.85, 'longitude' => -87.65], - 'Chisinau' => ['latitude' => 47.055556, 'longitude' => 28.8575], - 'Cockburn Town' => ['latitude' => 21.4666667, 'longitude' => -71.1333333], - 'Colombo' => ['latitude' => 6.9319444, 'longitude' => 79.8477778], - 'Conakry' => ['latitude' => 9.5091667, 'longitude' => -13.7122222], - 'Copenhagen' => ['latitude' => 55.6666667, 'longitude' => 12.5833333], - 'Cotonou' => ['latitude' => 6.35, 'longitude' => 2.4333333], - 'Dakar' => ['latitude' => 14.6708333, 'longitude' => -17.4380556], - 'Damascus' => ['latitude' => 33.5, 'longitude' => 36.3], - 'Dar es Salaam' => ['latitude' => -6.8, 'longitude' => 39.2833333], - 'Dhaka' => ['latitude' => 23.7230556, 'longitude' => 90.4086111], - 'Dili' => ['latitude' => -8.5586111, 'longitude' => 125.5736111], - 'Djibouti' => ['latitude' => 11.595, 'longitude' => 43.1480556], - 'Dodoma' => ['latitude' => -6.1833333, 'longitude' => 35.75], - 'Doha' => ['latitude' => 25.2866667, 'longitude' => 51.5333333], - 'Dubai' => ['latitude' => 25.2522222, 'longitude' => 55.28], - 'Dublin' => ['latitude' => 53.3330556, 'longitude' => -6.2488889], - 'Dushanbe' => ['latitude' => 38.56, 'longitude' => 68.7738889], - 'Fagatogo' => ['latitude' => -14.2825, 'longitude' => -170.69], - 'Fongafale' => ['latitude' => -8.5166667, 'longitude' => 179.2166667], - 'Freetown' => ['latitude' => 8.49, 'longitude' => -13.2341667], - 'Gaborone' => ['latitude' => -24.6463889, 'longitude' => 25.9119444], - 'Geneva' => ['latitude' => 46.2, 'longitude' => 6.1666667], - 'George Town' => ['latitude' => 19.3, 'longitude' => -81.3833333], - 'Georgetown' => ['latitude' => 6.8, 'longitude' => -58.1666667], - 'Gibraltar' => ['latitude' => 36.1333333, 'longitude' => -5.35], - 'Glasgow' => ['latitude' => 55.8333333, 'longitude' => -4.25], - 'Guatemala la Nueva' => ['latitude' => 14.6211111, 'longitude' => -90.5269444], - 'Hagatna' => ['latitude' => 13.47417, 'longitude' => 144.74778], - 'The Hague' => ['latitude' => 52.0833333, 'longitude' => 4.3], - 'Hamilton' => ['latitude' => 32.2941667, 'longitude' => -64.7838889], - 'Hanoi' => ['latitude' => 21.0333333, 'longitude' => 105.85], - 'Harare' => ['latitude' => -17.8177778, 'longitude' => 31.0447222], - 'Havana' => ['latitude' => 23.1319444, 'longitude' => -82.3641667], - 'Helsinki' => ['latitude' => 60.1755556, 'longitude' => 24.9341667], - 'Honiara' => ['latitude' => -9.4333333, 'longitude' => 159.95], - 'Islamabad' => ['latitude' => 30.8486111, 'longitude' => 72.4944444], - 'Istanbul' => ['latitude' => 41.0186111, 'longitude' => 28.9647222], - 'Jakarta' => ['latitude' => -6.1744444, 'longitude' => 106.8294444], - 'Jamestown' => ['latitude' => -15.9333333, 'longitude' => -5.7166667], - 'Jerusalem' => ['latitude' => 31.7666667, 'longitude' => 35.2333333], - 'Johannesburg' => ['latitude' => -26.2, 'longitude' => 28.0833333], - 'Kabul' => ['latitude' => 34.5166667, 'longitude' => 69.1833333], - 'Kampala' => ['latitude' => 0.3155556, 'longitude' => 32.5655556], - 'Kathmandu' => ['latitude' => 27.7166667, 'longitude' => 85.3166667], - 'Khartoum' => ['latitude' => 15.5880556, 'longitude' => 32.5341667], - 'Kigali' => ['latitude' => -1.9536111, 'longitude' => 30.0605556], - 'Kingston' => ['latitude' => -29.05, 'longitude' => 167.95], - 'Kingstown' => ['latitude' => 13.1333333, 'longitude' => -61.2166667], - 'Kinshasa' => ['latitude' => -4.3, 'longitude' => 15.3], - 'Kolkata' => ['latitude' => 22.5697222, 'longitude' => 88.3697222], - 'Kuala Lumpur' => ['latitude' => 3.1666667, 'longitude' => 101.7], - 'Kuwait City' => ['latitude' => 29.3697222, 'longitude' => 47.9783333], - 'Kiev' => ['latitude' => 50.4333333, 'longitude' => 30.5166667], - 'La Paz' => ['latitude' => -16.5, 'longitude' => -68.15], - 'Libreville' => ['latitude' => 0.3833333, 'longitude' => 9.45], - 'Lilongwe' => ['latitude' => -13.9833333, 'longitude' => 33.7833333], - 'Lima' => ['latitude' => -12.05, 'longitude' => -77.05], - 'Lisbon' => ['latitude' => 38.7166667, 'longitude' => -9.1333333], - 'Ljubljana' => ['latitude' => 46.0552778, 'longitude' => 14.5144444], - 'Lobamba' => ['latitude' => -26.4666667, 'longitude' => 31.2], - 'Lomé' => ['latitude' => 9.7166667, 'longitude' => 38.3], - 'London' => ['latitude' => 51.5, 'longitude' => -0.1166667], - 'Los Angeles' => ['latitude' => 34.05222, 'longitude' => -118.24278], - 'Luanda' => ['latitude' => -8.8383333, 'longitude' => 13.2344444], - 'Lusaka' => ['latitude' => -15.4166667, 'longitude' => 28.2833333], - 'Luxembourg' => ['latitude' => 49.6116667, 'longitude' => 6.13], - 'Madrid' => ['latitude' => 40.4, 'longitude' => -3.6833333], - 'Majuro' => ['latitude' => 7.1, 'longitude' => 171.3833333], - 'Malabo' => ['latitude' => 3.75, 'longitude' => 8.7833333], - 'Managua' => ['latitude' => 12.1508333, 'longitude' => -86.2683333], - 'Manama' => ['latitude' => 26.2361111, 'longitude' => 50.5830556], - 'Manila' => ['latitude' => 14.6041667, 'longitude' => 120.9822222], - 'Maputo' => ['latitude' => -25.9652778, 'longitude' => 32.5891667], - 'Maseru' => ['latitude' => -29.3166667, 'longitude' => 27.4833333], - 'Mbabane' => ['latitude' => -26.3166667, 'longitude' => 31.1333333], - 'Melbourne' => ['latitude' => -37.8166667, 'longitude' => 144.9666667], - 'Melekeok' => ['latitude' => 7.4933333, 'longitude' => 134.6341667], - 'Mexiko City' => ['latitude' => 19.4341667, 'longitude' => -99.1386111], - 'Minsk' => ['latitude' => 53.9, 'longitude' => 27.5666667], - 'Mogadishu' => ['latitude' => 2.0666667, 'longitude' => 45.3666667], - 'Monaco' => ['latitude' => 43.7333333, 'longitude' => 7.4166667], - 'Monrovia' => ['latitude' => 6.3105556, 'longitude' => -10.8047222], - 'Montevideo' => ['latitude' => -34.8580556, 'longitude' => -56.1708333], - 'Montreal' => ['latitude' => 45.5, 'longitude' => -73.5833333], - 'Moroni' => ['latitude' => -11.7041667, 'longitude' => 43.2402778], - 'Moscow' => ['latitude' => 55.7522222, 'longitude' => 37.6155556], - 'Muscat' => ['latitude' => 23.6133333, 'longitude' => 58.5933333], - 'Nairobi' => ['latitude' => -1.3166667, 'longitude' => 36.8333333], - 'Nassau' => ['latitude' => 25.0833333, 'longitude' => -77.35], - 'N´Djamena' => ['latitude' => 12.1130556, 'longitude' => 15.0491667], - 'New Dehli' => ['latitude' => 28.6, 'longitude' => 77.2], - 'New York' => ['latitude' => 40.71417, 'longitude' => -74.00639], - 'Newcastle' => ['latitude' => -32.9166667, 'longitude' => 151.75], - 'Niamey' => ['latitude' => 13.6666667, 'longitude' => 1.7833333], - 'Nicosia' => ['latitude' => 35.1666667, 'longitude' => 33.3666667], - 'Nouakchott' => ['latitude' => 18.0863889, 'longitude' => -15.9752778], - 'Noumea' => ['latitude' => -22.2666667, 'longitude' => 166.45], - 'Nuku´alofa' => ['latitude' => -21.1333333, 'longitude' => -175.2], - 'Nuuk' => ['latitude' => 64.1833333, 'longitude' => -51.75], - 'Oranjestad' => ['latitude' => 12.5166667, 'longitude' => -70.0333333], - 'Oslo' => ['latitude' => 59.9166667, 'longitude' => 10.75], - 'Ouagadougou' => ['latitude' => 12.3702778, 'longitude' => -1.5247222], - 'Palikir' => ['latitude' => 6.9166667, 'longitude' => 158.15], - 'Panama City' => ['latitude' => 8.9666667, 'longitude' => -79.5333333], - 'Papeete' => ['latitude' => -17.5333333, 'longitude' => -149.5666667], - 'Paramaribo' => ['latitude' => 5.8333333, 'longitude' => -55.1666667], - 'Paris' => ['latitude' => 48.8666667, 'longitude' => 2.3333333], - 'Perth' => ['latitude' => -31.9333333, 'longitude' => 115.8333333], - 'Phnom Penh' => ['latitude' => 11.55, 'longitude' => 104.9166667], - 'Podgorica' => ['latitude' => 43.7752778, 'longitude' => 19.6827778], - 'Port Louis' => ['latitude' => -20.1666667, 'longitude' => 57.5], - 'Port Moresby' => ['latitude' => -9.4647222, 'longitude' => 147.1925], - 'Port-au-Prince' => ['latitude' => 18.5391667, 'longitude' => -72.335], - 'Port of Spain' => ['latitude' => 10.6666667, 'longitude' => -61.5], - 'Porto-Novo' => ['latitude' => 6.4833333, 'longitude' => 2.6166667], - 'Prague' => ['latitude' => 50.0833333, 'longitude' => 14.4666667], - 'Praia' => ['latitude' => 14.9166667, 'longitude' => -23.5166667], - 'Pretoria' => ['latitude' => -25.7069444, 'longitude' => 28.2294444], - 'Pyongyang' => ['latitude' => 39.0194444, 'longitude' => 125.7547222], - 'Quito' => ['latitude' => -0.2166667, 'longitude' => -78.5], - 'Rabat' => ['latitude' => 34.0252778, 'longitude' => -6.8361111], - 'Reykjavik' => ['latitude' => 64.15, 'longitude' => -21.95], - 'Riga' => ['latitude' => 56.95, 'longitude' => 24.1], - 'Rio de Janero' => ['latitude' => -22.9, 'longitude' => -43.2333333], - 'Road Town' => ['latitude' => 18.4166667, 'longitude' => -64.6166667], - 'Rome' => ['latitude' => 41.9, 'longitude' => 12.4833333], - 'Roseau' => ['latitude' => 15.3, 'longitude' => -61.4], - 'Rotterdam' => ['latitude' => 51.9166667, 'longitude' => 4.5], - 'Salvador' => ['latitude' => -12.9833333, 'longitude' => -38.5166667], - 'San José' => ['latitude' => 9.9333333, 'longitude' => -84.0833333], - 'San Juan' => ['latitude' => 18.46833, 'longitude' => -66.10611], - 'San Marino' => ['latitude' => 43.5333333, 'longitude' => 12.9666667], - 'San Salvador' => ['latitude' => 13.7086111, 'longitude' => -89.2030556], - 'Sanaá' => ['latitude' => 15.3547222, 'longitude' => 44.2066667], - 'Santa Cruz' => ['latitude' => -17.8, 'longitude' => -63.1666667], - 'Santiago' => ['latitude' => -33.45, 'longitude' => -70.6666667], - 'Santo Domingo' => ['latitude' => 18.4666667, 'longitude' => -69.9], - 'Sao Paulo' => ['latitude' => -23.5333333, 'longitude' => -46.6166667], - 'Sarajevo' => ['latitude' => 43.85, 'longitude' => 18.3833333], - 'Seoul' => ['latitude' => 37.5663889, 'longitude' => 126.9997222], - 'Shanghai' => ['latitude' => 31.2222222, 'longitude' => 121.4580556], - 'Sydney' => ['latitude' => -33.8833333, 'longitude' => 151.2166667], - 'Singapore' => ['latitude' => 1.2930556, 'longitude' => 103.8558333], - 'Skopje' => ['latitude' => 42, 'longitude' => 21.4333333], - 'Sofia' => ['latitude' => 42.6833333, 'longitude' => 23.3166667], - 'St. George´s' => ['latitude' => 12.05, 'longitude' => -61.75], - 'St. John´s' => ['latitude' => 17.1166667, 'longitude' => -61.85], - 'Stanley' => ['latitude' => -51.7, 'longitude' => -57.85], - 'Stockholm' => ['latitude' => 59.3333333, 'longitude' => 18.05], - 'Suva' => ['latitude' => -18.1333333, 'longitude' => 178.4166667], - 'Taipei' => ['latitude' => 25.0166667, 'longitude' => 121.45], - 'Tallinn' => ['latitude' => 59.4338889, 'longitude' => 24.7280556], - 'Tashkent' => ['latitude' => 41.3166667, 'longitude' => 69.25], - 'Tbilisi' => ['latitude' => 41.725, 'longitude' => 44.7908333], - 'Tegucigalpa' => ['latitude' => 14.1, 'longitude' => -87.2166667], - 'Tehran' => ['latitude' => 35.6719444, 'longitude' => 51.4244444], - 'The Hague' => ['latitude' => 52.0833333, 'longitude' => 4.3], - 'Thimphu' => ['latitude' => 27.4833333, 'longitude' => 89.6], - 'Tirana' => ['latitude' => 41.3275, 'longitude' => 19.8188889], - 'Tiraspol' => ['latitude' => 46.8402778, 'longitude' => 29.6433333], - 'Tokyo' => ['latitude' => 35.685, 'longitude' => 139.7513889], - 'Toronto' => ['latitude' => 43.6666667, 'longitude' => -79.4166667], - 'Tórshavn' => ['latitude' => 62.0166667, 'longitude' => -6.7666667], - 'Tripoli' => ['latitude' => 32.8925, 'longitude' => 13.18], - 'Tunis' => ['latitude' => 36.8027778, 'longitude' => 10.1797222], - 'Ulaanbaatar' => ['latitude' => 47.9166667, 'longitude' => 106.9166667], - 'Vaduz' => ['latitude' => 47.1333333, 'longitude' => 9.5166667], - 'Valletta' => ['latitude' => 35.8997222, 'longitude' => 14.5147222], - 'Valparaiso' => ['latitude' => -33.0477778, 'longitude' => -71.6011111], - 'Vancouver' => ['latitude' => 49.25, 'longitude' => -123.1333333], - 'Vatican City' => ['latitude' => 41.9, 'longitude' => 12.4833333], - 'Victoria' => ['latitude' => -4.6166667, 'longitude' => 55.45], - 'Vienna' => ['latitude' => 48.2, 'longitude' => 16.3666667], - 'Vientaine' => ['latitude' => 17.9666667, 'longitude' => 102.6], - 'Vilnius' => ['latitude' => 54.6833333, 'longitude' => 25.3166667], - 'Warsaw' => ['latitude' => 52.25, 'longitude' => 21], - 'Washington dc' => ['latitude' => 38.895, 'longitude' => -77.03667], - 'Wellington' => ['latitude' => -41.3, 'longitude' => 174.7833333], - 'Willemstad' => ['latitude' => 12.1, 'longitude' => -68.9166667], - 'Windhoek' => ['latitude' => -22.57, 'longitude' => 17.0836111], - 'Yamoussoukro' => ['latitude' => 6.8166667, 'longitude' => -5.2833333], - 'Yaoundé' => ['latitude' => 3.8666667, 'longitude' => 11.5166667], - 'Yerevan' => ['latitude' => 40.1811111, 'longitude' => 44.5136111], - 'Zürich' => ['latitude' => 47.3666667, 'longitude' => 8.55], - 'Zagreb' => ['latitude' => 45.8, 'longitude' => 16], - ]; - - /** - * Returns the location from the selected city. - * - * @param string $city City to get location for - * @param string $horizon Horizon to use : - * default: effective - * others are civil, nautic, astronomic - * - * @return array - */ - public static function City($city, $horizon = false) - { - foreach (self::$cities as $key => $value) { - if (strtolower($key) === strtolower($city)) { - $return = $value; - $return['horizon'] = $horizon; - - return $return; - } - } - - throw new Zend_Date_Exception('unknown city'); - } - - /** - * Return a list with all known cities. - * - * @return array - */ - public static function getCityList() - { - return array_keys(self::$cities); - } -} diff --git a/library/Zend/Date/DateObject.php b/library/Zend/Date/DateObject.php deleted file mode 100644 index efa4870a..00000000 --- a/library/Zend/Date/DateObject.php +++ /dev/null @@ -1,1135 +0,0 @@ - 0, 1960 => -315_619_200, 1950 => -631_152_000, - 1940 => -946_771_200, 1930 => -1_262_304_000, 1920 => -1_577_923_200, - 1910 => -1_893_456_000, 1900 => -2_208_988_800, 1890 => -2_524_521_600, - 1880 => -2_840_140_800, 1870 => -3_155_673_600, 1860 => -3_471_292_800, - 1850 => -3_786_825_600, 1840 => -4_102_444_800, 1830 => -4_417_977_600, - 1820 => -4_733_596_800, 1810 => -5_049_129_600, 1800 => -5_364_662_400, - 1790 => -5_680_195_200, 1780 => -5_995_814_400, 1770 => -6_311_347_200, - 1760 => -6_626_966_400, 1750 => -6_942_499_200, 1740 => -7_258_118_400, - 1730 => -7_573_651_200, 1720 => -7_889_270_400, 1710 => -8_204_803_200, - 1700 => -8_520_336_000, 1690 => -8_835_868_800, 1680 => -9_151_488_000, - 1670 => -9_467_020_800, 1660 => -9_782_640_000, 1650 => -10_098_172_800, - 1640 => -10_413_792_000, 1630 => -10_729_324_800, 1620 => -11_044_944_000, - 1610 => -11_360_476_800, 1600 => -11_676_096_000, ]; - - /** - * Set this object to have a new UNIX timestamp. - * - * @param int|string $timestamp OPTIONAL timestamp; defaults to local time using time() - * - * @return int|string old timestamp - */ - protected function setUnixTimestamp($timestamp = null) - { - $old = $this->_unixTimestamp; - - if (is_numeric($timestamp)) { - $this->_unixTimestamp = $timestamp; - } elseif ($timestamp === null) { - $this->_unixTimestamp = time(); - } else { - throw new Zend_Date_Exception('\'' . $timestamp . '\' is not a valid UNIX timestamp', 0, null, $timestamp); - } - - return $old; - } - - /** - * Returns this object's UNIX timestamp - * A timestamp greater then the integer range will be returned as string - * This function does not return the timestamp as object. Use copy() instead. - * - * @return int|string timestamp - */ - protected function getUnixTimestamp() - { - if ($this->_unixTimestamp === intval($this->_unixTimestamp)) { - return (int) $this->_unixTimestamp; - } - - return (string) $this->_unixTimestamp; - } - - /** - * Internal function. - * Returns time(). This method exists to allow unit tests to work-around methods that might otherwise - * be hard-coded to use time(). For example, this makes it possible to test isYesterday() in Date.php. - * - * @param int $sync OPTIONAL time syncronisation value - * - * @return int timestamp - */ - protected function _getTime($sync = null) - { - if ($sync !== null) { - $this->_syncronised = round($sync); - } - - return time() + $this->_syncronised; - } - - /** - * Internal mktime function used by Zend_Date. - * The timestamp returned by mktime() can exceed the precision of traditional UNIX timestamps, - * by allowing PHP to auto-convert to using a float value. - * - * Returns a timestamp relative to 1970/01/01 00:00:00 GMT/UTC. - * DST (Summer/Winter) is depriciated since php 5.1.0. - * Year has to be 4 digits otherwise it would be recognised as - * year 70 AD instead of 1970 AD as expected !! - * - * @param int $hour - * @param int $minute - * @param int $second - * @param int $month - * @param int $day - * @param int $year - * @param bool $gmt OPTIONAL true = other arguments are for UTC time, false = arguments are for local time/date - * - * @return float|int timestamp (number of seconds elapsed relative to 1970/01/01 00:00:00 GMT/UTC) - */ - protected function mktime($hour, $minute, $second, $month, $day, $year, $gmt = false) - { - $id = null; - // complete date but in 32bit timestamp - use PHP internal - if ((1901 < $year) and ($year < 2038)) { - $oldzone = @date_default_timezone_get(); - // Timezone also includes DST settings, therefor substracting the GMT offset is not enough - // We have to set the correct timezone to get the right value - if (($this->_timezone != $oldzone) and ($gmt === false)) { - date_default_timezone_set($this->_timezone); - } - $result = ($gmt) ? @gmmktime($hour, $minute, $second, (int) $month, $day, $year) - : @mktime($hour, $minute, $second,(int) $month, $day, $year); - date_default_timezone_set($oldzone); - - return $result; - } - - if ($gmt !== true) { - $second += $this->_offset; - } - - if (isset(self::$_cache)) { - $id = strtr('Zend_DateObject_mkTime_' . $this->_offset . '_' . $year . $month . $day . '_' . $hour . $minute . $second . '_' . (int) $gmt, '-','_'); - if ($result = self::$_cache->load($id)) { - return unserialize($result); - } - } - - // date to integer - $day = intval($day); - $month = intval($month); - $year = intval($year); - - // correct months > 12 and months < 1 - if ($month > 12) { - $overlap = floor($month / 12); - $year += $overlap; - $month -= $overlap * 12; - } else { - $overlap = ceil((1 - $month) / 12); - $year -= $overlap; - $month += $overlap * 12; - } - - $date = 0; - if ($year >= 1970) { - // Date is after UNIX epoch - // go through leapyears - // add months from latest given year - for ($count = 1970; $count <= $year; ++$count) { - $leapyear = self::isYearLeapYear($count); - if ($count < $year) { - $date += 365; - if ($leapyear === true) { - ++$date; - } - } else { - for ($mcount = 0; $mcount < ($month - 1); ++$mcount) { - $date += self::$_monthTable[$mcount]; - if (($leapyear === true) and ($mcount == 1)) { - ++$date; - } - } - } - } - - $date += $day - 1; - $date = (($date * 86400) + ($hour * 3600) + ($minute * 60) + $second); - } else { - // Date is before UNIX epoch - // go through leapyears - // add months from latest given year - for ($count = 1969; $count >= $year; --$count) { - $leapyear = self::isYearLeapYear($count); - if ($count > $year) { - $date += 365; - if ($leapyear === true) { - ++$date; - } - } else { - for ($mcount = 11; $mcount > ($month - 1); --$mcount) { - $date += self::$_monthTable[$mcount]; - if (($leapyear === true) and ($mcount == 2)) { - ++$date; - } - } - } - } - - $date += (self::$_monthTable[$month - 1] - $day); - $date = -(($date * 86400) + (86400 - (($hour * 3600) + ($minute * 60) + $second))); - - // gregorian correction for 5.Oct.1582 - if ($date < -12_220_185_600) { - $date += 864000; - } elseif ($date < -12_219_321_600) { - $date = -12_219_321_600; - } - } - - if (isset(self::$_cache)) { - if (self::$_cacheTags) { - self::$_cache->save(serialize($date), $id, [\Zend_Date::class]); - } else { - self::$_cache->save(serialize($date), $id); - } - } - - return $date; - } - - /** - * Returns true, if given $year is a leap year. - * - * @param int $year - * - * @return bool true, if year is leap year - */ - protected static function isYearLeapYear($year) - { - $year = (int) $year; - // all leapyears can be divided through 4 - if (($year % 4) != 0) { - return false; - } - - // all leapyears can be divided through 400 - if ($year % 400 == 0) { - return true; - } - if (($year > 1582) and ($year % 100 == 0)) { - return false; - } - - return true; - } - - /** - * Internal mktime function used by Zend_Date for handling 64bit timestamps. - * - * Returns a formatted date for a given timestamp. - * - * @param string $format format for output - * @param mixed $timestamp - * @param bool $gmt OPTIONAL true = other arguments are for UTC time, false = arguments are for local time/date - * - * @return string - */ - protected function date($format, $timestamp = null, $gmt = false) - { - $idstamp = null; - $oldzone = @date_default_timezone_get(); - if ($this->_timezone != $oldzone) { - date_default_timezone_set($this->_timezone); - } - - if ($timestamp === null) { - $result = ($gmt) ? @gmdate($format) : @date($format); - date_default_timezone_set($oldzone); - - return $result; - } - - if (abs($timestamp) <= 0x7FFFFFFF) { - // See ZF-11992 - // "o" will sometimes resolve to the previous year (see - // http://php.net/date ; it's part of the ISO 8601 - // standard). However, this is not desired, so replacing - // all occurrences of "o" not preceded by a backslash - // with "Y" - $format = preg_replace('/(?_offset . '_' . $timestamp . '_' . (int) $gmt, '-','_'); - if ($result2 = self::$_cache->load($idstamp)) { - $timestamp = unserialize($result2); - $jump = true; - } - } - - // check on false or null alone fails - if (empty($gmt) and empty($jump)) { - $tempstamp = $timestamp; - if ($tempstamp > 0) { - while (abs($tempstamp) > 0x7FFFFFFF) { - $tempstamp -= (86400 * 23376); - } - - $dst = date('I', $tempstamp); - if ($dst === 1) { - $timestamp += 3600; - } - - $temp = date('Z', $tempstamp); - $timestamp += $temp; - } - - if (isset(self::$_cache)) { - if (self::$_cacheTags) { - self::$_cache->save(serialize($timestamp), $idstamp, [\Zend_Date::class]); - } else { - self::$_cache->save(serialize($timestamp), $idstamp); - } - } - } - - if (($timestamp < 0) and ($gmt !== true)) { - $timestamp -= $this->_offset; - } - - date_default_timezone_set($oldzone); - $date = $this->getDateParts($timestamp, true); - $length = strlen($format); - $output = ''; - - for ($i = 0; $i < $length; ++$i) { - switch ($format[$i]) { - // day formats - case 'd': // day of month, 2 digits, with leading zero, 01 - 31 - $output .= (($date['mday'] < 10) ? '0' . $date['mday'] : $date['mday']); - - break; - - case 'D': // day of week, 3 letters, Mon - Sun - $output .= date('D', 86400 * (3 + self::dayOfWeek($date['year'], $date['mon'], $date['mday']))); - - break; - - case 'j': // day of month, without leading zero, 1 - 31 - $output .= $date['mday']; - - break; - - case 'l': // day of week, full string name, Sunday - Saturday - $output .= date('l', 86400 * (3 + self::dayOfWeek($date['year'], $date['mon'], $date['mday']))); - - break; - - case 'N': // ISO 8601 numeric day of week, 1 - 7 - $day = self::dayOfWeek($date['year'], $date['mon'], $date['mday']); - if ($day == 0) { - $day = 7; - } - $output .= $day; - - break; - - case 'S': // english suffix for day of month, st nd rd th - if (($date['mday'] % 10) == 1) { - $output .= 'st'; - } elseif ((($date['mday'] % 10) == 2) and ($date['mday'] != 12)) { - $output .= 'nd'; - } elseif (($date['mday'] % 10) == 3) { - $output .= 'rd'; - } else { - $output .= 'th'; - } - - break; - - case 'w': // numeric day of week, 0 - 6 - $output .= self::dayOfWeek($date['year'], $date['mon'], $date['mday']); - - break; - - case 'z': // day of year, 0 - 365 - $output .= $date['yday']; - - break; - - // week formats - case 'W': // ISO 8601, week number of year - $output .= $this->weekNumber($date['year'], $date['mon'], $date['mday']); - - break; - - // month formats - case 'F': // string month name, january - december - $output .= date('F', mktime(0, 0, 0, $date['mon'], 2, 1971)); - - break; - - case 'm': // number of month, with leading zeros, 01 - 12 - $output .= (($date['mon'] < 10) ? '0' . $date['mon'] : $date['mon']); - - break; - - case 'M': // 3 letter month name, Jan - Dec - $output .= date('M',mktime(0, 0, 0, $date['mon'], 2, 1971)); - - break; - - case 'n': // number of month, without leading zeros, 1 - 12 - $output .= $date['mon']; - - break; - - case 't': // number of day in month - $output .= self::$_monthTable[$date['mon'] - 1]; - - break; - - // year formats - case 'L': // is leap year ? - $output .= (self::isYearLeapYear($date['year'])) ? '1' : '0'; - - break; - - case 'o': // ISO 8601 year number - $week = $this->weekNumber($date['year'], $date['mon'], $date['mday']); - if (($week > 50) and ($date['mon'] == 1)) { - $output .= ($date['year'] - 1); - } else { - $output .= $date['year']; - } - - break; - - case 'Y': // year number, 4 digits - $output .= $date['year']; - - break; - - case 'y': // year number, 2 digits - $output .= substr($date['year'], strlen($date['year']) - 2, 2); - - break; - - // time formats - case 'a': // lower case am/pm - $output .= (($date['hours'] >= 12) ? 'pm' : 'am'); - - break; - - case 'A': // upper case am/pm - $output .= (($date['hours'] >= 12) ? 'PM' : 'AM'); - - break; - - case 'B': // swatch internet time - $dayseconds = ($date['hours'] * 3600) + ($date['minutes'] * 60) + $date['seconds']; - if ($gmt === true) { - $dayseconds += 3600; - } - $output .= (int) (($dayseconds % 86400) / 86.4); - - break; - - case 'g': // hours without leading zeros, 12h format - if ($date['hours'] > 12) { - $hour = $date['hours'] - 12; - } else { - if ($date['hours'] == 0) { - $hour = '12'; - } else { - $hour = $date['hours']; - } - } - $output .= $hour; - - break; - - case 'G': // hours without leading zeros, 24h format - $output .= $date['hours']; - - break; - - case 'h': // hours with leading zeros, 12h format - if ($date['hours'] > 12) { - $hour = $date['hours'] - 12; - } else { - if ($date['hours'] == 0) { - $hour = '12'; - } else { - $hour = $date['hours']; - } - } - $output .= (($hour < 10) ? '0' . $hour : $hour); - - break; - - case 'H': // hours with leading zeros, 24h format - $output .= (($date['hours'] < 10) ? '0' . $date['hours'] : $date['hours']); - - break; - - case 'i': // minutes with leading zeros - $output .= (($date['minutes'] < 10) ? '0' . $date['minutes'] : $date['minutes']); - - break; - - case 's': // seconds with leading zeros - $output .= (($date['seconds'] < 10) ? '0' . $date['seconds'] : $date['seconds']); - - break; - - // timezone formats - case 'e': // timezone identifier - if ($gmt === true) { - $output .= gmdate('e', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } else { - $output .= date('e', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } - - break; - - case 'I': // daylight saving time or not - if ($gmt === true) { - $output .= gmdate('I', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } else { - $output .= date('I', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } - - break; - - case 'O': // difference to GMT in hours - $gmtstr = ($gmt === true) ? 0 : $this->getGmtOffset(); - $output .= sprintf('%s%04d', ($gmtstr <= 0) ? '+' : '-', abs($gmtstr) / 36); - - break; - - case 'P': // difference to GMT with colon - $gmtstr = ($gmt === true) ? 0 : $this->getGmtOffset(); - $gmtstr = sprintf('%s%04d', ($gmtstr <= 0) ? '+' : '-', abs($gmtstr) / 36); - $output = $output . substr($gmtstr, 0, 3) . ':' . substr($gmtstr, 3); - - break; - - case 'T': // timezone settings - if ($gmt === true) { - $output .= gmdate('T', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } else { - $output .= date('T', mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], 2000)); - } - - break; - - case 'Z': // timezone offset in seconds - $output .= ($gmt === true) ? 0 : -$this->getGmtOffset(); - - break; - - // complete time formats - case 'c': // ISO 8601 date format - $difference = $this->getGmtOffset(); - $difference = sprintf('%s%04d', ($difference <= 0) ? '+' : '-', abs($difference) / 36); - $difference = substr($difference, 0, 3) . ':' . substr($difference, 3); - $output .= $date['year'] . '-' - . (($date['mon'] < 10) ? '0' . $date['mon'] : $date['mon']) . '-' - . (($date['mday'] < 10) ? '0' . $date['mday'] : $date['mday']) . 'T' - . (($date['hours'] < 10) ? '0' . $date['hours'] : $date['hours']) . ':' - . (($date['minutes'] < 10) ? '0' . $date['minutes'] : $date['minutes']) . ':' - . (($date['seconds'] < 10) ? '0' . $date['seconds'] : $date['seconds']) - . $difference; - - break; - - case 'r': // RFC 2822 date format - $difference = $this->getGmtOffset(); - $difference = sprintf('%s%04d', ($difference <= 0) ? '+' : '-', abs($difference) / 36); - $output .= gmdate('D', 86400 * (3 + self::dayOfWeek($date['year'], $date['mon'], $date['mday']))) . ', ' - . (($date['mday'] < 10) ? '0' . $date['mday'] : $date['mday']) . ' ' - . date('M', mktime(0, 0, 0, $date['mon'], 2, 1971)) . ' ' - . $date['year'] . ' ' - . (($date['hours'] < 10) ? '0' . $date['hours'] : $date['hours']) . ':' - . (($date['minutes'] < 10) ? '0' . $date['minutes'] : $date['minutes']) . ':' - . (($date['seconds'] < 10) ? '0' . $date['seconds'] : $date['seconds']) . ' ' - . $difference; - - break; - - case 'U': // Unix timestamp - $output .= $origstamp; - - break; - - // special formats - case '\\': // next letter to print with no format - $i++; - if ($i < $length) { - $output .= $format[$i]; - } - - break; - - default: // letter is no format so add it direct - $output .= $format[$i]; - - break; - } - } - - return (string) $output; - } - - /** - * Returns the day of week for a Gregorian calendar date. - * 0 = sunday, 6 = saturday. - * - * @param int $year - * @param int $month - * @param int $day - * - * @return int dayOfWeek - */ - protected static function dayOfWeek($year, $month, $day) - { - if ((1901 < $year) and ($year < 2038)) { - return (int) date('w', mktime(0, 0, 0, $month, $day, $year)); - } - - // gregorian correction - $correction = 0; - if (($year < 1582) or (($year == 1582) and (($month < 10) or (($month == 10) && ($day < 15))))) { - $correction = 3; - } - - if ($month > 2) { - $month -= 2; - } else { - $month += 10; - --$year; - } - - $day = floor((13 * $month - 1) / 5) + $day + ($year % 100) + floor(($year % 100) / 4); - $day += floor(($year / 100) / 4) - 2 * floor($year / 100) + 77 + $correction; - - return (int) ($day - 7 * floor($day / 7)); - } - - /** - * Internal getDateParts function for handling 64bit timestamps, similar to: - * http://www.php.net/getdate. - * - * Returns an array of date parts for $timestamp, relative to 1970/01/01 00:00:00 GMT/UTC. - * - * $fast specifies ALL date parts should be returned (slower) - * Default is false, and excludes $dayofweek, weekday, month and timestamp from parts returned. - * - * @param mixed $timestamp - * @param bool $fast OPTIONAL defaults to fast (false), resulting in fewer date parts - * - * @return array - */ - protected function getDateParts($timestamp = null, $fast = null) - { - $year = null; - $id = null; - // actual timestamp - if (!is_numeric($timestamp)) { - return getdate(); - } - - // 32bit timestamp - if (abs($timestamp) <= 0x7FFFFFFF) { - return @getdate((int) $timestamp); - } - - if (isset(self::$_cache)) { - $id = strtr('Zend_DateObject_getDateParts_' . $timestamp . '_' . (int) $fast, '-','_'); - if ($result = self::$_cache->load($id)) { - return unserialize($result); - } - } - - $otimestamp = $timestamp; - $numday = 0; - $month = 0; - // gregorian correction - if ($timestamp < -12_219_321_600) { - $timestamp -= 864000; - } - - // timestamp lower 0 - if ($timestamp < 0) { - $sec = 0; - $act = 1970; - - // iterate through 10 years table, increasing speed - foreach (self::$_yearTable as $year => $seconds) { - if ($timestamp >= $seconds) { - $i = $act; - - break; - } - $sec = $seconds; - $act = $year; - } - - $timestamp -= $sec; - if (!isset($i)) { - $i = $act; - } - - // iterate the max last 10 years - do { - --$i; - $day = $timestamp; - - $timestamp += 31_536_000; - $leapyear = self::isYearLeapYear($i); - if ($leapyear === true) { - $timestamp += 86400; - } - - if ($timestamp >= 0) { - $year = $i; - - break; - } - } while ($timestamp < 0); - - $secondsPerYear = 86400 * ($leapyear ? 366 : 365) + $day; - - $timestamp = $day; - // iterate through months - for ($i = 12; --$i >= 0;) { - $day = $timestamp; - - $timestamp += self::$_monthTable[$i] * 86400; - if (($leapyear === true) and ($i == 1)) { - $timestamp += 86400; - } - - if ($timestamp >= 0) { - $month = $i; - $numday = self::$_monthTable[$i]; - if (($leapyear === true) and ($i == 1)) { - ++$numday; - } - - break; - } - } - - $timestamp = $day; - $numberdays = $numday + ceil(($timestamp + 1) / 86400); - - $timestamp += ($numday - $numberdays + 1) * 86400; - $hours = floor($timestamp / 3600); - } else { - // iterate through years - for ($i = 1970; ; ++$i) { - $day = $timestamp; - - $timestamp -= 31_536_000; - $leapyear = self::isYearLeapYear($i); - if ($leapyear === true) { - $timestamp -= 86400; - } - - if ($timestamp < 0) { - $year = $i; - - break; - } - } - - $secondsPerYear = $day; - - $timestamp = $day; - // iterate through months - for ($i = 0; $i <= 11; ++$i) { - $day = $timestamp; - $timestamp -= self::$_monthTable[$i] * 86400; - - if (($leapyear === true) and ($i == 1)) { - $timestamp -= 86400; - } - - if ($timestamp < 0) { - $month = $i; - $numday = self::$_monthTable[$i]; - if (($leapyear === true) and ($i == 1)) { - ++$numday; - } - - break; - } - } - - $timestamp = $day; - $numberdays = ceil(($timestamp + 1) / 86400); - $timestamp = $timestamp - ($numberdays - 1) * 86400; - $hours = floor($timestamp / 3600); - } - - $timestamp -= $hours * 3600; - - ++$month; - $minutes = floor($timestamp / 60); - $seconds = $timestamp - $minutes * 60; - - if ($fast === true) { - $array = [ - 'seconds' => $seconds, - 'minutes' => $minutes, - 'hours' => $hours, - 'mday' => $numberdays, - 'mon' => $month, - 'year' => $year, - 'yday' => floor($secondsPerYear / 86400), - ]; - } else { - $dayofweek = self::dayOfWeek($year, $month, $numberdays); - $array = [ - 'seconds' => $seconds, - 'minutes' => $minutes, - 'hours' => $hours, - 'mday' => $numberdays, - 'wday' => $dayofweek, - 'mon' => $month, - 'year' => $year, - 'yday' => floor($secondsPerYear / 86400), - 'weekday' => gmdate('l', 86400 * (3 + $dayofweek)), - 'month' => gmdate('F', mktime(0, 0, 0, $month, 1, 1971)), - 0 => $otimestamp, - ]; - } - - if (isset(self::$_cache)) { - if (self::$_cacheTags) { - self::$_cache->save(serialize($array), $id, [\Zend_Date::class]); - } else { - self::$_cache->save(serialize($array), $id); - } - } - - return $array; - } - - /** - * Internal getWeekNumber function for handling 64bit timestamps. - * - * Returns the ISO 8601 week number of a given date - * - * @param int $year - * @param int $month - * @param int $day - * - * @return int - */ - protected function weekNumber($year, $month, $day) - { - if ((1901 < $year) and ($year < 2038)) { - return (int) date('W', mktime(0, 0, 0, $month, $day, $year)); - } - - $dayofweek = self::dayOfWeek($year, $month, $day); - $firstday = self::dayOfWeek($year, 1, 1); - if (($month == 1) and (($firstday < 1) or ($firstday > 4)) and ($day < 4)) { - $firstday = self::dayOfWeek($year - 1, 1, 1); - $month = 12; - $day = 31; - } elseif (($month == 12) and ((self::dayOfWeek($year + 1, 1, 1) < 5) - and (self::dayOfWeek($year + 1, 1, 1) > 0))) { - return 1; - } - - return intval(((self::dayOfWeek($year, 1, 1) < 5) and (self::dayOfWeek($year, 1, 1) > 0)) - + 4 * ($month - 1) + (2 * ($month - 1) + ($day - 1) + $firstday - $dayofweek + 6) * 36 / 256); - } - - /** - * Internal _range function - * Sets the value $a to be in the range of [0, $b]. - * - * @param float $a - value to correct - * @param float $b - maximum range to set - */ - private function _range($a, $b) - { - while ($a < 0) { - $a += $b; - } - while ($a >= $b) { - $a -= $b; - } - - return $a; - } - - /** - * Calculates the sunrise or sunset based on a location. - * - * @param array $location Location for calculation MUST include 'latitude', 'longitude', 'horizon' - * @param bool $horizon true: sunrise; false: sunset - * @param mixed $rise - * - * @return mixed - false: midnight sun, integer: - */ - protected function calcSun($location, $horizon, $rise = false) - { - // timestamp within 32bit - if (abs($this->_unixTimestamp) <= 0x7FFFFFFF) { - if ($rise === false) { - return date_sunset($this->_unixTimestamp, SUNFUNCS_RET_TIMESTAMP, $location['latitude'], - $location['longitude'], 90 + $horizon, $this->getGmtOffset() / 3600); - } - - return date_sunrise($this->_unixTimestamp, SUNFUNCS_RET_TIMESTAMP, $location['latitude'], - $location['longitude'], 90 + $horizon, $this->getGmtOffset() / 3600); - } - - // self calculation - timestamp bigger than 32bit - // fix circle values - $quarterCircle = 0.5 * M_PI; - $halfCircle = M_PI; - $threeQuarterCircle = 1.5 * M_PI; - $fullCircle = 2 * M_PI; - - // radiant conversion for coordinates - $radLatitude = $location['latitude'] * $halfCircle / 180; - $radLongitude = $location['longitude'] * $halfCircle / 180; - - // get solar coordinates - $tmpRise = $rise ? $quarterCircle : $threeQuarterCircle; - $radDay = $this->date('z',$this->_unixTimestamp) + ($tmpRise - $radLongitude) / $fullCircle; - - // solar anomoly and longitude - $solAnomoly = $radDay * 0.017202 - 0.0574039; - $solLongitude = $solAnomoly + 0.0334405 * sin($solAnomoly); - $solLongitude += 4.93289 + 3.49066E-4 * sin(2 * $solAnomoly); - - // get quadrant - $solLongitude = $this->_range($solLongitude, $fullCircle); - - if (($solLongitude / $quarterCircle) - intval($solLongitude / $quarterCircle) == 0) { - $solLongitude += 4.84814E-6; - } - - // solar ascension - $solAscension = sin($solLongitude) / cos($solLongitude); - $solAscension = atan2(0.91746 * $solAscension, 1); - - // adjust quadrant - if ($solLongitude > $threeQuarterCircle) { - $solAscension += $fullCircle; - } elseif ($solLongitude > $quarterCircle) { - $solAscension += $halfCircle; - } - - // solar declination - $solDeclination = 0.39782 * sin($solLongitude); - $solDeclination /= sqrt(-$solDeclination * $solDeclination + 1); - $solDeclination = atan2($solDeclination, 1); - - $solHorizon = $horizon - sin($solDeclination) * sin($radLatitude); - $solHorizon /= cos($solDeclination) * cos($radLatitude); - - // midnight sun, always night - if (abs($solHorizon) > 1) { - return false; - } - - $solHorizon /= sqrt(-$solHorizon * $solHorizon + 1); - $solHorizon = $quarterCircle - atan2($solHorizon, 1); - - if ($rise) { - $solHorizon = $fullCircle - $solHorizon; - } - - // time calculation - $localTime = $solHorizon + $solAscension - 0.0172028 * $radDay - 1.73364; - $universalTime = $localTime - $radLongitude; - - // determinate quadrant - $universalTime = $this->_range($universalTime, $fullCircle); - - // radiant to hours - $universalTime *= 24 / $fullCircle; - - // convert to time - $hour = intval($universalTime); - $universalTime = ($universalTime - $hour) * 60; - $min = intval($universalTime); - $universalTime = ($universalTime - $min) * 60; - $sec = intval($universalTime); - - return $this->mktime($hour, $min, $sec, $this->date('m', $this->_unixTimestamp), - $this->date('j', $this->_unixTimestamp), $this->date('Y', $this->_unixTimestamp), - -1); - } - - /** - * Sets a new timezone for calculation of $this object's gmt offset. - * For a list of supported timezones look here: http://php.net/timezones - * If no timezone can be detected or the given timezone is wrong UTC will be set. - * - * @param string $zone OPTIONAL timezone for date calculation; defaults to date_default_timezone_get() - * - * @return Zend_Date_DateObject Provides fluent interface - */ - public function setTimezone($zone = null) - { - $oldzone = @date_default_timezone_get(); - if ($zone === null) { - $zone = $oldzone; - } - - // throw an error on false input, but only if the new date extension is available - if (function_exists('timezone_open')) { - if (!@timezone_open($zone)) { - throw new Zend_Date_Exception("timezone ($zone) is not a known timezone", 0, null, $zone); - } - } - // this can generate an error if the date extension is not available and a false timezone is given - $result = @date_default_timezone_set($zone); - if ($result === true) { - $this->_offset = mktime(0, 0, 0, 1, 2, 1970) - gmmktime(0, 0, 0, 1, 2, 1970); - $this->_timezone = $zone; - } - date_default_timezone_set($oldzone); - - if (($zone == 'UTC') or ($zone == 'GMT')) { - $this->_dst = false; - } else { - $this->_dst = true; - } - - return $this; - } - - /** - * Return the timezone of $this object. - * The timezone is initially set when the object is instantiated. - * - * @return string actual set timezone string - */ - public function getTimezone() - { - return $this->_timezone; - } - - /** - * Return the offset to GMT of $this object's timezone. - * The offset to GMT is initially set when the object is instantiated using the currently, - * in effect, default timezone for PHP functions. - * - * @return int seconds difference between GMT timezone and timezone when object was instantiated - */ - public function getGmtOffset() - { - $offset = null; - $date = $this->getDateParts($this->getUnixTimestamp(), true); - $zone = @date_default_timezone_get(); - $result = @date_default_timezone_set($this->_timezone); - if ($result === true) { - $offset = $this->mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], $date['year'], false) - - $this->mktime($date['hours'], $date['minutes'], $date['seconds'], - $date['mon'], $date['mday'], $date['year'], true); - } - date_default_timezone_set($zone); - - return $offset; - } - - /** - * Internal method to check if the given cache supports tags. - */ - protected static function _getTagSupportForCache() - { - $backend = self::$_cache->getBackend(); - if ($backend instanceof Zend_Cache_Backend_ExtendedInterface) { - $cacheOptions = $backend->getCapabilities(); - self::$_cacheTags = $cacheOptions['tags']; - } else { - self::$_cacheTags = false; - } - - return self::$_cacheTags; - } -} diff --git a/library/Zend/Date/Exception.php b/library/Zend/Date/Exception.php deleted file mode 100644 index 303456cd..00000000 --- a/library/Zend/Date/Exception.php +++ /dev/null @@ -1,41 +0,0 @@ -operand = $op; - parent::__construct($message, $code, $e); - } - - public function getOperand() - { - return $this->operand; - } -} diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php index e8f7e397..252c4b1d 100644 --- a/library/Zend/Locale/Format.php +++ b/library/Zend/Locale/Format.php @@ -1185,7 +1185,6 @@ public static function getDate($date, array $options = []) /** * Returns if the given datestring contains all date parts from the given format. * If no format is given, the default date format from the locale is used - * If you want to check if the date is a proper date you should use Zend_Date::isDate(). * * @param string $date Date string * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details. diff --git a/library/Zend/Validate/Date.php b/library/Zend/Validate/Date.php deleted file mode 100644 index b3d74113..00000000 --- a/library/Zend/Validate/Date.php +++ /dev/null @@ -1,256 +0,0 @@ - 'Invalid type given. String, integer, array or Zend_Date expected', - self::INVALID_DATE => "'%value%' does not appear to be a valid date", - self::FALSEFORMAT => "'%value%' does not fit the date format '%format%'", - ]; - - /** - * @var array - */ - protected $_messageVariables = [ - 'format' => '_format', - ]; - - /** - * Optional format. - * - * @var null|string - */ - protected $_format; - - /** - * Optional locale. - * - * @var null|string|Zend_Locale - */ - protected $_locale; - - /** - * Sets validator options. - * - * @param array|string|Zend_Config $options OPTIONAL - */ - public function __construct($options = []) - { - $temp = []; - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (!is_array($options)) { - $options = func_get_args(); - $temp['format'] = array_shift($options); - if (!empty($options)) { - $temp['locale'] = array_shift($options); - } - - $options = $temp; - } - - if (array_key_exists('format', $options)) { - $this->setFormat($options['format']); - } - - if (!array_key_exists('locale', $options)) { - if (Zend_Registry::isRegistered(\Zend_Locale::class)) { - $options['locale'] = Zend_Registry::get(\Zend_Locale::class); - } - } - - if (array_key_exists('locale', $options)) { - $this->setLocale($options['locale']); - } - } - - /** - * Returns the locale option. - * - * @return null|string|Zend_Locale - */ - public function getLocale() - { - return $this->_locale; - } - - /** - * Sets the locale option. - * - * @param string|Zend_Locale $locale - * - * @return Zend_Validate_Date provides a fluent interface - */ - public function setLocale($locale = null) - { - $this->_locale = Zend_Locale::findLocale($locale); - - return $this; - } - - /** - * Returns the locale option. - * - * @return null|string - */ - public function getFormat() - { - return $this->_format; - } - - /** - * Sets the format option. - * - * @param string $format - * - * @return Zend_Validate_Date provides a fluent interface - */ - public function setFormat($format = null) - { - $this->_format = $format; - - return $this; - } - - /** - * Defined by Zend_Validate_Interface. - * - * Returns true if $value is a valid date of the format YYYY-MM-DD - * If optional $format or $locale is set the date format is checked - * according to Zend_Date, see Zend_Date::isDate() - * - * @param array|string|Zend_Date $value - * - * @return bool - */ - public function isValid($value) - { - if (!is_string($value) && !is_int($value) && !is_float($value) - && !is_array($value) && !($value instanceof Zend_Date)) { - $this->_error(self::INVALID); - - return false; - } - - $this->_setValue($value); - - if (($this->_format !== null) || ($this->_locale !== null) || is_array($value) - || $value instanceof Zend_Date) { - if (!Zend_Date::isDate($value, $this->_format, $this->_locale)) { - if ($this->_checkFormat($value) === false) { - $this->_error(self::FALSEFORMAT); - } else { - $this->_error(self::INVALID_DATE); - } - - return false; - } - } else { - if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $value)) { - $this->_format = 'yyyy-MM-dd'; - $this->_error(self::FALSEFORMAT); - $this->_format = null; - - return false; - } - - [$year, $month, $day] = sscanf($value, '%d-%d-%d'); - - if (!checkdate($month, $day, $year)) { - $this->_error(self::INVALID_DATE); - - return false; - } - } - - return true; - } - - /** - * Check if the given date fits the given format. - * - * @param string $value Date to check - * - * @return bool False when date does not fit the format - */ - private function _checkFormat($value) - { - try { - $parsed = Zend_Locale_Format::getDate($value, [ - 'date_format' => $this->_format, 'format_type' => 'iso', - 'fix_date' => false, ]); - if (isset($parsed['year']) and ((strpos(strtoupper($this->_format), 'YY') !== false) - and (strpos(strtoupper($this->_format), 'YYYY') === false))) { - $parsed['year'] = Zend_Date::getFullYear($parsed['year']); - } - } catch (Exception $e) { - // Date can not be parsed - return false; - } - - if (((strpos($this->_format, 'Y') !== false) or (strpos($this->_format, 'y') !== false)) - and (!isset($parsed['year']))) { - // Year expected but not found - return false; - } - - if ((strpos($this->_format, 'M') !== false) and (!isset($parsed['month']))) { - // Month expected but not found - return false; - } - - if ((strpos($this->_format, 'd') !== false) and (!isset($parsed['day']))) { - // Day expected but not found - return false; - } - - if (((strpos($this->_format, 'H') !== false) or (strpos($this->_format, 'h') !== false)) - and (!isset($parsed['hour']))) { - // Hour expected but not found - return false; - } - - if ((strpos($this->_format, 'm') !== false) and (!isset($parsed['minute']))) { - // Minute expected but not found - return false; - } - - if ((strpos($this->_format, 's') !== false) and (!isset($parsed['second']))) { - // Second expected but not found - return false; - } - - // Date fits the format - return true; - } -} diff --git a/tests/TestConfiguration.php.dist b/tests/TestConfiguration.php.dist index 3e51c8c8..1b3b186a 100644 --- a/tests/TestConfiguration.php.dist +++ b/tests/TestConfiguration.php.dist @@ -227,7 +227,6 @@ defined('TESTS_ZEND_LOCALE_FORMAT_SETLOCALE') || define('TESTS_ZEND_LOCALE_FORMA * Edit TestConfiguration.php, not TestConfiguration.php.dist. */ defined('TESTS_ZEND_LOCALE_BCMATH_ENABLED') || define('TESTS_ZEND_LOCALE_BCMATH_ENABLED', true); -defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || define('TESTS_ZEND_I18N_EXTENDED_COVERAGE', true); /** * Zend_Rest tests diff --git a/tests/Zend/Date/DateObjectTest.php b/tests/Zend/Date/DateObjectTest.php deleted file mode 100644 index d194314a..00000000 --- a/tests/Zend/Date/DateObjectTest.php +++ /dev/null @@ -1,594 +0,0 @@ -originalTimezone = date_default_timezone_get(); - date_default_timezone_set('Europe/Paris'); - $this->_cache = Zend_Cache::factory('Core', 'File', - ['lifetime' => 120, 'automatic_serialization' => true], - ['cache_dir' => __DIR__ . '/../_files/']); - Zend_Date_DateObjectTestHelper::setOptions(['cache' => $this->_cache]); - } - - public function tearDown(): void - { - date_default_timezone_set($this->originalTimezone); - $this->_cache->clean(Zend_Cache::CLEANING_MODE_ALL); - } - - /** - * Test for date object creation null value. - */ - public function testCreationNull() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - $date = new Zend_Date(0); - $this->assertTrue($date instanceof Zend_Date); - } - - /** - * Test for date object creation negative timestamp. - */ - public function testCreationNegative() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - $date = new Zend_Date(1000); - $this->assertTrue($date instanceof Zend_Date); - } - - /** - * Test for date object creation text given. - */ - public function testCreationFailed() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - try { - $date = new Zend_Date('notimestamp'); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - self::assertTrue(true); - } - } - - /** - * Test for setUnixTimestamp. - */ - public function testsetUnixTimestamp() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $diff = abs(time() - $date->getUnixTimestamp()); - $this->assertTrue(($diff < 2), 'Zend_Date->setUnixTimestamp() returned a significantly ' - . "different timestamp than expected: $diff seconds"); - $date->setUnixTimestamp(0); - $this->assertSame('0', (string) $date->setUnixTimestamp('12345678901234567890')); - $this->assertSame('12345678901234567890', (string) $date->setUnixTimestamp('12345678901234567890')); - - $date->setUnixTimestamp(); - $diff = abs(time() - $date->getUnixTimestamp()); - $this->assertTrue($diff < 2, "setUnixTimestamp has a significantly different time than returned by time()): $diff seconds"); - } - - /** - * Test for setUnixTimestampFailed. - */ - public function testsetUnixTimestampFailed() - { - try { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $date->setUnixTimestamp('notimestamp'); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - self::assertTrue(true); - } - } - - /** - * Test for getUnixTimestamp. - */ - public function testgetUnixTimestamp() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $result = $date->getUnixTimestamp(); - $diff = abs($result - time()); - $this->assertTrue($diff < 2, "Instance of Zend_Date_DateObject has a significantly different time than returned by setTime(): $diff seconds"); - } - - /** - * Test for mktime. - */ - public function testMkTimeforDateValuesInPHPRange() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $this->assertSame(mktime(0, 0, 0, 12, 30, 2037), $date->mktime(0, 0, 0, 12, 30, 2037, false)); - $this->assertSame(gmmktime(0, 0, 0, 12, 30, 2037), $date->mktime(0, 0, 0, 12, 30, 2037, true)); - - $this->assertSame(mktime(0, 0, 0, 1, 1, 2000), $date->mktime(0, 0, 0, 1, 1, 2000, false)); - $this->assertSame(gmmktime(0, 0, 0, 1, 1, 2000), $date->mktime(0, 0, 0, 1, 1, 2000, true)); - - $this->assertSame(mktime(0, 0, 0, 1, 1, 1970), $date->mktime(0, 0, 0, 1, 1, 1970, false)); - $this->assertSame(gmmktime(0, 0, 0, 1, 1, 1970), $date->mktime(0, 0, 0, 1, 1, 1970, true)); - - $this->assertSame(mktime(0, 0, 0, 12, 30, 1902), $date->mktime(0, 0, 0, 12, 30, 1902, false)); - $this->assertSame(gmmktime(0, 0, 0, 12, 30, 1902), $date->mktime(0, 0, 0, 12, 30, 1902, true)); - } - - /** - * Test for mktime. - */ - public function testMkTimeforDateValuesGreaterPHPRange() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $this->assertSame(2_232_658_800, $date->mktime(0, 0, 0,10, 1, 2040, false)); - $this->assertSame(2_232_662_400, $date->mktime(0, 0, 0,10, 1, 2040, true)); - $this->assertSame(7_258_114_800, $date->mktime(0, 0, 0, 1, 1, 2200, false)); - $this->assertSame(7_258_118_400, $date->mktime(0, 0, 0, 1, 1, 2200, true)); - $this->assertSame(16_749_586_800, $date->mktime(0, 0, 0,10,10, 2500, false)); - $this->assertSame(16_749_590_400, $date->mktime(0, 0, 0,10,10, 2500, true)); - $this->assertSame(32_503_676_400, $date->mktime(0, 0, 0, 1, 1, 3000, false)); - $this->assertSame(32_503_680_000, $date->mktime(0, 0, 0, 1, 1, 3000, true)); - $this->assertSame(95_617_580_400, $date->mktime(0, 0, 0, 1, 1, 5000, false)); - $this->assertSame(95_617_584_000, $date->mktime(0, 0, 0, 1, 1, 5000, true)); - - // test for different set external timezone - // the internal timezone should always be used for calculation - $date->setTimezone('Europe/Paris'); - $this->assertSame(1_577_833_200, $date->mktime(0, 0, 0, 1, 1, 2020, false)); - $this->assertSame(1_577_836_800, $date->mktime(0, 0, 0, 1, 1, 2020, true)); - date_default_timezone_set('Indian/Maldives'); - $this->assertSame(1_577_833_200, $date->mktime(0, 0, 0, 1, 1, 2020, false)); - $this->assertSame(1_577_836_800, $date->mktime(0, 0, 0, 1, 1, 2020, true)); - } - - /** - * Test for mktime. - */ - public function testMkTimeforDateValuesSmallerPHPRange() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $this->assertSame(-2_208_992_400, $date->mktime(0, 0, 0, 1, 1, 1900, false)); - $this->assertSame(-2_208_988_800, $date->mktime(0, 0, 0, 1, 1, 1900, true)); - $this->assertSame(-8_520_339_600, $date->mktime(0, 0, 0, 1, 1, 1700, false)); - $this->assertSame(-8_520_336_000, $date->mktime(0, 0, 0, 1, 1, 1700, true)); - $this->assertSame(-14_830_995_600, $date->mktime(0, 0, 0, 1, 1, 1500, false)); - $this->assertSame(-14_830_992_000, $date->mktime(0, 0, 0, 1, 1, 1500, true)); - $this->assertSame(-12_219_321_600, $date->mktime(0, 0, 0,10,10, 1582, false)); - $this->assertSame(-12_219_321_600, $date->mktime(0, 0, 0,10,10, 1582, true)); - $this->assertSame(-30_609_795_600, $date->mktime(0, 0, 0, 1, 1, 1000, false)); - $this->assertSame(-30_609_792_000, $date->mktime(0, 0, 0, 1, 1, 1000, true)); - $this->assertSame(-62_167_395_600, $date->mktime(0, 0, 0, 1, 1, 0, false)); - $this->assertSame(-62_167_392_000, $date->mktime(0, 0, 0, 1, 1, 0, true)); - $this->assertSame(-125_282_595_600, $date->mktime(0, 0, 0, 1, 1,-2000, false)); - $this->assertSame(-125_282_592_000, $date->mktime(0, 0, 0, 1, 1,-2000, true)); - - $this->assertSame(-2_208_992_400, $date->mktime(0, 0, 0, 13, 1, 1899, false)); - $this->assertSame(-2_208_988_800, $date->mktime(0, 0, 0, 13, 1, 1899, true)); - $this->assertSame(-2_208_992_400, $date->mktime(0, 0, 0,-11, 1, 1901, false)); - $this->assertSame(-2_208_988_800, $date->mktime(0, 0, 0,-11, 1, 1901, true)); - } - - public function testIsLeapYear() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $this->assertTrue($date->checkLeapYear(2000)); - $this->assertFalse($date->checkLeapYear(2002)); - $this->assertTrue($date->checkLeapYear(2004)); - $this->assertFalse($date->checkLeapYear(1899)); - $this->assertTrue($date->checkLeapYear(1500)); - $this->assertFalse($date->checkLeapYear(1455)); - } - - public function testWeekNumber() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $this->assertSame((int) date('W',mktime(0, 0, 0, 1, 1, 2000)), $date->weekNumber(2000, 1, 1)); - $this->assertSame((int) date('W',mktime(0, 0, 0, 10, 1, 2020)), $date->weekNumber(2020, 10, 1)); - $this->assertSame((int) date('W',mktime(0, 0, 0, 5, 15, 2005)), $date->weekNumber(2005, 5, 15)); - $this->assertSame((int) date('W',mktime(0, 0, 0, 11, 22, 1994)), $date->weekNumber(1994, 11, 22)); - $this->assertSame((int) date('W',mktime(0, 0, 0, 12, 31, 2000)), $date->weekNumber(2000, 12, 31)); - $this->assertSame(52, $date->weekNumber(2050, 12, 31)); - $this->assertSame(23, $date->weekNumber(2050, 6, 6)); - $this->assertSame(52, $date->weekNumber(2056, 1, 1)); - $this->assertSame(52, $date->weekNumber(2049, 12, 31)); - $this->assertSame(53, $date->weekNumber(2048, 12, 31)); - $this->assertSame(1, $date->weekNumber(2047, 12, 31)); - } - - public function testDayOfWeek() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $this->assertSame((int) date('w',mktime(0, 0, 0, 1, 1, 2000)), $date->dayOfWeekHelper(2000, 1, 1)); - $this->assertSame((int) date('w',mktime(0, 0, 0, 1, 2, 2000)), $date->dayOfWeekHelper(2000, 1, 2)); - $this->assertSame((int) date('w',mktime(0, 0, 0, 1, 3, 2000)), $date->dayOfWeekHelper(2000, 1, 3)); - $this->assertSame((int) date('w',mktime(0, 0, 0, 1, 4, 2000)), $date->dayOfWeekHelper(2000, 1, 4)); - $this->assertSame((int) date('w',mktime(0, 0, 0, 1, 5, 2000)), $date->dayOfWeekHelper(2000, 1, 5)); - $this->assertSame((int) date('w',mktime(0, 0, 0, 1, 6, 2000)), $date->dayOfWeekHelper(2000, 1, 6)); - $this->assertSame((int) date('w',mktime(0, 0, 0, 1, 7, 2000)), $date->dayOfWeekHelper(2000, 1, 7)); - $this->assertSame((int) date('w',mktime(0, 0, 0, 1, 8, 2000)), $date->dayOfWeekHelper(2000, 1, 8)); - $this->assertSame(6, $date->dayOfWeekHelper(2050, 1, 1)); - $this->assertSame(0, $date->dayOfWeekHelper(2050, 1, 2)); - $this->assertSame(1, $date->dayOfWeekHelper(2050, 1, 3)); - $this->assertSame(2, $date->dayOfWeekHelper(2050, 1, 4)); - $this->assertSame(3, $date->dayOfWeekHelper(2050, 1, 5)); - $this->assertSame(4, $date->dayOfWeekHelper(2050, 1, 6)); - $this->assertSame(5, $date->dayOfWeekHelper(2050, 1, 7)); - $this->assertSame(6, $date->dayOfWeekHelper(2050, 1, 8)); - $this->assertSame(4, $date->dayOfWeekHelper(1500, 1, 1)); - } - - public function testCalcSunInternal() - { - $date = new Zend_Date_DateObjectTestHelper(10_000_000); - $this->assertSame(9961716, $date->calcSun(['latitude' => 38.4, 'longitude' => -29], -0.0145439, true)); - $this->assertSame(10010341, $date->calcSun(['latitude' => 38.4, 'longitude' => -29], -0.0145439, false)); - - $date = new Zend_Date_DateObjectTestHelper(-148_309_884); - $this->assertSame(-148322626, $date->calcSun(['latitude' => 38.4, 'longitude' => -29], -0.0145439, true)); - $this->assertSame(-148274784, $date->calcSun(['latitude' => 38.4, 'longitude' => -29], -0.0145439, false)); - } - - public function testGetDate() - { - $date = new Zend_Date_DateObjectTestHelper(0); - $this->assertTrue(is_array($date->getDateParts())); - $this->assertTrue(is_array($date->getDateParts(1_000_000))); - - $test = ['seconds' => 40, 'minutes' => 46, - 'hours' => 14, 'mday' => 12, 'wday' => 1, - 'mon' => 1, 'year' => 1970, 'yday' => 11, - 'weekday' => 'Monday', 'month' => 'January', 0 => 1_000_000, ]; - $result = $date->getDateParts(1_000_000); - - $this->assertSame((int) $test['seconds'], (int) $result['seconds']); - $this->assertSame((int) $test['minutes'], (int) $result['minutes']); - $this->assertSame((int) $test['hours'], (int) $result['hours']); - $this->assertSame((int) $test['mday'], (int) $result['mday']); - $this->assertSame((int) $test['wday'], (int) $result['wday']); - $this->assertSame((int) $test['mon'], (int) $result['mon']); - $this->assertSame((int) $test['year'], (int) $result['year']); - $this->assertSame((int) $test['yday'], (int) $result['yday']); - $this->assertSame($test['weekday'], $result['weekday']); - $this->assertSame($test['month'], $result['month']); - $this->assertSame($test[0], $result[0]); - - $test = ['seconds' => 20, 'minutes' => 33, - 'hours' => 11, 'mday' => 6, 'wday' => 3, - 'mon' => 3, 'year' => 1748, 'yday' => 65, - 'weekday' => 'Wednesday', 'month' => 'February', 0 => -7_000_000_000, ]; - $result = $date->getDateParts(-7_000_000_000); - - $this->assertSame((int) $test['seconds'], (int) $result['seconds']); - $this->assertSame((int) $test['minutes'], (int) $result['minutes']); - $this->assertSame((int) $test['hours'], (int) $result['hours']); - $this->assertSame((int) $test['mday'], (int) $result['mday']); - $this->assertSame((int) $test['wday'], (int) $result['wday']); - $this->assertSame((int) $test['mon'], (int) $result['mon']); - $this->assertSame((int) $test['year'], (int) $result['year']); - $this->assertSame((int) $test['yday'], (int) $result['yday']); - $this->assertSame($test['weekday'], $result['weekday']); - $this->assertSame($test['month'], $result['month']); - $this->assertSame($test[0], $result[0]); - - $test = ['seconds' => 0, 'minutes' => 40, - 'hours' => 2, 'mday' => 26, 'wday' => 2, - 'mon' => 8, 'year' => 2188, 'yday' => 238, - 'weekday' => 'Tuesday', 'month' => 'July', 0 => 6_900_000_000, ]; - $result = $date->getDateParts(6_900_000_000); - - $this->assertSame((int) $test['seconds'], (int) $result['seconds']); - $this->assertSame((int) $test['minutes'], (int) $result['minutes']); - $this->assertSame((int) $test['hours'], (int) $result['hours']); - $this->assertSame((int) $test['mday'], (int) $result['mday']); - $this->assertSame((int) $test['wday'], (int) $result['wday']); - $this->assertSame((int) $test['mon'], (int) $result['mon']); - $this->assertSame((int) $test['year'], (int) $result['year']); - $this->assertSame((int) $test['yday'], (int) $result['yday']); - $this->assertSame($test['weekday'], $result['weekday']); - $this->assertSame($test['month'], $result['month']); - $this->assertSame($test[0], $result[0]); - - $test = ['seconds' => 0, 'minutes' => 40, - 'hours' => 2, 'mday' => 26, 'wday' => 3, - 'mon' => 8, 'year' => 2188, 'yday' => 238, - 'weekday' => 'Wednesday', 'month' => 'July', 0 => 6_900_000_000, ]; - $result = $date->getDateParts(6_900_000_000, true); - - $this->assertSame((int) $test['seconds'], (int) $result['seconds']); - $this->assertSame((int) $test['minutes'], (int) $result['minutes']); - $this->assertSame((int) $test['hours'], (int) $result['hours']); - $this->assertSame((int) $test['mday'], (int) $result['mday']); - $this->assertSame((int) $test['mon'], (int) $result['mon']); - $this->assertSame((int) $test['year'], (int) $result['year']); - $this->assertSame((int) $test['yday'], (int) $result['yday']); - } - - public function testDate() - { - $date = new Zend_Date_DateObjectTestHelper(0); - $this->assertTrue($date->date('U') > 0); - $this->assertSame('0', $date->date('U',0)); - $this->assertSame('0', $date->date('U',0,false)); - $this->assertSame('0', $date->date('U',0,true)); - $this->assertSame('6900000000', $date->date('U',6_900_000_000)); - $this->assertSame('-7000000000', $date->date('U',-7_000_000_000)); - $this->assertSame('06', $date->date('d',-7_000_000_000)); - $this->assertSame('Wed', $date->date('D',-7_000_000_000)); - $this->assertSame('6', $date->date('j',-7_000_000_000)); - $this->assertSame('Wednesday', $date->date('l',-7_000_000_000)); - $this->assertSame('3', $date->date('N',-7_000_000_000)); - $this->assertSame('th', $date->date('S',-7_000_000_000)); - $this->assertSame('3', $date->date('w',-7_000_000_000)); - $this->assertSame('65', $date->date('z',-7_000_000_000)); - $this->assertSame('10', $date->date('W',-7_000_000_000)); - $this->assertSame('March', $date->date('F',-7_000_000_000)); - $this->assertSame('03', $date->date('m',-7_000_000_000)); - $this->assertSame('Mar', $date->date('M',-7_000_000_000)); - $this->assertSame('3', $date->date('n',-7_000_000_000)); - $this->assertSame('31', $date->date('t',-7_000_000_000)); - $this->assertSame('CET', $date->date('T',-7_000_000_000)); - $this->assertSame('1', $date->date('L',-7_000_000_000)); - $this->assertSame('1748', $date->date('o',-7_000_000_000)); - $this->assertSame('1748', $date->date('Y',-7_000_000_000)); - $this->assertSame('48', $date->date('y',-7_000_000_000)); - $this->assertSame('pm', $date->date('a',-7_000_000_000)); - $this->assertSame('PM', $date->date('A',-7_000_000_000)); - $this->assertSame('523', $date->date('B',-7_000_000_000)); - $this->assertSame('12', $date->date('g',-7_000_000_000)); - $this->assertSame('12', $date->date('G',-7_000_000_000)); - $this->assertSame('12', $date->date('h',-7_000_000_000)); - $this->assertSame('12', $date->date('H',-7_000_000_000)); - $this->assertSame('33', $date->date('i',-7_000_000_000)); - $this->assertSame('20', $date->date('s',-7_000_000_000)); - $this->assertSame('Europe/Paris', $date->date('e',-7_000_000_000)); - $this->assertSame('0', $date->date('I',-7_000_000_000)); - $this->assertSame('+0100', $date->date('O',-7_000_000_000)); - $this->assertSame('+01:00', $date->date('P',-7_000_000_000)); - $this->assertSame('CET', $date->date('T',-7_000_000_000)); - $this->assertSame('3600', $date->date('Z',-7_000_000_000)); - $this->assertSame('1748-03-06T12:33:20+01:00', $date->date('c',-7_000_000_000)); - $this->assertSame('Wed, 06 Mar 1748 12:33:20 +0100', $date->date('r',-7_000_000_000)); - $this->assertSame('-7000000000', $date->date('U' ,-7_000_000_000)); - $this->assertSame('H', $date->date('\\H' ,-7_000_000_000)); - $this->assertSame('.', $date->date('.' ,-7_000_000_000)); - $this->assertSame('12:33:20', $date->date('H:i:s',-7_000_000_000)); - $this->assertSame('06-Mar-1748', $date->date('d-M-Y',-7_000_000_000)); - $this->assertSame('6900000000', $date->date('U',6_900_000_000, true)); - $this->assertSame('152', $date->date('B',6_900_000_000, true)); - $this->assertSame('12', $date->date('g',6_899_993_000, true)); - $this->assertSame('1', $date->date('g',6_899_997_000, true)); - $this->assertSame('1', $date->date('g',6_900_039_200, true)); - $this->assertSame('12', $date->date('h',6_899_993_000, true)); - $this->assertSame('01', $date->date('h',6_899_997_000, true)); - $this->assertSame('01', $date->date('h',6_900_040_200, true)); - $this->assertSame('UTC', $date->date('e',-7_000_000_000,true)); - $this->assertSame('0', $date->date('I',-7_000_000_000,true)); - $this->assertSame('GMT', $date->date('T',-7_000_000_000,true)); - $this->assertSame('6', $date->date('N',6_899_740_800, true)); - $this->assertSame('st', $date->date('S',6_900_518_000, true)); - $this->assertSame('nd', $date->date('S',6_900_604_800, true)); - $this->assertSame('rd', $date->date('S',6_900_691_200, true)); - $this->assertSame('7', $date->date('N',6_900_432_000, true)); - $date->setTimezone('Europe/Vienna'); - date_default_timezone_set('Indian/Maldives'); - $reference = $date->date('U'); - $this->assertTrue(abs($reference - time()) < 2); - $this->assertSame('69000000', $date->date('U',69_000_000)); - - // ISO Year (o) depends on the week number so 1.1. can be last year is week is 52/53 - $this->assertSame('1739', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1740))); - $this->assertSame('1740', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1741))); - $this->assertSame('1742', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1742))); - $this->assertSame('1743', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1743))); - $this->assertSame('1744', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1744))); - $this->assertSame('1744', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1745))); - $this->assertSame('1745', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1746))); - $this->assertSame('1746', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1747))); - $this->assertSame('1748', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1748))); - $this->assertSame('1749', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 1749))); - $this->assertSame('2049', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 2050))); - $this->assertSame('2050', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 2051))); - $this->assertSame('2052', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 2052))); - $this->assertSame('2053', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 2053))); - $this->assertSame('2054', $date->date('o',$date->mktime(0, 0, 0, 1, 1, 2054))); - } - - function testMktimeDay0And32() - { - // the following functionality is used by isTomorrow() and isYesterday() in Zend_Date. - $date = new Zend_Date_DateObjectTestHelper(0); - $this->assertSame('20060101', $date->date('Ymd', $date->mktime(0, 0, 0, 12, 32, 2005))); - $this->assertSame('20050301', $date->date('Ymd', $date->mktime(0, 0, 0, 2, 29, 2005))); - $this->assertSame('20051231', $date->date('Ymd', $date->mktime(0, 0, 0, 1, 0, 2006))); - $this->assertSame('20050131', $date->date('Ymd', $date->mktime(0, 0, 0, 2, 0, 2005))); - } - - /** - * Test for setTimezone(). - */ - public function testSetTimezone() - { - $date = new Zend_Date_DateObjectTestHelper(0); - - date_default_timezone_set('Europe/Vienna'); - $date->setTimezone('Indian/Maldives'); - $this->assertSame('Indian/Maldives', $date->getTimezone()); - - try { - $date->setTimezone('Unknown'); - // without new phpdate false timezones do not throw an exception ! - // known and expected behaviour - if (function_exists('timezone_open')) { - $this->fail('exception expected'); - } - } catch (Zend_Date_Exception $e) { - $this->assertMatchesRegularExpression('/not a known timezone/i', $e->getMessage()); - $this->assertSame('Unknown', $e->getOperand()); - } - $this->assertSame('Indian/Maldives', $date->getTimezone()); - $date->setTimezone(); - $this->assertSame('Europe/Vienna', $date->getTimezone()); - } - - /** - * Test for gmtOffset. - */ - public function testgetGmtOffset() - { - $date = new Zend_Date_DateObjectTestHelper(0); - - date_default_timezone_set('Europe/Vienna'); - $date->setTimezone(); - - $this->assertSame(-3600, $date->getGmtOffset()); - $date->setTimezone('GMT'); - $this->assertSame(0, $date->getGmtOffset()); - } - - /** - * Test for _getTime. - */ - public function test_getTime() - { - $date = new Zend_Date_DateObjectTestHelper(Zend_Date::now()); - $time = $date->_getTime(); - $diff = abs(time() - $time); - $this->assertTrue(($diff < 2), 'Zend_Date_DateObject->_getTime() returned a significantly ' - . "different timestamp than expected: $diff seconds"); - } - - /** - * Test for RFC 2822's Obsolete Date and Time (paragraph 4.3). - * - * @see ZF-11296 - */ - public function test_obsRfc2822() - { - $date = new Zend_Date(); - // Obsolete timezones - $this->assertTrue($date->set('Mon, 15 Aug 2005 15:52:01 +0000', Zend_Date::RFC_2822) instanceof Zend_Date); - $this->assertTrue($date->set('Mon, 15 Aug 2005 15:52:01 UT', Zend_Date::RFC_2822) instanceof Zend_Date); - $this->assertTrue($date->set('Mon, 15 Aug 2005 15:52:01 GMT', Zend_Date::RFC_2822) instanceof Zend_Date); - $this->assertTrue($date->set('Mon, 15 Aug 2005 15:52:01 EST', Zend_Date::RFC_2822) instanceof Zend_Date); - $this->assertTrue($date->set('Mon, 15 Aug 2005 15:52:01 I', Zend_Date::RFC_2822) instanceof Zend_Date); - $this->assertTrue($date->set('Mon, 15 Aug 2005 15:52:01 Z', Zend_Date::RFC_2822) instanceof Zend_Date); - } - - public function testToStringShouldEqualWithAndWithoutPhpFormat() - { - $date = new Zend_Date('22.05.2014'); - $date->setTime('12:00'); - $date->setTimezone('America/Los_Angeles'); - - $this->assertEquals( - $date->toString(Zend_Date::ATOM), - $date->toString(DateTime::ATOM, 'php') - ); - } -} - -class Zend_Date_DateObjectTestHelper extends Zend_Date -{ - public function __construct($date = null, $part = null, $locale = null) - { - $this->setTimezone('Europe/Paris'); - parent::__construct($date, $part, $locale); - } - - public function mktime($hour, $minute, $second, $month, $day, $year, $dst = -1, $gmt = false) - { - return parent::mktime($hour, $minute, $second, $month, $day, $year, $dst, $gmt); - } - - public function getUnixTimestamp() - { - return parent::getUnixTimestamp(); - } - - public function setUnixTimestamp($timestamp = null) - { - return parent::setUnixTimestamp($timestamp); - } - - public function weekNumber($year, $month, $day) - { - return parent::weekNumber($year, $month, $day); - } - - public function dayOfWeekHelper($y, $m, $d) - { - return Zend_Date_DateObject::dayOfWeek($y, $m, $d); - } - - public function calcSun($location, $horizon, $rise = false) - { - return parent::calcSun($location, $horizon, $rise); - } - - public function date($format, $timestamp = null, $gmt = false) - { - return parent::date($format, $timestamp, $gmt); - } - - public function getDateParts($timestamp = null, $fast = null) - { - return parent::getDateParts($timestamp, $fast); - } - - public function _getTime($sync = null) - { - return parent::_getTime($sync); - } -} diff --git a/tests/Zend/DateTest.php b/tests/Zend/DateTest.php deleted file mode 100644 index c55139f1..00000000 --- a/tests/Zend/DateTest.php +++ /dev/null @@ -1,5849 +0,0 @@ -originalTimezone = date_default_timezone_get(); - date_default_timezone_set('Indian/Maldives'); - $this->_cache = Zend_Cache::factory('Core', 'File', - ['lifetime' => 120, 'automatic_serialization' => true], - ['cache_dir' => __DIR__ . '/_files/']); - $this->_orig = Zend_Date::setOptions(); - - Zend_Date::setOptions(['cache' => $this->_cache]); - Zend_Date::setOptions(['fix_dst' => true]); - Zend_Date::setOptions(['extend_month' => false]); - Zend_Date::setOptions(['format_type' => 'iso']); - } - - public function tearDown(): void - { - Zend_Date::setOptions($this->_orig); - $this->_cache->clean(Zend_Cache::CLEANING_MODE_ALL); - date_default_timezone_set($this->originalTimezone); - } - - /** - * Test for date object creation. - */ - public function testCreation() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - $date = new Zend_Date(0); - $this->assertTrue($date instanceof Zend_Date); - } - - /** - * Test for date object creation using default format for a locale. - */ - public function testCreationDefaultFormat() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - $date = new Zend_Date('2006-01-01'); - $this->assertTrue($date instanceof Zend_Date); - $this->assertSame('2006-01-01T00:00:00+05:00', $date->get(Zend_Date::ISO_8601)); - - $date = new Zend_Date('2006-01-01', 'en_US'); - $this->assertTrue($date instanceof Zend_Date); - $this->assertSame('2006-01-01T00:00:00+05:00', $date->get(Zend_Date::ISO_8601)); - } - - /** - * Test for date object creation using default format for a locale. - */ - public function testCreationDefaultFormatConsistency() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - date_default_timezone_set('America/New_York'); - $locale = 'en_US'; - //2006-01-01T00:00:00+05:00 - $date1 = new Zend_Date('2006-01-01 01:00:00', Zend_Date::ISO_8601, $locale); - $date1string = $date1->get(Zend_Date::ISO_8601); - - // en_US defines AM/PM, hour 0 does not exist - // ISO defines dates without AM, 0 exists instead of 12 PM - // therefor hour is set to 1 to verify - $date2 = new Zend_Date('2006-01-01', Zend_Date::DATES, $locale); - $date2->setTime('01:00:00'); - $this->assertSame($date1string, $date2->get(Zend_Date::ISO_8601)); - $date2 = new Zend_Date('01-01-2006', Zend_Date::DATES, $locale); - $date2->setTime('01:00:00'); - $this->assertSame($date1string, $date2->get(Zend_Date::ISO_8601)); - $date2 = new Zend_Date('2006-01-01', null, $locale); - $date2->setTime('01:00:00'); - $this->assertSame($date1string, $date2->get(Zend_Date::ISO_8601)); - $date2 = new Zend_Date('2006-01-01'); - $date2->setTime('01:00:00'); - $this->assertSame($date1string, $date2->get(Zend_Date::ISO_8601)); - $date2 = new Zend_Date('2006-01-01 01:00:00'); - $this->assertSame($date1string, $date2->get(Zend_Date::ISO_8601)); - } - - /** - * Test for creation with timestamp. - */ - public function testCreationTimestamp() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - $date = new Zend_Date('12345678'); - $this->assertTrue($date instanceof Zend_Date); - } - - /** - * Test for creation but only part of date. - */ - public function testCreationDatePart() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - $date = new Zend_Date('13',Zend_Date::HOUR); - $this->assertTrue($date instanceof Zend_Date); - - $date = new Zend_Date('20070802', 'YYYYMMdd'); - $this->assertSame('2007-08-02T00:00:00+05:00', $date->getIso()); - } - - /** - * Test for creation but only a defined locale. - */ - public function testCreationLocale() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date('13',null,$locale); - $this->assertTrue($date instanceof Zend_Date); - } - - /** - * Test for creation but only part of date with locale. - */ - public function testCreationLocalePart() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date('13',Zend_Date::HOUR,$locale); - $this->assertTrue($date instanceof Zend_Date); - } - - /** - * Test for date object creation using default format for a locale. - */ - public function testCreationDefaultLoose() - { - // look if locale is detectable - try { - $locale = new Zend_Locale(); - } catch (Zend_Locale_Exception $e) { - $this->markTestSkipped('Autodetection of locale failed'); - - return; - } - - $locale = 'de_AT'; - $date = new Zend_Date(); - - $date = $date->getTimestamp(); - $this->assertTrue(abs($date - time()) < 2); - - date_default_timezone_set('GMT'); - $date = new Zend_Date(Zend_Date::YEAR); - - $date = $date->getTimestamp(); - $reference = gmmktime(0,0,0,1,1,date('Y')); - $this->assertTrue($reference == $date); - - $date = new Zend_Date('ar_EG'); - $this->assertSame('ar_EG', $date->getLocale()); - $date = $date->getTimestamp(); - $this->assertTrue(abs($date - time()) < 2); - } - - /** - * Test for getTimestamp. - */ - public function testGetTimestamp() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(10_000_000); - $this->assertSame(10_000_000, $date->getTimestamp()); - } - - /** - * Test for getUnixTimestamp. - */ - public function testgetUnixTimestamp2() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(-100_000_000); - $this->assertSame(-100_000_000, $date->getTimestamp()); - } - - /** - * Test for setTimestamp. - */ - public function testSetTimestamp() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,Zend_Date::TIMESTAMP,$locale); - $result = $date->setTimestamp(10_000_000); - $this->assertSame('10000000', (string) $result->getTimestamp()); - } - - /** - * Test for setTimestamp. - */ - public function testSetTimestamp2() - { - try { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $result = $date->setTimestamp('notimestamp'); - $this->Fail('exception expected'); - } catch (Zend_Date_Exception $e) { - self::assertTrue(true); - } - } - - /** - * Test for addTimestamp. - */ - public function testAddTimestamp() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $result = $date->addTimestamp(10_000_000); - $this->assertSame('10000000', (string) $result->getTimestamp()); - - $result = $date->addTimestamp(['timestamp' => '1000']); - $this->assertSame('10001000', (string) $result->getTimestamp()); - - try { - $result = $date->addTimestamp(['notimestamp' => 1000]); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - } - - /** - * Test for addTimestamp. - */ - public function testAddTimestamp2() - { - try { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $result = $date->addTimestamp('notimestamp'); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - self::assertTrue(true); - } - } - - /** - * Test for subTimestamp. - */ - public function testSubTimestamp() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $result = $date->subTimestamp(10_000_000); - $this->assertSame('-10000000', (string) $result->getTimestamp()); - } - - /** - * Test for subTimestamp. - */ - public function testSubTimestamp2() - { - try { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $result = $date->subTimestamp('notimestamp'); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - self::assertTrue(true); - } - } - - /** - * Test for compareTimestamp. - */ - public function testCompareTimestamp() - { - $locale = new Zend_Locale('de_AT'); - $date1 = new Zend_Date(0,null,$locale); - $date2 = new Zend_Date(0,null,$locale); - $this->assertSame(0, $date1->compareTimestamp($date2)); - - $date2 = new Zend_Date(100,null,$locale); - $this->assertSame(-1, $date1->compareTimestamp($date2)); - - $date2 = new Zend_Date(-100,null,$locale); - $this->assertSame(1, $date1->compareTimestamp($date2)); - } - - /** - * Test for __toString. - */ - public function test_ToString() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $date->setTimezone(date_default_timezone_get()); - $this->assertSame('01.01.1970 05:00:00', $date->__toString()); - } - - /** - * Test for toString. - */ - public function testToString() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->setTimezone(date_default_timezone_get()); - $this->assertSame('14.02.2009 04:31:30', $date->toString()); - $this->assertSame('Feb 14, 2009 4:31:30 AM', $date->toString('en_US')); - $this->assertSame('Feb 14, 2009 4:31:30 AM', $date->toString(null, 'en_US')); - $this->assertSame('2009', $date->toString('yyy', null)); - $this->assertSame('14.02.2009 04:31:30', $date->toString(null, null)); - - $date->setTimeZone('UTC'); - $this->assertSame('Feb 13, 2009 11:31:30 PM', $date->toString(null, 'en_US')); - - $date->setTimeZone('Indian/Maldives'); - $this->assertSame("xxyy'yyxx", $date->toString("xx'yy''yy'xx")); - $this->assertSame('n.', $date->toString('GGGGG')); - $this->assertSame('n. Chr.', $date->toString('GGGG')); - $this->assertSame('n. Chr.', $date->toString('GGG')); - $this->assertSame('n. Chr.', $date->toString('GG')); - $this->assertSame('n. Chr.', $date->toString('G')); - $this->assertSame('02009', $date->toString('yyyyy')); - $this->assertSame('2009', $date->toString('yyyy')); - $this->assertSame('2009', $date->toString('yyy')); - $this->assertSame('09', $date->toString('yy')); - $this->assertSame('2009', $date->toString('y')); - $this->assertSame('02009', $date->toString('YYYYY')); - $this->assertSame('2009', $date->toString('YYYY')); - $this->assertSame('2009', $date->toString('YYY')); - $this->assertSame('09', $date->toString('YY')); - $this->assertSame('2009', $date->toString('Y')); - $this->assertSame('F', $date->toString('MMMMM')); - $this->assertSame('Februar', $date->toString('MMMM')); - $this->assertSame('Feb.', $date->toString('MMM')); - $this->assertSame('02', $date->toString('MM')); - $this->assertSame('2', $date->toString('M')); - $this->assertSame('07', $date->toString('ww')); - $this->assertSame('7', $date->toString('w')); - $this->assertSame('14', $date->toString('dd')); - $this->assertSame('14', $date->toString('d')); - $this->assertSame('044', $date->toString('DDD')); - $this->assertSame('44', $date->toString('DD')); - $this->assertSame('44', $date->toString('D')); - $this->assertSame('S', $date->toString('EEEEE')); - $this->assertSame('Samstag', $date->toString('EEEE')); - $this->assertSame('Sam', $date->toString('EEE')); - $this->assertSame('Sa.', $date->toString('EE')); - $this->assertSame('S', $date->toString('E')); - $this->assertSame('06', $date->toString('ee')); - $this->assertSame('6', $date->toString('e')); - $this->assertSame('vorm.', $date->toString('a')); - $this->assertSame('04', $date->toString('hh')); - $this->assertSame('4', $date->toString('h')); - $this->assertSame('04', $date->toString('HH')); - $this->assertSame('4', $date->toString('H')); - $this->assertSame('31', $date->toString('mm')); - $this->assertSame('31', $date->toString('m')); - $this->assertSame('30', $date->toString('ss')); - $this->assertSame('30', $date->toString('s')); - $this->assertSame('0', $date->toString('S')); - $this->assertSame('Indian/Maldives', $date->toString('zzzz')); - $this->assertSame('+05', $date->toString('zzz')); - $this->assertSame('+05', $date->toString('zz')); - $this->assertSame('+05', $date->toString('z')); - $this->assertSame('+05:00', $date->toString('ZZZZ')); - $this->assertSame('+0500', $date->toString('ZZZ')); - $this->assertSame('+0500', $date->toString('ZZ')); - $this->assertSame('+0500', $date->toString('Z')); - $this->assertSame('16290000', $date->toString('AAAAA')); - $this->assertSame('16290000', $date->toString('AAAA')); - $this->assertSame('16290000', $date->toString('AAA')); - $this->assertSame('16290000', $date->toString('AA')); - $this->assertSame('16290000', $date->toString('A')); - - $date = new Zend_Date('1-1-01',null,$locale); - $date->setTimezone(date_default_timezone_get()); - $this->assertSame('01', $date->toString('yy')); - } - - /** - * Test for toValue. - */ - public function testToValue() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->setTimezone(date_default_timezone_get()); - $this->assertSame(1_234_567_890, $date->toValue()); - $this->assertSame(14, $date->toValue(Zend_Date::DAY)); - - $date->setTimezone('UTC'); - $this->assertSame(13, $date->toValue(Zend_Date::DAY)); - $this->assertFalse($date->toValue(Zend_Date::WEEKDAY_SHORT)); - $this->assertSame(13, $date->toValue(Zend_Date::DAY_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::WEEKDAY)); - $this->assertSame(5, $date->toValue(Zend_Date::WEEKDAY_8601)); - $this->assertFalse($date->toValue(Zend_Date::DAY_SUFFIX)); - $this->assertSame(5, $date->toValue(Zend_Date::WEEKDAY_DIGIT)); - $this->assertSame(43, $date->toValue(Zend_Date::DAY_OF_YEAR)); - $this->assertFalse($date->toValue(Zend_Date::WEEKDAY_NARROW)); - $this->assertFalse($date->toValue(Zend_Date::WEEKDAY_NAME)); - $this->assertSame(7, $date->toValue(Zend_Date::WEEK)); - $this->assertFalse($date->toValue(Zend_Date::MONTH_NAME)); - $this->assertSame(2, $date->toValue(Zend_Date::MONTH)); - $this->assertFalse($date->toValue(Zend_Date::MONTH_NAME_SHORT)); - $this->assertSame(2, $date->toValue(Zend_Date::MONTH_SHORT)); - $this->assertSame(28, $date->toValue(Zend_Date::MONTH_DAYS)); - $this->assertFalse($date->toValue(Zend_Date::MONTH_NAME_NARROW)); - $this->assertSame(0, $date->toValue(Zend_Date::LEAPYEAR)); - $this->assertSame(2009, $date->toValue(Zend_Date::YEAR_8601)); - $this->assertSame(2009, $date->toValue(Zend_Date::YEAR)); - $this->assertSame(9, $date->toValue(Zend_Date::YEAR_SHORT)); - $this->assertSame(9, $date->toValue(Zend_Date::YEAR_SHORT_8601)); - $this->assertFalse($date->toValue(Zend_Date::MERIDIEM)); - $this->assertSame(21, $date->toValue(Zend_Date::SWATCH)); - $this->assertSame(11, $date->toValue(Zend_Date::HOUR_SHORT_AM)); - $this->assertSame(23, $date->toValue(Zend_Date::HOUR_SHORT)); - $this->assertSame(11, $date->toValue(Zend_Date::HOUR_AM)); - $this->assertSame(23, $date->toValue(Zend_Date::HOUR)); - $this->assertSame(31, $date->toValue(Zend_Date::MINUTE)); - $this->assertSame(30, $date->toValue(Zend_Date::SECOND)); - $this->assertSame(0, $date->toValue(Zend_Date::MILLISECOND)); - $this->assertSame(31, $date->toValue(Zend_Date::MINUTE_SHORT)); - $this->assertSame(30, $date->toValue(Zend_Date::SECOND_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::TIMEZONE_NAME)); - $this->assertSame(0, $date->toValue(Zend_Date::DAYLIGHT)); - $this->assertSame(0, $date->toValue(Zend_Date::GMT_DIFF)); - $this->assertFalse($date->toValue(Zend_Date::GMT_DIFF_SEP)); - $this->assertFalse($date->toValue(Zend_Date::TIMEZONE)); - $this->assertSame(0, $date->toValue(Zend_Date::TIMEZONE_SECS)); - $this->assertFalse($date->toValue(Zend_Date::ISO_8601)); - $this->assertFalse($date->toValue(Zend_Date::RFC_2822)); - $this->assertSame(1_234_567_890, $date->toValue(Zend_Date::TIMESTAMP)); - $this->assertFalse($date->toValue(Zend_Date::ERA)); - $this->assertFalse($date->toValue(Zend_Date::ERA_NAME)); - $this->assertFalse($date->toValue(Zend_Date::DATES)); - $this->assertFalse($date->toValue(Zend_Date::DATE_FULL)); - $this->assertFalse($date->toValue(Zend_Date::DATE_LONG)); - $this->assertFalse($date->toValue(Zend_Date::DATE_MEDIUM)); - $this->assertFalse($date->toValue(Zend_Date::DATE_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::TIMES)); - $this->assertFalse($date->toValue(Zend_Date::TIME_FULL)); - $this->assertFalse($date->toValue(Zend_Date::TIME_LONG)); - $this->assertFalse($date->toValue(Zend_Date::TIME_MEDIUM)); - $this->assertFalse($date->toValue(Zend_Date::TIME_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME_FULL)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME_LONG)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME_MEDIUM)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::ATOM)); - $this->assertFalse($date->toValue(Zend_Date::COOKIE)); - $this->assertFalse($date->toValue(Zend_Date::RFC_822)); - $this->assertFalse($date->toValue(Zend_Date::RFC_850)); - $this->assertFalse($date->toValue(Zend_Date::RFC_1036)); - $this->assertFalse($date->toValue(Zend_Date::RFC_1123)); - $this->assertFalse($date->toValue(Zend_Date::RFC_3339)); - $this->assertFalse($date->toValue(Zend_Date::RSS)); - $this->assertFalse($date->toValue(Zend_Date::W3C)); - - $date->setTimezone('Indian/Maldives'); - $this->assertFalse($date->toValue(Zend_Date::WEEKDAY_SHORT)); - $this->assertSame(14, $date->toValue(Zend_Date::DAY_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::WEEKDAY)); - $this->assertSame(6, $date->toValue(Zend_Date::WEEKDAY_8601)); - $this->assertFalse($date->toValue(Zend_Date::DAY_SUFFIX)); - $this->assertSame(6, $date->toValue(Zend_Date::WEEKDAY_DIGIT)); - $this->assertSame(44, $date->toValue(Zend_Date::DAY_OF_YEAR)); - $this->assertFalse($date->toValue(Zend_Date::WEEKDAY_NARROW)); - $this->assertFalse($date->toValue(Zend_Date::WEEKDAY_NAME)); - $this->assertSame(7, $date->toValue(Zend_Date::WEEK)); - $this->assertFalse($date->toValue(Zend_Date::MONTH_NAME)); - $this->assertSame(2, $date->toValue(Zend_Date::MONTH)); - $this->assertFalse($date->toValue(Zend_Date::MONTH_NAME_SHORT)); - $this->assertSame(2, $date->toValue(Zend_Date::MONTH_SHORT)); - $this->assertSame(28, $date->toValue(Zend_Date::MONTH_DAYS)); - $this->assertFalse($date->toValue(Zend_Date::MONTH_NAME_NARROW)); - $this->assertSame(0, $date->toValue(Zend_Date::LEAPYEAR)); - $this->assertSame(2009, $date->toValue(Zend_Date::YEAR_8601)); - $this->assertSame(2009, $date->toValue(Zend_Date::YEAR)); - $this->assertSame(9, $date->toValue(Zend_Date::YEAR_SHORT)); - $this->assertSame(9, $date->toValue(Zend_Date::YEAR_SHORT_8601)); - $this->assertFalse($date->toValue(Zend_Date::MERIDIEM)); - $this->assertSame(21, $date->toValue(Zend_Date::SWATCH)); - $this->assertSame(4, $date->toValue(Zend_Date::HOUR_SHORT_AM)); - $this->assertSame(4, $date->toValue(Zend_Date::HOUR_SHORT)); - $this->assertSame(4, $date->toValue(Zend_Date::HOUR_AM)); - $this->assertSame(4, $date->toValue(Zend_Date::HOUR)); - $this->assertSame(31, $date->toValue(Zend_Date::MINUTE)); - $this->assertSame(30, $date->toValue(Zend_Date::SECOND)); - $this->assertSame(0, $date->toValue(Zend_Date::MILLISECOND)); - $this->assertSame(31, $date->toValue(Zend_Date::MINUTE_SHORT)); - $this->assertSame(30, $date->toValue(Zend_Date::SECOND_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::TIMEZONE_NAME)); - $this->assertSame(0, $date->toValue(Zend_Date::DAYLIGHT)); - $this->assertSame(500, $date->toValue(Zend_Date::GMT_DIFF)); - $this->assertFalse($date->toValue(Zend_Date::GMT_DIFF_SEP)); - $this->assertSame(5, $date->toValue(Zend_Date::TIMEZONE)); - $this->assertSame(18000, $date->toValue(Zend_Date::TIMEZONE_SECS)); - $this->assertFalse($date->toValue(Zend_Date::ISO_8601)); - $this->assertFalse($date->toValue(Zend_Date::RFC_2822)); - $this->assertSame(1_234_567_890, $date->toValue(Zend_Date::TIMESTAMP)); - $this->assertFalse($date->toValue(Zend_Date::ERA)); - $this->assertFalse($date->toValue(Zend_Date::ERA_NAME)); - $this->assertFalse($date->toValue(Zend_Date::DATES)); - $this->assertFalse($date->toValue(Zend_Date::DATE_FULL)); - $this->assertFalse($date->toValue(Zend_Date::DATE_LONG)); - $this->assertFalse($date->toValue(Zend_Date::DATE_MEDIUM)); - $this->assertFalse($date->toValue(Zend_Date::DATE_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::TIMES)); - $this->assertFalse($date->toValue(Zend_Date::TIME_FULL)); - $this->assertFalse($date->toValue(Zend_Date::TIME_LONG)); - $this->assertFalse($date->toValue(Zend_Date::TIME_MEDIUM)); - $this->assertFalse($date->toValue(Zend_Date::TIME_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME_FULL)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME_LONG)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME_MEDIUM)); - $this->assertFalse($date->toValue(Zend_Date::DATETIME_SHORT)); - $this->assertFalse($date->toValue(Zend_Date::ATOM)); - $this->assertFalse($date->toValue(Zend_Date::COOKIE)); - $this->assertFalse($date->toValue(Zend_Date::RFC_822)); - $this->assertFalse($date->toValue(Zend_Date::RFC_850)); - $this->assertFalse($date->toValue(Zend_Date::RFC_1036)); - $this->assertFalse($date->toValue(Zend_Date::RFC_1123)); - $this->assertFalse($date->toValue(Zend_Date::RFC_3339)); - $this->assertFalse($date->toValue(Zend_Date::RSS)); - $this->assertFalse($date->toValue(Zend_Date::W3C)); - } - - /** - * Test for toValue. - */ - public function testGet() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - - $date->setTimezone('UTC'); - $this->assertSame('13', $date->get(Zend_Date::DAY)); - $this->assertSame('Fre', $date->get(Zend_Date::WEEKDAY_SHORT)); - $this->assertSame('13', $date->get(Zend_Date::DAY_SHORT)); - $this->assertSame('Freitag', $date->get(Zend_Date::WEEKDAY)); - $this->assertSame('5', $date->get(Zend_Date::WEEKDAY_8601)); - $this->assertSame('th', $date->get(Zend_Date::DAY_SUFFIX)); - $this->assertSame('5', $date->get(Zend_Date::WEEKDAY_DIGIT)); - $this->assertSame('43', $date->get(Zend_Date::DAY_OF_YEAR)); - $this->assertSame('F', $date->get(Zend_Date::WEEKDAY_NARROW)); - $this->assertSame('Fr.', $date->get(Zend_Date::WEEKDAY_NAME)); - $this->assertSame('07', $date->get(Zend_Date::WEEK)); - $this->assertSame('Februar', $date->get(Zend_Date::MONTH_NAME)); - $this->assertSame('02', $date->get(Zend_Date::MONTH)); - $this->assertSame('Feb.', $date->get(Zend_Date::MONTH_NAME_SHORT)); - $this->assertSame('2', $date->get(Zend_Date::MONTH_SHORT)); - $this->assertSame('28', $date->get(Zend_Date::MONTH_DAYS)); - $this->assertSame('F', $date->get(Zend_Date::MONTH_NAME_NARROW)); - $this->assertSame('0', $date->get(Zend_Date::LEAPYEAR)); - $this->assertSame('2009', $date->get(Zend_Date::YEAR_8601)); - $this->assertSame('2009', $date->get(Zend_Date::YEAR)); - $this->assertSame('09', $date->get(Zend_Date::YEAR_SHORT)); - $this->assertSame('09', $date->get(Zend_Date::YEAR_SHORT_8601)); - $this->assertSame('nachm.', $date->get(Zend_Date::MERIDIEM)); - $this->assertSame('021', $date->get(Zend_Date::SWATCH)); - $this->assertSame('11', $date->get(Zend_Date::HOUR_SHORT_AM)); - $this->assertSame('23', $date->get(Zend_Date::HOUR_SHORT)); - $this->assertSame('11', $date->get(Zend_Date::HOUR_AM)); - $this->assertSame('23', $date->get(Zend_Date::HOUR)); - $this->assertSame('31', $date->get(Zend_Date::MINUTE)); - $this->assertSame('30', $date->get(Zend_Date::SECOND)); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND)); - $this->assertSame('31', $date->get(Zend_Date::MINUTE_SHORT)); - $this->assertSame('30', $date->get(Zend_Date::SECOND_SHORT)); - $this->assertSame('UTC', $date->get(Zend_Date::TIMEZONE_NAME)); - $this->assertSame('0', $date->get(Zend_Date::DAYLIGHT)); - $this->assertSame('+0000', $date->get(Zend_Date::GMT_DIFF)); - $this->assertSame('+00:00', $date->get(Zend_Date::GMT_DIFF_SEP)); - $this->assertSame('UTC', $date->get(Zend_Date::TIMEZONE)); - $this->assertSame('0', $date->get(Zend_Date::TIMEZONE_SECS)); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::ISO_8601)); - $this->assertSame('Fri, 13 Feb 2009 23:31:30 +0000', $date->get(Zend_Date::RFC_2822)); - $this->assertSame('1234567890', $date->get(Zend_Date::TIMESTAMP)); - $this->assertSame('n. Chr.', $date->get(Zend_Date::ERA)); - $this->assertSame('n. Chr.', $date->get(Zend_Date::ERA_NAME)); - $this->assertSame('13.02.2009', $date->get(Zend_Date::DATES)); - $this->assertSame('Freitag, 13. Februar 2009', $date->get(Zend_Date::DATE_FULL)); - $this->assertSame('13. Februar 2009', $date->get(Zend_Date::DATE_LONG)); - $this->assertSame('13.02.2009', $date->get(Zend_Date::DATE_MEDIUM)); - $this->assertSame('13.02.09', $date->get(Zend_Date::DATE_SHORT)); - $this->assertSame('23:31:30', $date->get(Zend_Date::TIMES)); - $this->assertSame('23:31:30 UTC', $date->get(Zend_Date::TIME_FULL)); - $this->assertSame('23:31:30 UTC', $date->get(Zend_Date::TIME_LONG)); - $this->assertSame('23:31:30', $date->get(Zend_Date::TIME_MEDIUM)); - $this->assertSame('23:31', $date->get(Zend_Date::TIME_SHORT)); - $this->assertSame('13.02.2009 23:31:30', $date->get(Zend_Date::DATETIME)); - $this->assertSame('Freitag, 13. Februar 2009 23:31:30 UTC', $date->get(Zend_Date::DATETIME_FULL)); - $this->assertSame('13. Februar 2009 23:31:30 UTC', $date->get(Zend_Date::DATETIME_LONG)); - $this->assertSame('13.02.2009 23:31:30', $date->get(Zend_Date::DATETIME_MEDIUM)); - $this->assertSame('13.02.09 23:31', $date->get(Zend_Date::DATETIME_SHORT)); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::ATOM)); - $this->assertSame('Friday, 13-Feb-09 23:31:30 UTC', $date->get(Zend_Date::COOKIE)); - $this->assertSame('Fri, 13 Feb 09 23:31:30 +0000', $date->get(Zend_Date::RFC_822)); - $this->assertSame('Friday, 13-Feb-09 23:31:30 UTC', $date->get(Zend_Date::RFC_850)); - $this->assertSame('Fri, 13 Feb 09 23:31:30 +0000', $date->get(Zend_Date::RFC_1036)); - $this->assertSame('Fri, 13 Feb 2009 23:31:30 +0000', $date->get(Zend_Date::RFC_1123)); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::RFC_3339)); - $this->assertSame('Fri, 13 Feb 2009 23:31:30 +0000', $date->get(Zend_Date::RSS)); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - - $this->assertSame('13', $date->get(Zend_Date::DAY, 'es')); - $this->assertSame('vie', $date->get(Zend_Date::WEEKDAY_SHORT, 'es')); - $this->assertSame('13', $date->get(Zend_Date::DAY_SHORT, 'es')); - $this->assertSame('viernes', $date->get(Zend_Date::WEEKDAY, 'es')); - $this->assertSame('5', $date->get(Zend_Date::WEEKDAY_8601, 'es')); - $this->assertSame('th', $date->get(Zend_Date::DAY_SUFFIX, 'es')); - $this->assertSame('5', $date->get(Zend_Date::WEEKDAY_DIGIT, 'es')); - $this->assertSame('43', $date->get(Zend_Date::DAY_OF_YEAR, 'es')); - $this->assertSame('v', $date->get(Zend_Date::WEEKDAY_NARROW, 'es')); - $this->assertSame('vie.', $date->get(Zend_Date::WEEKDAY_NAME, 'es')); - $this->assertSame('07', $date->get(Zend_Date::WEEK, 'es')); - $this->assertSame('febrero', $date->get(Zend_Date::MONTH_NAME, 'es')); - $this->assertSame('02', $date->get(Zend_Date::MONTH, 'es')); - $this->assertSame('feb.', $date->get(Zend_Date::MONTH_NAME_SHORT, 'es')); - $this->assertSame('2', $date->get(Zend_Date::MONTH_SHORT, 'es')); - $this->assertSame('28', $date->get(Zend_Date::MONTH_DAYS, 'es')); - $this->assertSame('f', $date->get(Zend_Date::MONTH_NAME_NARROW, 'es')); - $this->assertSame('0', $date->get(Zend_Date::LEAPYEAR, 'es')); - $this->assertSame('2009', $date->get(Zend_Date::YEAR_8601, 'es')); - $this->assertSame('2009', $date->get(Zend_Date::YEAR, 'es')); - $this->assertSame('09', $date->get(Zend_Date::YEAR_SHORT, 'es')); - $this->assertSame('09', $date->get(Zend_Date::YEAR_SHORT_8601, 'es')); - $this->assertSame('p. m.', $date->get(Zend_Date::MERIDIEM, 'es')); - $this->assertSame('021', $date->get(Zend_Date::SWATCH, 'es')); - $this->assertSame('11', $date->get(Zend_Date::HOUR_SHORT_AM, 'es')); - $this->assertSame('23', $date->get(Zend_Date::HOUR_SHORT, 'es')); - $this->assertSame('11', $date->get(Zend_Date::HOUR_AM, 'es')); - $this->assertSame('23', $date->get(Zend_Date::HOUR, 'es')); - $this->assertSame('31', $date->get(Zend_Date::MINUTE, 'es')); - $this->assertSame('30', $date->get(Zend_Date::SECOND, 'es')); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND, 'es')); - $this->assertSame('31', $date->get(Zend_Date::MINUTE_SHORT, 'es')); - $this->assertSame('30', $date->get(Zend_Date::SECOND_SHORT, 'es')); - $this->assertSame('UTC', $date->get(Zend_Date::TIMEZONE_NAME, 'es')); - $this->assertSame('0', $date->get(Zend_Date::DAYLIGHT, 'es')); - $this->assertSame('+0000', $date->get(Zend_Date::GMT_DIFF, 'es')); - $this->assertSame('+00:00', $date->get(Zend_Date::GMT_DIFF_SEP, 'es')); - $this->assertSame('UTC', $date->get(Zend_Date::TIMEZONE, 'es')); - $this->assertSame('0', $date->get(Zend_Date::TIMEZONE_SECS, 'es')); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::ISO_8601, 'es')); - $this->assertSame('Fri, 13 Feb 2009 23:31:30 +0000', $date->get(Zend_Date::RFC_2822, 'es')); - $this->assertSame('1234567890', $date->get(Zend_Date::TIMESTAMP, 'es')); - $this->assertSame('d. C.', $date->get(Zend_Date::ERA, 'es')); - $this->assertSame('anno Dómini', $date->get(Zend_Date::ERA_NAME, 'es')); - $this->assertSame('13/2/2009', $date->get(Zend_Date::DATES, 'es')); - $this->assertSame('viernes, 13 de febrero de 2009', $date->get(Zend_Date::DATE_FULL, 'es')); - $this->assertSame('13 de febrero de 2009', $date->get(Zend_Date::DATE_LONG, 'es')); - $this->assertSame('13/2/2009', $date->get(Zend_Date::DATE_MEDIUM, 'es')); - $this->assertSame('13/2/09', $date->get(Zend_Date::DATE_SHORT, 'es')); - $this->assertSame('23:31:30', $date->get(Zend_Date::TIMES, 'es')); - $this->assertSame('23:31:30 (UTC)', $date->get(Zend_Date::TIME_FULL, 'es')); - $this->assertSame('23:31:30 UTC', $date->get(Zend_Date::TIME_LONG, 'es')); - $this->assertSame('23:31:30', $date->get(Zend_Date::TIME_MEDIUM, 'es')); - $this->assertSame('23:31', $date->get(Zend_Date::TIME_SHORT, 'es')); - $this->assertSame('13/2/2009 23:31:30', $date->get(Zend_Date::DATETIME, 'es')); - $this->assertSame('viernes, 13 de febrero de 2009, 23:31:30 (UTC)', $date->get(Zend_Date::DATETIME_FULL, 'es')); - $this->assertSame('13 de febrero de 2009, 23:31:30 UTC', $date->get(Zend_Date::DATETIME_LONG, 'es')); - $this->assertSame('13/2/2009 23:31:30', $date->get(Zend_Date::DATETIME_MEDIUM, 'es')); - $this->assertSame('13/2/09 23:31', $date->get(Zend_Date::DATETIME_SHORT, 'es')); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::ATOM, 'es')); - $this->assertSame('Friday, 13-Feb-09 23:31:30 UTC', $date->get(Zend_Date::COOKIE, 'es')); - $this->assertSame('Fri, 13 Feb 09 23:31:30 +0000', $date->get(Zend_Date::RFC_822, 'es')); - $this->assertSame('Friday, 13-Feb-09 23:31:30 UTC', $date->get(Zend_Date::RFC_850, 'es')); - $this->assertSame('Fri, 13 Feb 09 23:31:30 +0000', $date->get(Zend_Date::RFC_1036, 'es')); - $this->assertSame('Fri, 13 Feb 2009 23:31:30 +0000', $date->get(Zend_Date::RFC_1123, 'es')); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::RFC_3339, 'es')); - $this->assertSame('Fri, 13 Feb 2009 23:31:30 +0000', $date->get(Zend_Date::RSS, 'es')); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C, 'es')); - - $date->setTimezone('Indian/Maldives'); - $this->assertSame('1234567890', $date->get()); - $this->assertSame('14', $date->get(Zend_Date::DAY)); - $this->assertSame('Sam', $date->get(Zend_Date::WEEKDAY_SHORT)); - $this->assertSame('14', $date->get(Zend_Date::DAY_SHORT)); - $this->assertSame('Samstag', $date->get(Zend_Date::WEEKDAY)); - $this->assertSame('6', $date->get(Zend_Date::WEEKDAY_8601)); - $this->assertSame('th', $date->get(Zend_Date::DAY_SUFFIX)); - $this->assertSame('6', $date->get(Zend_Date::WEEKDAY_DIGIT)); - $this->assertSame('44', $date->get(Zend_Date::DAY_OF_YEAR)); - $this->assertSame('S', $date->get(Zend_Date::WEEKDAY_NARROW)); - $this->assertSame('Sa.', $date->get(Zend_Date::WEEKDAY_NAME)); - $this->assertSame('07', $date->get(Zend_Date::WEEK)); - $this->assertSame('Februar', $date->get(Zend_Date::MONTH_NAME)); - $this->assertSame('02', $date->get(Zend_Date::MONTH)); - $this->assertSame('Feb.', $date->get(Zend_Date::MONTH_NAME_SHORT)); - $this->assertSame('2', $date->get(Zend_Date::MONTH_SHORT)); - $this->assertSame('28', $date->get(Zend_Date::MONTH_DAYS)); - $this->assertSame('F', $date->get(Zend_Date::MONTH_NAME_NARROW)); - $this->assertSame('0', $date->get(Zend_Date::LEAPYEAR)); - $this->assertSame('2009', $date->get(Zend_Date::YEAR_8601)); - $this->assertSame('2009', $date->get(Zend_Date::YEAR)); - $this->assertSame('09', $date->get(Zend_Date::YEAR_SHORT)); - $this->assertSame('09', $date->get(Zend_Date::YEAR_SHORT_8601)); - $this->assertSame('vorm.', $date->get(Zend_Date::MERIDIEM)); - $this->assertSame('021', $date->get(Zend_Date::SWATCH)); - $this->assertSame('4', $date->get(Zend_Date::HOUR_SHORT_AM)); - $this->assertSame('4', $date->get(Zend_Date::HOUR_SHORT)); - $this->assertSame('04', $date->get(Zend_Date::HOUR_AM)); - $this->assertSame('04', $date->get(Zend_Date::HOUR)); - $this->assertSame('31', $date->get(Zend_Date::MINUTE)); - $this->assertSame('30', $date->get(Zend_Date::SECOND)); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND)); - $this->assertSame('31', $date->get(Zend_Date::MINUTE_SHORT)); - $this->assertSame('30', $date->get(Zend_Date::SECOND_SHORT)); - $this->assertSame('Indian/Maldives', $date->get(Zend_Date::TIMEZONE_NAME)); - $this->assertSame('0', $date->get(Zend_Date::DAYLIGHT)); - $this->assertSame('+0500', $date->get(Zend_Date::GMT_DIFF)); - $this->assertSame('+05:00', $date->get(Zend_Date::GMT_DIFF_SEP)); - $this->assertSame('+05', $date->get(Zend_Date::TIMEZONE)); - $this->assertSame('18000', $date->get(Zend_Date::TIMEZONE_SECS)); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::ISO_8601)); - $this->assertSame('Sat, 14 Feb 2009 04:31:30 +0500', $date->get(Zend_Date::RFC_2822)); - $this->assertSame('1234567890', $date->get(Zend_Date::TIMESTAMP)); - $this->assertSame('n. Chr.', $date->get(Zend_Date::ERA)); - $this->assertSame('n. Chr.', $date->get(Zend_Date::ERA_NAME)); - $this->assertSame('14.02.2009', $date->get(Zend_Date::DATES)); - $this->assertSame('Samstag, 14. Februar 2009', $date->get(Zend_Date::DATE_FULL)); - $this->assertSame('14. Februar 2009', $date->get(Zend_Date::DATE_LONG)); - $this->assertSame('14.02.2009', $date->get(Zend_Date::DATE_MEDIUM)); - $this->assertSame('14.02.09', $date->get(Zend_Date::DATE_SHORT)); - $this->assertSame('04:31:30', $date->get(Zend_Date::TIMES)); - $this->assertSame('04:31:30 Indian/Maldives', $date->get(Zend_Date::TIME_FULL)); - $this->assertSame('04:31:30 +05', $date->get(Zend_Date::TIME_LONG)); - $this->assertSame('04:31:30', $date->get(Zend_Date::TIME_MEDIUM)); - $this->assertSame('04:31', $date->get(Zend_Date::TIME_SHORT)); - $this->assertSame('14.02.2009 04:31:30', $date->get(Zend_Date::DATETIME)); - $this->assertSame('Samstag, 14. Februar 2009 04:31:30 Indian/Maldives', $date->get(Zend_Date::DATETIME_FULL)); - $this->assertSame('14. Februar 2009 04:31:30 +05', $date->get(Zend_Date::DATETIME_LONG)); - $this->assertSame('14.02.2009 04:31:30', $date->get(Zend_Date::DATETIME_MEDIUM)); - $this->assertSame('14.02.09 04:31', $date->get(Zend_Date::DATETIME_SHORT)); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::ATOM)); - $this->assertSame('Saturday, 14-Feb-09 04:31:30 Indian/Maldives', $date->get(Zend_Date::COOKIE)); - $this->assertSame('Sat, 14 Feb 09 04:31:30 +0500', $date->get(Zend_Date::RFC_822)); - $this->assertSame('Saturday, 14-Feb-09 04:31:30 Indian/Maldives', $date->get(Zend_Date::RFC_850)); - $this->assertSame('Sat, 14 Feb 09 04:31:30 +0500', $date->get(Zend_Date::RFC_1036)); - $this->assertSame('Sat, 14 Feb 2009 04:31:30 +0500', $date->get(Zend_Date::RFC_1123)); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::RFC_3339)); - $this->assertSame('Sat, 14 Feb 2009 04:31:30 +0500', $date->get(Zend_Date::RSS)); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - // when get() receives a format string it responses like toString(); - $date->setTimezone('Indian/Maldives'); - $this->assertSame('2009', $date->get('Y')); - } - - /** - * Test for toValue. - */ - public function testGet2() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(-62_362_925_370,null,$locale); - $this->assertSame('v. Chr.', $date->get(Zend_Date::ERA)); - $this->assertSame('v. Chr.', $date->get(Zend_Date::ERA_NAME)); - } - - /** - * Test for set. - */ - public function testSet() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - $date->setTimezone(date_default_timezone_get()); - $d2->setTimezone(date_default_timezone_get()); - - $retour = $date->set(1_234_567_890); - $this->assertSame('1234567890', $retour->getTimestamp()); - $this->assertSame('1010101010', $date->set($d2)->getTimestamp()); - $this->assertSame('1234567891', $date->set(1_234_567_891)->getTimestamp()); - - try { - $date->set('noday', Zend_Date::DAY); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2, Zend_Date::DAY); - $this->assertSame('2009-02-04T04:31:31+05:00', $date->get(Zend_Date::W3C)); - $date->set(10, Zend_Date::DAY); - $this->assertSame('2009-02-10T04:31:31+05:00', $date->get(Zend_Date::W3C)); - $date->set(40, Zend_Date::DAY); - $this->assertSame('2009-03-12T04:31:31+05:00', $date->get(Zend_Date::W3C)); - $date->set(-10, Zend_Date::DAY); - $this->assertSame('2009-02-18T04:31:31+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('UTC'); - $date->set(10, Zend_Date::DAY); - $this->assertSame('2009-02-10T23:31:31+00:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set($d2, Zend_Date::DAY); - $this->assertSame('2009-02-04T04:31:31+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('UTC'); - $date->set(10, Zend_Date::DAY, 'en_US'); - $this->assertSame('2009-02-10T23:31:31+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::DAY, 'en_US'); - $this->assertSame('2009-02-04T04:31:31+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(-20, Zend_Date::DAY, 'en_US'); - $this->assertSame('2009-01-11T04:31:31+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::DAY, 'en_US'); - $this->assertSame('2009-01-04T04:31:31+05:00', $date->get(Zend_Date::W3C)); - - $date->set('10.April.2007', 'dd.MMMM.YYYY'); - $this->assertSame('2007-04-10T00:00:00+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for set. - */ - public function testSet2() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $date->setTimezone(date_default_timezone_get()); - $d2->setTimezone(date_default_timezone_get()); - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::WEEKDAY_SHORT); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::WEEKDAY_SHORT); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('Son', Zend_Date::WEEKDAY_SHORT); - $this->assertSame('2009-02-08T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('Mon', Zend_Date::WEEKDAY_SHORT); - $this->assertSame('2009-02-09T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('UTC'); - $date->set('Fre', Zend_Date::WEEKDAY_SHORT); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_SHORT); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set('Thu', Zend_Date::WEEKDAY_SHORT, 'en_US'); - $this->assertSame('2009-02-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_SHORT, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('UTC'); - $date->set('Wed', Zend_Date::WEEKDAY_SHORT , 'en_US'); - $this->assertSame('2009-02-11T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_SHORT, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('xxx', Zend_Date::DAY_SHORT); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DAY_SHORT); - $this->assertSame('2009-02-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(10, Zend_Date::DAY_SHORT); - $this->assertSame('2009-02-10T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(40, Zend_Date::DAY_SHORT); - $this->assertSame('2009-03-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-10, Zend_Date::DAY_SHORT); - $this->assertSame('2009-02-18T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(10, Zend_Date::DAY_SHORT); - $this->assertSame('2009-02-10T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::DAY_SHORT); - $this->assertSame('2009-02-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(10, Zend_Date::DAY_SHORT, 'en_US'); - $this->assertSame('2009-02-10T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::DAY_SHORT, 'en_US'); - $this->assertSame('2009-02-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-20, Zend_Date::DAY_SHORT, 'en_US'); - $this->assertSame('2009-01-11T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::DAY_SHORT, 'en_US'); - $this->assertSame('2009-01-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::WEEKDAY); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::WEEKDAY); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('Sonntag', Zend_Date::WEEKDAY); - $this->assertSame('2009-02-08T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('Montag', Zend_Date::WEEKDAY); - $this->assertSame('2009-02-09T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('Freitag', Zend_Date::WEEKDAY); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set('Wednesday', Zend_Date::WEEKDAY, 'en_US'); - $this->assertSame('2009-02-11T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('Thursday', Zend_Date::WEEKDAY, 'en_US'); - $this->assertSame('2009-02-12T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set(0, Zend_Date::WEEKDAY_8601); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->set('noday', Zend_Date::WEEKDAY_8601); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::WEEKDAY_8601); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1, Zend_Date::WEEKDAY_8601); - $this->assertSame('2009-02-09T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(5, Zend_Date::WEEKDAY_8601); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(2, Zend_Date::WEEKDAY_8601); - $this->assertSame('2009-02-10T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_8601); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(4, Zend_Date::WEEKDAY_8601, 'en_US'); - $this->assertSame('2009-02-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_8601, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(3, Zend_Date::WEEKDAY_8601, 'en_US'); - $this->assertSame('2009-02-11T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_8601, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set($d2, Zend_Date::DAY_SUFFIX); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set(7, Zend_Date::WEEKDAY_DIGIT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->set('noday', Zend_Date::WEEKDAY_DIGIT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::WEEKDAY_DIGIT); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1, Zend_Date::WEEKDAY_DIGIT); - $this->assertSame('2009-02-09T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(5, Zend_Date::WEEKDAY_DIGIT); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(2, Zend_Date::WEEKDAY_DIGIT); - $this->assertSame('2009-02-10T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_DIGIT); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(4, Zend_Date::WEEKDAY_DIGIT, 'en_US'); - $this->assertSame('2009-02-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_DIGIT, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(3, Zend_Date::WEEKDAY_DIGIT, 'en_US'); - $this->assertSame('2009-02-11T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_DIGIT, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DAY_OF_YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2009-01-03T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(124, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2009-05-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(524, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2010-06-08T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-135, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2009-08-18T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(422, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2010-02-26T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2010-01-03T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(12, Zend_Date::DAY_OF_YEAR, 'en_US'); - $this->assertSame('2010-01-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::DAY_OF_YEAR, 'en_US'); - $this->assertSame('2010-01-03T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-253, Zend_Date::DAY_OF_YEAR, 'en_US'); - $this->assertSame('2009-04-22T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::DAY_OF_YEAR, 'en_US'); - $this->assertSame('2009-01-03T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::WEEKDAY_NARROW); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::WEEKDAY_NARROW); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('S', Zend_Date::WEEKDAY_NARROW); - $this->assertSame('2009-02-08T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('M', Zend_Date::WEEKDAY_NARROW); - $this->assertSame('2009-02-09T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('F', Zend_Date::WEEKDAY_NARROW); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_NARROW); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set('W', Zend_Date::WEEKDAY_NARROW, 'en_US'); - $this->assertSame('2009-02-11T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_NARROW, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('W', Zend_Date::WEEKDAY_NARROW, 'en_US'); - $this->assertSame('2009-02-11T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_NARROW, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::WEEKDAY_NAME); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::WEEKDAY_NAME); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('So.', Zend_Date::WEEKDAY_NAME); - $this->assertSame('2009-02-08T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('Mo.', Zend_Date::WEEKDAY_NAME); - $this->assertSame('2009-02-09T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('Fr.', Zend_Date::WEEKDAY_NAME); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_NAME); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set('Thu', Zend_Date::WEEKDAY_NAME, 'en_US'); - $this->assertSame('2009-02-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_NAME, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('Wed', Zend_Date::WEEKDAY_NAME, 'en_US'); - $this->assertSame('2009-02-11T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEKDAY_NAME, 'en_US'); - $this->assertSame('2009-02-13T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::WEEK); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::WEEK); - $this->assertSame('2009-01-03T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1, Zend_Date::WEEK); - $this->assertSame('2009-01-03T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(55, Zend_Date::WEEK); - $this->assertSame('2010-01-16T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-57, Zend_Date::WEEK); - $this->assertSame('2008-11-29T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(50, Zend_Date::WEEK); - $this->assertSame('2008-12-12T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEK); - $this->assertSame('2008-01-05T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(10, Zend_Date::WEEK, 'en_US'); - $this->assertSame('2008-03-08T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEK, 'en_US'); - $this->assertSame('2008-01-05T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-25, Zend_Date::WEEK, 'en_US'); - $this->assertSame('2007-07-06T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::WEEK, 'en_US'); - $this->assertSame('2007-01-06T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::MONTH_NAME); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::MONTH_NAME); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('März', Zend_Date::MONTH_NAME); - $this->assertSame('2009-03-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('Dezember', Zend_Date::MONTH_NAME); - $this->assertSame('2009-12-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('August', Zend_Date::MONTH_NAME); - $this->assertSame('2009-08-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set('April', Zend_Date::MONTH_NAME, 'en_US'); - $this->assertSame('2009-04-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME, 'en_US'); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('July', Zend_Date::MONTH_NAME, 'en_US'); - $this->assertSame('2009-07-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME, 'en_US'); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::MONTH); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::MONTH); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('03', Zend_Date::MONTH); - $this->assertSame('2009-03-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(14, Zend_Date::MONTH); - $this->assertSame('2010-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::MONTH); - $this->assertSame('2009-06-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(10, Zend_Date::MONTH); - $this->assertSame('2009-10-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::MONTH, 'en_US'); - $this->assertSame('2009-09-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH, 'en_US'); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-20, Zend_Date::MONTH, 'en_US'); - $this->assertSame('2007-04-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH, 'en_US'); - $this->assertSame('2007-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::MONTH_NAME_SHORT); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::MONTH_NAME_SHORT); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('März', Zend_Date::MONTH_NAME_SHORT); - $this->assertSame('2009-03-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('Dez.', Zend_Date::MONTH_NAME_SHORT); - $this->assertSame('2009-12-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('Aug.', Zend_Date::MONTH_NAME_SHORT); - $this->assertSame('2009-08-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME_SHORT); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set('Apr', Zend_Date::MONTH_NAME_SHORT, 'en_US'); - $this->assertSame('2009-04-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME_SHORT, 'en_US'); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('Jul', Zend_Date::MONTH_NAME_SHORT, 'en_US'); - $this->assertSame('2009-07-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME_SHORT, 'en_US'); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::MONTH_SHORT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::MONTH_SHORT); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::MONTH_SHORT); - $this->assertSame('2009-03-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(14, Zend_Date::MONTH_SHORT); - $this->assertSame('2010-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::MONTH_SHORT); - $this->assertSame('2009-06-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(10, Zend_Date::MONTH_SHORT); - $this->assertSame('2009-10-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_SHORT); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::MONTH_SHORT, 'en_US'); - $this->assertSame('2009-09-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_SHORT, 'en_US'); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-20, Zend_Date::MONTH_SHORT, 'en_US'); - $this->assertSame('2007-04-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_SHORT, 'en_US'); - $this->assertSame('2007-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set($d2, Zend_Date::MONTH_DAYS); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('xxday', Zend_Date::MONTH_NAME_NARROW); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::MONTH_NAME_NARROW); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('M', Zend_Date::MONTH_NAME_NARROW); - $this->assertSame('2009-03-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('D', Zend_Date::MONTH_NAME_NARROW); - $this->assertSame('2009-12-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('A', Zend_Date::MONTH_NAME_NARROW); - $this->assertSame('2009-04-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME_NARROW); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set('A', Zend_Date::MONTH_NAME_NARROW, 'en_US'); - $this->assertSame('2009-04-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME_NARROW, 'en_US'); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set('J', Zend_Date::MONTH_NAME_NARROW, 'en_US'); - $this->assertSame('2009-01-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MONTH_NAME_NARROW, 'en_US'); - $this->assertSame('2009-01-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set($d2, Zend_Date::LEAPYEAR); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::YEAR_8601); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::YEAR_8601); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1970, Zend_Date::YEAR_8601); - $this->assertSame('1970-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(2020, Zend_Date::YEAR_8601); - $this->assertSame('2020-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(2040, Zend_Date::YEAR_8601); - $this->assertSame('2040-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(1900, Zend_Date::YEAR_8601); - $this->assertSame('1900-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_8601); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(2500, Zend_Date::YEAR_8601, 'en_US'); - $this->assertSame('2500-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_8601, 'en_US'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-20, Zend_Date::YEAR_8601, 'en_US'); - $this->assertSame('-20-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_8601, 'en_US'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::YEAR); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1970, Zend_Date::YEAR); - $this->assertSame('1970-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(2020, Zend_Date::YEAR); - $this->assertSame('2020-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(2040, Zend_Date::YEAR); - $this->assertSame('2040-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(1900, Zend_Date::YEAR); - $this->assertSame('1900-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(2500, Zend_Date::YEAR, 'en_US'); - $this->assertSame('2500-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR, 'en_US'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-20, Zend_Date::YEAR, 'en_US'); - $this->assertSame('-20-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR, 'en_US'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::YEAR_SHORT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::YEAR_SHORT); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(70, Zend_Date::YEAR_SHORT); - $this->assertSame('1970-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(20, Zend_Date::YEAR_SHORT); - $this->assertSame('2020-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(40, Zend_Date::YEAR_SHORT); - $this->assertSame('2040-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(0, Zend_Date::YEAR_SHORT); - $this->assertSame('2000-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_SHORT); - $date->setTimezone('Indian/Maldives'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(30, Zend_Date::YEAR_SHORT, 'en_US'); - $this->assertSame('2030-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_SHORT, 'en_US'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-20, Zend_Date::YEAR_SHORT, 'en_US'); - $this->assertSame('-20-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_SHORT, 'en_US'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::YEAR_SHORT_8601); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(70, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('1970-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(20, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('2020-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(40, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('2040-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(0, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('2000-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(30, Zend_Date::YEAR_SHORT_8601, 'en_US'); - $this->assertSame('2030-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_SHORT_8601, 'en_US'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-20, Zend_Date::YEAR_SHORT_8601, 'en_US'); - $this->assertSame('-20-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::YEAR_SHORT_8601, 'en_US'); - $this->assertSame('2002-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::MERIDIEM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::SWATCH); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::SWATCH); - $this->assertSame('2009-02-14T00:36:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(0, Zend_Date::SWATCH); - $this->assertSame('2009-02-14T00:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(600, Zend_Date::SWATCH); - $this->assertSame('2009-02-14T14:23:59+05:00', $date->get(Zend_Date::W3C)); - $date->set(1700, Zend_Date::SWATCH); - $this->assertSame('2009-02-15T16:47:59+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(1900, Zend_Date::SWATCH); - $this->assertSame('2009-02-16T21:36:00+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SWATCH); - $this->assertSame('2009-02-17T00:36:00+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(3700, Zend_Date::SWATCH, 'en_US'); - $this->assertSame('2009-02-20T16:48:00+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SWATCH, 'en_US'); - $this->assertSame('2009-02-20T00:36:00+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-200, Zend_Date::SWATCH, 'en_US'); - $this->assertSame('2009-02-18T19:12:00+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SWATCH, 'en_US'); - $this->assertSame('2009-02-19T00:36:00+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::HOUR_SHORT_AM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2009-02-14T03:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(14, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2009-02-14T14:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2009-02-13T18:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(30, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2009-02-14T06:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::HOUR_SHORT_AM, 'en_US'); - $this->assertSame('2009-02-14T09:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_SHORT_AM, 'en_US'); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-26, Zend_Date::HOUR_SHORT_AM, 'en_US'); - $this->assertSame('2009-02-11T22:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_SHORT_AM, 'en_US'); - $this->assertSame('2009-02-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::HOUR_SHORT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::HOUR_SHORT); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::HOUR_SHORT); - $this->assertSame('2009-02-14T03:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(14, Zend_Date::HOUR_SHORT); - $this->assertSame('2009-02-14T14:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::HOUR_SHORT); - $this->assertSame('2009-02-13T18:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(30, Zend_Date::HOUR_SHORT); - $this->assertSame('2009-02-14T06:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_SHORT); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::HOUR_SHORT, 'en_US'); - $this->assertSame('2009-02-14T09:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_SHORT, 'en_US'); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-26, Zend_Date::HOUR_SHORT, 'en_US'); - $this->assertSame('2009-02-11T22:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_SHORT, 'en_US'); - $this->assertSame('2009-02-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::HOUR_AM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::HOUR_AM); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::HOUR_AM); - $this->assertSame('2009-02-14T03:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(14, Zend_Date::HOUR_AM); - $this->assertSame('2009-02-14T14:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::HOUR_AM); - $this->assertSame('2009-02-13T18:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(30, Zend_Date::HOUR_AM); - $this->assertSame('2009-02-14T06:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_AM); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::HOUR_AM, 'en_US'); - $this->assertSame('2009-02-14T09:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_AM, 'en_US'); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-26, Zend_Date::HOUR_AM, 'en_US'); - $this->assertSame('2009-02-11T22:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR_AM, 'en_US'); - $this->assertSame('2009-02-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::HOUR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::HOUR); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::HOUR); - $this->assertSame('2009-02-14T03:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(14, Zend_Date::HOUR); - $this->assertSame('2009-02-14T14:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::HOUR); - $this->assertSame('2009-02-13T18:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(30, Zend_Date::HOUR); - $this->assertSame('2009-02-14T06:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::HOUR, 'en_US'); - $this->assertSame('2009-02-14T09:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR, 'en_US'); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-26, Zend_Date::HOUR, 'en_US'); - $this->assertSame('2009-02-11T22:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::HOUR, 'en_US'); - $this->assertSame('2009-02-12T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::MINUTE); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::MINUTE); - $this->assertSame('2009-02-14T04:36:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::MINUTE); - $this->assertSame('2009-02-14T04:03:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(65, Zend_Date::MINUTE); - $this->assertSame('2009-02-14T05:05:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::MINUTE); - $this->assertSame('2009-02-14T04:54:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(30, Zend_Date::MINUTE); - $this->assertSame('2009-02-13T23:30:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MINUTE); - $this->assertSame('2009-02-14T04:36:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::MINUTE, 'en_US'); - $this->assertSame('2009-02-14T04:09:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MINUTE, 'en_US'); - $this->assertSame('2009-02-14T04:36:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-65, Zend_Date::MINUTE, 'en_US'); - $this->assertSame('2009-02-13T21:55:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MINUTE, 'en_US'); - $this->assertSame('2009-02-14T02:36:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::MINUTE_SHORT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::MINUTE_SHORT); - $this->assertSame('2009-02-14T04:36:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::MINUTE_SHORT); - $this->assertSame('2009-02-14T04:03:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(65, Zend_Date::MINUTE_SHORT); - $this->assertSame('2009-02-14T05:05:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::MINUTE_SHORT); - $this->assertSame('2009-02-14T04:54:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(30, Zend_Date::MINUTE_SHORT); - $this->assertSame('2009-02-13T23:30:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MINUTE_SHORT); - $this->assertSame('2009-02-14T04:36:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::MINUTE_SHORT, 'en_US'); - $this->assertSame('2009-02-14T04:09:30+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MINUTE_SHORT, 'en_US'); - $this->assertSame('2009-02-14T04:36:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-65, Zend_Date::MINUTE_SHORT, 'en_US'); - $this->assertSame('2009-02-13T21:55:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::MINUTE_SHORT, 'en_US'); - $this->assertSame('2009-02-14T02:36:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::SECOND); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::SECOND); - $this->assertSame('2009-02-14T04:31:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::SECOND); - $this->assertSame('2009-02-14T04:31:03+05:00', $date->get(Zend_Date::W3C)); - $date->set(65, Zend_Date::SECOND); - $this->assertSame('2009-02-14T04:32:05+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::SECOND); - $this->assertSame('2009-02-14T04:31:54+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(30, Zend_Date::SECOND); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SECOND); - $this->assertSame('2009-02-14T04:31:50+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::SECOND, 'en_US'); - $this->assertSame('2009-02-14T04:31:09+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SECOND, 'en_US'); - $this->assertSame('2009-02-14T04:31:50+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-65, Zend_Date::SECOND, 'en_US'); - $this->assertSame('2009-02-13T23:29:55+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SECOND, 'en_US'); - $this->assertSame('2009-02-14T04:29:50+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::SECOND_SHORT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::SECOND_SHORT); - $this->assertSame('2009-02-14T04:31:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(3, Zend_Date::SECOND_SHORT); - $this->assertSame('2009-02-14T04:31:03+05:00', $date->get(Zend_Date::W3C)); - $date->set(65, Zend_Date::SECOND_SHORT); - $this->assertSame('2009-02-14T04:32:05+05:00', $date->get(Zend_Date::W3C)); - $date->set(-6, Zend_Date::SECOND_SHORT); - $this->assertSame('2009-02-14T04:31:54+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(30, Zend_Date::SECOND_SHORT); - $this->assertSame('2009-02-13T23:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SECOND_SHORT); - $this->assertSame('2009-02-14T04:31:50+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(9, Zend_Date::SECOND_SHORT, 'en_US'); - $this->assertSame('2009-02-14T04:31:09+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SECOND_SHORT, 'en_US'); - $this->assertSame('2009-02-14T04:31:50+05:00', $date->get(Zend_Date::W3C)); - $date->setTimeZone('UTC'); - $date->set(-65, Zend_Date::SECOND_SHORT, 'en_US'); - $this->assertSame('2009-02-13T23:29:55+00:00', $date->get(Zend_Date::W3C)); - $date->set($d2, Zend_Date::SECOND_SHORT, 'en_US'); - $this->assertSame('2009-02-14T04:29:50+05:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::MILLISECOND); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::MILLISECOND); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND)); - $date->set(3, Zend_Date::MILLISECOND); - $this->assertSame('3', $date->get(Zend_Date::MILLISECOND)); - $date->set(1065, Zend_Date::MILLISECOND); - $this->assertSame('65', $date->get(Zend_Date::MILLISECOND)); - $date->set(-6, Zend_Date::MILLISECOND); - $this->assertSame('994', $date->get(Zend_Date::MILLISECOND)); - $date->set(30, Zend_Date::MILLISECOND, true); - $this->assertSame('30', $date->get(Zend_Date::MILLISECOND)); - $date->set($d2, Zend_Date::MILLISECOND, true); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND)); - $date->set(9, Zend_Date::MILLISECOND, false); - $this->assertSame('9', $date->get(Zend_Date::MILLISECOND)); - $date->set($d2, Zend_Date::MILLISECOND, false); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND)); - $date->set(-65, Zend_Date::MILLISECOND, true); - $this->assertSame('935', $date->get(Zend_Date::MILLISECOND)); - $date->set($d2, Zend_Date::MILLISECOND, true); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIMEZONE_NAME); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DAYLIGHT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::GMT_DIFF); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::GMT_DIFF_SEP); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIMEZONE); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIMEZONE_SECS); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::ISO_8601); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::ISO_8601); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('2007-10-20 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('2007-10-20 201030', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('07-10-20 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('80-10-20 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('1980-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('-2007-10-20 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('-2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('-07-10-20 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('-7-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('2007-10-20T20:10:30', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('2007-10-20T201030', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('20-10-20T20:10:30', Zend_Date::ISO_8601); - $this->assertSame('2020-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('80-10-20T20:10:30', Zend_Date::ISO_8601); - $this->assertSame('1980-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('-2007-10-20T20:10:30', Zend_Date::ISO_8601); - $this->assertSame('-2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('-07-10-20T20:10:30', Zend_Date::ISO_8601); - $this->assertSame('-7-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('20071020 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('201020 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('2020-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('801020 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('1980-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('-071020 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('-7-10-20T20:10:30-07:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('-00071020 20:10:30', Zend_Date::ISO_8601); - $this->assertSame('-7-10-20T20:10:30+00:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(1_234_567_890); - $date->set('20071020T20:10:30', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T20:10:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('20071020T10:30', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T10:30:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('20071020T103000', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T10:30:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('20071020T1020', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T10:20:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('-00071020T20:10:30', Zend_Date::ISO_8601); - $this->assertSame('-7-10-20T20:10:30+00:00', $date->get(Zend_Date::W3C)); - $date->setTimezone('Indian/Maldives'); - $date->set(1_234_567_890); - $date->set('2007-10-20', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T00:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('20071020', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T00:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('20071020122030', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T12:20:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('071020', Zend_Date::ISO_8601); - $this->assertSame('2007-10-20T00:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('07:10:20', Zend_Date::ISO_8601); - $this->assertSame('1970-01-01T07:10:20+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::RFC_2822); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::RFC_2822); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Jan 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-01-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Feb 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-02-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Mar 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-03-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Apr 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-04-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 May 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-05-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Jun 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-06-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Jul 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-07-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Aug 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-08-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Sep 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-09-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Oct 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-10-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Nov 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-11-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Thu, 05 Dec 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->assertSame('2009-12-05T01:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - - try { - $date->set('Thu, 05 Fxx 2009 01:31:30 +0500', Zend_Date::RFC_2822); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIMESTAMP); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::TIMESTAMP); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('1010101099', Zend_Date::TIMESTAMP); - $this->assertSame('2002-01-04T04:38:19+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::ERA); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::ERA_NAME); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATES); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATES); - $this->assertSame('2002-01-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('14.02.2009', Zend_Date::DATES); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATE_FULL); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATE_FULL); - $this->assertSame('2002-01-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Samstag, 14. Februar 2009', Zend_Date::DATE_FULL); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATE_LONG); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATE_LONG); - $this->assertSame('2002-01-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('14. Februar 2009', Zend_Date::DATE_LONG); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATE_MEDIUM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATE_MEDIUM); - $this->assertSame('2002-01-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('14.02.2009', Zend_Date::DATE_MEDIUM); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATE_SHORT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATE_SHORT); - $this->assertSame('2002-01-04T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('14.02.09', Zend_Date::DATE_SHORT); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIMES); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::TIMES); - $this->assertSame('2009-02-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('15:26:40', Zend_Date::TIMES); - $this->assertSame('2009-02-14T15:26:40+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIME_FULL); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::TIME_FULL); - $this->assertSame('2009-02-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('15:26 Uhr CET', Zend_Date::TIME_FULL); - $this->assertSame('2009-02-14T15:26:00+01:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIME_LONG); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::TIME_LONG); - $this->assertSame('2009-02-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('15:26:40 CET', Zend_Date::TIME_LONG); - $this->assertSame('2009-02-14T15:26:40+01:00', $date->get(Zend_Date::W3C)); - - $date->setTimezone('Indian/Maldives'); - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIME_MEDIUM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::TIME_MEDIUM); - $this->assertSame('2009-02-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('15:26:40', Zend_Date::TIME_MEDIUM); - $this->assertSame('2009-02-14T15:26:40+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::TIME_SHORT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::TIME_SHORT); - $this->assertSame('2009-02-14T04:36:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('15:26', Zend_Date::TIME_SHORT); - $this->assertSame('2009-02-14T15:26:00+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATETIME); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATETIME); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('14.02.2009 15:26:03', Zend_Date::DATETIME); - $this->assertSame('2009-02-14T15:26:03+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATETIME_FULL); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATETIME_FULL); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Samstag, 14. Februar 2009 15:26 Uhr CET', Zend_Date::DATETIME_FULL); - $this->assertSame('2009-02-14T15:26:00+01:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATETIME_LONG); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATETIME_LONG); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('14. Februar 2009 15:26:03 CET', Zend_Date::DATETIME_LONG); - $this->assertSame('2009-02-14T15:26:03+01:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATETIME_MEDIUM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATETIME_MEDIUM); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('14.02.2009 15:26:31', Zend_Date::DATETIME_MEDIUM); - $this->assertSame('2009-02-14T15:26:31+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::DATETIME_SHORT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::DATETIME_SHORT); - $this->assertSame('2002-01-04T04:36:00+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('14.02.09 15:26', Zend_Date::DATETIME_SHORT); - $this->assertSame('2009-02-14T15:26:00+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::ATOM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::ATOM); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('2009-02-14T00:31:30+05:00', Zend_Date::ATOM); - $this->assertSame('2009-02-14T00:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::COOKIE); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::COOKIE); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Saturday, 14-Feb-09 00:31:30 Europe/Vienna', Zend_Date::COOKIE); - $this->assertSame('2009-02-14T00:31:30+01:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::RFC_822); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::RFC_822); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Sat, 14 Feb 09 00:31:30 +0500', Zend_Date::RFC_822); - $this->assertSame('2009-02-14T00:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::RFC_850); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::RFC_850); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Saturday, 14-Feb-09 00:31:30 Europe/Vienna', Zend_Date::RFC_850); - $this->assertSame('2009-02-14T00:31:30+01:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::RFC_1036); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::RFC_1036); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Sat, 14 Feb 09 00:31:30 +0500', Zend_Date::RFC_1036); - $this->assertSame('2009-02-14T00:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::RFC_1123); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::RFC_1123); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Sat, 14 Feb 2009 00:31:30 +0500', Zend_Date::RFC_1123); - $this->assertSame('2009-02-14T00:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::RFC_3339); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::RFC_3339); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('2009-02-14T00:31:30+05:00', Zend_Date::RFC_3339); - $this->assertSame('2009-02-14T00:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::RSS); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::RSS); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('Sat, 14 Feb 2009 00:31:30 +0500', Zend_Date::RSS); - $this->assertSame('2009-02-14T00:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('Sat, 14 Feb 2009 00:31:30 GMT', Zend_Date::RSS); - $this->assertSame('2009-02-14T00:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set('Sat, 14 Feb 09 00:31:30 GMT', Zend_Date::RSS); - $this->assertSame('2009-02-14T00:31:30+00:00', $date->get(Zend_Date::W3C)); - $date->set('Sat, 14 Feb 09 00:31:30 +0500', Zend_Date::RSS); - $this->assertSame('2009-02-14T00:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date->set(1_234_567_890); - - try { - $date->set('noday', Zend_Date::W3C); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set($d2, Zend_Date::W3C); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->set(1_234_567_890); - $date->set('2009-02-14T00:31:30+05:00', Zend_Date::W3C); - $this->assertSame('2009-02-14T00:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->set('2009-02-14T00:31:30-05:00', Zend_Date::W3C); - $this->assertSame('2009-02-14T00:31:30-05:00', $date->get(Zend_Date::W3C)); - - $date->setTimezone('Indian/Maldives'); - $date->set(1_234_567_890); - - try { - $date->set('noday', 'xx'); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->set($d2, 'xx'); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - $date->set(1_234_567_890); - $date->set('1000', 'xx'); - $this->assertSame('1970-01-01T05:16:40+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for add. - */ - public function testAdd() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $retour = $date->set(1_234_567_890); - $this->assertSame($retour->getTimestamp(),'1234567890'); - $this->assertSame($date->add(10)->getTimestamp(),'1234567900'); - $this->assertSame($date->add(-10)->getTimestamp(),'1234567890'); - $this->assertSame($date->add(0)->getTimestamp(),'1234567890'); - - $date->set($d2); - $date->add(10, Zend_Date::DAY); - $this->assertSame('2002-01-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::DAY); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Mon', Zend_Date::WEEKDAY_SHORT); - $this->assertSame('2002-01-05T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::DAY_SHORT); - $this->assertSame('2002-01-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::DAY_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Montag', Zend_Date::WEEKDAY); - $this->assertSame('2002-01-05T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(1, Zend_Date::WEEKDAY_8601); - $this->assertSame('2002-01-05T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->add($d2, Zend_Date::DAY_SUFFIX); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - } - - /** - * Test for add. - */ - public function testAdd2() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $date->set($d2); - $date->add(1, Zend_Date::WEEKDAY_DIGIT); - $this->assertSame('2002-01-05T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2002-01-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('M', Zend_Date::WEEKDAY_NARROW); - $this->assertSame('2002-01-05T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Mo.', Zend_Date::WEEKDAY_NAME); - $this->assertSame('2002-01-05T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::WEEK); - $this->assertSame('2002-03-15T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::WEEK); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('April', Zend_Date::MONTH_NAME); - $this->assertSame('2002-08-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::MONTH); - $this->assertSame('2002-11-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::MONTH); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Apr.', Zend_Date::MONTH_NAME_SHORT); - $this->assertSame('2002-08-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::MONTH_SHORT); - $this->assertSame('2002-11-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::MONTH_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->add($d2, Zend_Date::MONTH_DAYS); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->add('M', Zend_Date::MONTH_NAME_NARROW); - $this->assertSame('2002-06-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->add($d2, Zend_Date::LEAPYEAR); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->add(10, Zend_Date::YEAR_8601); - $this->assertSame('2012-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::YEAR_8601); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::YEAR); - $this->assertSame('2012-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::YEAR); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::YEAR_SHORT); - $this->assertSame('2012-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::YEAR_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('2012-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::MERIDIEM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->add(10, Zend_Date::SWATCH); - $this->assertSame('2002-01-04T04:51:14+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::SWATCH); - $this->assertSame('2002-01-04T04:36:49+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2002-01-04T14:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::HOUR_SHORT); - $this->assertSame('2002-01-04T14:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::HOUR_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::HOUR_AM); - $this->assertSame('2002-01-04T14:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::HOUR_AM); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::HOUR); - $this->assertSame('2002-01-04T14:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::HOUR); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::MINUTE); - $this->assertSame('2002-01-04T04:46:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::MINUTE); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::MINUTE_SHORT); - $this->assertSame('2002-01-04T04:46:50+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::MINUTE_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::SECOND); - $this->assertSame('2002-01-04T04:37:00+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::SECOND); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::SECOND_SHORT); - $this->assertSame('2002-01-04T04:37:00+05:00', $date->get(Zend_Date::W3C)); - $date->add(-10, Zend_Date::SECOND_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::MILLISECOND); - $this->assertSame('10', $date->get(Zend_Date::MILLISECOND)); - $date->add(-10, Zend_Date::MILLISECOND); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND)); - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::TIMEZONE_NAME); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::DAYLIGHT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::GMT_DIFF); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::GMT_DIFF_SEP); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::TIMEZONE); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::TIMEZONE_SECS); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->add('1000-01-02 20:05:12', Zend_Date::ISO_8601); - $this->assertSame('3002-02-07T19:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Thu, 02 Jan 1000 20:05:12 +0500', Zend_Date::RFC_2822); - $this->assertSame('3002-02-07T19:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add(10, Zend_Date::TIMESTAMP); - $this->assertSame('2002-01-04T04:37:00+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::ERA); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->add('noday', Zend_Date::ERA_NAME); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->add('10.02.0005', Zend_Date::DATES); - $this->assertSame('2007-03-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Samstag, 10. Februar 0005', Zend_Date::DATE_FULL); - $this->assertSame('2007-03-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10. Februar 0005', Zend_Date::DATE_LONG); - $this->assertSame('2007-03-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10.02.0005', Zend_Date::DATE_MEDIUM); - $this->assertSame('2007-03-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10.02.05', Zend_Date::DATE_SHORT); - $this->assertSame('4007-03-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10:05:05', Zend_Date::TIMES); - $this->assertSame('2002-01-04T14:41:55+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10:05 Uhr CET', Zend_Date::TIME_FULL); - $this->assertSame('2002-01-04T14:41:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10:05:05 CET', Zend_Date::TIME_LONG); - $this->assertSame('2002-01-04T14:41:55+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10:05:05', Zend_Date::TIME_MEDIUM); - $this->assertSame('2002-01-04T14:41:55+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10:05', Zend_Date::TIME_SHORT); - $this->assertSame('2002-01-04T14:41:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10.02.0005 10:05:05', Zend_Date::DATETIME); - $this->assertSame('2007-03-14T14:41:55+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Samstag, 10. Februar 0005 10:05 Uhr CET', Zend_Date::DATETIME_FULL); - $this->assertSame('2007-03-14T14:41:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10. Februar 0005 10:05:05 CET', Zend_Date::DATETIME_LONG); - $this->assertSame('2007-03-14T14:41:55+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10.02.0005 10:05:05', Zend_Date::DATETIME_MEDIUM); - $this->assertSame('2007-03-14T14:41:55+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('10.02.05 10:05', Zend_Date::DATETIME_SHORT); - $this->assertSame('4007-03-14T14:41:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('1000-01-02T20:05:12+05:00', Zend_Date::ATOM); - $this->assertSame('3002-02-08T00:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Saturday, 02-Jan-00 20:05:12 Europe/Vienna', Zend_Date::COOKIE); - $this->assertSame('4002-02-07T00:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Sat, 02 Jan 00 20:05:12 +0500', Zend_Date::RFC_822); - $this->assertSame('4002-02-06T19:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Saturday, 02-Jan-00 20:05:12 Europe/Vienna', Zend_Date::RFC_850); - $this->assertSame('4002-02-07T00:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Sat, 02 Jan 00 20:05:12 +0500', Zend_Date::RFC_1036); - $this->assertSame('4002-02-06T19:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Sat, 02 Jan 1000 20:05:12 +0500', Zend_Date::RFC_1123); - $this->assertSame('3002-02-08T00:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('1000-01-02T20:05:12+05:00', Zend_Date::RFC_3339); - $this->assertSame('3002-02-08T00:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('Sat, 02 Jan 1000 20:05:12 +0500', Zend_Date::RSS); - $this->assertSame('3002-02-08T00:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('1000-01-02T20:05:12+05:00', Zend_Date::W3C); - $this->assertSame('3002-02-08T00:42:02+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->add('1000', 'xx'); - $this->assertSame('2002-01-04T04:53:30+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for sub. - */ - public function testSub() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $retour = $date->set(1_234_567_890); - $this->assertSame('1234567890', $retour->getTimestamp()); - $this->assertSame('1234567900', $date->sub(-10)->getTimestamp()); - $this->assertSame('1234567890', $date->sub(10)->getTimestamp()); - $this->assertSame('1234567890', $date->sub(0)->getTimestamp()); - - $date->set($d2); - $date->sub(-10, Zend_Date::DAY); - $this->assertSame('2002-01-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::DAY); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for sub. - */ - public function testSub2() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $date->set($d2); - $date->sub('Mon', Zend_Date::WEEKDAY_SHORT); - $this->assertSame('2002-01-03T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::DAY_SHORT); - $this->assertSame('2002-01-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::DAY_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Montag', Zend_Date::WEEKDAY); - $this->assertSame('2002-01-03T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(1, Zend_Date::WEEKDAY_8601); - $this->assertSame('2002-01-03T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->sub($d2, Zend_Date::DAY_SUFFIX); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->sub(1, Zend_Date::WEEKDAY_DIGIT); - $this->assertSame('2002-01-03T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2002-01-14T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::DAY_OF_YEAR); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('M', Zend_Date::WEEKDAY_NARROW); - $this->assertSame('2002-01-03T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Mo.', Zend_Date::WEEKDAY_NAME); - $this->assertSame('2002-01-03T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::WEEK); - $this->assertSame('2002-03-15T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::WEEK); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('April', Zend_Date::MONTH_NAME); - $this->assertSame('2001-09-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::MONTH); - $this->assertSame('2002-11-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::MONTH); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Apr.', Zend_Date::MONTH_NAME_SHORT); - $this->assertSame('2001-09-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::MONTH_SHORT); - $this->assertSame('2002-11-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::MONTH_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->sub($d2, Zend_Date::MONTH_DAYS); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->sub('M', Zend_Date::MONTH_NAME_NARROW); - $this->assertSame('2001-10-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->sub($d2, Zend_Date::LEAPYEAR); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->sub(-10, Zend_Date::YEAR_8601); - $this->assertSame('2012-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::YEAR_8601); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::YEAR); - $this->assertSame('2012-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::YEAR); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(10, Zend_Date::YEAR_SHORT); - $this->assertSame('1992-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(-10, Zend_Date::YEAR_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(10, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('1992-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(-10, Zend_Date::YEAR_SHORT_8601); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::MERIDIEM); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->sub(-10, Zend_Date::SWATCH); - $this->assertSame('2002-01-04T04:51:15+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::SWATCH); - $this->assertSame('2002-01-04T04:36:51+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2002-01-04T14:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::HOUR_SHORT_AM); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::HOUR_SHORT); - $this->assertSame('2002-01-04T14:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::HOUR_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::HOUR_AM); - $this->assertSame('2002-01-04T14:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::HOUR_AM); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::HOUR); - $this->assertSame('2002-01-04T14:36:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::HOUR); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::MINUTE); - $this->assertSame('2002-01-04T04:46:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::MINUTE); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::MINUTE_SHORT); - $this->assertSame('2002-01-04T04:46:50+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::MINUTE_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::SECOND); - $this->assertSame('2002-01-04T04:37:00+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::SECOND); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::SECOND_SHORT); - $this->assertSame('2002-01-04T04:37:00+05:00', $date->get(Zend_Date::W3C)); - $date->sub(10, Zend_Date::SECOND_SHORT); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::MILLISECOND); - $this->assertSame('10', $date->get(Zend_Date::MILLISECOND)); - $date->sub(10, Zend_Date::MILLISECOND); - $this->assertSame('0', $date->get(Zend_Date::MILLISECOND)); - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::TIMEZONE_NAME); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::DAYLIGHT); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::GMT_DIFF); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::GMT_DIFF_SEP); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::TIMEZONE); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::TIMEZONE_SECS); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->sub('1000-01-02 20:05:12', Zend_Date::ISO_8601); - $this->assertSame('1001-11-25T13:31:38+05:00', $date->get(Zend_Date::W3C)); - $date->set($d2); - $date->sub('1000-01-02T20:05:12+05:00', Zend_Date::ISO_8601); - $this->assertSame('1001-11-25T13:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Thu, 02 Jan 1000 20:05:12 +0500', Zend_Date::RFC_2822); - $this->assertSame('1001-11-25T13:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub(-10, Zend_Date::TIMESTAMP); - $this->assertSame('2002-01-04T04:37:00+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::ERA); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - - try { - $date->sub('noday', Zend_Date::ERA_NAME); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set($d2); - $date->sub('10.02.0005', Zend_Date::DATES); - $this->assertSame('1996-10-27T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Samstag, 10. Februar 0005', Zend_Date::DATE_FULL); - $this->assertSame('1996-10-27T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10. Februar 0005', Zend_Date::DATE_LONG); - $this->assertSame('1996-10-27T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10.02.0005', Zend_Date::DATE_MEDIUM); - $this->assertSame('1996-10-27T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10.02.05', Zend_Date::DATE_SHORT); - $this->assertSame('-4-10-29T04:36:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10:05:05', Zend_Date::TIMES); - $this->assertSame('2002-01-03T18:31:45+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10:05 Uhr CET', Zend_Date::TIME_FULL); - $this->assertSame('2002-01-03T18:31:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10:05:05 CET', Zend_Date::TIME_LONG); - $this->assertSame('2002-01-03T18:31:45+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10:05:05', Zend_Date::TIME_MEDIUM); - $this->assertSame('2002-01-03T18:31:45+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10:05', Zend_Date::TIME_SHORT); - $this->assertSame('2002-01-03T18:31:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10.02.0005 10:05:05', Zend_Date::DATETIME); - $this->assertSame('1996-10-26T18:31:45+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Samstag, 10. Februar 0005 10:05 Uhr CET', Zend_Date::DATETIME_FULL); - $this->assertSame('1996-10-26T18:31:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10. Februar 0005 10:05:05 CET', Zend_Date::DATETIME_LONG); - $this->assertSame('1996-10-26T18:31:45+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10.02.0005 10:05:05', Zend_Date::DATETIME_MEDIUM); - $this->assertSame('1996-10-26T18:31:45+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('10.02.05 10:05', Zend_Date::DATETIME_SHORT); - $this->assertSame('-4-10-28T18:31:50+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('1000-01-02T20:05:12+05:00', Zend_Date::ATOM); - $this->assertSame('1001-11-25T08:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Saturday, 02-Jan-00 20:05:12 Europe/Vienna', Zend_Date::COOKIE); - $this->assertSame('1-12-03T08:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Sat, 02 Jan 00 20:05:12 +0500', Zend_Date::RFC_822); - $this->assertSame('1-12-03T13:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Saturday, 02-Jan-00 20:05:12 Europe/Vienna', Zend_Date::RFC_850); - $this->assertSame('1-12-03T08:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Sat, 02 Jan 00 20:05:12 +0500', Zend_Date::RFC_1036); - $this->assertSame('1-12-03T13:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Sat, 02 Jan 1000 20:05:12 +0500', Zend_Date::RFC_1123); - $this->assertSame('1001-11-25T08:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('1000-01-02T20:05:12+05:00', Zend_Date::RFC_3339); - $this->assertSame('1001-11-25T08:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('Sat, 02 Jan 1000 20:05:12 +0500', Zend_Date::RSS); - $this->assertSame('1001-11-25T08:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('1000-01-02T20:05:12+05:00', Zend_Date::W3C); - $this->assertSame('1001-11-25T08:31:38+05:00', $date->get(Zend_Date::W3C)); - - $date->set($d2); - $date->sub('1000', 'xx'); - $this->assertSame('2002-01-04T04:20:10+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for compare. - */ - public function testCompare() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); //03.01.2002 15:36:50 - - $retour = $date->set(1_234_567_890); //13.02.2009 15:31:30 - $this->assertSame('1234567890', $retour->getTimestamp()); - $this->assertSame(0, $date->compare(1_234_567_890)); - $this->assertSame(1, $date->compare(1_234_567_800)); - $this->assertSame(-1, $date->compare(1_234_567_899)); - - $date->set($d2); //03.01.2002 15:36:50 - $this->assertSame(1, $date->compare(3,Zend_Date::DAY)); - $this->assertSame(0, $date->compare(4,Zend_Date::DAY)); - $this->assertSame(-1, $date->compare(5,Zend_Date::DAY)); - - $this->assertSame(1, $date->compare('Mon',Zend_Date::WEEKDAY_SHORT)); - $this->assertSame(-1, $date->compare('Sam',Zend_Date::WEEKDAY_SHORT)); - - $date->set($d2); //03.01.2002 15:36:50 - $this->assertSame(0, $date->compare(0,Zend_Date::MILLISECOND)); - } - - /** - * Test for copy. - */ - public function testCopy() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $date->set(1_234_567_890); - $newdate = clone $date; - $this->assertSame($date->get(),$newdate->get()); - - $date->set($d2); - $newdate = $date->copyPart(Zend_Date::DAY); - $this->assertSame('2002-01-04T04:36:50+05:00', $date->get(Zend_Date::W3C)); - $this->assertSame('1970-01-04T05:00:00+05:00', $newdate->get(Zend_Date::W3C)); - } - - /** - * Test for equals. - */ - public function testEquals() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $retour = $date->set(1_234_567_890); - $this->assertSame('1234567890', $retour->getTimestamp()); - $this->assertTrue($date->equals(1_234_567_890)); - $this->assertFalse($date->equals(1_234_567_800)); - - $date->set($d2); - $this->assertFalse($date->equals(3,Zend_Date::DAY)); - $this->assertTrue($date->equals(4,Zend_Date::DAY)); - } - - /** - * Test for isEarlier. - */ - public function testIsEarlier() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $retour = $date->set(1_234_567_890); - $this->assertSame('1234567890', $retour->getTimestamp()); - $this->assertFalse($date->isEarlier(1_234_567_890)); - $this->assertFalse($date->isEarlier(1_234_567_800)); - $this->assertTrue($date->isEarlier(1_234_567_899)); - - $date->set($d2); - $this->assertFalse($date->isEarlier(3,Zend_Date::DAY)); - $this->assertFalse($date->isEarlier(4,Zend_Date::DAY)); - $this->assertTrue($date->isEarlier(5,Zend_Date::DAY)); - } - - /** - * Test for isLater. - */ - public function testIsLater() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(0,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $retour = $date->set(1_234_567_890); - $this->assertSame('1234567890', $retour->getTimestamp()); - $this->assertFalse($date->isLater(1_234_567_890)); - $this->assertTrue($date->isLater(1_234_567_800)); - $this->assertFalse($date->isLater(1_234_567_899)); - - $date->set($d2); - $this->assertTrue($date->isLater(3,Zend_Date::DAY)); - $this->assertFalse($date->isLater(4,Zend_Date::DAY)); - $this->assertFalse($date->isLater(5,Zend_Date::DAY)); - } - - /** - * Test for getTime. - */ - public function testGetTime() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_010_101_010,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $result = $date->getTime(); - $this->assertSame('1970-01-01T04:36:50+05:00', $result->get(Zend_Date::W3C)); - } - - /** - * Test for setTime. - */ - public function testSetTime() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $result = $date->setTime(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - $result = $date->setTime('10:20:30'); - $this->assertSame('2009-02-14T10:20:30+05:00', $result->get(Zend_Date::W3C)); - $this->assertSame('2009-02-14T10:20:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTime('30-20-10','ss:mm:HH'); - $this->assertSame('2009-02-14T10:20:30+05:00', $date->get(Zend_Date::W3C)); - $date->setTime($d2); - $this->assertSame('2009-02-14T04:31:39+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(Zend_Date::now(), $locale); - $t1 = $date->get(Zend_Date::TIMESTAMP); - $date->setTime(Zend_Date::now()); - $t2 = $date->get(Zend_Date::TIMESTAMP); - $diff = abs($t2 - $t1); - $this->assertTrue($diff < 2, "Instance of Zend_Date has a significantly different time than returned by setTime(): $diff seconds"); - } - - /** - * Test for addTime. - */ - public function testAddTime() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $result = $date->addTime(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $result = $date->addTime('10:20:30'); - $this->assertSame('2009-02-14T14:52:00+05:00', $result->get(Zend_Date::W3C)); - $this->assertSame('2009-02-14T14:52:00+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->addTime('30:20:10','ss:mm:HH'); - $this->assertSame('2009-02-14T14:52:00+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->addTime($d2); - $this->assertSame('2009-02-14T09:03:09+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for subTime. - */ - public function testSubTime() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $result = $date->subTime(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $result = $date->subTime('10:20:30'); - $this->assertSame('2009-02-13T18:11:00+05:00', $result->get(Zend_Date::W3C)); - $this->assertSame('2009-02-13T18:11:00+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->subTime('30-20-10','ss:mm:HH'); - $this->assertSame('2009-02-13T18:11:00+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->subTime($d2); - $this->assertSame('2009-02-13T23:59:51+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for compareTime. - */ - public function testCompareTime() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $this->assertSame(-1, $date->compareTime('10:20:30')); - $this->assertSame(0, $date->compareTime('04:31:30')); - $this->assertSame(1, $date->compareTime('04:00:30')); - $this->assertSame(-1, $date->compareTime($d2)); - } - - /** - * Test for setTime. - */ - public function testSetHour() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - for ($i = 23; $i >= 0; --$i) { - $date->setHour($i); - $hour = $i; - if ($i < 10) { - $hour = '0' . $hour; - } - $this->assertSame("2009-02-14T$hour:31:30+05:00", $date->get(Zend_Date::W3C)); - } - } - - /** - * Test for getDate. - */ - public function testGetDate() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_010_101_010,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $result = $date->getDate(); - $this->assertSame('2002-01-04T00:00:00+05:00', $result->get(Zend_Date::W3C)); - } - - /** - * Test for setDate. - */ - public function testSetDate() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $result = $date->setDate(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - $result = $date->setDate('11.05.2008'); - // Hint: the hour changes from 0 to 1 because of DST... - // An hour is added by winter->summertime change - $this->assertSame('2008-05-11T04:31:30+05:00', $result->get(Zend_Date::W3C)); - $this->assertSame('2008-05-11T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setDate('2008-05-11','YYYY-MM-dd'); - $this->assertSame('2008-05-11T04:31:30+05:00', $date->get(Zend_Date::W3C)); - $date->setDate($d2); - $this->assertSame('2009-02-14T04:31:30+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for addDate. - */ - public function testAddDate() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $result = $date->addDate(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $result = $date->addDate('02-03-05'); - $this->assertSame('4014-05-17T04:31:30+05:00', $result->get(Zend_Date::W3C)); - $this->assertSame('4014-05-17T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->addDate('05-03-02','YY-MM-dd'); - $this->assertSame('4014-05-17T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->addDate($d2); - $this->assertSame('4018-04-28T04:31:30+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for subDate. - */ - public function testSubDate() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $result = $date->subDate(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $result = $date->subDate('03-05-1001'); - $this->assertSame('1007-09-08T04:31:30+05:00', $result->get(Zend_Date::W3C)); - $this->assertSame('1007-09-08T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->subDate('1001-05-03','YYYY-MM-dd'); - $this->assertSame('1007-09-08T04:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->subDate($d2); - $this->assertSame('-1-12-06T04:31:30+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for compareDate. - */ - public function testCompareDate() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - - $date = new Zend_Date(1_234_567_890,$locale); - $this->assertSame(1, $date->compareDate('10.01.2009')); - $this->assertSame(0, $date->compareDate('14.02.2009')); - $this->assertSame(-1, $date->compareDate('15.02.2009')); - $this->assertSame(0, $date->compareDate($d2)); - } - - /** - * Test for getIso. - */ - public function testGetIso() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_010_101_010,null,$locale); - $d2 = new Zend_Date(1_010_101_010,null,$locale); - - $result = $date->getIso(); - $this->assertTrue(is_string($result)); - $this->assertSame('2002-01-04T04:36:50+05:00', $result); - } - - /** - * Test for setIso. - */ - public function testSetIso() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $result = $date->setIso(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - $result = $date->setIso('2002-01-04T00:00:00+0000'); - $this->assertSame('2002-01-04T00:00:00+00:00', $result->get(Zend_Date::W3C)); - $this->assertSame('2002-01-04T00:00:00+00:00', $date->get(Zend_Date::W3C)); - $date->setIso($d2); - $this->assertSame('2009-02-14T04:31:39+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for addIso. - */ - public function testAddIso() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - - $result = $date->addIso(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - } - - /** - * Test for addIso. - */ - public function testAddIso2() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - - $result = $date->setIso('2002-01-04T01:00:00+0500'); - $result = $date->addIso('0000-00-00T01:00:00+0500'); - $this->assertSame('2002-01-03T21:00:00+05:00', $result->get(Zend_Date::W3C)); - $this->assertSame('2002-01-03T21:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->addIso('0001-01-01T01:01:01+0500'); - $this->assertSame('2003-02-04T17:01:01+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,$locale); - $date->addIso($d2); - $this->assertSame('4018-04-28T04:03:09+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for subIso. - */ - public function testSubIso() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $result = $date->subIso(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - } - - /** - * Test for subIso. - */ - public function testSubIso2() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - $result = $date->subIso('0000-00-00T01:00:00+0500'); - $this->assertSame('2009-02-14T08:31:30+05:00', $result->get(Zend_Date::W3C)); - $this->assertSame('2009-02-14T08:31:30+05:00', $date->get(Zend_Date::W3C)); - - $result = $date->subIso('0001-01-01T01:01:01+0500'); - $this->assertSame('2008-01-14T12:30:29+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $date->subIso($d2); - $this->assertSame('-1-12-06T04:59:51+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for compareIso. - */ - public function testCompareIso() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,null,$locale); - $d2 = new Zend_Date(1_234_567_899,null,$locale); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $this->assertSame(1, $date->compareIso('2002-01-04T04:00:00+0500')); - $this->assertSame(0, $date->compareIso('2009-02-14T04:31:30+0500')); - $this->assertSame(-1, $date->compareIso('2010-01-04T05:00:00+0500')); - $this->assertSame(-1, $date->compareIso($d2)); - } - - /** - * Test for getArpa. - */ - public function testGetArpa() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_010_101_010,null,$locale); - - $result = $date->getArpa(); - $this->assertTrue(is_string($result)); - $this->assertSame('Fri, 04 Jan 02 04:36:50 +0500', $result); - } - - /** - * Test for setArpa. - */ - public function testSetArpa() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - $date->setTimezone('Indian/Maldives'); - - $result = $date->setArpa(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - $result = $date->setArpa('Sat, 03 May 01 00:00:00 +0500'); - $this->assertSame('Thu, 03 May 01 00:00:00 +0500', $result->get(Zend_Date::RFC_822)); - $this->assertSame('2001-05-03T00:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->setArpa($d2); - $this->assertSame('2009-02-14T04:31:39+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for addArpa. - */ - public function testAddArpa() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - - $result = $date->addArpa(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - - $date = new Zend_Date(1_234_567_890,$locale); - $result = $date->addArpa('Sat, 03 May 01 00:00:00 +0500'); - $this->assertSame('Sat, 17 Jul 10 23:31:30 +0500', $result->get(Zend_Date::RFC_822)); - $this->assertSame('4010-07-17T23:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,$locale); - $date->addArpa($d2); - $this->assertSame('4018-04-28T04:03:09+05:00', $date->get(Zend_Date::W3C)); - - $result = $date->setArpa('Fri, 05 Jan 07 03:35:53 +0500'); - $arpa = $result->getArpa(); - $this->assertSame('Fri, 05 Jan 07 03:35:53 +0500', $arpa); - } - - /** - * Test for subArpa. - */ - public function testSubArpa() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - - $result = $date->subArpa(Zend_Date::now()); - $this->assertTrue($result instanceof Zend_Date); - - $date = new Zend_Date(1_234_567_890,null,$locale); - $result = $date->subArpa('Sat, 03 May 01 00:00:00 +0500'); - $this->assertSame('Wed, 16 Sep 7 09:31:30 +0500', $result->get(Zend_Date::RFC_822)); - $this->assertSame('7-09-16T09:31:30+05:00', $date->get(Zend_Date::W3C)); - - $date = new Zend_Date(1_234_567_890,$locale); - $date->subArpa($d2); - $this->assertSame('-1-12-06T04:59:51+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for compareArpa. - */ - public function testCompareArpa() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - - $date = new Zend_Date(1_234_567_890,$locale); - $this->assertSame(-1, $date->compareArpa('Sat, 14 Feb 09 05:31:30 +0500')); - $this->assertSame(0, $date->compareArpa('Sat, 14 Feb 09 04:31:30 +0500')); - $this->assertSame(1, $date->compareArpa('Sat, 13 Feb 09 04:31:30 +0500')); - $this->assertSame(-1, $date->compareArpa($d2)); - } - - /** - * Test for false locale setting. - */ - public function testReducedParams() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_010_101_010,$locale); - - $date->setArpa('Sat, 03 May 01 00:00:00 +0500',$locale); - $this->assertSame('Thu, 03 May 01 00:00:00 +0500', $date->get(Zend_Date::RFC_822)); - } - - /** - * Test for SunFunc. - */ - public function testSunFunc() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_010_101_010,$locale); - $date->setTimezone(date_default_timezone_get()); - - $result = Zend_Date_Cities::City('vienna'); - $this->assertTrue(is_array($result)); - $result = $date->getSunset($result); - $this->assertSame('2002-01-04T20:09:40+05:00', $result->get(Zend_Date::W3C)); - - unset($result); - $result = Zend_Date_Cities::City('vienna', 'civil'); - $this->assertTrue(is_array($result)); - $result = $date->getSunset($result); - $this->assertSame('2002-01-04T20:09:01+05:00', $result->get(Zend_Date::W3C)); - - unset($result); - $result = Zend_Date_Cities::City('vienna', 'nautic'); - $this->assertTrue(is_array($result)); - $result = $date->getSunset($result); - $this->assertSame('2002-01-04T20:08:15+05:00', $result->get(Zend_Date::W3C)); - - unset($result); - $result = Zend_Date_Cities::City('vienna', 'astronomic'); - $this->assertTrue(is_array($result)); - $result = $date->getSunset($result); - $this->assertSame('2002-01-04T20:07:30+05:00', $result->get(Zend_Date::W3C)); - - unset($result); - $result = Zend_Date_Cities::City('BERLIN'); - $this->assertTrue(is_array($result)); - $result = $date->getSunrise($result); - $this->assertSame('2002-01-04T12:21:26+05:00', $result->get(Zend_Date::W3C)); - - unset($result); - $result = Zend_Date_Cities::City('London'); - $this->assertTrue(is_array($result)); - $result = $date->getSunInfo($result); - $this->assertSame('2002-01-04T13:10:15+05:00', $result['sunrise']['effective']->get(Zend_Date::W3C)); - - unset($result); - $result = ['longitude' => 0]; - - try { - $result = $date->getSunrise($result); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - unset($result); - $result = ['latitude' => 0]; - - try { - $result = $date->getSunrise($result); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - unset($result); - $result = ['longitude' => 180.1, 'latitude' => 0]; - - try { - $result = $date->getSunrise($result); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - unset($result); - $result = ['longitude' => -180.1, 'latitude' => 0]; - - try { - $result = $date->getSunrise($result); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - unset($result); - $result = ['longitude' => 0, 'latitude' => 90.1]; - - try { - $result = $date->getSunrise($result); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - unset($result); - $result = ['longitude' => 0, 'latitude' => -90.1]; - - try { - $result = $date->getSunrise($result); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - unset($result); - $result = ['latitude' => 0, 'longitude' => 0]; - $result = $date->getSunInfo($result); - $this->assertTrue(is_array($result)); - - unset($result); - $result = ['latitude' => 0, 'longitude' => 0]; - $result = $date->getSunrise($result); - $this->assertTrue($result instanceof Zend_Date); - } - - /** - * Test for Timezone. - */ - public function testTimezone() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_010_101_010,$locale); - $date->setTimezone(date_default_timezone_get()); - - $result = $date->getTimezone(); - $this->assertSame('Indian/Maldives', $result); - - try { - $result = $date->setTimezone('unknown'); - // if function timezone_identifiers_list is not available false should be returned - $this->assertFalse($result); - } catch (Zend_Date_Exception $e) { - // success - } - $result = $date->getTimezone(); - $this->assertSame('Indian/Maldives', $result); - - $result = $date->setTimezone('America/Chicago'); - $this->assertTrue($result instanceof Zend_Date); - $result = $date->getTimezone(); - $this->assertSame('America/Chicago', $result); - - $date = new Zend_Date('01.01.2000T00:00:00Z',Zend_Date::ISO_8601); - $result = $date->getTimezone(); - $this->assertSame('Etc/UTC', $result); - } - - /** - * Test for LeapYear. - */ - public function testLeapYear() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date('01.01.2006', Zend_Date::DATES, $locale); - $this->assertFalse($date->isLeapYear()); - - unset($date); - $date = new Zend_Date('01.01.2004', Zend_Date::DATES, $locale); - $this->assertTrue($date->isLeapYear()); - - try { - $result = Zend_Date::checkLeapYear('noyear'); - $this->fail('exception expected'); - } catch (Zend_Date_Exception $e) { - // succeed - } - } - - /** - * Test for Today. - */ - public function testToday() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(Zend_Date::now()); - $d2 = new Zend_Date(1_010_101_010,$locale); - - $this->assertFalse($d2->isToday()); - $this->assertTrue($date->isToday()); - } - - /** - * Test for Yesterday. - */ - public function testYesterday() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(Zend_Date::now()); - $d2 = new Zend_Date(1_010_101_010,$locale); - $date->subDay(1); - $this->assertFalse($d2->isYesterday()); - $this->assertTrue($date->isYesterday()); - } - - /** - * Test for Tomorrow. - */ - public function testTomorrow() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(Zend_Date::now()); - $d2 = new Zend_Date(1_010_101_010,$locale); - - $date->addDay(1); - $this->assertFalse($d2->isTomorrow()); - $this->assertTrue($date->isTomorrow()); - } - - /** - * test isToday(), isTomorrow(), and isYesterday() for cases other than time() = "now". - */ - public function testIsDay() - { - date_default_timezone_set('Europe/Vienna'); // should have DST - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date_TestHelper('01.01.2006', Zend_Date::DATES, $locale); - - $date->_setTime($date->mktime(0, 0, 0, 1, 1, 2006)); - $this->assertTrue($date->isToday()); - $this->assertFalse($date->isTomorrow()); - $date->_setTime($date->mktime(0, 0, 0, 1, 1, 2006)); - $this->assertFalse($date->isYesterday()); - - $date->_setTime($date->mktime(0, 0, 0, 12, 31, 2005)); - $this->assertTrue($date->isTomorrow()); - $date->_setTime($date->mktime(0, 0, 0, 12, 31, 2005)); - $this->assertFalse($date->isYesterday()); - - $date->_setTime($date->mktime(0, 0, 0, 12, 31, 2006)); - $this->assertFalse($date->isTomorrow()); - $date->_setTime($date->mktime(0, 0, 0, 12, 31, 2006)); - $this->assertFalse($date->isYesterday()); - - $date->_setTime($date->mktime(0, 0, 0, 1, 0, 2006)); - $this->assertTrue($date->isTomorrow()); - $date->_setTime($date->mktime(0, 0, 0, 1, 0, 2006)); - $this->assertFalse($date->isYesterday()); - - $date->_setTime($date->mktime(0, 0, 0, 1, 2, 2006)); - $this->assertFalse($date->isTomorrow()); - $date->_setTime($date->mktime(0, 0, 0, 1, 2, 2006)); - $this->assertTrue($date->isYesterday()); - } - - /** - * Test for Now. - */ - public function testNow() - { - $locale = new Zend_Locale('de_AT'); - - $date = Zend_Date::now(); - - $reference = date('U'); - $this->assertTrue(($reference - $date->get(Zend_Date::TIMESTAMP)) < 2); - } - - /** - * Test for getYear. - */ - public function testGetYear() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_610_101_010,$locale); - $date->setTimeZone(date_default_timezone_get()); - $d2->setTimeZone(date_default_timezone_get()); - - $result = $date->getYear(); - $this->assertTrue($result instanceof Zend_Date); - $this->assertSame('01.01.2009 05:00:00', $result->toString()); - $this->assertSame('01.01.2021 05:00:00', $d2->getYear()->toString()); - } - - /** - * Test for setYear. - */ - public function testSetYear() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_577_833_200,$locale); - $date2 = new Zend_Date(2006, Zend_Date::YEAR); - $date->setTimeZone(date_default_timezone_get()); - - $date->setYear(2000); - $this->assertSame('2000-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(1800); - $this->assertSame('1800-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(2100); - $this->assertSame('2100-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear($date2); - $this->assertSame('2006-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - try { - $date->setYear('noyear'); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - } - - /** - * Test for addYear. - */ - public function testAddYear() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_577_833_200,$locale); - $date->setTimeZone(date_default_timezone_get()); - - $date->addYear(1); - $this->assertSame('2021-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2022-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2023-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2024-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2025-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(1500); - $this->assertSame('1500-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(20); - $this->assertSame('1520-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(2100); - $this->assertSame('2100-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(20); - $this->assertSame('2120-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setDay(4); - $date->setMonth(4); - $date->setYear(2020); - $this->assertSame('2020-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2021-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2022-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2023-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2024-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(1); - $this->assertSame('2025-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(1500); - $this->assertSame('1500-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(20); - $this->assertSame('1520-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(2100); - $this->assertSame('2100-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->addYear(20); - $this->assertSame('2120-04-04T04:00:00+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for subYear. - */ - public function testSubYear() - { - if (!defined('TESTS_ZEND_I18N_EXTENDED_COVERAGE') || TESTS_ZEND_I18N_EXTENDED_COVERAGE == false) { - $this->markTestSkipped('Extended I18N test skipped'); - - return; - } - - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_577_833_200,$locale); - $date->setTimeZone(date_default_timezone_get()); - - $date->subYear(1); - $this->assertSame('2019-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->subYear(1); - $this->assertSame('2018-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->subYear(1); - $this->assertSame('2017-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->subYear(1); - $this->assertSame('2016-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->subYear(1); - $this->assertSame('2015-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(1500); - $this->assertSame('1500-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->subYear(20); - $this->assertSame('1480-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(2100); - $this->assertSame('2100-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->subYear(20); - $this->assertSame('2080-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for compareYear. - */ - public function testCompareYear() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - - $date = new Zend_Date(1_234_567_890,$locale); - $this->assertSame(-1, $date->compareYear(2010)); - $this->assertSame(0, $date->compareYear(2009)); - $this->assertSame(1, $date->compareYear(2008)); - $this->assertSame(0, $date->compareYear($d2)); - } - - /** - * Test for getMonth. - */ - public function testGetMonth() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_610_101_010,$locale); - $date->setTimeZone(date_default_timezone_get()); - $d2->setTimeZone(date_default_timezone_get()); - - $result = $date->getMonth(); - $this->assertTrue($result instanceof Zend_Date); - $this->assertSame('01.02.1970 05:00:00', $result->toString()); - $this->assertSame('01.02.1970 05:00:00', $date->getMonth()->toString()); - } - - /** - * Test for setMonth. - */ - public function testSetMonth() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_577_833_200,$locale); - $date2 = new Zend_Date(2006, Zend_Date::YEAR); - $date->setTimeZone(date_default_timezone_get()); - - $date->setMonth(3); - $this->assertSame('2020-03-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setMonth(-3); - $this->assertSame('2019-09-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setMonth('March', 'en'); - $this->assertSame('2019-03-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setMonth($date2); - $this->assertSame('2019-01-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - try { - $date->setMonth('nomonth'); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - } - - /** - * Test for addMonth. - */ - public function testAddMonth() - { - date_default_timezone_set('Europe/Vienna'); - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_577_833_200,$locale); - $date->setTimeZone(date_default_timezone_get()); - - $date->addMonth(1); - $this->assertSame('2020-02-01T00:00:00+01:00', $date->get(Zend_Date::W3C)); - $date->addMonth(1); - $this->assertSame('2020-03-01T00:00:00+01:00', $date->get(Zend_Date::W3C)); - $date->addMonth(1); - $this->assertSame('2020-04-01T00:00:00+02:00', $date->get(Zend_Date::W3C)); - $date->addMonth(1); - $this->assertSame('2020-05-01T00:00:00+02:00', $date->get(Zend_Date::W3C)); - $date->addMonth(1); - $this->assertSame('2020-06-01T00:00:00+02:00', $date->get(Zend_Date::W3C)); - $date->addMonth(5); - $this->assertSame('2020-11-01T00:00:00+01:00', $date->get(Zend_Date::W3C)); - - Zend_Date::setOptions(['fix_dst' => true]); - $date = new Zend_Date('2007-10-01 00:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-10-01 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-11-01 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - $date = new Zend_Date('2007-10-01 23:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-10-01 23:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-11-01 23:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - $date = new Zend_Date('2007-03-01 00:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-03-01 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-04-01 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - $date = new Zend_Date('2007-03-01 23:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-03-01 23:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-04-01 23:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - Zend_Date::setOptions(['fix_dst' => false]); - $date = new Zend_Date('2007-10-01 00:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-10-01 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-10-31 23:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - $date = new Zend_Date('2007-10-01 23:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-10-01 23:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-11-01 22:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - $date = new Zend_Date('2007-03-01 00:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-03-01 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-04-01 01:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - $date = new Zend_Date('2007-03-01 23:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-03-01 23:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-04-02 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - $date = new Zend_Date('2007-01-31 00:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-01-31 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - $date->addMonth(1); - $this->assertSame('2007-02-28 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - $date = new Zend_Date('2007-01-31 00:00:00', Zend_Date::ISO_8601); - $this->assertSame('2007-01-31 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - Zend_Date::setOptions(['extend_month' => true]); - $date->addMonth(1); - $this->assertSame('2007-03-03 00:00:00', $date->toString('yyyy-MM-dd HH:mm:ss')); - - date_default_timezone_set('America/Chicago'); - $date = new Zend_Date(1_577_858_400,$locale); - $date->setTimeZone(date_default_timezone_get()); - $this->assertSame('2020-01-01T00:00:00-06:00', $date->get(Zend_Date::ISO_8601)); - $date->addMonth(12); - $this->assertSame('2021-01-01T00:00:00-06:00', $date->get(Zend_Date::ISO_8601)); - } - - /** - * Test for subMonth. - */ - public function testSubMonth() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_577_833_200,$locale); - $date->setTimeZone(date_default_timezone_get()); - - $date->subMonth(1); - $this->assertSame('2019-12-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->subMonth(12); - $this->assertSame('2018-12-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * Test for compareMonth. - */ - public function testCompareMonth() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_234_567_890,$locale); - $d2 = new Zend_Date(1_234_567_899,$locale); - - $date = new Zend_Date(1_234_567_890,$locale); - $this->assertSame(1, $date->compareMonth(1)); - $this->assertSame(0, $date->compareMonth(2)); - $this->assertSame(-1, $date->compareMonth(3)); - $this->assertSame(0, $date->compareYear($d2)); - } - - /** - * Test accessors for _Locale member property of Zend_Date. - */ - public function testLocale() - { - $date = new Zend_Date(Zend_Date::now()); - $locale = new Zend_Locale('en_US'); - $date->setLocale($locale); - $this->assertSame('en_US', $date->getLocale()); - } - - /** - * test for getWeek. - */ - public function testGetWeek() - { - $locale = new Zend_Locale('de_AT'); - $date = new Zend_Date(1_168_293_600, $locale); - - //Tuesday - $date->addDay(1); - $this->assertSame('08.01.1970 05:00:00', $date->getWeek()->toString()); - - //Wednesday - $date->addDay(1); - $this->assertSame('08.01.1970 05:00:00', $date->getWeek()->toString()); - - //Thursday - $date->addDay(1); - $this->assertSame('08.01.1970 05:00:00', $date->getWeek()->toString()); - - //Friday - $date->addDay(1); - $this->assertSame('08.01.1970 05:00:00', $date->getWeek()->toString()); - - //Friday 05:30 am - $date->addTime('05:30:00'); - $this->assertSame('08.01.1970 05:00:00', $date->getWeek()->toString()); - - //Saturday - $date->addDay(1); - $this->assertSame('08.01.1970 05:00:00', $date->getWeek()->toString()); - - //Saturday [ar_EG] - // The right value for AM/PM has to be set in arabic letters - $this->assertSame('08‏/01‏/1970 5:00:00 ص', $date->getWeek('ar_EG')->toString()); - $date->setTimeZone('UTC'); - $this->assertSame('08‏/01‏/1970 12:00:00 ص', $date->getWeek('ar_EG')->toString()); - $date->setTimeZone('Indian/Maldives'); - $this->assertSame('08‏/01‏/1970 5:00:00 ص', $date->getWeek('ar_EG')->toString()); - - //Sunday [start of a new week as defined per ISO 8601] - $date->addDay(1); - $this->assertSame('15.01.1970 05:00:00', $date->getWeek()->toString()); - - //Monday - $date->addDay(1); - $this->assertSame('15.01.1970 05:00:00', $date->getWeek()->toString()); - - //Monday 03:45 pm - $date->addTime('15:45:00'); - $this->assertSame('15.01.1970 05:00:00', $date->getWeek()->toString()); - } - - /** - * test setting dates to specify weekdays. - */ - public function testDay() - { - // all tests and calculations below are in GMT (that is intention for this test) - $date = new Zend_Date(0, 'de_AT'); - $date->setTimeZone('UTC'); - $dw = $date->getDay(); - $this->assertSame('01.01.1970 00:00:00', $dw->toString()); - for ($day = 1; $day < 31; ++$day) { - $date->setDay($day); - $dw = $date->getDay(); - $weekday = str_pad($day, 2, '0', STR_PAD_LEFT); - $this->assertSame("$weekday.01.1970 00:00:00", $dw->toString()); - } - } - - /** - * @group ZF-8332 - */ - public function testSetDayOnThirtyFirstGivesThirtyOne() - { - $locale = new Zend_Locale('en_US'); - $date = new Zend_Date(); - $date->setYear(2009, $locale) - ->setMonth(5, $locale) - ->setDay(31, $locale); - $this->assertSame('5/31/09', $date->get(Zend_Date::DATE_SHORT, $locale)); - } - - /** - * test setWeekday. - */ - public function testSetWeekday() - { - $date = new Zend_Date('2006-01-01','YYYY-MM-dd', 'en'); - $date->setWeekday(1); - $this->assertSame('2005-12-26T00:00:00+05:00', $date->getIso()); - - $date->set('2006-01-02', 'YYYY-MM-dd'); - $date->setWeekday(1); - $this->assertSame('2006-01-02T00:00:00+05:00', $date->getIso()); - } - - /** - * test setLocale/getLocale. - */ - public function testSetLocale() - { - $date = new Zend_Date(0, 'de'); - - $this->assertSame('de', $date->getLocale()); - $date->setLocale('en'); - $this->assertSame('en', $date->getLocale()); - $date->setLocale('en_XX'); - $this->assertSame('en', $date->getLocale()); - $date->setLocale('de_AT'); - $this->assertSame('de_AT', $date->getLocale()); - $locale = new Zend_Locale('ar'); - $date->setLocale($locale); - $this->assertSame('ar', $date->getLocale()); - - try { - $date->setLocale('xx_XX'); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - } - - /** - * test looseBehaviour. - */ - public function testLoose() - { - $date = new Zend_Date(0, 'de_DE'); - - try { - $date->set(null, Zend_Date::YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->set(10, 'de_DE'); - $this->assertEquals(10, $date->getTimestamp()); - - try { - $date->add(null, Zend_Date::YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->add(10, 'de_DE'); - $this->assertEquals(20, $date->getTimestamp()); - - try { - $date->sub(null, Zend_Date::YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $date->sub(10, 'de_DE'); - $this->assertEquals(10, $date->getTimestamp()); - - try { - $date->compare(null, Zend_Date::YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->equals(null, Zend_Date::YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->isEarlier(null, Zend_Date::YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->isLater(null, Zend_Date::YEAR); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setTime(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addTime(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subTime(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareTime(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setDate(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addDate(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subDate(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareDate(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setIso(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addIso(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subIso(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareIso(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setArpa(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addArpa(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subArpa(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareArpa(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setYear(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addYear(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subYear(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareYear(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setMonth(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addMonth(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subMonth(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareMonth(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setDay(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addDay(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subDay(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareDay(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setWeekday(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addWeekday(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subWeekday(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareWeekday(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setDayOfYear(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addDayOfYear(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subDayOfYear(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareDayOfYear(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setHour(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addHour(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subHour(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareHour(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setMinute(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addMinute(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subMinute(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareMinute(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setSecond(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addSecond(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subSecond(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareSecond(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->setWeek(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->addWeek(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->subWeek(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - $date->compareWeek(null); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - } - - public function testUsePhpDateFormat() - { - Zend_Date::setOptions(['format_type' => 'iso']); - - // PHP date() format specifier tests - $date1 = new Zend_Date('2006-01-02 23:58:59', Zend_Date::ISO_8601, 'en_US'); - $date2 = new Zend_Date('2006-01-02 23:58:59', 'YYYY-MM-dd HH:mm:ss', 'en_US'); - $this->assertSame($date1->getTimestamp(), $date2->getTimestamp()); - - date_default_timezone_set('GMT'); - $date = new Zend_Date(0); // 1970-01-01 is a Thursday (should be 4 for 'w' format specifier) - $this->assertSame(gmdate('w',$date->getTimestamp()), $date->toString('eee')); - $this->assertSame(gmdate('d',$date->getTimestamp()), $date->toString('dd')); - $this->assertSame(gmdate('D',$date->getTimestamp()), $date->toString('EEE', 'en')); - $this->assertSame(gmdate('j',$date->getTimestamp()), $date->toString('d')); - $this->assertSame(gmdate('l',$date->getTimestamp()), $date->toString('EEEE', 'en')); - $this->assertSame(gmdate('N',$date->getTimestamp()), $date->toString('e')); - $this->assertSame(gmdate('S',$date->getTimestamp()), $date->toString('SS')); - $this->assertSame(gmdate('z',$date->getTimestamp()), $date->toString('D')); - $this->assertSame(gmdate('W',$date->getTimestamp()), $date->toString('ww')); - $this->assertSame(gmdate('F',$date->getTimestamp()), $date->toString('MMMM', 'en')); - $this->assertSame(gmdate('m',$date->getTimestamp()), $date->toString('MM')); - $this->assertSame(gmdate('M',$date->getTimestamp()), $date->toString('MMM', 'en')); - $this->assertSame(gmdate('n',$date->getTimestamp()), $date->toString('M')); - $this->assertSame(gmdate('t',$date->getTimestamp()), $date->toString('ddd')); - $this->assertSame(gmdate('L',$date->getTimestamp()), $date->toString('l')); - $this->assertSame(gmdate('o',$date->getTimestamp()), $date->toString('YYYY')); - $this->assertSame(gmdate('Y',$date->getTimestamp()), $date->toString('yyyy')); - $this->assertSame(gmdate('y',$date->getTimestamp()), $date->toString('yy')); - $this->assertSame(gmdate('a',$date->getTimestamp()), strtolower($date->toString('a', 'en'))); - $this->assertSame(gmdate('A',$date->getTimestamp()), strtoupper($date->toString('a', 'en'))); - $this->assertSame(gmdate('B',$date->getTimestamp()), $date->toString('B')); - $this->assertSame(gmdate('g',$date->getTimestamp()), $date->toString('h')); - $this->assertSame(gmdate('G',$date->getTimestamp()), $date->toString('H')); - $this->assertSame(gmdate('h',$date->getTimestamp()), $date->toString('hh')); - $this->assertSame(gmdate('H',$date->getTimestamp()), $date->toString('HH')); - $this->assertSame(gmdate('i',$date->getTimestamp()), $date->toString('mm')); - $this->assertSame(gmdate('s',$date->getTimestamp()), $date->toString('ss')); - $this->assertSame(date('e',$date->getTimestamp()), $date->toString('zzzz')); - $this->assertSame(gmdate('I',$date->getTimestamp()), $date->toString('I')); - $this->assertSame(gmdate('O',$date->getTimestamp()), $date->toString('Z')); - $this->assertSame(gmdate('P',$date->getTimestamp()), $date->toString('ZZZZ')); - $this->assertSame(gmdate('T',$date->getTimestamp()), $date->toString('z')); - $this->assertSame(gmdate('Z',$date->getTimestamp()), $date->toString('X')); - $this->assertSame(gmdate('c',$date->getTimestamp()), $date->toString('yyyy-MM-ddTHH:mm:ssZZZZ')); - $this->assertSame(gmdate('r',$date->getTimestamp()), $date->toString('r')); - $this->assertSame(gmdate('U',$date->getTimestamp()), $date->toString('U')); - - // PHP date() format specifier tests - $date1 = new Zend_Date('2006-01-02 23:58:59', Zend_Date::ISO_8601, 'en_US'); - Zend_Date::setOptions(['format_type' => 'php']); - $date2 = new Zend_Date('2006-01-02 23:58:59', 'Y-m-d H:i:s', 'en_US'); - $this->assertSame($date1->getTimestamp(), $date2->getTimestamp()); - - date_default_timezone_set('GMT'); - $date = new Zend_Date(0); // 1970-01-01 is a Thursday (should be 4 for 'w' format specifier) - $this->assertSame(gmdate('w',$date->getTimestamp()), $date->toString('w')); - $this->assertSame(gmdate('d',$date->getTimestamp()), $date->toString('d')); - $this->assertSame(gmdate('D',$date->getTimestamp()), $date->toString('D', 'en')); - $this->assertSame(gmdate('j',$date->getTimestamp()), $date->toString('j')); - $this->assertSame(gmdate('l',$date->getTimestamp()), $date->toString('l', 'en')); - $this->assertSame(gmdate('N',$date->getTimestamp()), $date->toString('N')); - $this->assertSame(gmdate('S',$date->getTimestamp()), $date->toString('S')); - $this->assertSame(gmdate('z',$date->getTimestamp()), $date->toString('z')); - $this->assertSame(gmdate('W',$date->getTimestamp()), $date->toString('W')); - $this->assertSame(gmdate('F',$date->getTimestamp()), $date->toString('F', 'en')); - $this->assertSame(gmdate('m',$date->getTimestamp()), $date->toString('m')); - $this->assertSame(gmdate('M',$date->getTimestamp()), $date->toString('M', 'en')); - $this->assertSame(gmdate('n',$date->getTimestamp()), $date->toString('n')); - $this->assertSame(gmdate('t',$date->getTimestamp()), $date->toString('t')); - $this->assertSame(gmdate('L',$date->getTimestamp()), $date->toString('L')); - $this->assertSame(gmdate('o',$date->getTimestamp()), $date->toString('o')); - $this->assertSame(gmdate('Y',$date->getTimestamp()), $date->toString('Y')); - $this->assertSame(gmdate('y',$date->getTimestamp()), $date->toString('y')); - $this->assertSame(gmdate('a',$date->getTimestamp()), strtolower($date->toString('a', 'en'))); - $this->assertSame(gmdate('A',$date->getTimestamp()), strtoupper($date->toString('A', 'en'))); - $this->assertSame(gmdate('B',$date->getTimestamp()), $date->toString('B')); - $this->assertSame(gmdate('g',$date->getTimestamp()), $date->toString('g')); - $this->assertSame(gmdate('G',$date->getTimestamp()), $date->toString('G')); - $this->assertSame(gmdate('h',$date->getTimestamp()), $date->toString('h')); - $this->assertSame(gmdate('H',$date->getTimestamp()), $date->toString('H')); - $this->assertSame(gmdate('i',$date->getTimestamp()), $date->toString('i')); - $this->assertSame(gmdate('s',$date->getTimestamp()), $date->toString('s')); - $this->assertSame(date('e',$date->getTimestamp()), $date->toString('e')); - $this->assertSame(gmdate('I',$date->getTimestamp()), $date->toString('I')); - $this->assertSame(gmdate('O',$date->getTimestamp()), $date->toString('O')); - $this->assertSame(gmdate('P',$date->getTimestamp()), $date->toString('P')); - $this->assertSame(gmdate('T',$date->getTimestamp()), $date->toString('T')); - $this->assertSame(gmdate('Z',$date->getTimestamp()), $date->toString('Z')); - $this->assertSame(gmdate('c',$date->getTimestamp()), $date->toString('c')); - $this->assertSame(gmdate('r',$date->getTimestamp()), $date->toString('r')); - $this->assertSame(gmdate('U',$date->getTimestamp()), $date->toString('U')); - - date_default_timezone_set('GMT'); - $date = new Zend_Date(mktime(20,10,0,10,10,2000)); // 1970-01-01 is a Thursday (should be 4 for 'w' format specifier) - $this->assertSame(gmdate('w',$date->getTimestamp()), $date->toString('w')); - $this->assertSame(gmdate('d',$date->getTimestamp()), $date->toString('d')); - $this->assertSame(gmdate('D',$date->getTimestamp()), $date->toString('D', 'en')); - $this->assertSame(gmdate('j',$date->getTimestamp()), $date->toString('j')); - $this->assertSame(gmdate('l',$date->getTimestamp()), $date->toString('l', 'en')); - $this->assertSame(gmdate('N',$date->getTimestamp()), $date->toString('N')); - $this->assertSame(gmdate('S',$date->getTimestamp()), $date->toString('S')); - $this->assertSame(gmdate('z',$date->getTimestamp()), $date->toString('z')); - $this->assertSame(gmdate('W',$date->getTimestamp()), $date->toString('W')); - $this->assertSame(gmdate('F',$date->getTimestamp()), $date->toString('F', 'en')); - $this->assertSame(gmdate('m',$date->getTimestamp()), $date->toString('m')); - $this->assertSame(gmdate('M',$date->getTimestamp()), $date->toString('M', 'en')); - $this->assertSame(gmdate('n',$date->getTimestamp()), $date->toString('n')); - $this->assertSame(gmdate('t',$date->getTimestamp()), $date->toString('t')); - $this->assertSame(gmdate('L',$date->getTimestamp()), $date->toString('L')); - $this->assertSame(gmdate('o',$date->getTimestamp()), $date->toString('o')); - $this->assertSame(gmdate('Y',$date->getTimestamp()), $date->toString('Y')); - $this->assertSame(gmdate('y',$date->getTimestamp()), $date->toString('y')); - $this->assertSame(gmdate('a',$date->getTimestamp()), strtolower($date->toString('a', 'en'))); - $this->assertSame(gmdate('A',$date->getTimestamp()), strtoupper($date->toString('A', 'en'))); - $this->assertSame(gmdate('B',$date->getTimestamp()), $date->toString('B')); - $this->assertSame(gmdate('g',$date->getTimestamp()), $date->toString('g')); - $this->assertSame(gmdate('G',$date->getTimestamp()), $date->toString('G')); - $this->assertSame(gmdate('h',$date->getTimestamp()), $date->toString('h')); - $this->assertSame(gmdate('H',$date->getTimestamp()), $date->toString('H')); - $this->assertSame(gmdate('i',$date->getTimestamp()), $date->toString('i')); - $this->assertSame(gmdate('s',$date->getTimestamp()), $date->toString('s')); - $this->assertSame(date('e',$date->getTimestamp()), $date->toString('e')); - $this->assertSame(gmdate('I',$date->getTimestamp()), $date->toString('I')); - $this->assertSame(gmdate('O',$date->getTimestamp()), $date->toString('O')); - $this->assertSame(gmdate('P',$date->getTimestamp()), $date->toString('P')); - $this->assertSame(gmdate('T',$date->getTimestamp()), $date->toString('T')); - $this->assertSame(gmdate('Z',$date->getTimestamp()), $date->toString('Z')); - $this->assertSame(gmdate('c',$date->getTimestamp()), $date->toString('c')); - $this->assertSame(gmdate('r',$date->getTimestamp()), $date->toString('r')); - $this->assertSame(gmdate('U',$date->getTimestamp()), $date->toString('U')); - - date_default_timezone_set('Indian/Maldives'); - $date = new Zend_Date(0); // 1970-01-01 is a Thursday (should be 4 for 'w' format specifier) - $this->assertSame(date('w',$date->getTimestamp()), $date->toString('w')); - $this->assertSame(date('d',$date->getTimestamp()), $date->toString('d')); - $this->assertSame(date('D',$date->getTimestamp()), $date->toString('D', 'en')); - $this->assertSame(date('j',$date->getTimestamp()), $date->toString('j')); - $this->assertSame(date('l',$date->getTimestamp()), $date->toString('l', 'en')); - $this->assertSame(date('N',$date->getTimestamp()), $date->toString('N')); - $this->assertSame(date('S',$date->getTimestamp()), $date->toString('S')); - $this->assertSame(date('z',$date->getTimestamp()), $date->toString('z')); - $this->assertSame(date('W',$date->getTimestamp()), $date->toString('W')); - $this->assertSame(date('F',$date->getTimestamp()), $date->toString('F', 'en')); - $this->assertSame(date('m',$date->getTimestamp()), $date->toString('m')); - $this->assertSame(date('M',$date->getTimestamp()), $date->toString('M', 'en')); - $this->assertSame(date('n',$date->getTimestamp()), $date->toString('n')); - $this->assertSame(date('t',$date->getTimestamp()), $date->toString('t')); - $this->assertSame(date('L',$date->getTimestamp()), $date->toString('L')); - $this->assertSame(date('o',$date->getTimestamp()), $date->toString('o')); - $this->assertSame(date('Y',$date->getTimestamp()), $date->toString('Y')); - $this->assertSame(date('y',$date->getTimestamp()), $date->toString('y')); - $this->assertSame(date('a',$date->getTimestamp()), strtolower($date->toString('a', 'en'))); - $this->assertSame(date('A',$date->getTimestamp()), strtoupper($date->toString('A', 'en'))); - $this->assertSame(date('B',$date->getTimestamp()), $date->toString('B')); - $this->assertSame(date('g',$date->getTimestamp()), $date->toString('g')); - $this->assertSame(date('G',$date->getTimestamp()), $date->toString('G')); - $this->assertSame(date('h',$date->getTimestamp()), $date->toString('h')); - $this->assertSame(date('H',$date->getTimestamp()), $date->toString('H')); - $this->assertSame(date('i',$date->getTimestamp()), $date->toString('i')); - $this->assertSame(date('s',$date->getTimestamp()), $date->toString('s')); - $this->assertSame(date('e',$date->getTimestamp()), $date->toString('e')); - $this->assertSame(date('I',$date->getTimestamp()), $date->toString('I')); - $this->assertSame(date('O',$date->getTimestamp()), $date->toString('O')); - $this->assertSame(date('P',$date->getTimestamp()), $date->toString('P')); - $this->assertSame(date('T',$date->getTimestamp()), $date->toString('T')); - $this->assertSame(date('Z',$date->getTimestamp()), $date->toString('Z')); - $this->assertSame(date('c',$date->getTimestamp()), $date->toString('c')); - $this->assertSame(date('r',$date->getTimestamp()), $date->toString('r')); - $this->assertSame(date('U',$date->getTimestamp()), $date->toString('U')); - - date_default_timezone_set('Indian/Maldives'); - $date = new Zend_Date(mktime(20,10,0,10,10,2000)); // 1970-01-01 is a Thursday (should be 4 for 'w' format specifier) - $this->assertSame(date('w',$date->getTimestamp()), $date->toString('w')); - $this->assertSame(date('d',$date->getTimestamp()), $date->toString('d')); - $this->assertSame(date('D',$date->getTimestamp()), $date->toString('D', 'en')); - $this->assertSame(date('j',$date->getTimestamp()), $date->toString('j')); - $this->assertSame(date('l',$date->getTimestamp()), $date->toString('l', 'en')); - $this->assertSame(date('N',$date->getTimestamp()), $date->toString('N')); - $this->assertSame(date('S',$date->getTimestamp()), $date->toString('S')); - $this->assertSame(date('z',$date->getTimestamp()), $date->toString('z')); - $this->assertSame(date('W',$date->getTimestamp()), $date->toString('W')); - $this->assertSame(date('F',$date->getTimestamp()), $date->toString('F', 'en')); - $this->assertSame(date('m',$date->getTimestamp()), $date->toString('m')); - $this->assertSame(date('M',$date->getTimestamp()), $date->toString('M', 'en')); - $this->assertSame(date('n',$date->getTimestamp()), $date->toString('n')); - $this->assertSame(date('t',$date->getTimestamp()), $date->toString('t')); - $this->assertSame(date('L',$date->getTimestamp()), $date->toString('L')); - $this->assertSame(date('o',$date->getTimestamp()), $date->toString('o')); - $this->assertSame(date('Y',$date->getTimestamp()), $date->toString('Y')); - $this->assertSame(date('y',$date->getTimestamp()), $date->toString('y')); - $this->assertSame(date('a',$date->getTimestamp()), strtolower($date->toString('a', 'en'))); - $this->assertSame(date('A',$date->getTimestamp()), strtoupper($date->toString('A', 'en'))); - $this->assertSame(date('B',$date->getTimestamp()), $date->toString('B')); - $this->assertSame(date('g',$date->getTimestamp()), $date->toString('g')); - $this->assertSame(date('G',$date->getTimestamp()), $date->toString('G')); - $this->assertSame(date('h',$date->getTimestamp()), $date->toString('h')); - $this->assertSame(date('H',$date->getTimestamp()), $date->toString('H')); - $this->assertSame(date('i',$date->getTimestamp()), $date->toString('i')); - $this->assertSame(date('s',$date->getTimestamp()), $date->toString('s')); - $this->assertSame(date('e',$date->getTimestamp()), $date->toString('e')); - $this->assertSame(date('I',$date->getTimestamp()), $date->toString('I')); - $this->assertSame(date('O',$date->getTimestamp()), $date->toString('O')); - $this->assertSame(date('P',$date->getTimestamp()), $date->toString('P')); - $this->assertSame(date('T',$date->getTimestamp()), $date->toString('T')); - $this->assertSame(date('Z',$date->getTimestamp()), $date->toString('Z')); - $this->assertSame(date('c',$date->getTimestamp()), $date->toString('c')); - $this->assertSame(date('r',$date->getTimestamp()), $date->toString('r')); - $this->assertSame(date('U',$date->getTimestamp()), $date->toString('U')); - Zend_Date::setOptions(['format_type' => 'iso']); - } - - public function testDaylightsaving() - { - $date = new Zend_Date('2007.03.25', Zend_Date::DATES); - $date->set('16:00:00', Zend_Date::TIMES); - $this->assertEquals('2007-03-25T16:00:00+05:00', $date->get(Zend_Date::W3C)); - $date->set('01:00:00', Zend_Date::TIMES); - $this->assertEquals('2007-03-25T01:00:00+05:00', $date->get(Zend_Date::W3C)); - } - - public function testSetOptions() - { - $options = Zend_Date::setOptions(); - $this->assertTrue(is_array($options)); - $this->assertEquals('iso', $options['format_type']); - - Zend_Date::setOptions(['format_type' => 'php']); - $options = Zend_Date::setOptions(); - $this->assertEquals('php', $options['format_type']); - - try { - Zend_Date::setOptions(['format_type' => 'non']); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - Zend_Date::setOptions(['unknown' => 'non']); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - Zend_Date::setOptions(['fix_dst' => 2]); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - try { - Zend_Date::setOptions(['fix_dst' => 2]); - $this->fail(); - } catch (Zend_Date_Exception $e) { - // success - } - - $cache = Zend_Cache::factory('Core', 'File', - ['lifetime' => 120, 'automatic_serialization' => true], - ['cache_dir' => __DIR__ . '/_files/']); - Zend_Date::setOptions(['cache' => $cache]); - } - - public function testIsDate() - { - $this->assertTrue(Zend_Date::isDate('25.03.2007', 'de_AT')); - $this->assertTrue(Zend_Date::isDate('2007.03.25', 'YYYY.MM.dd')); - $this->assertTrue(Zend_Date::isDate('25.Mai.2007', 'dd.MMMM.YYYY', 'de_AT')); - $this->assertTrue(Zend_Date::isDate('25.Mai.2007 10:00:00', 'dd.MMMM.YYYY', 'de_AT')); - $this->assertFalse(Zend_Date::isDate('32.Mai.2007 10:00:00', 'dd.MMMM.YYYY', 'de_AT')); - $this->assertFalse(Zend_Date::isDate('30.Februar.2007 10:00:00', 'dd.MMMM.YYYY', 'de_AT')); - $this->assertFalse(Zend_Date::isDate('30.Februar.2007 30:00:00', 'dd.MMMM.YYYY HH:mm:ss', 'de_AT')); - $this->assertFalse(Zend_Date::isDate(3.01)); - } - - public function testToArray() - { - $date = new Zend_Date('2006-01-02 23:58:59', Zend_Date::ISO_8601, 'en_US'); - $return = $date->toArray(); - $orig = ['day' => '2', 'month' => '1', 'year' => '2006', 'hour' => '23', 'minute' => '58', - 'second' => '59', 'timezone' => '+05', 'timestamp' => '1136228339', 'weekday' => '1', - 'dayofyear' => '1', 'week' => '01', 'gmtsecs' => '18000', ]; - $this->assertEquals($orig, $return); - } - - public function testFromArray() - { - $date = new Zend_Date(['day' => '4', 'month' => '12', 'year' => '2006', 'hour' => '10', - 'minute' => '56', 'second' => '30', ], 'en_US'); - $this->assertSame('2006-12-04T10:56:30+05:00', $date->getIso()); - } - - public function testTimezoneArray() - { - date_default_timezone_set('UTC'); - - $date = new Zend_Date(['year' => '2007', 'month' => '1', 'day' => '1', - 'hour' => '20', 'minute' => '45', 'second' => '37', 'en_US', ]); - $this->assertSame('2007-01-01T20:45:37+00:00', $date->getIso()); - - date_default_timezone_set('CET'); - $date = new Zend_Date(['year' => '2007', 'month' => '1', 'day' => '1', - 'hour' => '1', 'minute' => '45', 'second' => '37', 'en_US', ]); - $this->assertSame('2007-01-01T01:45:37+01:00', $date->getIso()); - - $date = new Zend_Date(['year' => '2006', 'month' => '4', 'day' => '18', - 'hour' => '12', 'minute' => '3', 'second' => '10', 'de_AT', ]); - $this->assertSame('2006-04-18T12:03:10+02:00', $date->getIso()); - - $date = new Zend_Date(['year' => '2009', 'month' => '1', 'day' => '28', - 'hour' => '23', 'minute' => '30', 'second' => '0', 'de', ]); - $this->assertSame('2009-01-28T23:30:00+01:00', $date->getIso()); - - $date = new Zend_Date(['year' => '2009', 'month' => '8', 'day' => '28', - 'hour' => '22', 'minute' => '0', 'second' => '0', 'de', ]); - $this->assertSame('2009-08-28T22:00:00+02:00', $date->getIso()); - } - - public function testExtendedDst() - { - Zend_Date::setOptions(['format_type' => 'iso']); - $date = new Zend_Date(); - $date->setTimezone('UTC'); - $date->set('25-05-2050 12:00:00'); - $this->assertSame('2050-05-25 12:00:00', $date->get('YYYY-MM-dd HH:mm:ss')); - $date->setTimezone('Europe/Warsaw'); - $this->assertSame('2050-05-25 14:00:00', $date->get('YYYY-MM-dd HH:mm:ss')); - - $date->setTimezone('UTC'); - $date->set('25-05-2020 12:00:00'); - $this->assertSame('2020-05-25 12:00:00', $date->get('YYYY-MM-dd HH:mm:ss')); - $date->setTimezone('Europe/Warsaw'); - $this->assertSame('2020-05-25 14:00:00', $date->get('YYYY-MM-dd HH:mm:ss')); - } - - public function testGetFullYear() - { - $this->assertSame(1970, Zend_Date::getFullYear(70)); - $this->assertSame(1999, Zend_Date::getFullYear(99)); - $this->assertSame(2000, Zend_Date::getFullYear(0)); - $this->assertSame(2037, Zend_Date::getFullYear(37)); - $this->assertSame(2069, Zend_Date::getFullYear(69)); - $this->assertSame(-4, Zend_Date::getFullYear(-4)); - $this->assertSame(100, Zend_Date::getFullYear(100)); - } - - /** - * Test for ZF-3677. - */ - public function testZF3677() - { - $locale = new Zend_Locale('de_AT'); - Zend_Registry::set(\Zend_Locale::class, $locale); - - $date = new Zend_Date('13',null,$locale); - $this->assertSame($date->getLocale(), $locale->toString()); - } - - /** - * Test for ZF-4867. - */ - public function testZF4867() - { - date_default_timezone_set('America/New_York'); - $date1 = new Zend_Date('2006-01-01 01:00:00 Europe/Paris', Zend_Date::ISO_8601); - $this->assertEquals('Europe/Paris', $date1->getTimezone()); - } - - /** - * Test for ZF-5203. - */ - public function testMultiByteWeekdaysShouldNotBeTruncated() - { - $date1 = new Zend_Date('pl'); - $date1->setWeekday(3); - $this->assertEquals('ś', $date1->get(Zend_Date::WEEKDAY_NARROW)); - } - - /** - * Test for False Month Addition. - */ - public function testAddingMonthWhenChangingTimezone() - { - $date = new Zend_Date(mktime(22, 59, 59, 1, 10, 2009)); - $this->assertEquals(10, $date->toString('d')); - $this->assertEquals(1, $date->toString('M')); - $date->setTimezone('Europe/Berlin'); - $date->addMonth(1); - $this->assertEquals(10, $date->toString('d')); - $this->assertEquals(2, $date->toString('M')); - } - - /** - * Test for False Month Addition. - */ - public function testGmtOffsetValues() - { - date_default_timezone_set('Pacific/Auckland'); - $time = time(); - $date = new Zend_Date($time); - $stamp = $date->getGmtOffset(); - - $localtime = localtime($time, true); - $offset = mktime($localtime['tm_hour'], - $localtime['tm_min'], - $localtime['tm_sec'], - $localtime['tm_mon'] + 1, - $localtime['tm_mday'], - $localtime['tm_year'] + 1900) - - gmmktime($localtime['tm_hour'], - $localtime['tm_min'], - $localtime['tm_sec'], - $localtime['tm_mon'] + 1, - $localtime['tm_mday'], - $localtime['tm_year'] + 1900); - - $this->assertEquals($stamp, $offset); - - $date->addMonth(6); - $stamp = $date->getGmtOffset(); - - $localtime = localtime($time, true); - $offset = mktime($localtime['tm_hour'], - $localtime['tm_min'], - $localtime['tm_sec'], - $localtime['tm_mon'] + 7, - $localtime['tm_mday'], - $localtime['tm_year'] + 1900) - - gmmktime($localtime['tm_hour'], - $localtime['tm_min'], - $localtime['tm_sec'], - $localtime['tm_mon'] + 7, - $localtime['tm_mday'], - $localtime['tm_year'] + 1900); - - $this->assertEquals($stamp, $offset); - } - - public function testIsDateWithConstants() - { - $this->assertTrue(Zend_Date::isDate('2009-02-13T23:31:30+00:00', Zend_Date::W3C, 'de_AT')); - - $date = new Zend_Date(); - $string = $date->toString(Zend_Date::DATES); - $this->assertTrue(Zend_Date::isDate($string, Zend_Date::DATES)); - } - - /** - * @ZF-7154 - */ - public function testZF7154() - { - $locale = new Zend_Locale('de_AT'); - - $date = new Zend_Date(1_577_833_200,$locale); - $date2 = new Zend_Date(2006, Zend_Date::YEAR); - $date->setTimeZone(date_default_timezone_get()); - - $date->setYear(2000); - $date->setMonth('Apr.'); - $this->assertSame('2000-04-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - - $date->setYear(2004); - $date->setMonth('Februar'); - $this->assertSame('2004-02-01T04:00:00+05:00', $date->get(Zend_Date::W3C)); - } - - /** - * @ZF-7202 - */ - public function testZF7202() - { - $date = new Zend_Date(); - $timezone = $date->getTimezoneFromString('03:58:09 Jul 06, 2009 Indian/Reunion'); - $this->assertSame('Indian/Reunion', $timezone); - } - - /** - * @ZF-7589 - */ - public function testSetDateWithArray() - { - $date = new Zend_Date(1_234_567_890); - $result = $date->setDate(['year' => '2009', 'month' => '8', 'day' => '14']); - - $this->assertSame('2009-08-14T04:31:30+05:00', $result->get(Zend_Date::W3C)); - } - - /** - * @ZF-7454 - */ - public function testSetWithoutHourAtDSTChange() - { - $this->assertTrue(Zend_Date::isDate('23/05/2010', 'dd/MM/yyyy', 'it_IT')); - $this->assertTrue(Zend_Date::isDate('24/05/2010', 'dd/MM/yyyy', 'it_IT')); - } - - /** - * @ZF-7456 - */ - public function testSetArrayDateWithoutHour() - { - $date = new Zend_Date([ - 'year' => 2008, - 'month' => 3, - 'day' => 1, ] - ); - $this->assertEquals('2008-03-01T00:00:00+05:00', $date->getIso()); - } - - /** - * @ZF-7745 - */ - public function testSetFirstDayOfLeapYear() - { - $date = new Zend_Date(2008, Zend_Date::YEAR); - $date->setDayOfYear(1); - $this->assertEquals('2008-01-01T00:00:00+05:00', $date->getIso()); - - $date->setDayOfYear(61); - $this->assertEquals('2008-03-01T00:00:00+05:00', $date->getIso()); - - $date->setDayOfYear(62); - $this->assertEquals('2008-03-02T00:00:00+05:00', $date->getIso()); - } - - /** - * @ZF-7913 - */ - public function testUsePhpNFormat() - { - Zend_Date::setOptions(['format_type' => 'php']); - - date_default_timezone_set('GMT'); - $date = new Zend_Date(mktime(20,10,0,9,20,2009)); - $this->assertSame(gmdate('w',$date->getTimestamp()), $date->toString('w')); - $this->assertSame(gmdate('d',$date->getTimestamp()), $date->toString('d')); - $this->assertSame(gmdate('D',$date->getTimestamp()), $date->toString('D', 'en')); - $this->assertSame(gmdate('j',$date->getTimestamp()), $date->toString('j')); - $this->assertSame(gmdate('l',$date->getTimestamp()), $date->toString('l', 'en')); - $this->assertSame(gmdate('N',$date->getTimestamp()), $date->toString('N')); - $this->assertSame(gmdate('S',$date->getTimestamp()), $date->toString('S')); - $this->assertSame(gmdate('z',$date->getTimestamp()), $date->toString('z')); - $this->assertSame(gmdate('W',$date->getTimestamp()), $date->toString('W')); - $this->assertSame(gmdate('F',$date->getTimestamp()), $date->toString('F', 'en')); - $this->assertSame(gmdate('m',$date->getTimestamp()), $date->toString('m')); - $this->assertSame(gmdate('M',$date->getTimestamp()), $date->toString('M', 'en')); - $this->assertSame(gmdate('n',$date->getTimestamp()), $date->toString('n')); - $this->assertSame(gmdate('t',$date->getTimestamp()), $date->toString('t')); - $this->assertSame(gmdate('L',$date->getTimestamp()), $date->toString('L')); - $this->assertSame(gmdate('o',$date->getTimestamp()), $date->toString('o')); - $this->assertSame(gmdate('Y',$date->getTimestamp()), $date->toString('Y')); - $this->assertSame(gmdate('y',$date->getTimestamp()), $date->toString('y')); - $this->assertSame(gmdate('a',$date->getTimestamp()), strtolower($date->toString('a', 'en'))); - $this->assertSame(gmdate('A',$date->getTimestamp()), strtoupper($date->toString('A', 'en'))); - $this->assertSame(gmdate('B',$date->getTimestamp()), $date->toString('B')); - $this->assertSame(gmdate('g',$date->getTimestamp()), $date->toString('g')); - $this->assertSame(gmdate('G',$date->getTimestamp()), $date->toString('G')); - $this->assertSame(gmdate('h',$date->getTimestamp()), $date->toString('h')); - $this->assertSame(gmdate('H',$date->getTimestamp()), $date->toString('H')); - $this->assertSame(gmdate('i',$date->getTimestamp()), $date->toString('i')); - $this->assertSame(gmdate('s',$date->getTimestamp()), $date->toString('s')); - $this->assertSame(date('e',$date->getTimestamp()), $date->toString('e')); - $this->assertSame(gmdate('I',$date->getTimestamp()), $date->toString('I')); - $this->assertSame(gmdate('O',$date->getTimestamp()), $date->toString('O')); - $this->assertSame(gmdate('P',$date->getTimestamp()), $date->toString('P')); - $this->assertSame(gmdate('T',$date->getTimestamp()), $date->toString('T')); - $this->assertSame(gmdate('Z',$date->getTimestamp()), $date->toString('Z')); - $this->assertSame(gmdate('c',$date->getTimestamp()), $date->toString('c')); - $this->assertSame(gmdate('r',$date->getTimestamp()), $date->toString('r')); - $this->assertSame(gmdate('U',$date->getTimestamp()), $date->toString('U')); - - date_default_timezone_set('Indian/Maldives'); - $date = new Zend_Date(mktime(20,10,0,9,20,2009)); - $this->assertSame(date('w',$date->getTimestamp()), $date->toString('w')); - $this->assertSame(date('d',$date->getTimestamp()), $date->toString('d')); - $this->assertSame(date('D',$date->getTimestamp()), $date->toString('D', 'en')); - $this->assertSame(date('j',$date->getTimestamp()), $date->toString('j')); - $this->assertSame(date('l',$date->getTimestamp()), $date->toString('l', 'en')); - $this->assertSame(date('N',$date->getTimestamp()), $date->toString('N')); - $this->assertSame(date('S',$date->getTimestamp()), $date->toString('S')); - $this->assertSame(date('z',$date->getTimestamp()), $date->toString('z')); - $this->assertSame(date('W',$date->getTimestamp()), $date->toString('W')); - $this->assertSame(date('F',$date->getTimestamp()), $date->toString('F', 'en')); - $this->assertSame(date('m',$date->getTimestamp()), $date->toString('m')); - $this->assertSame(date('M',$date->getTimestamp()), $date->toString('M', 'en')); - $this->assertSame(date('n',$date->getTimestamp()), $date->toString('n')); - $this->assertSame(date('t',$date->getTimestamp()), $date->toString('t')); - $this->assertSame(date('L',$date->getTimestamp()), $date->toString('L')); - $this->assertSame(date('o',$date->getTimestamp()), $date->toString('o')); - $this->assertSame(date('Y',$date->getTimestamp()), $date->toString('Y')); - $this->assertSame(date('y',$date->getTimestamp()), $date->toString('y')); - $this->assertSame(date('a',$date->getTimestamp()), strtolower($date->toString('a', 'en'))); - $this->assertSame(date('A',$date->getTimestamp()), strtoupper($date->toString('A', 'en'))); - $this->assertSame(date('B',$date->getTimestamp()), $date->toString('B')); - $this->assertSame(date('g',$date->getTimestamp()), $date->toString('g')); - $this->assertSame(date('G',$date->getTimestamp()), $date->toString('G')); - $this->assertSame(date('h',$date->getTimestamp()), $date->toString('h')); - $this->assertSame(date('H',$date->getTimestamp()), $date->toString('H')); - $this->assertSame(date('i',$date->getTimestamp()), $date->toString('i')); - $this->assertSame(date('s',$date->getTimestamp()), $date->toString('s')); - $this->assertSame(date('e',$date->getTimestamp()), $date->toString('e')); - $this->assertSame(date('I',$date->getTimestamp()), $date->toString('I')); - $this->assertSame(date('O',$date->getTimestamp()), $date->toString('O')); - $this->assertSame(date('P',$date->getTimestamp()), $date->toString('P')); - $this->assertSame(date('T',$date->getTimestamp()), $date->toString('T')); - $this->assertSame(date('Z',$date->getTimestamp()), $date->toString('Z')); - $this->assertSame(date('c',$date->getTimestamp()), $date->toString('c')); - $this->assertSame(date('r',$date->getTimestamp()), $date->toString('r')); - $this->assertSame(date('U',$date->getTimestamp()), $date->toString('U')); - Zend_Date::setOptions(['format_type' => 'iso']); - } - - /** - * @ZF-7912 - */ - public function testPhpFormatWithIsEmpty() - { - Zend_Date::setOptions(['format_type' => 'php']); - $date1 = new Zend_Date(); - $date2 = clone $date1; - $date2->add(1, 'd'); - - $this->assertTrue($date1->isEarlier($date2, 'd.M.y')); - $this->assertFalse($date2->isEarlier($date1, 'd.M.y')); - $this->assertFalse($date1->isLater($date2, 'd.M.y')); - $this->assertTrue($date2->isLater($date1, 'd.M.y')); - } - - public function testPhpFormatWithToString() - { - Zend_Date::setOptions(['format_type' => 'php']); - $date = new Zend_Date('10.10.2009 10:10:10'); - $this->assertEquals('10.10.2009 10:10:10', $date->toString('d.m.Y H:i:s')); - $date->setTime('23:59:59'); - $this->assertEquals('10.10.2009 23:59:59', $date->toString('d.m.Y H:i:s')); - } - - /** - * @ZF-8650 - */ - public function testFractionalPrecision() - { - $date = new Zend_Date(); - $date->set('012345', Zend_Date::MILLISECOND); - - $this->assertEquals(3, $date->getFractionalPrecision()); - $this->assertEquals('345', $date->toString('S')); - - $date->setFractionalPrecision(6); - $this->assertEquals(6, $date->getFractionalPrecision()); - $this->assertEquals('345000', $date->toString('S')); - - $date->add(200, Zend_Date::MILLISECOND); - $this->assertEquals(6, $date->getFractionalPrecision()); - $this->assertEquals('345200', $date->toString('S')); - } - - /** - * @ZF-9085 - */ - public function testGettingMonthWhenUsingGNU() - { - Zend_Date::setOptions(['format_type' => 'php']); - $date = new Zend_Date(['day' => '1', 'month' => '4', 'year' => '2008']); - $date2 = $date->getMonth(); - $result = $date2->toArray(); - $this->assertEquals(1970, $result['year']); - } - - /** - * @ZF-9891 - */ - public function testComparingDatesWithoutOption() - { - $date = new Zend_Date(strtotime('Sat, 07 Mar 2009 08:03:50 +0000')); - $date2 = new Zend_Date(); - $date2->set('Sat, 07 Mar 2009 08:03:50 +0000', Zend_Date::RFC_2822); - - $this->assertTrue($date2->equals($date)); - } - - /** - * @ZF-10150 - */ - public function testChineseFullDates() - { - $date = new Zend_Date(['year' => '2008', 'month' => '10', 'day' => '12']); - $this->assertEquals('2008年10月12日', $date->get(Zend_Date::DATE_LONG, 'zh')); - } - - /** - * @group ZF-10492 - */ - public function test_farFutureDate() - { - $t = '2041-08-01 00:00:00'; - $date = new Zend_Date($t, 'yyyy-MM-dd HH:mm:ss'); - $this->assertEquals($t, $date->toString('yyyy-MM-dd HH:mm:ss')); - } - - /** - * @group ZF-11846 - */ - public function testGetTimezoneFromStringForTimezoneOffsetsGreaterThan12() - { - $date = new Zend_Date(); - $this->assertEquals('Etc/GMT-13', $date->getTimezoneFromString('18:00:00+1300')); - $this->assertEquals('Etc/GMT-14', $date->getTimezoneFromString('18:00:00+1400')); - } - - /** - * @group ZF-11992 - */ - public function testDateShouldMatchOnFirstDayOfYear() - { - $date = new Zend_Date('01.01.2012'); - $out = $date->toString('Y-MM-dd'); - $this->assertEquals('2012-01-01', $out); - } - - /** - * @group GH-2 - */ - public function testGetTimezoneFromStringForTimezonesWithUnderscore() - { - $date = new Zend_Date(); - - $this->assertEquals( - 'America/Los_Angeles', - $date->getTimezoneFromString('America/Los_Angeles') - ); - - $this->assertEquals( - 'America/New_York', - $date->getTimezoneFromString('America/New_York') - ); - } - - /** - * @group GH-561 - */ - public function testGetYearAndMonthWithoutDot() - { - $date = new Zend_Date('2014.12.29'); - - $this->assertEquals('29.12.2014', $date->get(Zend_Date::DATE_MEDIUM)); - $this->assertEquals('2014.12', $date->get('Y.M')); - $this->assertEquals('201412', $date->get('YM')); - } -} - -class Zend_Date_TestHelper extends Zend_Date -{ - public function _setTime($timestamp) - { - $this->_getTime($timestamp); - } - - protected function _getTime($timestamp = null) - { - static $_timestamp = null; - if ($timestamp !== null) { - $_timestamp = $timestamp; - } - if ($_timestamp !== null) { - return $_timestamp; - } - - return time(); - } - - public function mktime($hour, $minute, $second, $month, $day, $year, $dst = -1, $gmt = false) - { - return parent::mktime($hour, $minute, $second, $month, $day, $year, $dst, $gmt); - } -} diff --git a/tests/Zend/Locale/MathTest.php b/tests/Zend/Locale/MathTest.php index 6aaef05b..36e1a198 100644 --- a/tests/Zend/Locale/MathTest.php +++ b/tests/Zend/Locale/MathTest.php @@ -53,11 +53,6 @@ public function tearDown(): void } } - /* - * Note: All other aspects of Zend_Locale_Math receive extensive testing - * via unit tests in Zend_Date and Zend_Measure*. - */ - /** * test round() * expect string when BCMath extension is enabled. diff --git a/tests/Zend/LocaleTest.php b/tests/Zend/LocaleTest.php index 3922ebbe..1feaa1d8 100644 --- a/tests/Zend/LocaleTest.php +++ b/tests/Zend/LocaleTest.php @@ -17,8 +17,6 @@ * @version $Id $ */ -// define('TESTS_ZEND_LOCALE_BCMATH_ENABLED', false); // uncomment to disable use of bcmath extension by Zend_Date - /** * Zend_Locale. */ diff --git a/tests/Zend/Validate/DateTest.php b/tests/Zend/Validate/DateTest.php deleted file mode 100644 index 083bbe2c..00000000 --- a/tests/Zend/Validate/DateTest.php +++ /dev/null @@ -1,241 +0,0 @@ -_validator = new Zend_Validate_Date(); - } - - /** - * Ensures that the validator follows expected behavior. - */ - public function testBasic() - { - $valuesExpected = [ - '2007-01-01' => true, - '2007-02-28' => true, - '2007-02-29' => false, - '2008-02-29' => true, - '2007-02-30' => false, - '2007-02-99' => false, - '9999-99-99' => false, - 0 => false, - 999_999_999_999 => false, - 'Jan 1 2007' => false, - 'asdasda' => false, - 'sdgsdg' => false, - ]; - foreach ($valuesExpected as $input => $result) { - $this->assertEquals($result, $this->_validator->isValid($input), - "'$input' expected to be " . ($result ? '' : 'in') . 'valid'); - } - } - - /** - * Ensures that characters trailing an otherwise valid date cause the input to be invalid. - * - * @group ZF-1804 - */ - public function testCharactersTrailingInvalid() - { - $dateValid = '2007-08-02'; - $charactersTrailing = 'something'; - $this->assertTrue($this->_validator->isValid($dateValid)); - $this->assertFalse($this->_validator->isValid($dateValid . $charactersTrailing)); - } - - /** - * Ensures that characters leading an otherwise valid date cause the input to be invalid. - * - * @group ZF-1804 - */ - public function testCharactersLeadingInvalid() - { - $dateValid = '2007-08-02'; - $charactersLeading = 'something'; - $this->assertTrue($this->_validator->isValid($dateValid)); - $this->assertFalse($this->_validator->isValid($charactersLeading . $dateValid)); - } - - /** - * Ensures that getMessages() returns expected default value. - */ - public function testGetMessages() - { - $this->assertEquals([], $this->_validator->getMessages()); - } - - /** - * Ensures that the validator can handle different manual dateformats. - * - * @group ZF-2003 - */ - public function testUseManualFormat() - { - $this->assertTrue($this->_validator->setFormat('dd.MM.YYYY')->isValid('10.01.2008')); - $this->assertEquals('dd.MM.YYYY', $this->_validator->getFormat()); - - $this->assertTrue($this->_validator->setFormat('MM yyyy')->isValid('01 2010')); - $this->assertFalse($this->_validator->setFormat('dd/MM/yyyy')->isValid('2008/10/22')); - $this->assertTrue($this->_validator->setFormat('dd/MM/yy')->isValid('22/10/08')); - $this->assertFalse($this->_validator->setFormat('dd/MM/yy')->isValid('22/10')); - set_error_handler([$this, 'errorHandlerIgnore']); - $result = $this->_validator->setFormat('s')->isValid(0); - restore_error_handler(); - if (!$this->_errorOccurred) { - $this->assertTrue($result); - } else { - $this->markTestSkipped('Affected by bug described in ZF-2789'); - } - $this->_errorOccurred = false; - } - - /** - * Ensures that the validator can handle different dateformats from locale. - * - * @group ZF-2003 - */ - public function testUseLocaleFormat() - { - $errorOccurredLocal = false; - set_error_handler([$this, 'errorHandlerIgnore']); - $valuesExpected = [ - '10.01.2008' => true, - '32.02.2008' => false, - '20 April 2008' => true, - '1.Juli.2008' => true, - '2008/20/03' => false, - '99/99/2000' => false, - 0 => false, - 999_999_999_999 => false, - 'Jan 1 2007' => false, - ]; - foreach ($valuesExpected as $input => $resultExpected) { - $resultActual = $this->_validator->setLocale('de_AT')->isValid($input); - if (!$this->_errorOccurred) { - $this->assertEquals($resultExpected, $resultActual, "'$input' expected to be " - . ($resultExpected ? '' : 'in') . 'valid'); - } else { - $errorOccurredLocal = true; - } - $this->_errorOccurred = false; - } - $this->assertEquals('de_AT', $this->_validator->getLocale()); - restore_error_handler(); - if ($errorOccurredLocal) { - $this->markTestSkipped('Affected by bug described in ZF-2789'); - } - } - - /** - * Ensures that the validator can handle different dateformats from locale. - * - * @group ZF-2003 - */ - public function testLocaleContructor() - { - set_error_handler([$this, 'errorHandlerIgnore']); - $valid = new Zend_Validate_Date('dd.MM.YYYY', 'de'); - $this->assertTrue($valid->isValid('10.April.2008')); - - restore_error_handler(); - } - - /** - * @ZF-4352 - */ - public function testNonStringValidation() - { - $this->assertFalse($this->_validator->isValid([1 => 1])); - } - - /** - * @ZF-6374 - */ - public function testUsingApplicationLocale() - { - Zend_Registry::set(\Zend_Locale::class, new Zend_Locale('de')); - $valid = new Zend_Validate_Date(); - $this->assertTrue($valid->isValid('10.April.2008')); - } - - /** - * ZF-7630. - */ - public function testDateObjectVerification() - { - $date = new Zend_Date(); - $this->assertTrue($this->_validator->isValid($date), "'$date' expected to be valid"); - } - - /** - * ZF-6457. - */ - public function testArrayVerification() - { - $date = new Zend_Date(); - $array = $date->toArray(); - $this->assertTrue($this->_validator->isValid($array), 'array expected to be valid'); - } - - /** - * Ignores a raised PHP error when in effect, but throws a flag to indicate an error occurred. - * - * @param int $errno - * @param string $errstr - * @param string $errfile - * @param int $errline - * - * @group ZF-2789 - */ - public function errorHandlerIgnore($errno, $errstr, $errfile, $errline) - { - $this->_errorOccurred = true; - } -} From 815bb4ace3707593b39c4bd03bfd56938de38a28 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Tue, 10 Jun 2025 14:32:06 +0200 Subject: [PATCH 09/28] Drop unused localized validation error messages #11498 --- resources/languages/cs/Zend_Validate.php | 260 ------------------- resources/languages/de/Zend_Validate.php | 260 ------------------- resources/languages/en/Zend_Validate.php | 260 ------------------- resources/languages/es/Zend_Validate.php | 260 ------------------- resources/languages/fi/Zend_Validate.php | 260 ------------------- resources/languages/fr/Zend_Validate.php | 130 ---------- resources/languages/hr/Zend_Validate.php | 258 ------------------- resources/languages/it/Zend_Validate.php | 260 ------------------- resources/languages/ja/Zend_Validate.php | 260 ------------------- resources/languages/nl/Zend_Validate.php | 260 ------------------- resources/languages/pt_BR/Zend_Validate.php | 260 ------------------- resources/languages/ru/Zend_Validate.php | 254 ------------------- resources/languages/sk/Zend_Captcha.php | 31 --- resources/languages/sk/Zend_Validate.php | 260 ------------------- resources/languages/sr/Zend_Validate.php | 261 -------------------- resources/languages/uk/Zend_Validate.php | 254 ------------------- 16 files changed, 3788 deletions(-) delete mode 100644 resources/languages/cs/Zend_Validate.php delete mode 100644 resources/languages/de/Zend_Validate.php delete mode 100644 resources/languages/en/Zend_Validate.php delete mode 100644 resources/languages/es/Zend_Validate.php delete mode 100644 resources/languages/fi/Zend_Validate.php delete mode 100644 resources/languages/fr/Zend_Validate.php delete mode 100644 resources/languages/hr/Zend_Validate.php delete mode 100644 resources/languages/it/Zend_Validate.php delete mode 100644 resources/languages/ja/Zend_Validate.php delete mode 100644 resources/languages/nl/Zend_Validate.php delete mode 100644 resources/languages/pt_BR/Zend_Validate.php delete mode 100644 resources/languages/ru/Zend_Validate.php delete mode 100644 resources/languages/sk/Zend_Captcha.php delete mode 100644 resources/languages/sk/Zend_Validate.php delete mode 100644 resources/languages/sr/Zend_Validate.php delete mode 100644 resources/languages/uk/Zend_Validate.php diff --git a/resources/languages/cs/Zend_Validate.php b/resources/languages/cs/Zend_Validate.php deleted file mode 100644 index cfa35b92..00000000 --- a/resources/languages/cs/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' obsahuje i jiné znaky než písmena a číslice", - "'%value%' is an empty string" => "'%value%' je prázdný řetězec", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' contains non alphabetic characters" => "'%value%' obsahuje i jiné znaky než písmena", - "'%value%' is an empty string" => "'%value%' je prázdný řetězec", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' má chybný kontrolní součet", - "'%value%' contains invalid characters" => "'%value%' obsahuje neplatné znaky", - "'%value%' should have a length of %length% characters" => "'%value%' by měl mít délku %length% znaků", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec.', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' není mezi '%min%' a '%max%', včetně", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' není ostře mezi '%min%' a '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "Hodnota '%value%' není platná", - 'An exception has been raised within the callback' => 'Během volání byla vyvolána výjimka', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' musí obsahovat 13 až 19 číslic", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhnův algoritmus (kontrolní součet mod-10) nevyšel pro '%value%'", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "'%value%' obsahuje neplatný kontrolní součet", - "'%value%' must contain only digits" => "'%value%' musí obsahovat jen čísla", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' contains an invalid amount of digits" => "'%value%' obsahuje neplatný počet číslic", - "'%value%' is not from an allowed institute" => "'%value%' není od povolené společnosti", - "'%value%' seems to be an invalid creditcard number" => "'%value%' není platné číslo kreditní karty", - "An exception has been raised while validating '%value%'" => "Během validace '%value%' byla vyvolána výjimka", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Chybný typ. Byl očekáván řetězec, číslo, pole nebo Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' není platné datum", - "'%value%' does not fit the date format '%format%'" => "'%value%' neodpovídá formátu data '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Nebyl nalezen žádný záznam odpovídající '%value%'", - "A record matching '%value%' was found" => "Byl nalezen záznam odpovídající '%value%'", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo', - "'%value%' must contain only digits" => "'%value%' musí obsahovat jen číslice", - "'%value%' is an empty string" => "'%value%' je prázdný řetězec", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' is no valid email address in the basic format local-part@hostname" => "'%value%' není platná e-mailová adresa ve formátu local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' není platné hostname pro emailovou adresu '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' neobsahuje platný MX záznam pro e-mailovou adresu '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' není v směrovatelném úseku sítě. E-mailová adresa '%value%' by neměla být požadována z veřejné sítě", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' nemůže být porovnán proti dot-atom formátu", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' nemůže být porovnán proti quoted-string formátu", - "'%localPart%' is no valid local part for email address '%value%'" => "'%localPart%' není platná 'local part' pro e-mailovou adresu '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' překročil dovolenou délku", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Příliš mnoho souborů. Maximum je '%max%', ale bylo zadáno '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Příliš málo souborů. Minimum je '%min%', ale byl zadáno jen '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Soubor '%value%' neodpovídá zadanému crc32 hashi", - 'A crc32 hash could not be evaluated for the given file' => 'Pro zadaný soubor nemohl být vypočítán crc32 hash', - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Soubor '%value%' má nesprávnou příponu", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Soubor '%value%' má nesprávný mimetyp '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp souboru '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Soubor '%value%' neexistuje", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Soubor '%value%' má nesprávnou příponu", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Součet velikostí všech souborů by měl být maximálně '%max%', ale je '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Součet velikostí všech souborů by měl být nejméně '%min%', ale je '%size%'", - 'One or more files can not be read' => 'Jeden nebo více souborů není možné načíst', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Soubor '%value%' neodpovídané danému hashi", - 'A hash could not be evaluated for the given file' => 'Hash nemohl být pro daný soubor vypočítán', - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maximální šířka obrázku '%value%' by měla být '%maxwidth%', ale je '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimální šířka obrázku '%value%' by měla být '%minwidth%', ale je '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maximální výška obrázku '%value%' by měla být '%maxheight%', ale je '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimální výška obrázku '%value%' by měla být '%minheight%', ale je '%height%'", - "The size of image '%value%' could not be detected" => "Rozměry obrázku '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Soubor '%value%' není komprimovaný, ale '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp souboru '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Soubor '%value%' není obrázek, ale '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp souboru '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Soubor '%value%' neodpovídá danému md5 hashi", - 'A md5 hash could not be evaluated for the given file' => 'md5 hash nemohl být pro daný soubor vypočítán', - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Soubor '%value%' má neplatný mimetyp '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp souboru '%value%' nebylo možné zjistit", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Soubor '%value%' již existuje", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Soubor '%value%' neodpovídá danému sha1 hashi", - 'A sha1 hash could not be evaluated for the given file' => 'sha1 hash nemohl být pro daný soubor vypočítán', - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maximální povolená velikost souboru je '%max%', ale '%value%' má '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimální velikost souboru je '%min%', ale '%value%' má '%size%'", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Soubor '%value%' překročil velikost definovanou v ini souboru", - "File '%value%' exceeds the defined form size" => "Soubor '%value%' překročil velikost definovanou ve formuláři", - "File '%value%' was only partially uploaded" => "Soubor '%value%' byl nahrán jen částečně", - "File '%value%' was not uploaded" => "Soubor '%value%' nebyl nahrán", - "No temporary directory was found for file '%value%'" => "Pro soubor '%value%' nebyl nalezen žádný dočasný adresář", - "File '%value%' can't be written" => "Soubor '%value%' nemůže být zapsán", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP rozšíření vrátilo chybu během nahrávání souboru '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Soubor '%value%' byl nedovoleně nahrán. Může se jednat o útok", - "File '%value%' was not found" => "Soubor '%value%' nebyl nalezen", - "Unknown error while uploading file '%value%'" => "Během nahrávání souboru '%value%' došlo k chybě", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Příliš mnoho slov. Je jich dovoleno maximálně '%max%', ale bylo zadáno '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Příliš málo slov. Musí jich být alespoň '%min%', ale bylo zadáno jen '%count%'", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' buď není čitelný nebo neexistuje", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo', - "'%value%' does not appear to be a float" => "'%value%' není desetinné číslo", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' není větší než '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' has not only hexadecimal digit characters" => "'%value%' neobsahuje jen znaky hexadecimálních čísel.", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' vypadá jako IP adresa, ale ty nejsou dovoleny", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' vypadá jako hostname, ale nemohl být ověřen proti známým TLD", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' vypadá jako hostname, ale obsahuje pomlčku na nedovoleném místě", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' vypadá jako hostname, ale neodpovídá formátu hostname pro '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' sice vypadá jako hostname, ale nemohu určit TLD", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' neodpovídá očekáváné struktuře hostname", - "'%value%' does not appear to be a valid local network name" => "'%value%' nevypadá jako platné síťové jméno", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' vypadá jako hostname lokální sítě, ty ale nejsou povoleny", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' vypadá jako DNS hostname ale zadanou punycode notaci není možné dekódovat", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Neznámý stát v IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' není platný formát IBAN", - "'%value%' has failed the IBAN check" => "'%value%' neprošlo kontrolou IBAN", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Zadané položky nejsou shodné', - 'No token was provided to match against' => 'Nebyla zadána položka pro porovnání', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' nebyla nalezena v seznamu", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Chybný typ. Byl očekáván řetězec nebo celé číslo', - "'%value%' does not appear to be an integer" => "'%value%' není celé číslo", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' does not appear to be a valid IP address" => "'%value%' není platná IP adresa", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Chybný typ. Byl očekáván řetězec nebo celé číslo', - "'%value%' is no valid ISBN number" => "'%value%' není platné ISBN", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' není méně než '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo, boolean nebo pole', - "Value is required and can't be empty" => 'Položka je povinná a nesmí být prázdná', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Chybný typ. Byl očekáván řetězec nebo celé číslo', - "'%value%' does not appear to be a postal code" => "'%value%' nevypadá jako PSČ", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Byl očekáván řetězec, celé nebo desetinné číslo', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' neodpovídá šabloně '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Během zpracování šablony '%pattern%' došlo k interní chybě", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is no valid sitemap changefreq" => "'%value%' není platné 'changefreq' pro sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is no valid sitemap lastmod" => "'%value%' není platné 'lastmod' pro sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - - // Zend_Validate_Sitemap_Loc - "'%value%' is no valid sitemap location" => "'%value%' není platná 'location' pro sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - - // Zend_Validate_Sitemap_Priority - "'%value%' is no valid sitemap priority" => "'%value%' není platná 'priority' pro sitemapu", - 'Invalid type given. Numeric string, integer or float expected' => 'Chybný typ. Byl očekáván číselný řetězec, celé nebo desetinné číslo.', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Chybný typ. Byl očekáván řetězec', - "'%value%' is less than %min% characters long" => "'%value%' je kratší než %min% znaků", - "'%value%' is more than %max% characters long" => "'%value%' je delší než %max% znaků", -]; diff --git a/resources/languages/de/Zend_Validate.php b/resources/languages/de/Zend_Validate.php deleted file mode 100644 index b82342ea..00000000 --- a/resources/languages/de/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Ungültiger Typ angegeben. String, Integer oder Float erwartet', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' enthält Zeichen welche keine Buchstaben und keine Ziffern sind", - "'%value%' is an empty string" => "'%value%' ist ein leerer String", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' contains non alphabetic characters" => "'%value%' enthält Zeichen welche keine Buchstaben sind", - "'%value%' is an empty string" => "'%value%' ist ein leerer String", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' hat die Prüfung der Checksumme nicht bestanden", - "'%value%' contains invalid characters" => "'%value%' enthält ungültige Zeichen", - "'%value%' should have a length of %length% characters" => "'%value%' sollte eine Länge von %length% Zeichen haben", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' ist nicht zwischen '%min%' und '%max%', inklusive diesen Werten", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' ist nicht strikt zwischen '%min%' und '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' ist nicht gültig", - 'An exception has been raised within the callback' => 'Eine Exception wurde im Callback geworfen', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' muss zwischen 13 und 19 Ziffern enthalten", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Der Luhn Algorithmus (Mod-10 Checksumme) ist auf '%value%' fehlgeschlagen", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "'%value%' scheint eine ungültige Prüfsumme zu enthalten", - "'%value%' must contain only digits" => "'%value%' darf nur Ziffern enthalten", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' contains an invalid amount of digits" => "'%value%' enthält eine ungültige Anzahl an Ziffern", - "'%value%' is not from an allowed institute" => "'%value%' ist nicht von einem der erlaubten Institute", - "'%value%' seems to be an invalid creditcard number" => "'%value%' scheint eine ungültige Kreditkarten-Nummer zu sein", - "An exception has been raised while validating '%value%'" => "Eine Exception wurde wärend der Prüfung von '%value%' geworfen", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Ungültiger Typ angegeben. String, Integer, Array oder Zend_Date erwartet', - "'%value%' does not appear to be a valid date" => "'%value%' scheint kein gültiges Datum zu sein", - "'%value%' does not fit the date format '%format%'" => "'%value%' passt nicht in das angegebene Datumsformat '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Es wurde kein Eintrag gefunden der '%value%' entspricht", - "A record matching '%value%' was found" => "Ein Eintrag der '%value%' entspricht wurde gefunden", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Ungültiger Typ angegeben. String, Integer oder Float erwartet', - "'%value%' must contain only digits" => "'%value%' darf nur Ziffern enthalten", - "'%value%' is an empty string" => "'%value%' ist ein leerer String", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' ist keine gültige Emailadresse im Basisformat local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' ist kein gültiger Hostname für die Emailadresse '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' scheint keinen gültigen MX Eintrag für die Emailadresse '%value%' zu haben", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' ist in keinem routebaren Netzwerksegment. Die Emailadresse '%value%' sollte nicht vom öffentlichen Netz aus aufgelöst werden", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' passt nicht auf das dot-atom Format", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' passt nicht auf das quoted-string Format", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' ist kein gültiger lokaler Teil für die Emailadresse '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' ist länger als erlaubt", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Zu viele Dateien. Maximal '%max%' sind erlaubt aber '%count%' wurden angegeben", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Zu wenige Dateien. Minimal '%min%' wurden erwartet aber nur '%count%' wurden angegeben", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Die Datei '%value%' passt nicht auf die angegebenen Crc32 Hashes", - 'A crc32 hash could not be evaluated for the given file' => 'Für die angegebene Datei konnte kein Crc32 Hash evaluiert werden', - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Die Datei '%value%' hat eine falsche Erweiterung", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Die Datei '%value%' hat einen falschen Mimetyp von '%type%'", - "The mimetype of file '%value%' could not be detected" => "Der Mimetyp der Datei '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Die Datei '%value%' existiert nicht", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Die Datei '%value%' hat eine falsche Erweiterung", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Alle Dateien sollten in Summe eine maximale Größe von '%max%' haben, aber es wurde '%size%' erkannt", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Alle Dateien sollten in Summe eine minimale Größe von '%min%' haben, aber es wurde '%size%' erkannt", - 'One or more files can not be read' => 'Ein oder mehrere Dateien konnten nicht gelesen werden', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Die Datei '%value%' passt nicht auf die angegebenen Hashes", - 'A hash could not be evaluated for the given file' => 'Für die angegebene Datei konnte kein Hash evaluiert werden', - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Die maximal erlaubte Breite für das Bild '%value%' ist '%maxwidth%', aber es wurde '%width%' erkannt", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Die minimal erlaubte Breite für das Bild '%value%' ist '%minwidth%', aber es wurde '%width%' erkannt", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Die maximal erlaubte Höhe für das Bild '%value%' ist '%maxheight%', aber es wurde '%height%' erkannt", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Die minimal erlaubte Höhe für das Bild '%value%' ist '%minheight%', aber es wurde '%height%' erkannt", - "The size of image '%value%' could not be detected" => "Die Größe des Bildes '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Die Datei '%value%' ist nicht komprimiert. Es wurde '%type%' erkannt", - "The mimetype of file '%value%' could not be detected" => "Der Mimetyp der Datei '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Die Datei '%value%' ist kein Bild. Es wurde '%type%' erkannt", - "The mimetype of file '%value%' could not be detected" => "Der Mimetyp der Datei '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Die Datei '%value%' passt nicht auf die angegebenen Md5 Hashes", - 'A md5 hash could not be evaluated for the given file' => 'Für die angegebene Datei konnte kein Md5 Hash evaluiert werden', - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Die Datei '%value%' hat einen falschen Mimetyp von '%type%'", - "The mimetype of file '%value%' could not be detected" => "Der Mimetyp der Datei '%value%' konnte nicht erkannt werden", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Die Datei '%value%' existiert bereits", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Die Datei '%value%' passt nicht auf die angegebenen Sha1 Hashes", - 'A sha1 hash could not be evaluated for the given file' => 'Für die angegebene Datei konnte kein Sha1 Hash evaluiert werden', - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Die maximal erlaubte Größe für die Datei '%value%' ist '%max%', aber es wurde '%size%' entdeckt", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Die mindestens erwartete Größe für die Datei '%value%' ist '%min%', aber es wurde '%size%' entdeckt", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Die Datei '%value%' übersteigt die definierte Größe in der Konfiguration", - "File '%value%' exceeds the defined form size" => "Die Datei '%value%' übersteigt die definierte Größe des Formulars", - "File '%value%' was only partially uploaded" => "Die Datei '%value%' wurde nur teilweise hochgeladen", - "File '%value%' was not uploaded" => "Die Datei '%value%' wurde nicht hochgeladen", - "No temporary directory was found for file '%value%'" => "Für die Datei '%value%' wurde kein temporäres Verzeichnis gefunden", - "File '%value%' can't be written" => "Die Datei '%value%' konnte nicht geschrieben werden", - "A PHP extension returned an error while uploading the file '%value%'" => "Eine PHP Erweiterung retournierte einen Fehler wärend die Datei '%value%' hochgeladen wurde", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Die Datei '%value%' wurde illegal hochgeladen. Dies könnte eine mögliche Attacke sein", - "File '%value%' was not found" => "Die Datei '%value%' wurde nicht gefunden", - "Unknown error while uploading file '%value%'" => "Ein unbekannter Fehler ist aufgetreten wärend die Datei '%value%' hochgeladen wurde", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Zu viele Wörter. Maximal '%max%' sind erlaubt, aber '%count%' wurden gezählt", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Zu wenige Wörter. Mindestens '%min%' wurden erwartet, aber '%count%' wurden gezählt", - "File '%value%' is not readable or does not exist" => "Die Datei '%value%' konnte nicht gelesen werden oder existiert nicht", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Ungültiger Typ angegeben. String, Integer oder Float erwartet', - "'%value%' does not appear to be a float" => "'%value%' scheint kein Float zu sein", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' ist nicht größer als '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' has not only hexadecimal digit characters" => "'%value%' enthält nicht nur hexadezimale Ziffern", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' scheint eine IP Adresse zu sein, aber IP Adressen sind nicht erlaubt", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' scheint ein DNS Hostname zu sein, aber die TLD wurde in der bekannten Liste nicht gefunden", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' scheint ein DNS Hostname zu sein, enthält aber einen Bindestrich an einer ungültigen Position", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' scheint ein DNS Hostname zu sein, passt aber nicht in das Hostname Schema für die TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' scheint ein DNS Hostname zu sein, aber der TLD Teil konnte nicht extrahiert werden", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' passt nicht in die erwartete Struktur für einen DNS Hostname", - "'%value%' does not appear to be a valid local network name" => "'%value%' scheint kein gültiger lokaler Netzerkname zu sein", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' scheint ein lokaler Netzwerkname zu sein, aber lokale Netzwerknamen sind nicht erlaubt", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' scheint ein DNS Hostname zu sein, aber die angegebene Punycode Schreibweise konnte nicht dekodiert werden", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Unbekanntes Land in der IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' enthält ein falsches IBAN Format", - "'%value%' has failed the IBAN check" => "Die IBAN Prüfung ist für '%value%' fehlgeschlagen", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Die zwei angegebenen Token stimmen nicht überein', - 'No token was provided to match against' => 'Es wurde kein Token angegeben gegen den geprüft werden kann', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' wurde im Haystack nicht gefunden", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Ungültiger Typ angegeben. String oder Integer erwartet', - "'%value%' does not appear to be an integer" => "'%value%' scheint kein Integer zu sein", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' does not appear to be a valid IP address" => "'%value%' scheint keine gültige IP Adresse zu sein", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Ungültiger Typ angegeben. String oder Integer erwartet', - "'%value%' is not a valid ISBN number" => "'%value%' ist keine gültige ISBN Nummer", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' ist nicht weniger als '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Ungültiger Typ angegeben. String, Integer, Float, Boolean oder Array erwartet', - "Value is required and can't be empty" => 'Es wird ein Wert benötigt. Dieser darf nicht leer sein', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Ungültiger Typ angegeben. String oder Integer erwartet', - "'%value%' does not appear to be a postal code" => "'%value%' scheint keine gültige Postleitzahl zu sein", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Ungültiger Typ angegeben. String, Integer oder Float erwartet', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' scheint nicht auf das Pattern '%pattern%' zu passen", - "There was an internal error while using the pattern '%pattern%'" => "Es gab einen internen Fehler bei der Verwendung des Patterns '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' ist keine gültige Changefreq für Sitemap", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' ist keine gültige Lastmod für Sitemap", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' ist keine gültige Location für Sitemap", - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' ist keine gültige Priority für Sitemap", - 'Invalid type given. Numeric string, integer or float expected' => 'Ungültiger Typ angegeben. Nummerischer String, Integer oder Float erwartet', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Ungültiger Typ angegeben. String erwartet', - "'%value%' is less than %min% characters long" => "'%value%' ist weniger als %min% Zeichen lang", - "'%value%' is more than %max% characters long" => "'%value%' ist mehr als %max% Zeichen lang", -]; diff --git a/resources/languages/en/Zend_Validate.php b/resources/languages/en/Zend_Validate.php deleted file mode 100644 index 99f95907..00000000 --- a/resources/languages/en/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Invalid type given. String, integer or float expected', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contains characters which are non alphabetic and no digits", - "'%value%' is an empty string" => "'%value%' is an empty string", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' contains non alphabetic characters" => "'%value%' contains non alphabetic characters", - "'%value%' is an empty string" => "'%value%' is an empty string", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' failed checksum validation", - "'%value%' contains invalid characters" => "'%value%' contains invalid characters", - "'%value%' should have a length of %length% characters" => "'%value%' should have a length of %length% characters", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' is not between '%min%' and '%max%', inclusively", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' is not strictly between '%min%' and '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' is not valid", - 'An exception has been raised within the callback' => 'An exception has been raised within the callback', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' must contain between 13 and 19 digits", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algorithm (mod-10 checksum) failed on '%value%'", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "'%value%' seems to contain an invalid checksum", - "'%value%' must contain only digits" => "'%value%' must contain only digits", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' contains an invalid amount of digits" => "'%value%' contains an invalid amount of digits", - "'%value%' is not from an allowed institute" => "'%value%' is not from an allowed institute", - "'%value%' seems to be an invalid creditcard number" => "'%value%' seems to be an invalid creditcard number", - "An exception has been raised while validating '%value%'" => "An exception has been raised while validating '%value%'", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Invalid type given. String, integer, array or Zend_Date expected', - "'%value%' does not appear to be a valid date" => "'%value%' does not appear to be a valid date", - "'%value%' does not fit the date format '%format%'" => "'%value%' does not fit the date format '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "No record matching '%value%' was found", - "A record matching '%value%' was found" => "A record matching '%value%' was found", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Invalid type given. String, integer or float expected', - "'%value%' must contain only digits" => "'%value%' must contain only digits", - "'%value%' is an empty string" => "'%value%' is an empty string", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' is not a valid email address in the basic format local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' is not a valid hostname for email address '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' does not appear to have a valid MX record for the email address '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' can not be matched against dot-atom format", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' can not be matched against quoted-string format", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' is not a valid local part for email address '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' exceeds the allowed length", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Too many files, maximum '%max%' are allowed but '%count%' are given", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Too few files, minimum '%min%' are expected but '%count%' are given", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "File '%value%' does not match the given crc32 hashes", - 'A crc32 hash could not be evaluated for the given file' => 'A crc32 hash could not be evaluated for the given file', - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "File '%value%' has a false extension", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "File '%value%' has a false mimetype of '%type%'", - "The mimetype of file '%value%' could not be detected" => "The mimetype of file '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "File '%value%' does not exist", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "File '%value%' has a false extension", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "All files in sum should have a maximum size of '%max%' but '%size%' were detected", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "All files in sum should have a minimum size of '%min%' but '%size%' were detected", - 'One or more files can not be read' => 'One or more files can not be read', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "File '%value%' does not match the given hashes", - 'A hash could not be evaluated for the given file' => 'A hash could not be evaluated for the given file', - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected", - "The size of image '%value%' could not be detected" => "The size of image '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "File '%value%' is not compressed, '%type%' detected", - "The mimetype of file '%value%' could not be detected" => "The mimetype of file '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "File '%value%' is no image, '%type%' detected", - "The mimetype of file '%value%' could not be detected" => "The mimetype of file '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "File '%value%' does not match the given md5 hashes", - 'A md5 hash could not be evaluated for the given file' => 'A md5 hash could not be evaluated for the given file', - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "File '%value%' has a false mimetype of '%type%'", - "The mimetype of file '%value%' could not be detected" => "The mimetype of file '%value%' could not be detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "File '%value%' exists", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "File '%value%' does not match the given sha1 hashes", - 'A sha1 hash could not be evaluated for the given file' => 'A sha1 hash could not be evaluated for the given file', - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimum expected size for file '%value%' is '%min%' but '%size%' detected", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "File '%value%' exceeds the defined ini size", - "File '%value%' exceeds the defined form size" => "File '%value%' exceeds the defined form size", - "File '%value%' was only partially uploaded" => "File '%value%' was only partially uploaded", - "File '%value%' was not uploaded" => "File '%value%' was not uploaded", - "No temporary directory was found for file '%value%'" => "No temporary directory was found for file '%value%'", - "File '%value%' can't be written" => "File '%value%' can't be written", - "A PHP extension returned an error while uploading the file '%value%'" => "A PHP extension returned an error while uploading the file '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "File '%value%' was illegally uploaded. This could be a possible attack", - "File '%value%' was not found" => "File '%value%' was not found", - "Unknown error while uploading file '%value%'" => "Unknown error while uploading file '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Too much words, maximum '%max%' are allowed but '%count%' were counted", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Too less words, minimum '%min%' are expected but '%count%' were counted", - "File '%value%' is not readable or does not exist" => "File '%value%' is not readable or does not exist", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Invalid type given. String, integer or float expected', - "'%value%' does not appear to be a float" => "'%value%' does not appear to be a float", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' is not greater than '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' has not only hexadecimal digit characters" => "'%value%' has not only hexadecimal digit characters", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' appears to be an IP address, but IP addresses are not allowed", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' appears to be a DNS hostname but cannot match TLD against known list", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' appears to be a DNS hostname but contains a dash in an invalid position", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' appears to be a DNS hostname but cannot extract TLD part", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' does not match the expected structure for a DNS hostname", - "'%value%' does not appear to be a valid local network name" => "'%value%' does not appear to be a valid local network name", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' appears to be a local network name but local network names are not allowed", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Unknown country within the IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' has a false IBAN format", - "'%value%' has failed the IBAN check" => "'%value%' has failed the IBAN check", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'The two given tokens do not match', - 'No token was provided to match against' => 'No token was provided to match against', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' was not found in the haystack", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Invalid type given. String or integer expected', - "'%value%' does not appear to be an integer" => "'%value%' does not appear to be an integer", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' does not appear to be a valid IP address" => "'%value%' does not appear to be a valid IP address", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Invalid type given. String or integer expected', - "'%value%' is not a valid ISBN number" => "'%value%' is not a valid ISBN number", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' is not less than '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Invalid type given. String, integer, float, boolean or array expected', - "Value is required and can't be empty" => "Value is required and can't be empty", - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Invalid type given. String or integer expected', - "'%value%' does not appear to be a postal code" => "'%value%' does not appear to be a postal code", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Invalid type given. String, integer or float expected', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' does not match against pattern '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "There was an internal error while using the pattern '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' is not a valid sitemap changefreq", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' is not a valid sitemap lastmod", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' is not a valid sitemap location", - 'Invalid type given. String expected' => 'Invalid type given. String expected', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' is not a valid sitemap priority", - 'Invalid type given. Numeric string, integer or float expected' => 'Invalid type given. Numeric string, integer or float expected', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Invalid type given. String expected', - "'%value%' is less than %min% characters long" => "'%value%' is less than %min% characters long", - "'%value%' is more than %max% characters long" => "'%value%' is more than %max% characters long", -]; diff --git a/resources/languages/es/Zend_Validate.php b/resources/languages/es/Zend_Validate.php deleted file mode 100644 index aef9e8fe..00000000 --- a/resources/languages/es/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'El tipo especificado no es válido, el valor debe ser de tipo float, una cadena de texto o entero', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contiene caracteres que no son alfabéticos ni dígitos", - "'%value%' is an empty string" => "'%value%' es una cadena de texto vacia", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto', - "'%value%' contains non alphabetic characters" => "'%value%' contiene caracteres no alfabéticos", - "'%value%' is an empty string" => "'%value%' es una cadena de texto vacia", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' Fallo la validación de checksum", - "'%value%' contains invalid characters" => "'%value%' contiene caracteres no válidos", - "'%value%' should have a length of %length% characters" => "'%value%' debe tener una longitud de %length% caracteres", - 'Invalid type given, value should be string' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' no está incluido entre '%min%' y '%max%'", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' no está exactamente entre '%min%' y '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' no es válido", - 'Failure within the callback, exception returned' => 'Falló dentro de la llamada de retorno, ha devuelto una excepción', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' debe contener entre 13 y 19 dígitos", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "El algoritmo de Luhn (checksum del módulo 10) fallo en '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "El algoritmo de Luhn (checksum del módulo 10) fallo en '%value%'", - "'%value%' must contain only digits" => "'%value%' debe contener solo dígitos", - 'Invalid type given, value should be a string' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto', - "'%value%' contains an invalid amount of digits" => "'%value%' contiene una cantidad inválida de dígitos", - "'%value%' is not from an allowed institute" => "'%value%' no es de una institución autorizada", - "Validation of '%value%' has been failed by the service" => "La validación de '%value%' fallo por causa del servicio", - "The service returned a failure while validating '%value%'" => "El servicio devolvió un fallo durante la validación de '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto, entero, array o un objeto Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' no parece ser una fecha válida", - "'%value%' does not fit the date format '%format%'" => "'%value%' no se ajusta al formato de fecha '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'No fue encontrado ningun registro que coincida con %value%', - "A record matching '%value%' was found" => 'Se encontro un registro coincidente con %value%', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto, entero o float', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' contiene caracteres que no son dígitos, solo se permiten dígitos", - "'%value%' is an empty string" => "'%value%' es una cadena vacía", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'El tipo especificado no es válido, el valor debe ser una cadena de texto', - "'%value%' is no valid email address in the basic format local-part@hostname" => "'%value%' no es una dirección de correo electrónico válido en el formato local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' no es un nombre de host válido para la dirección de correo electrónico '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' no parece tener un registro MX válido para la dirección de correo electrónico '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' no esta en un segmento de red ruteable. La dirección de correo electrónico '%value%' no se debe poder resolver desde una red pública.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' no es igual al formato dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' no es igual al formato quoted-string", - "'%localPart%' is no valid local part for email address '%value%'" => "'%localPart%' no es una parte local válida para la dirección de correo electrónico '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' excede la longitud permitida", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Demasiados archivos, se permiten un máximo de '%max%' pero se han especificado '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Muy pocos archivos, se esperaba un mí­nimo de '%min%' pero sólo se han especificado '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "El CRC32 del archivo '%value%' es incorrecto", - 'A crc32 hash could not be evaluated for the given file' => 'No se ha podido calcular el CRC32 del archivo especificado', - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "El archivo '%value%' tiene una extensión incorrecta", - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "El archivo '%value%' tiene un tipo MIME '%type%' incorrecto", - "The mimetype of file '%value%' could not be detected" => "No se ha podido determinar el tipo MIME del archivo '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "El archivo '%value%' no existe", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "El archivo '%value%' tiene una extensión incorrecta", - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Todos los archivos deberí­an tener un tamaño máximo de '%max%' pero tiene un tamaño de '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Todos los archivos deberí­an tener un tamaño mí­nimo de '%min%' pero tiene un tamaño de '%size%'", - 'One or more files can not be read' => 'Uno o más archivos no se pueden leer', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "El archivo '%value%' no se corresponde con los códigos hash especificados", - 'A hash could not be evaluated for the given file' => 'No se ha podido evaluar ningún código hash para el archivo especificado', - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "El ancho máxima para la imagen '%value%' deberí­a ser '%maxwidth%' pero es de '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "El ancho mí­nima para la imagen '%value%' deberí­a ser '%minwidth%' pero es de '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "La altura máxima para la imagen '%value%' deberí­a ser '%maxheight%' pero es de '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "La altura mí­nima para la imagen '%value%' deberí­a ser '%minheight%' pero es de '%height%'", - "The size of image '%value%' could not be detected" => "No se ha podido determinar el tamaño de la imagen '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "El archivo '%value%' no está comprimido, '%type%' detectado", - "The mimetype of file '%value%' could not be detected" => "No se ha podido determinar el tipo MIME del archivo '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "El archivo '%value%' no es una imagen, '%type%' detectado", - "The mimetype of file '%value%' could not be detected" => "No se ha podido determinar el tipo MIME del archivo '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "El archivo '%value%' no se corresponde con el MD5 especificado", - 'A md5 hash could not be evaluated for the given file' => 'No se ha podido calcular el MD5 del archivo especificado', - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "El archivo '%value%' tiene un tipo MIME '%type%' falso", - "The mimetype of file '%value%' could not be detected" => "No se ha podido determinar el tipo MIME del archivo '%value%'", - "File '%value%' can not be read" => "El archivo '%value%' no se puede leer", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "El archivo '%value%' existe", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "El archivo '%value%' no es igual al SHA1 especificado", - 'A sha1 hash could not be evaluated for the given file' => 'No se ha podido calcular el SHA1 del archivo especificado', - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "El tamaño máximo permitido para el archivo '%value%' es '%max%' pero se ha detectado un tamaño de '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "El tamaño mí­nimo permitido para el archivo '%value%' es '%min%' pero se ha detectado un tamaño de '%size%'", - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "El tamaño del archivo '%value%' excede el valor definido en el ini", - "File '%value%' exceeds the defined form size" => "El archivo '%value%' excede el tamaño definido en el formulario", - "File '%value%' was only partially uploaded" => "El archivo '%value%' ha sido sólo parcialmente subido", - "File '%value%' was not uploaded" => "El archivo '%value%' no ha sido subido", - "No temporary directory was found for file '%value%'" => "No se ha encontrado el directorio temporal para el archivo '%value%'", - "File '%value%' can't be written" => "No se puede escribir en el archivo '%value%'", - "A PHP extension returned an error while uploading the file '%value%'" => "Una extensión PHP devolvió un error mientras se subí­a el archivo '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "El archivo '%value%' ha sido subido ilegalmente, lo cual podrí­a ser un ataque", - "File '%value%' was not found" => "Archivo '%value%' no encontrado", - "Unknown error while uploading file '%value%'" => "error desconocido al intentar subir el archivo '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Demasiadas palabras, sólo se permiten '%max%' pero se han contado '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Demasiado pocas palabras, se esperaban al menos '%min%' pero se han contado '%count%'", - "File '%value%' could not be found" => "No se ha podido encontrar el archivo '%value%'", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'El tipo especificado no es válido, el valor deberí­a ser de tipo float, una cadena de texto o un entero', - "'%value%' does not appear to be a float" => "'%value%' no parece ser un float", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' no es mayor que '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' has not only hexadecimal digit characters" => "'%value%' no consta únicamente de dí­gitos y caracteres hexadecimales", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' parece una dirección IP, pero éstas no están permitidas", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' parece ser un nombre de dominio DNS pero el TLD no es válido", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' parece ser un nombre de dominio DNS pero contiene una barra en una posición inválida", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' parece ser un nombre de dominio DNS pero su formato no se corresponde con el correcto para el TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' parece ser un nombre de dominio DNS pero no se puede extraer la parte del TLD", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' no se corresponde con la estructura esperada para un nombre de dominio DNS", - "'%value%' does not appear to be a valid local network name" => "'%value%' no parece ser un nombre de área local válido", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' parece ser un nombre de área local pero no se permiten nombres de área local", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' parece ser un nombre de dominio DNS pero no se puede decodificar la notación de punycode", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Paí­s desconocido dentro del IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' tiene un formato falso de IBAN", - "'%value%' has failed the IBAN check" => "La prueba de validación de IBAN de '%value%' ha fallado", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Las dos muestras especificados no concuerdan', - 'No token was provided to match against' => 'No se ha especificado ninguna muestra a comprobar', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "No se ha encontrado '%value%' en el argumento especificado", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto o un entero', - "'%value%' does not appear to be an integer" => "'%value%' no parece ser un entero", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' does not appear to be a valid IP address" => "'%value%' no parece ser una dirección IP válida", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto o un entero', - "'%value%' is not a valid ISBN number" => "El número ISBN especificado ('%value%') no es válido", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' no es menor que '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'El tipo especificado es inválido, el valor deberí­a ser un float, una cadena de texto, un array, un boolean o un entero', - "Value is required and can't be empty" => 'Se requiere un valor y éste no puede estar vací­o', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' does not appear to be a postal code" => "'%value%' no parece ser un código postal", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'El tipo especificado es incorrecto, el valor deberí­a ser de tipo float, una cadena de texto o un entero', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' no concuerda con el patrón '%pattern%' especificado", - "There was an internal error while using the pattern '%pattern%'" => "Se ha producido un error interno al usar el patrón '%pattern%' especificado", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' no es una especificación válida de frecuencia de cambio", - 'Invalid type given, the value should be a string' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' no es un lastmod de mapa web válido", - 'Invalid type given, the value should be a string' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' no es una ubicación de mapa web válida", - 'Invalid type given, the value should be a string' => 'El tipo especificado es inválido, el valor deberí­a ser una cadena de texto', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' no es una prioridad de mapa web válida", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'El tipo especificado es inválido, el valor deberí­a ser un entero, un float o una cadena de texto numérica', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'El tipo especificado es incorrecto, el valor deberí­a ser una cadena de texto', - "'%value%' is less than %min% characters long" => "'%value%' tiene menos de '%min%' caracteres", - "'%value%' is more than %max% characters long" => "'%value%' tiene más de '%max%' caracteres", -]; diff --git a/resources/languages/fi/Zend_Validate.php b/resources/languages/fi/Zend_Validate.php deleted file mode 100644 index b72bbfda..00000000 --- a/resources/languages/fi/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Epäkelpo syöte. Pitäisi olla liukuluku, merkkijono tai kokonaisluku', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' on virheelinen, ainoastaan aakkoset ja numerot ovat sallittuja", - "'%value%' is an empty string" => "'%value%' on tyhjä merkkijono", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' contains non alphabetic characters" => "'%value%' on virheellinen, ainoastaan aakkoset ovat sallittuja", - "'%value%' is an empty string" => "'%value%' on tyhjä merkkijono", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "Syötteen '%value%' tarkistusluvun vahvistus epäonnistui", - "'%value%' contains invalid characters" => "'%value%' sisältää epäkelpoja merkkejä", - "'%value%' should have a length of %length% characters" => "'%value%' pitäisi olla %length% merkkiä pitkä", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' ei ole luku väliltä %min%-%max%", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' ei ole luku väliltä %min%-%max%, poislukien ylä- ja alarajat", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' on epäkelpo", - 'An exception has been raised within the callback' => 'Odottamaton virhe, callback-validaattori palautti poikkeuksen', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' pitää olla luku väliltä 13-19", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn-algoritmin (mod 10) suoritus syötteelle '%value%' epäonnistui", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "Syötteen '%value%' tarkistusluku on viallinen", - "'%value%' must contain only digits" => "'%value%' saa sisältää ainoastaan numeroita", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' contains an invalid amount of digits" => "'%value%' sisältää väärän määrän numeroita", - "'%value%' is not from an allowed institute" => "'%value%' ei ole sallitun luottolaitoksen alkuosa", - "'%value%' seems to be an invalid creditcard number" => "Luottokortin numero '%value%' tulkittiin virheelliseksi", - "An exception has been raised while validating '%value%'" => "Kortin '%value%' varmennus epäonnistui, palvelu palautti virheen", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono, kokonaisluku, taulukko tai Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' ei ole kelvollinen päivä", - "'%value%' does not fit the date format '%format%'" => "'%value%' ei ole muotoa '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Rekisteristä ei löytynyt arvoa, joka vastaisi syötettä '%value%'", - "A record matching '%value%' was found" => "Rekisteristä löytyi syötettä '%value%' vastaava arvo", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono, kokonaisluku tai liukuluku', - "'%value%' must contain only digits" => "'%value%' on virheellinen, ainoastaan numerot ovat sallittuja", - "'%value%' is an empty string" => "'%value%' on tyhjä merkkijono", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' on virheellinen sähköpostiosoite, ei vastaa muotoa paikallisosa@alue", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' on virheellinen verkkotunnus osoitteelle '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "Osoitteen '%value%' verkkotunnukselle '%hostname%' ei löydy MX-tietuetta", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' ei ole reititettävän verkon osa. Sähköpostiosoitetta '%value%' ei pitäisi selvittää julkisesta verkosta.", - "'%localPart%' can not be matched against dot-atom format" => "Virheellinen paikallisosa, '%localPart%' ei ole verrattavissa dot-atom -muotoon", - "'%localPart%' can not be matched against quoted-string format" => "Virheellinen paikallisosa, '%localPart%' ei ole verrattavissa quoted-string -muotoon", - "'%localPart%' is not a valid local part for email address '%value%'" => "Sähköpostiosoitteen '%value%' paikallisosa '%localPart%' on virheellinen", - "'%value%' exceeds the allowed length" => "Osoite '%value%' on liian pitkä", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Virheellinen määrä tiedostoja, maksimimäärä on '%max%', vastaanotettiin '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Virheellinen määrä tiedostoja, minimimäärä on '%min%', vastaanotettiin '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Tiedoston '%value%' crc32-tarkistusluku ei vastaa annettua", - 'A crc32 hash could not be evaluated for the given file' => 'Tarkistuslukua crc32 ei pystytty määrittämään vastaanotetulle tiedostolle', - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Tiedostolla '%value%' on virheellinen pääte", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Tiedoston '%value%' MIME-tyyppi '%type%' on virheellinen", - "The mimetype of file '%value%' could not be detected" => "Tiedoston '%value%' MIME-tyyppiä ei pystytty todentamaan", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Tiedostoa '%value%' ei ole olemassa", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Tiedostolla '%value%' on virheellinen pääte", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Kaikkien tiedostojen yhteenlaskettu koko saa olla maksimissaan '%max%', vastaanotettiin '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Kaikkien tiedostojen yhteenlaskettu koko pitää olla vähintään '%min%', vastaanotettiin '%size%'", - 'One or more files can not be read' => 'Yhtä tai useampaa tiedostoa ei voida lukea', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Tiedoston '%value%' tarkastusluku ei vastaa annettua", - 'A hash could not be evaluated for the given file' => 'Tarkistuslukua ei pystytty määrittämään vastaanotetulle tiedostolle', - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Kuvan '%value%' maksimileveys on '%maxwidth%', annettu '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Kuvan '%value%' minimileveys on '%minwidth%', annettu '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Kuvan '%value%' maksimikorkeus on '%maxheight%', annettu '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Kuvan '%value%' minimikorkeus on '%minheight%', annettu '%height%'", - "The size of image '%value%' could not be detected" => "Kuvan '%value%' kokoa ei voida todentaa", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Tiedosto '%value%' ei ole pakattu, vastaanotettiin tyyppiä '%type%'", - "The mimetype of file '%value%' could not be detected" => "Tiedoston '%value%' MIME-tyyppiä ei pystytty todentamaan", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Tiedosto '%value%' ei ole kuvatiedosto, vastaanotettiin tyyppiä '%type%'", - "The mimetype of file '%value%' could not be detected" => "Tiedoston '%value%' MIME-tyyppiä ei pystytty todentamaan", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Tiedoston '%value%' tarkistusluku ei vastaa annettua (md5)", - 'A md5 hash could not be evaluated for the given file' => 'Tiedostolle ei voitu määrittää md5-tarkistuslukua', - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Tiedoston '%value%' MIME-tyyppi '%type%' on virheellinen", - "The mimetype of file '%value%' could not be detected" => "Tiedoston '%value%' MIME-tyyppiä ei pystytty todentamaan", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Tiedostoa '%value%' ei ole olemassa", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Tiedoston '%value%' tarkistusluku ei vastaa annettua (sha1)", - 'A sha1 hash could not be evaluated for the given file' => 'Tiedostolle ei voitu määrittää sha1-tarkistuslukua', - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Tiedoston '%value%' maksimikoko on '%max%', vastaanotettu '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Tiedoston '%value%' minimikoko on '%min%', vastaanotettu '%size%'", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voidea lukea tai sitä ei ole", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Tiedosto '%value%' ylittää ini-tiedostossa määritellyn tiedostokoon", - "File '%value%' exceeds the defined form size" => "Tiedosto '%value%' ylittää lomakkeessa määritellyn tiedostokoon", - "File '%value%' was only partially uploaded" => "Tiedosto '%value%' vastaanotettiin ainoastaan osittain", - "File '%value%' was not uploaded" => "Tiedostoa '%value%' ei lähetetty", - "No temporary directory was found for file '%value%'" => "Väliaikaishakemistoa ei löytynyt tiedostolle '%value%'", - "File '%value%' can't be written" => "Tiedostoon '%value%' ei voida kirjoittaa", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP:n lisäosa palautti virheen kesken tiedoston '%value%' lähetyksen", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Tiedoston '%value%' lähetyksessä haivattu laittomuus, mahdollinen hyökkäys", - "File '%value%' was not found" => "Tiedostoa '%value%' ei löydy", - "Unknown error while uploading file '%value%'" => "Tiedoston '%value%' lähetyksessä tapahtui tunnistamaton virhe", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Virheellinen määrä sanoja, maksimäärä on '%max%', annettu '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Virheellinen määrä sanoja, minimimäärä on '%min%', annettu '%count%'", - "File '%value%' is not readable or does not exist" => "Tiedostoa '%value%' ei voida lukea tai sitä ei ole", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Epäkelpo syöte. Pitäisi olla liukuluku, merkkijono tai kokonaisluku', - "'%value%' does not appear to be a float" => "'%value%' ei ole liukuluku", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' ei ole suurempi kuin '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' has not only hexadecimal digit characters" => "'%value%' voi sisältää ainoastaan heksadeslimaalin muotoisia merkkejä", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' näyttäisi olevan ip-osoite eikä verkkotunnus", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' verkkotunnuksen TLD-osa ei ole tunnettu", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' näyttäisi olevan käypä verkkotunnus, mutta sisältää viivan väärässä paikassa", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' näyttäisi olevan käypä verkkotunnus, mutta sen TLD-osa '%tld%' on virheellinen", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' verkkotunnuksen TLD-osaa ei pystytty erottamaan", - "'%value%' does not match the expected structure for a DNS hostname" => "Verkkotunnus '%value%' on jäsennykseltään virheellinen", - "'%value%' does not appear to be a valid local network name" => "'%value%' on epäkelpo paikallisverkkon tunnus", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' tulkittiin paikallisverkon tunnukseksi, jotka eivät ole sallittuja", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "Verkkotunnuksen '%value%' punycode-koodauksen purku epäonnistui", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Maata ei pystytty tunnistamaan IBAN-koodista '%value%'", - "'%value%' has a false IBAN format" => "'%value%' on väärän muotoinen IBAN-koodi", - "'%value%' has failed the IBAN check" => "'%value%' IBAN-koodin tarkastus epäonnistui", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Annetut kaksi arvoa eivät täsmää', - 'No token was provided to match against' => 'Toinen arvoista puuttuu', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' ei löydy sallittujen syötteiden joukosta", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono tai kokonaisluku', - "'%value%' does not appear to be an integer" => "'%value%' ei ole kokonaisluku", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' does not appear to be a valid IP address" => "'%value%' ei ole käypä IP-osoite", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono tai kokonaisluku', - "'%value%' is not a valid ISBN number" => "'%value%' ei ole käypä ISBN-numero", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' ei ole pienempi kuin '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Epäkelpo syöte. Pitäisi olla kokonaisluku, liukuluku, boolean tai taulukko', - "Value is required and can't be empty" => 'Kenttä ei voi olla tyhjä', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono tai kokonaisluku', - "'%value%' does not appear to be a postal code" => "'%value%' ei ole käypä postiosoite", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono, kokonaisluku tai liukuluku', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' ei ole muotoa '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Sisäinen virhe käytettäessa muotoa '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' ei ole käypä sivukartan muutosnopeus", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' ei ole käypä arvo sivukartan viimeksimuokatuksi arvoksi", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' ei ole käypä sivukartan sijainti", - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' ei ole käypä sivukartan prioriteetti", - 'Invalid type given. Numeric string, integer or float expected' => 'Epäkelpo syöte. Pitäisi olla kokonaisluku tai liukuluku', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Epäkelpo syöte. Pitäisi olla merkkijono', - "'%value%' is less than %min% characters long" => "'%value%' on lyhyempi kuin vaaditut %min% merkkiä", - "'%value%' is more than %max% characters long" => "'%value%' on pidempi kuin sallitut %max% merkkiä", -]; diff --git a/resources/languages/fr/Zend_Validate.php b/resources/languages/fr/Zend_Validate.php deleted file mode 100644 index 4095b73f..00000000 --- a/resources/languages/fr/Zend_Validate.php +++ /dev/null @@ -1,130 +0,0 @@ - "'%hostname%' ne semble pas avoir d'enregistrement MX valide pour l'adresse email '%value%'", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' n'est pas un nom d'hôte valide pour l'adresse email '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' n'est pas dans un segment réseau routable. L'adresse email '%value%' ne devrait pas être résolue depuis un réseau public.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' ne correspond pas au format dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' ne correspond pas au format quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' n'est pas une partie locale valide pour l'adresse email '%value%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' semble être un nom d'hôte DNS mais l'extension TLD ne peut être extraite", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' semble être un nom d'hôte DNS mais son extension TLD semble inconnue", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' semble être un nom d'hôte DNS valide mais ne correspond pas au schéma de l'extension TLD '%tld%'", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' semble être un nom d'hôte DNS mais il contient un tiret à une position invalide", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' semble être un DNS valide mais le code n'a pu être décodé", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' semble être un nom réseau local mais les noms locaux sont interdits", - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' semble être une IP valide mais celles-ci ne sont pas autorisées", - "'%value%' contains an invalid amount of digits" => "'%value%' contient un nombre incorrect de chiffres", - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contient des caractères non alphabétiques et non numériques", - "'%value%' contains invalid characters" => "'%value%' contient des caractères invalides", - "'%value%' contains non alphabetic characters" => "'%value%' contient des caractères non alphabétiques", - "'%value%' does not appear to be a float" => "'%value%' ne semble pas être de type flottant", - "'%value%' does not appear to be a postal code" => "'%value%' ne semble pas être un code postal valide", - "'%value%' does not appear to be a valid IP address" => "'%value%' n'est pas une IP valide", - "'%value%' does not appear to be a valid date" => "'%value%' ne semble pas être une date valide", - "'%value%' does not appear to be a valid local network name" => "'%value%' ne semble pas être une adresse réseau local valide", - "'%value%' does not appear to be an integer" => "'%value%' n'est pas un entier", - "'%value%' does not fit the date format '%format%'" => "'%value%' ne correspond pas au format de date '%format%'", - "'%value%' does not match against pattern '%pattern%'" => "'%value%' n'a pas de correspondance avec le motif '%pattern%'", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' ne correspond pas à la structure d'un nom d'hôte DNS valide", - "'%value%' exceeds the allowed length" => "'%value%' excède la taille autorisée", - "'%value%' failed checksum validation" => "'%value%' ne passe pas la validation de somme de contrôle", - "'%value%' has a false IBAN format" => "'%value%' n'a pas un format IBAN valide", - "'%value%' has failed the IBAN check" => "'%value%' n'a pas passé la validation IBAN", - "'%value%' has not only hexadecimal digit characters" => "'%value%' ne contient pas uniquement des caractères héxadécimaux", - "'%value%' is an empty string" => "'%value%' est une chaîne vide", - "'%value%' is less than %min% characters long" => "La taille de '%value%' est inférieure à %min% caractères", - "'%value%' is more than %max% characters long" => "La taille de '%value%' est supérieure à %max% caractères", - "'%value%' is not a valid ISBN number" => "'%value%' n'est pas un ISBN valide", - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' n'est pas un email valide dans le format local-part@hostname", - "'%value%' is not a valid sitemap changefreq" => "'%value%' n'est pas une valeur de fréquence de sitemap valide", - "'%value%' is not a valid sitemap lastmod" => "'%value%' n'est pas une date de modification de sitemap valide", - "'%value%' is not a valid sitemap location" => "'%value%' n'est pas un emplacement valide pour une sitemap", - "'%value%' is not a valid sitemap priority" => "'%value%' n'est pas une priorité sitemap valide", - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' n'est pas comprise entre '%min%' et '%max%', inclusivement", - "'%value%' is not from an allowed institute" => "'%value%' ne provient pas d'une institution autorisée", - "'%value%' is not greater than '%min%'" => "'%value%' n'est pas plus grand que '%min%'", - "'%value%' is not less than '%max%'" => "'%value%' n'est pas plus petit que '%max%'", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' n'est pas strictement comprise entre '%min%' et '%max%'", - "'%value%' is not valid" => "'%value%' n'est pas valide", - "'%value%' must contain between 13 and 19 digits" => "'%value%' doit contenir entre 13 et 19 chiffres", - "'%value%' must contain only digits" => "'%value%' ne doit contenir que des chiffres", - "'%value%' seems to be an invalid creditcard number" => "'%value%' ne semble pas être une carte de crédit valide", - "'%value%' seems to contain an invalid checksum" => "'%value%' semble contenir un somme de vérification invalide", - "'%value%' should have a length of %length% characters" => "'%value%' devrait avoir une taille de %length% caractères", - "'%value%' was not found in the haystack" => "'%value%' ne fait pas partie des valeurs attendues", - "A PHP extension returned an error while uploading the file '%value%'" => "Une extension PHP a retourné une erreur lors de l'envoi du fichier '%value%'", - 'A crc32 hash could not be evaluated for the given file' => "La somme de contrôle crc32 n'a pas pu être évaluée pour le fichier", - 'A hash could not be evaluated for the given file' => "Une somme de contrôle n'a pas pu être calculée pour le fichier", - 'A md5 hash could not be evaluated for the given file' => "Une somme de contrôle MD5 n'a pas pu être calculée pour le fichier", - "A record matching '%value%' was found" => "Un enregistrement a été trouvé pour '%value%'", - 'A sha1 hash could not be evaluated for the given file' => "La valeur de somme de contrôle SHA-1 n'a pas pu être calculée pour le fichier", - 'An exception has been raised within the callback' => 'Une exception a été levée par la fonction de rappel', - "An exception has been raised while validating '%value%'" => "Une exception a été levée lors de la validation de '%value%'", - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Tous les fichiers devraient avoir une taille maximale de '%max%' mais une taille de '%size%' a été détectée", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Tous les fichiers devraient avoir une taille minimale de '%min%' mais une taille de '%size%' a été détectée", - "File '%value%' can't be written" => "Le fichier '%value%' ne peut être écrit", - "File '%value%' does not exist" => "Le fichier '%value%' n'existe pas", - "File '%value%' does not match the given crc32 hashes" => "Le fichier '%value%' ne correspond pas à la somme de contrôle crc32", - "File '%value%' does not match the given hashes" => "Le fichier '%value%' ne correspond pas à la somme de contrôle", - "File '%value%' does not match the given md5 hashes" => "Le fichier '%value%' ne correspond pas à la somme de contrôle MD5", - "File '%value%' does not match the given sha1 hashes" => "Le fichier '%value%' ne correspond pas à la somme de contrôle SHA-1", - "File '%value%' exceeds the defined form size" => "Le fichier '%value%' excède la taille requise par le formulaire", - "File '%value%' exceeds the defined ini size" => "Le fichier '%value%' excède la taille requise par le fichier ini", - "File '%value%' exists" => "Le fichier '%value%' existe déja", - "File '%value%' has a false extension" => "Le fichier '%value%' n'a pas la bonne extension", - "File '%value%' has a false mimetype of '%type%'" => "Le fichier '%value%' a un mauvais type MIME : '%type%'", - "File '%value%' is no image, '%type%' detected" => "Le fichier '%value%' n'est pas une image : '%type%' détecté", - "File '%value%' is not compressed, '%type%' detected" => "Le fichier '%value%' n'est pas compressé : '%type%' détecté", - "File '%value%' is not readable or does not exist" => "Le fichier '%value%' n'est pas lisible ou n'existe pas", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Fichier '%value%' mal envoyé. Ceci peut être possiblement une attaque", - "File '%value%' was not found" => "Fichier '%value%' introuvable", - "File '%value%' was not uploaded" => "Le fichier '%value%' n'a pas été envoyé", - "File '%value%' was only partially uploaded" => "Le fichier '%value%' n'a été que partiellement envoyé", - 'Invalid type given. Numeric string, integer or float expected' => 'Type invalide. Chaîne numérique, entier ou flottant attendu', - 'Invalid type given. String expected' => 'Type invalide. Chaîne attendue', - 'Invalid type given. String or integer expected' => 'Type invalide. Chaîne ou entier attendu', - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Type invalide. Chaîne, entier, tableau ou Zend_Date attendu', - 'Invalid type given. String, integer, float, boolean or array expected' => 'Type invalide. Chaîne, entier, flottant, booléen ou tableau attendu', - 'Invalid type given. String, integer or float expected' => 'Type invalide. Chaîne, entier ou flottant attendu', - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "L'algorithme Luhn (somme de contrôle mod-10) a échoué pour '%value%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "La hauteur maximale de l'image '%value%' devrait être '%maxheight%' mais '%height%' a été détectée", - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "La taille maximale requise pour le fichier '%value%' est de '%max%' mais '%size%' a été détecté", - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "La largeur maximale de l'image '%value%' devrait être '%maxwidth%' mais '%width%' a été détectée", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "La hauteur minimale de l'image '%value%' devrait être '%minheight%' mais '%height%' a été détectée", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "La taille minimale requise pour le fichier '%value%' est de '%min%' mais '%size%' a été détecté", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "La largeur minimale de l'image '%value%' devrait être '%minwidth%' mais '%width%' a été détectée", - "No record matching '%value%' was found" => "Aucun enregistrement trouvé pour '%value%'", - "No temporary directory was found for file '%value%'" => "Pas de dossier temporaire trouvé pour le fichier '%value%'", - 'No token was provided to match against' => "Aucun jeton de correspondance n'a été donné", - 'One or more files can not be read' => "Un ou plusieurs fichiers n'est pas lisible", - "The mimetype of file '%value%' could not be detected" => "Le type MIME du fichier '%value%' n'a pu être détecté", - "The size of image '%value%' could not be detected" => "La taille de l'image '%value%' n'a pas pu être détectée", - 'The two given tokens do not match' => 'Les deux jetons passés ne correspondent pas', - "There was an internal error while using the pattern '%pattern%'" => "Il y a eu une erreur interne lors de l'utilisation du motif '%pattern%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Trop peu de fichiers : un minimum de '%min%' est autorisé mais '%count%' ont été fournis", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Trop peu de mots, un minimum de '%min%' est requis, '%count%' ont été fournis", - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Trop de fichiers : un maximum de'%max%' est autorisé mais '%count%' ont été fournis", - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Trop de mots, un maximum de '%max%' est requis, '%count%' ont été fournis", - "Unknown country within the IBAN '%value%'" => "Pays inconnu pour l'IBAN '%value%'", - "Unknown error while uploading file '%value%'" => "Erreur inconnue lors de l'envoi du fichier '%value%'", - "Value is required and can't be empty" => 'Cette valeur est obligatoire et ne peut être vide', -]; diff --git a/resources/languages/hr/Zend_Validate.php b/resources/languages/hr/Zend_Validate.php deleted file mode 100644 index 116fe75c..00000000 --- a/resources/languages/hr/Zend_Validate.php +++ /dev/null @@ -1,258 +0,0 @@ - 'Neispravan tip, vrijednost bi trebala biti niz slova, brojki ili realni broj', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' sadrži znakove koji nisu ni slova ni brojke", - "'%value%' is an empty string" => "'%value%' je prazan niz", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost mora biti niz slova', - "'%value%' contains non alphabetic characters" => "'%value%' sadrži znakove koji nisu slova", - "'%value%' is an empty string" => "'%value%' je prazan niz", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' nije prošao provjeru", - "'%value%' contains invalid characters" => "'%value%' sadrži neispravne znakove", - "'%value%' should have a length of %length% characters" => "'%value%' bi trebao imati dužinu od %length% znakova", - 'Invalid type given, value should be string' => 'Neispravan tip, vrijedno mora biti niz znakova', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' nije između '%min%' i '%max%', uključivo", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' nije strogo između '%min%' i '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' nije ispravan", - 'Failure within the callback, exception returned' => 'Pogreška sa povratnim pozivom, iznimka vraćena', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' mora sadržavati između 13 i 19 znamenki", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algoritam (mod-10 provjera) nije prošla na '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algoritam (mod-10 provjera) nije prošla na '%value%'", - "'%value%' must contain only digits" => "'%value%' mora sadržavati samo znamenke", - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost mora biti niz znakova', - "'%value%' contains an invalid amount of digits" => "'%value%' sadrži neispravan broj znamenki", - "'%value%' is not from an allowed institute" => "'%value%' nije iz dozvoljene institucije", - "Validation of '%value%' has been failed by the service" => "Servis nije odobrio provjeru '%value%'", - "The service returned a failure while validating '%value%'" => "Servis je vratio pogrešku provjeravajući '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'Neispravan tip, vrijednost mora biti niz znakova, broj, polje ili Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' ne izgleda kao ispravan datum", - "'%value%' does not fit the date format '%format%'" => "'%value%' ne odgovara formatu datuma '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Nije pronađen zapis koji se podudara sa %value%', - "A record matching '%value%' was found" => 'Zapis koji se podudara sa %value% je pronađen', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Neispravan tip, vrijednost bi trebala biti niz slova, brojki ili realni broj', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' sadrži znakove koji nisu znamenke; samo znamenke su dozvoljene", - "'%value%' is an empty string" => "'%value%' je prazan niz", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost bi trebala biti niz', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' nije ispravna email adresa u osnovnom formatu lokalni-dio@ime-poslužitelja", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' nije ispravno ime poslužitelja za email adresu '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' nema ispravan MX zapis za email adresu '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' nije u rutabilnom mrežnom segmentu. Email adresa '%value%' ne bi smjela biti razlučiva iz javne mreže.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' se ne podudara s dot-atom formatom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' se ne podudara s 'quoted-string' formatom", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' nije ispravan lokalni dio za email adresu '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' je duža od dozvoljene dužine", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Previše datoteka, maksimalno '%max%' je dozvoljeno, a '%count%' je zadano", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Premalo datoteka, minimalno '%min%' se očekuje a '%count%' je zadano", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Datoteka '%value%' se ne podudara sa zadanim crc32 hash-em", - 'A crc32 hash could not be evaluated for the given file' => 'crc32 hash se ne može izračunati za zadanu datoteku', - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Datoteka '%value%' ima neispravnu ekstenziju", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Datoteka '%value%' ima neispravan 'mime' tip '%type%'", - "The mimetype of file '%value%' could not be detected" => "'Mime' tip datoteke '%value%' nije moguće detektirati", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Datoteka '%value%' ne postoji", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Datoteka '%value%' ima neispravnu ekstenziju", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Sve datoteke zajedno mogu imati maksimalnu veličinu od '%max%', a imaju '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Sve datoteke zajedno moraju imati minimalnu veličinu od '%min%', a imaju '%size%'", - 'One or more files can not be read' => 'Jednu ili više datoteka nije moguće pročitati', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Datoteka '%value%' ne odgovara danom 'hashu'", - 'A hash could not be evaluated for the given file' => "'Hash' nije moguće izračunati za zadanu datoteku", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maksimalna dozvoljena širina slike '%value%' je '%maxwidth%', slika je široka '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimalna očekivana širina slike '%value%' je '%minwidth%' slika je široka '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maksimalna dozvoljena visina slike '%value%' je '%maxheight%', slika je visoka '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimalna očekivana visina slike '%value%' je '%minheight%', slika je visoka '%height%'", - "The size of image '%value%' could not be detected" => "Dimenzije slike '%value%' nije moguće otkriti", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Datoteka '%value%' nije kompresirana, datoteka je tipa '%type%'", - "The mimetype of file '%value%' could not be detected" => "'Mime' tip datoteke '%value%' nije moguće detektirati", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Datoteka '%value%' nije slika, datoteka je tipa '%type%'", - "The mimetype of file '%value%' could not be detected" => "'Mime' tip datoteke '%value%' nijem moguće detektirati", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Datoteka '%value%' ne odgovara zadanom md5 hash-u", - 'A md5 hash could not be evaluated for the given file' => 'Md5 hash nije moguće izračunati za zadanu datoteku', - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Datoteka '%value%' ima neispravan 'mime' tip '%type%'", - "The mimetype of file '%value%' could not be detected" => "'Mime' tip datoteke '%value%' nije moguće detektirati", - "File '%value%' can not be read" => "Datoteku '%value%' nije moguće pročitati", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Datiteja '%value%' postoji", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Datoteka '%value%' ne odgovara zadanom sha1 hash-u", - 'A sha1 hash could not be evaluated for the given file' => 'Sha1 hash se ne može izračunati za zadanu datoteku', - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maksimalna dozvoljena veličina datoteka '%value%' je '%max%', datoteka je velika '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimalna dozvoljena veličina datoteke '%value%' je '%min%', datoteka je velika '%size%'", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Datoteka '%value%' prelazi veličinu definiranu u ini datoteci", - "File '%value%' exceeds the defined form size" => "Datoteka '%value%' prelazi veličinu definiranu u formi", - "File '%value%' was only partially uploaded" => "Datoteka '%value%' je samo djelomično poslana", - "File '%value%' was not uploaded" => "Datoteka '%value%' nije poslana", - "No temporary directory was found for file '%value%'" => "Nije pronađen privremeni direktorij za datoteku '%value%'", - "File '%value%' can't be written" => "Datoteku '%value%' nije moguće zapisati", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP ekstenzija je vratila pogrešku prilikom slanja datoteke '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Datoteka '%value%' je nelegalno poslana. Ovo bi mogao biti napad", - "File '%value%' was not found" => "Datoteka '%value%' nije pronađena", - "Unknown error while uploading file '%value%'" => "Nepoznata pogreška prilikom slanja datoteke '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Previše riječi, maksimalno '%max%' riječi je dozvoljeno, a ima ih '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Premalo riječi, očekuje se minimalno '%min%' riječi, a ima ih '%count%' ", - "File '%value%' could not be found" => "Datoteku '%value%' nije moguće pronaći", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Neispravan tip, vrijednost bi trebala biti niz slova, brojki ili realni broj', - "'%value%' does not appear to be a float" => "'%value%' nije realni broj", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' nije veće od '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost bi trebala biti niz', - "'%value%' has not only hexadecimal digit characters" => "'%value%' nema samo heksadekadske znamenke", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Neispravan tup, vrijednost bi trebala biti niz', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' izgleda kao IP adresa, IP adrese nisu dozvoljene", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' izgleda kao DNS ime poslužitelja, ali ne mogu pronaći vršnu domenu u listi poznatih", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' izgleda kao DNS ime poslužitelja, ali ima crtu ne neispravnoj poziciji", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' izgleda kao DNS ime poslužitelja ali se ne podudara sa shemom imena poslužitelja za vršnu domenu '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' izgleda kao DNS ime poslužitelja, ali ne mogu izvući dio koji označava vršnu domenu", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' se ne podudara sa očekivanom strukturom DNS imena poslužitelja", - "'%value%' does not appear to be a valid local network name" => "'%value%' ne izgleda kao ispravno ime lokalne mreže", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' izgleda kao ime lokalne mreže, ali imena lokalnih mreža nisu dozvoljena", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' izgleda kao DNS ime poslužitelja ali zadanu 'punycode' notaciju nije moguće dekodirati", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Nepoznata zemlja unutar IBAN-a '%value%'", - "'%value%' has a false IBAN format" => "'%value%' ima neispravan IBAN format", - "'%value%' has failed the IBAN check" => "'%value%' nije prošlo IBAN provjeru", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Zadane vrijednosti se ne podudaraju', - 'No token was provided to match against' => 'Nije zadano vrijednost s kojom se treba usporediti', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "Vrijednost '%value%' nije pronađena u polju", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Neispravan tip, vrijednost bi trebala biti niz ili cijeli broj', - "'%value%' does not appear to be an integer" => "'%value%' ne izgleda kao cijeli broj", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - "'%value%' does not appear to be a valid IP address" => "'%value%' ne izgleda kao ispravna IP adresa", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'Neispravan tip, vrijednost mora biti niz ili cijeli broj', - "'%value%' is not a valid ISBN number" => "'%value%' nije ispravan ISBN broj", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' nije manje od '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => "Neispravan tip, vrijednost mora biti realni broj, niz, polje, cijeli broj ili 'boolean'", - "Value is required and can't be empty" => 'Vrijednost ne smije biti prazna', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'Neispravan tip. Vrijednost mora biti niz ili cijeli broj', - "'%value%' does not appear to be a postal code" => "'%value%' ne izgleda kao poštanski kod", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Neispravan tip, vrijednost mora biti niz, cijeli ili realni broj', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' se ne podudara sa uzorkom '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Došlo je do interne pogreške prilikom korištenja uzorka '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' nije ispravna vrijednost za sitemap 'changefreq'", - 'Invalid type given, the value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' nije ispravna vrijednost za sitemap 'lastmod'", - 'Invalid type given, the value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' nije ispravna lokacija za 'sitemap'", - 'Invalid type given, the value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' nije ispravna vrijednost za sitemap 'priority'", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'Neispravan tip, vrijednost mora biti cijeli broj, realni broj ili niz znamenki', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Neispravan tip, vrijednost mora biti niz', - "'%value%' is less than %min% characters long" => "'%value%' ima manje od %min% znaka", - "'%value%' is more than %max% characters long" => "'%value%' ima više od %max% znakova", -]; diff --git a/resources/languages/it/Zend_Validate.php b/resources/languages/it/Zend_Validate.php deleted file mode 100644 index 218442e4..00000000 --- a/resources/languages/it/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - "Tipo di dato non valido: il dato dev'essere di tipo float, stringa o intero.", - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contine caratteri che non sono alfanumerici", - "'%value%' is an empty string" => "'%value%' è una stringa vuota", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' contains non alphabetic characters" => "'%value%' contiene caratteri non alfabetici", - "'%value%' is an empty string" => "'%value%' è una stringa vuota", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' non ha un checksum valido", - "'%value%' contains invalid characters" => "'%value%' contiene caratteri non permessi", - "'%value%' should have a length of %length% characters" => "'%value%' non ha la lunghezza corretta di %length% caratteri", - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' non è compreso tra '%min%' e '%max%', inclusi", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' non è strettamente compreso tra '%min%' e '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' non è valido", - 'Failure within the callback, exception returned' => 'Callback fallita, eccezione ritornata', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' deve contenere tra 13 e 19 cifre", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "L'algoritmo di Luhn (checksum mod-10) è fallito su '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "L'algoritmo di Luhn (checksum mod-10) è fallito su '%value%'", - "'%value%' must contain only digits" => "'%value%' deve contenere solo cifre", - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' contains an invalid amount of digits" => "'%value%' contiene un numero non valido di cifre", - "'%value%' is not from an allowed institute" => "'%value%' proviene da un istituto non supportato", - "Validation of '%value%' has been failed by the service" => "'%value%' non è stato validato dal servizio", - "The service returned a failure while validating '%value%'" => "Il servizio ha ritornato validazione negativa per '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => "Tipo di dato non valido, il dato dev'essere di tipo stringa, intero, array o Zend_Date", - "'%value%' does not appear to be a valid date" => "'%value%' non sembra essere una data valida", - "'%value%' does not fit the date format '%format%'" => "'%value%' non corrisponde al formato data '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Non è stato trovato una riga con valore %value%', - "A record matching '%value%' was found" => "E' già stata trovata una riga con valore %value%", - - // Zend_Validate_Digits - 'Invalid type given, value should be float, string, or integer' => "Tipo di dato non valido: il dato dev'essere di tipo float, stringa o intero.", - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' contiene caratteri che non sono cifre, ma solo le cifre sono ammesse", - "'%value%' is an empty string" => "'%value%' è una stringa vuota", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' non è un indirizzo email valido nel formato base local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' non è un hostname valido nell'indirizzo email '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' non sembra avere un record MX DNS valido nell'indirizzo email %value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' non è in un segmento di rete routabile. L'indirizzo email '%value%' non può essere risolto nella rete pubblica.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' non può essere validato nel formato dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' non può essere validato nel formato quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' non è una local part valida nell'indirizzo email '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' supera la lunghezza consentita", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Troppi file, sono consentiti massimo '%max%' file ma ne sono stati passati '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Troppi pochi file, sono attesi minimo '%min%' file ma ne sono stato passati solo '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Il file '%value%' non ha un hash crc32 tra quelli consentiti", - 'A crc32 hash could not be evaluated for the given file' => "L'hash crc32 non può essere calcolato per il file dato", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Il file '%value%' ha un'estensione invalida", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => " Il file '%value%' ha un mimetype non consentito: '%type%'", - "The mimetype of file '%value%' could not be detected" => "Il mimetype del file '%value%' non può essere individuato", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Il file '%value%' non esiste", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Il file '%value%' ha un'estensione invalida", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "I file devono avere in totale una dimensione massima di '%max%' ma è stata rilevata una dimensione di '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "I file devono avere in totale una dimensione minima di '%min%' ma è stata rilevata una dimensione di '%size%'", - 'One or more files can not be read' => 'Uno o più file non possono essere letti', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "I file '%value%' non corrisponde agli hash dati", - 'A hash could not be evaluated for the given file' => 'Un hash non può essere valutato per il file dato', - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "La larghezza massima consentita per l'immagine '%value%' è '%maxwidth%' ma è stata rilevata una larghezza di '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "La larghezza minima consentita per l'immagine '%value%' è '%minwidth%' ma è stata rilevata una larghezza di '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "L'altezza massima consentita per l'immagine '%value%' è '%maxheight%' ma è stata rilevata un'altezza di '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "L'altezza minima consentita per l'immagine '%value%' è '%minheight%' ma è stata rilevata un'altezza di '%height%'", - "The size of image '%value%' could not be detected" => "Le dimensioni dell'immagine '%value%' non possono essere rilevate", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Il file '%value%' non è un file compresso, ma un file di tipo '%type%'", - "The mimetype of file '%value%' could not be detected" => "Il mimetype del file '%value%' non può essere rilevato", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Il file '%value%' non è un'immagine, ma un file di tipo '%type%'", - "The mimetype of file '%value%' could not be detected" => "Il mimetype del file '%value%' non può essere rilevato", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Il file '%value%' non corrisponde agli hash md5 dati", - 'A md5 hash could not be evaluated for the given file' => 'Un hash md5 non può essere valutato per il file dato', - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Il file '%value%' ha un mimetype invalido: '%type%'", - "The mimetype of file '%value%' could not be detected" => "Il mimetype del file '%value%' non può essere rilevato", - "File '%value%' can not be read" => "Il file '%value%' non può essere letto", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Il file '%value%' esiste già", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Il file '%value%' non corrisponde agli hash sha1 dati", - 'A sha1 hash could not be evaluated for the given file' => 'Un hash sha1 non può essere valutato per il file dato', - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "La dimensione massima consentita per il file '%value%' è '%max%' ma è stata rilevata una dimensione di '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "La dimensione minima consentita per il file '%value%' è '%min%' ma è stata rilevata una dimensione di '%size%'", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Il file '%value%' eccede la dimensione definita nell'ini", - "File '%value%' exceeds the defined form size" => "Il file '%value%' eccede la dimensione definita nella form", - "File '%value%' was only partially uploaded" => "Il file '%value%' è stato caricato solo parzialmente", - "File '%value%' was not uploaded" => "Il file '%value%' non è stato caricato", - "No temporary directory was found for file '%value%'" => "Non è stata trovata una directory temporanea per il file '%value%'", - "File '%value%' can't be written" => "Il file '%value%' non può essere scritto", - "A PHP extension returned an error while uploading the file '%value%'" => "Un'estensione di PHP ha generato un errore durante il caricamento del file '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Il file '%value%' è stato caricato irregolarmente. Potrebbe trattarsi di un attacco", - "File '%value%' was not found" => "Il file '%value%' non è stato trovato", - "Unknown error while uploading file '%value%'" => "Errore sconosciuto durante il caricamento del file '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Il file contiene troppe parole, ne sono consentite massimo '%max%' ma ne sono state contate '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Il file contiene troppe poche parole, ne sono consentite minimo '%min%' ma ne sono state contate '%count%'", - "File '%value%' could not be found" => "Il file '%value%' non può essere trovato", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => "Tipo di dato non valido: il dato dev'essere di tipo float, stringa o intero.", - "'%value%' does not appear to be a float" => "'%value%' non sembra essere un dato di tipo float", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' non è maggiore di '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' has not only hexadecimal digit characters" => "'%value%' non è composto solo da caratteri esadecimali", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' sembra essere un indirizzo IP, ma gli indirizzi IP non sono consentiti", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' sembra essere un hostname DNS ma il suo TLD è sconosciuto", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' sembra essere un hostname DNS ma contiene un trattino in una posizione non valida", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' sembra essere un hostname DNS ma non rispetta lo schema per il TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' sembra essere un hostname DNS ma non è possibile estrarne il TLD", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' non sembra rispettare la struttura attesa per un hostname DNS", - "'%value%' does not appear to be a valid local network name" => "'%value%' non sembra essere un local network name valido", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' sembra essere un local network name, ma i local network names non sono consentiti", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' sembra essere un hostname DNS ma la notazione punycode data non può essere decodificata", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Country Code sconosciuto nell'IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' ha un formato IBAN non valido", - "'%value%' has failed the IBAN check" => "'%value%' ha fallito il controllo IBAN", - - // Zend_Validate_Identical - "The token '%token%' does not match the given token '%value%'" => "Il token '%token%' non corrisponde al token dato '%value%'", - 'No token was provided to match against' => 'Non è stato dato nessun token per il confronto', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' non è stato trovato nell'array", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => "Tipo di dato non valido, il dato dev'essere una stringa o un intero", - "'%value%' does not appear to be an integer" => "'%value%' non sembra essere un intero", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' does not appear to be a valid IP address" => "'%value%' non sembra essere un indirizzo IP valido", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => "Tipo di dato non valido, il dato dev'essere una stringa o un intero", - "'%value%' is not a valid ISBN number" => "'%value%' non è un numero ISBN valido", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' non è minore di '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => "Tipo di dato non valido, il dato dev'essere di tipo float, stringa, array, booleano o intero", - "Value is required and can't be empty" => 'Il dato è richiesto e non può essere vuoto', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => "Tipo di dato non valido. Il dato dev'essere una stringa o un intero", - "'%value%' does not appear to be a postal code" => "'%value%' non sembra essere un codice postale", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => "Tipo di dato non valido: il dato dev'essere di tipo stringa, intero o float.", - "'%value%' does not match against pattern '%pattern%'" => "'%value%' non corrisponde al pattern '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Si è verificato un errore interno usando il pattern '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' non è una sitemap changefreq valida", - 'Invalid type given, the value should be a string' => 'Invalid type given, the value should be a string', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' non è un sitemap lastmod valido", - 'Invalid type given, the value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' non è una sitemap location valida", - 'Invalid type given, the value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' non è una sitemap priority valida", - 'Invalid type given, the value should be a integer, a float or a numeric string' => "Tipo di dato non valido, il dato dev'essere di tipo intero, float o una stringa numerica", - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => "Tipo di dato non valido, il dato dev'essere una stringa", - "'%value%' is less than %min% characters long" => "'%value%' è meno lungo di %min% caratteri", - "'%value%' is more than %max% characters long" => "'%value%' è più lungo di %max% caratteri", -]; diff --git a/resources/languages/ja/Zend_Validate.php b/resources/languages/ja/Zend_Validate.php deleted file mode 100644 index 62b529d5..00000000 --- a/resources/languages/ja/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - '不正な形式です。文字列、整数もしくは小数が期待されています', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' にアルファベットと数字以外の文字が含まれています", - "'%value%' is an empty string" => "'%value%' は空の文字列です", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' contains non alphabetic characters" => "'%value%' にアルファベット以外の文字が含まれています", - "'%value%' is an empty string" => "'%value%' は空の文字列です", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' はチェックサムが一致していません", - "'%value%' contains invalid characters" => "'%value%' は不正な文字を含んでいます", - "'%value%' should have a length of %length% characters" => "'%value%' は %length% 文字である必要があります", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' は '%min%' 以上 '%max%' 以下ではありません", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' は '%min%' 以下か '%max%' 以上です", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' は正しくありません", - 'An exception has been raised within the callback' => 'コールバック内で例外が発生しました', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' は 13 桁から 19 桁の数字でなければなりません", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "'%value%' でルーンアルゴリズム(mod-10 チェックサム)に失敗しました", - - // Zend_Validate_CreditCard - "%value%' seems to contain an invalid checksum" => "'%value%' は不正なチェックサムを含んでいるようです", - "'%value%' must contain only digits" => "'%value%' は数値だけで構成される必要があります", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' contains an invalid amount of digits" => "'%value%' は不正な桁数です", - "'%value%' is not from an allowed institute" => "'%value%' は認可機関から許可されていません", - "%value%' seems to be an invalid creditcard number" => "'%value%' は不正なクレジットカード番号を含んでいるようです", - "An exception has been raised while validating '%value%" => "'%value%' を検証中に例外が発生しました", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => '不正な形式です。値は文字列、整数、配列もしくは Zend_Date 形式である必要があります', - "'%value%' does not appear to be a valid date" => "'%value%' は正しい日付ではないようです", - "'%value%' does not fit the date format '%format%'" => "'%value%' は '%format%' フォーマットに一致していません", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => " '%value%' に一致するレコードは見つかりませんでした", - "A record matching '%value%' was found" => " '%value%' に一致するレコードが見つかりました", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => '不正な形式です。文字列、整数または小数が期待されています', - "%value%' must contain only digits" => "'%value%' は数字のみである必要があります", - "'%value%' is an empty string" => "'%value%' は空の文字列です", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' is no valid email address in the basic format local-part@hostname" => "'%value%' はメールアドレスの基本的な形式 local-part@hostname ではありません", - "'%hostname%' is not a valid hostname for email address '%value%'" => "メールアドレス '%value%' 内の '%hostname%' は有効なホスト名ではありません", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "メールアドレス '%value%' 内の '%hostname%' は有効な MX レコードではないようです", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' はネットワークセグメントにありません。メールアドレス '%value%' はパブリックなネットワークから名前解決できませんでした", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' はドットアトム形式ではありません", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' は引用文字列形式ではありません", - "'%localPart%' is no valid local part for email address '%value%'" => "メールアドレス '%value%' 内の '%localPart%' は有効なローカルパートではありません", - "'%value%' exceeds the allowed length" => "'%value%' は許された長さを超えています", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "ファイル数が多すぎます。最大 '%max%' まで許されていますが、 '%count%' 個指定しました", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "ファイル数が少なすぎます。最小 '%min%' 以上の必要がありますが、 '%count%' 個指定されていません", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "ファイル '%value%' は crc32 ハッシュ値と一致しませんでした", - 'A crc32 hash could not be evaluated for the given file' => 'ファイルに crc32 ハッシュ値が見つかりませんでした', - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "ファイル '%value%' は誤った拡張子です", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "ファイル '%value%' は誤った mimetype '%type%' です", - "The mimetype of file '%value%' could not be detected" => "ファイル '%value%' の mimetype が見つかりませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "ファイル '%value%' は存在しません", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "ファイル '%value%' は誤った拡張子です", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "全てのファイルの合計は最大 '%max%' より小さい必要があります。しかしファイルサイズは '%size%' でした", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "全てのファイルの合計は最小 '%min%' より大きい必要があります。しかしファイルサイズは '%size%' でした", - 'One or more files can not be read' => 'ファイルを読み込めませんでした', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "ファイル '%value%' は設定されたハッシュ値と一致しませんでした", - 'A hash could not be evaluated for the given file' => '渡されたファイルのハッシュ値を評価できませんでした', - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "画像 '%value%' の横幅は '%width%' でした。横幅は最大 '%maxwidth%' まで許されています", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "画像 '%value%' の横幅は '%width%' でした。横幅は最小 '%minwidth%' 以上である必要があります", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "画像 '%value%' の高さは '%height%' でした。高さは最大 '%maxheight%' まで許されています", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "画像 '%value%' の高さは '%height%' でした。高さは最小 '%minheight%' 以上である必要があります", - "The size of image '%value%' could not be detected" => "画像 '%value%' の大きさを取得できませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => " '%type%' が見つかりました。ファイル '%value%' は圧縮されていません", - "The mimetype of file '%value%' could not be detected" => "ファイル '%value%' の Mimetype は見つかりませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "ファイル '%value%' は画像ではありません。 '%type%' です", - "The mimetype of file '%value%' could not be detected" => "ファイル '%value%' の Mimetype は見つかりませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "ファイル '%value%' は md5 ハッシュ値と一致していません", - 'A md5 hash could not be evaluated for the given file' => '渡されたファイルの md5 ハッシュ値を評価できませんでした', - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "ファイル '%value%' は誤った MimeType '%type%' です", - "The mimetype of file '%value%' could not be detected" => "ファイル '%value%' の Mimetype は見つかりませんでした", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "ファイル '%value%' は存在しています", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "ファイル '%value%' は sha1 ハッシュ値と一致していません", - 'A sha1 hash could not be evaluated for the given file' => '渡されたファイルの sha1 ハッシュ値を評価できませんでした', - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "ファイルサイズは '%size%' です。ファイル '%value%' のサイズは最大 '%max%' まで許されています", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "ファイルサイズは '%size%' です。ファイル '%value%' のサイズは最小 '%min%' 以上必要です", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "ファイル '%value%' は ini で定義されたサイズを超えています", - "File '%value%' exceeds the defined form size" => "ファイル '%value%' はフォームで定義されたサイズを超えています", - "File '%value%' was only partially uploaded" => "ファイル '%value%' は一部のみしかアップロードされていません", - "File '%value%' was not uploaded" => "ファイル '%value%' はアップロードされませんでした", - "No temporary directory was found for file '%value%'" => "ファイル '%value%' をアップロードする一時ディレクトリが見つかりませんでした", - "File '%value%' can't be written" => "ファイル '%value%' は書き込めませんでした", - "A PHP extension returned an error while uploading the file '%value%'" => "ファイル '%value%' をアップロード中に拡張モジュールがエラーを応答しました", - "File '%value%' was illegally uploaded. This could be a possible attack" => "ファイル '%value%' は不正なアップロードでした。攻撃の可能性があります", - "File '%value%' was not found" => "ファイル '%value%' は見つかりませんでした", - "Unknown error while uploading file '%value%'" => "ファイル '%value%' をアップロード中に未知のエラーが発生しました", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "単語数 '%count%' が多過ぎます。最大で '%max%' 個が許されます", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "単語数 '%count%' が少な過ぎます。少なくとも '%min%' 個必要です", - "File '%value%' is not readable or does not exist" => "ファイル '%value%' は読み込めないかもしくは存在しません", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => '不正な形式です。文字列、整数もしくは小数が期待されています', - "'%value%' does not appear to be a float" => " '%value%' は小数ではないようです", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => " '%value%' は '%min%' より大きくありません", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' has not only hexadecimal digit characters" => " '%value%' は 16 進文字列以外を含んでいます", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => " '%value%' は IP アドレスのようですが、 IP アドレスは許されていません", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => " '%value%' は DNS ホスト名のようですが、 TLD が一覧に見つかりません", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => " '%value%' は DNS ホスト名のようですが不正な位置にダッシュがあります", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => " '%value%' は DNS ホスト名のようですが TLD '%tld%' のホスト名スキーマと一致していません", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => " '%value%' は DNS ホスト名のようですが TLD 部を展開できません", - "'%value%' does not match the expected structure for a DNS hostname" => " '%value%' は DNS ホスト名の構造に一致していません", - "'%value%' does not appear to be a valid local network name" => " '%value%' は有効なローカルネットワーク名ではないようです", - "'%value%' appears to be a local network name but local network names are not allowed" => " '%value%' はローカルネットワーク名のようですがローカルネットワーク名は許されていません", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => " '%value%' は DNS ホスト名のようですが、 punycode 変換ができませんでした", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "IBAN コード '%value%' に未知の国があります", - "'%value%' has a false IBAN format" => " '%value%' は誤った IBAN 書式です", - "'%value%' has failed the IBAN check" => " '%value%' は IBAN コードチェックに失敗しました", - - // Zend_Validate_Identical - 'The two given tokens do not match' => '2 つのトークンは一致しませんでした', - 'No token was provided to match against' => 'チェックを行うためのトークンがありませんでした', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => " '%value%' が haystack の中に見つかりませんでした", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => '不正な形式です。文字列または整数が期待されています', - "'%value%' does not appear to be an integer" => " '%value%' は整数ではないようです", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' does not appear to be a valid IP address" => " '%value%' は IP アドレスではないようです", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => '不正な形式です。文字列または整数が期待されています', - "'%value%' is no valid ISBN number" => " '%value%' は ISBN 番号ではありません", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => " '%value%' は '%max%' 未満ではありません", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => '不正な形式です。文字列、整数、小数、真偽値もしくは配列が期待されています', - "Value is required and can't be empty" => '値は必須です。空値は許可されていません', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => '不正な形式です。文字列もしくは整数が期待されています', - "'%value%' does not appear to be a postal code" => " '%value%' は郵便番号でないようです", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => '不正な形式です。文字列、整数、もしくは小数が期待されています', - "'%value%' does not match against pattern '%pattern%'" => " '%value%' はパターン '%pattern%' と一致していません", - "There was an internal error while using the pattern '%pattern%'" => "正規表現パターン '%pattern%' を使用中に内部エラーが発生しました。", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is no valid sitemap changefreq" => " '%value%' は正しいサイトマップの更新頻度ではありません", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is no valid sitemap lastmod" => " '%value%' は正しいサイトマップの最終更新日ではありません", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - - // Zend_Validate_Sitemap_Loc - "'%value%' is no valid sitemap location" => " '%value%' は正しいサイトマップの位置ではありません", - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - - // Zend_Validate_Sitemap_Priority - "'%value%' is no valid sitemap priority" => " '%value%' は正しいサイトマップの優先度ではありません", - 'Invalid type given. Numeric string, integer or float expected' => '不正な形式です。数字、整数もしくは小数が期待されています', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => '不正な形式です。文字列が期待されています', - "'%value%' is less than %min% characters long" => " '%value%' は %min% 文字より短いです", - "'%value%' is more than %max% characters long" => " '%value%' は %max% 文字より長いです", -]; diff --git a/resources/languages/nl/Zend_Validate.php b/resources/languages/nl/Zend_Validate.php deleted file mode 100644 index 52d5adbc..00000000 --- a/resources/languages/nl/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Ongeldig type opgegeven, waarde moet een float, string of integer zijn', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' bevat tekens welke alfabetisch, noch numeriek zijn", - "'%value%' is an empty string" => "'%value%' is een lege string", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Ongeldig type opgegeven, waarde moet een string zijn', - "'%value%' contains non alphabetic characters" => "'%value%' bevat tekens welke niet alfabetisch zijn", - "'%value%' is an empty string" => "'%value%' is een lege string", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' slaagde niet in de checksum validatie", - "'%value%' contains invalid characters" => "'%value%' bevat ongeldige tekens", - "'%value%' should have a length of %length% characters" => "'%value%' moet een lengte hebben van %length% tekens", - 'Invalid type given, value should be string' => 'Ongeldig type opgegeven, waarde moet een string zijn', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' is niet tussen of gelijk aan '%min%' en '%max%'", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' is niet tussen '%min%' en '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' is ongeldig", - 'Failure within the callback, exception returned' => 'Fout opgetreden in de callback, exceptie teruggegeven', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' moet 13 tot 19 cijfers bevatten", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Het Luhn algoritme (mod-10 checksum) is niet gelukt op '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Het Luhn algoritme (mod-10 checksum) is niet geslaagd op '%value%'", - "'%value%' must contain only digits" => "'%value%' kan alleen cijfers bevatten", - 'Invalid type given, value should be a string' => 'Ongeldig type opgegeven, waarde moet een string zijn', - "'%value%' contains an invalid amount of digits" => "'%value%' bevat een ongeldige hoeveelheid cijfers", - "'%value%' is not from an allowed institute" => "'%value%' is niet afkomstig van een toegestaan instituut", - "Validation of '%value%' has been failed by the service" => "Validatie door de service van '%value%' is mislukt", - "The service returned a failure while validating '%value%'" => "De service heeft een foutmelding teruggegeven bij het valideren van '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'Ongeldig type opgegeven, waarde moet een string, integer, array of Zend_Date zijn', - "'%value%' does not appear to be a valid date" => "'%value%' lijkt geen geldige datum te zijn", - "'%value%' does not fit the date format '%format%'" => "'%value%' past niet in het datumformaat '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Er kon geen record gevonden wat overeenkomt met %value%', - "A record matching '%value%' was found" => 'Een record wat overeenkomt met %value% is gevonden', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Ongeldig type opgegeven, waarde moet een string, integer of float zijn', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' bevat niet enkel numerieke karakters", - "'%value%' is an empty string" => "'%value%' is een lege string", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Ongeldig type opgegeven, waarde moet een string zijn', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' is geen geldig e-mail adres in het basis formaat lokaal-gedeelte@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' is geen geldige hostnaam voor e-mail adres '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' lijkt geen geldig MX record te hebben voor e-mail adres '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' bevindt zich niet in een routeerbaar netwerk segment. Het e-mail adres '%value%' zou niet naar mogen worden verwezen vanaf een publiek netwerk.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' kan niet worden gematched met het dot-atom formaat", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' kan niet worden gematched met het quoted-string formaat", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' is geen geldig lokaal gedeelte voor e-mail adres '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' overschrijdt de toegestane lengte", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Te veel bestanden, maximaal '%max%' zijn toegestaan, maar '%count%' werd opgegeven", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Te weinig bestanden, er worden er minimaal '%min%' verwacht, maar er waren er '%count%' opgegeven", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "File '%value%' matcht niet met de opgegeven crc32 hashes", - 'A crc32 hash could not be evaluated for the given file' => 'Fout tijdens het genereren van een crc32 hash van het opgegeven bestand', - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Het bestand '%value%' heeft een ongeldige extensie", - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Het bestand '%value%' heeft een ongeldig mimetype: '%type%'", - "The mimetype of file '%value%' could not be detected" => "Het mimetype van bestand '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Het bestand '%value%' kon niet worden gelezen", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Bestand '%value%' bestaat niet", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Het bestand '%value%' heeft een ongeldige extensie", - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Alle bestanden tesamen hebben een maximale grootte van '%max%' maar '%size%' was gedetecteerd", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Alle bestanden tesamen hebben een minimum grotte van '%min%' maar '%size%' was gedetecteerd", - 'One or more files can not be read' => 'Eén of meer bestanden konden niet worden gelezen', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Het bestand '%value%' matcht niet met de opgegeven hashes", - 'A hash could not be evaluated for the given file' => 'Een hash kon niet worden gegenereerd voor het opgegeven bestand', - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maximum breedte voor afbeelding '%value%' is '%maxwidth%' maar '%width%' werd gedetecteerd", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimum breedte voor afbeelding '%value%' is '%minwidth%' maar '%width%' werd gedetecteerd", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maximum hoogte voor afbeelding '%value%' is '%maxheight%' maar '%height%' werd gedetecteerd", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimum hoogte voor afbeelding '%value%' is '%minheight%' maar '%height%' werd gedetecteerd", - "The size of image '%value%' could not be detected" => "De grootte van afbeelding '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Het bestand '%value%' kan niet worden gelezen", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Het bestand '%value%' is niet gecomprimeerd, '%type%' gedetecteerd", - "The mimetype of file '%value%' could not be detected" => "Het mimetype van bestand '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Bestand '%value%' kan niet worden gelezen", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Het bestand '%value%' is geen afbeelding, '%type%' gedetecteerd", - "The mimetype of file '%value%' could not be detected" => "Het mimetype van bestand '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Het bestand '%value%' kon niet worden gelezen", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Het bestand '%value%' matcht niet met de opgegeven md5-hashes", - 'A md5 hash could not be evaluated for the given file' => 'Een md5-hash kon niet gegenereerd worden voor het opgegeven bestand', - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Het bestand '%value%' heeft een ongeldig mimetype: '%type%'", - "The mimetype of file '%value%' could not be detected" => "Het mimetype van bestand '%value%' kon niet worden gedetecteerd", - "File '%value%' can not be read" => "Het bestand '%value%' kon niet worden gelezen", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Het bestand '%value%' bestaat", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Het bestand '%value%' matcht niet met de opgegeven sha1-hashes", - 'A sha1 hash could not be evaluated for the given file' => 'Een sha1-hash kon niet worden gegenereerd voor het opgegeven bestand', - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maximum grootte voor bestand '%value%' is '%max%' maar '%size%' werd gedetecteerd", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimum grootte voor bestand '%value%' is '%min%' maar '%size%' werd gedetecteerd", - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Het bestand '%value%' overschrijdt de ini grootte", - "File '%value%' exceeds the defined form size" => "Het bestand '%value%' overschrijdt de formulier grootte", - "File '%value%' was only partially uploaded" => "Het bestand '%value%' was slechts gedeeltelijk geüpload", - "File '%value%' was not uploaded" => "Het bestand '%value%' was niet geüpload", - "No temporary directory was found for file '%value%'" => "Geen tijdelijke map was gevonden voor bestand '%value%'", - "File '%value%' can't be written" => "Het bestand '%value%' kan niet worden geschreven", - "A PHP extension returned an error while uploading the file '%value%'" => "Een PHP-extensie gaf een foutmelding terug tijdens het uploaden van het bestand '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Het bestand '%value%' was illegaal geüpload. Dit kan een aanval zijn", - "File '%value%' was not found" => "Het bestand '%value%' kon niet worden gevonden", - "Unknown error while uploading file '%value%'" => "Er is een onbekende fout opgetreden tijdens het uploaden van '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Te veel woorden, er is een maximum van '%max%', maar er waren '%count%' geteld", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Te weinig worden, er is een minimum van '%min%' maar er waren '%count%' geteld", - "File '%value%' could not be found" => "Het bestand '%value%' kon niet worden gevonden", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Ongeldig type opgegeven, waarde moet een float, string, of integer zijn', - "'%value%' does not appear to be a float" => "'%value%' lijkt geen float te zijn", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' is niet groter dan '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Ongeldig type gegeven, waarde moet een string zijn', - "'%value%' has not only hexadecimal digit characters" => "'%value%' bestaat niet enkel uit acht hexadecimale cijfers", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Ongeldig type gegeven, waarde moet een string zijn', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' lijkt een IP adres te zijn, maar IP adressen zijn niet toegestaan", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' lijkt een DNS hostnaam te zijn, maar het TLD bestaat niet in de lijst met bekende TLD's", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' lijkt een DNS hostnaam te zijn, maar bevat een streep op een ongeldige plek", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' lijkt een DNS hostnaam te zijn, maar past niet in het hostnaam-schema voor TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' lijkt een DNS hostnaam te zijn, maar kan niet het TLD gedeelte bepalen", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' matcht niet met de verwachte structuur voor een DNS hostnaam", - "'%value%' does not appear to be a valid local network name" => "'%value%' lijkt geen geldige lokale netwerknaam te zijn", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' lijkt een lokale netwerknaam te zijn, welke niet zijn toegestaan", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' lijkt een geldige DNS hostnaam te zijn, maar de opgegeven punnycode notatie kan niet worden gedecodeerd", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Onbekend land in de IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' heeft een ongeldig IBAN formaat", - "'%value%' has failed the IBAN check" => "'%value%' is geen geldige IBAN", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'De twee tokens komen niet overeen', - 'No token was provided to match against' => 'Er is geen token opgegeven om mee te matchen', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' kon niet worden gevonden in lijst met beschikbare waardes", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Ongeldig type opgegeven, waarde moet een string of integer zijn', - "'%value%' does not appear to be an integer" => "'%value%' lijkt geen integer te zijn", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Ongeldig type gegeven, waarde moet een string zijn', - "'%value%' does not appear to be a valid IP address" => "'%value%' lijkt geen geldig IP adres te zijn", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'Ongeldig type opgegeven, waarde moet een string of integer zijn', - "'%value%' is not a valid ISBN number" => "'%value%' is geen geldig ISBN nummer", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' is niet minder dan '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'Ongeldig type opgegeven, waarde dient een float, string, array, boolean of integer te zijn', - "Value is required and can't be empty" => 'Waarde is vereist en kan niet leeg worden gelaten', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'Ongeldig type opgegeven, waarde moet een string of integer zijn', - "'%value%' does not appear to be a postal code" => "'%value%' lijkt geen geldige postcode te zijn", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Ongeldig type opgegeven, waarde dient een string, integer of float te zijn', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' matcht niet met het patroon '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Er is een interne fout opgetreden tijdens het gebruik van het patroon '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' is geen geldige sitemap changefreq", - 'Invalid type given, the value should be a string' => 'Ongeldig type opgegeven, waarde dient een string te zijn', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' is geen geldige sitemap lastmod", - 'Invalid type given, the value should be a string' => 'Ongeldig type opgegeven, waarde dient een string te zijn', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' is geen geldige sitemap locatie", - 'Invalid type given, the value should be a string' => 'Ongeldig type opgegeven, waarde dient een string te zijn', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' is geen geldige sitemap prioriteit", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'Ongeldig type opgegeven, waarde dient een integer, float of een numerieke string te zijn', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Ongeldig type opgegeven, waarde dient een string te zijn', - "'%value%' is less than %min% characters long" => "'%value%' is minder dan %min% tekens lang", - "'%value%' is more than %max% characters long" => "'%value%' is meer dan %max% tekens lang", -]; diff --git a/resources/languages/pt_BR/Zend_Validate.php b/resources/languages/pt_BR/Zend_Validate.php deleted file mode 100644 index 315f8ea0..00000000 --- a/resources/languages/pt_BR/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'O tipo especificado é inválido, o valor deve ser float, string, ou inteiro', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' contém caracteres que não são alfabéticos e nem dígitos", - "'%value%' is an empty string" => "'%value%' é uma string vazia", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' contains non alphabetic characters" => "'%value%' contém caracteres não alfabéticos", - "'%value%' is an empty string" => "'%value%' é uma string vazia", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' falhou na validação do checksum", - "'%value%' contains invalid characters" => "'%value%' contém caracteres inválidos", - "'%value%' should have a length of %length% characters" => "'%value%' tem um comprimento de %length% caracteres", - 'Invalid type given, value should be string' => 'O tipo especificado é inválido, o valor deve ser string', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' não está entre '%min%' e '%max%', inclusivamente", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' não está exatamente entre '%min%' e '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' não é válido", - 'Failure within the callback, exception returned' => 'Falha na chamada de retorno, exceção retornada', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' deve conter entre 13 e 19 dígitos", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "O algoritmo de Luhn (checksum de módulo 10) falhou em '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "O algoritmo de Luhn (checksum de módulo 10) falhou em '%value%'", - "'%value%' must contain only digits" => "'%value%' deve conter apenas dígitos", - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' contains an invalid amount of digits" => "'%value%' contém uma quantidade inválida de dígitos", - "'%value%' is not from an allowed institute" => "'%value%' não vem de uma instituição autorizada", - "Validation of '%value%' has been failed by the service" => "A validação de '%value%' falhou por causa do serviço", - "The service returned a failure while validating '%value%'" => "O serviço devolveu um erro enquanto validava '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'O tipo especificado é inválido, o valor deve ser string, inteiro, matriz ou Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' não parece ser uma data válida", - "'%value%' does not fit the date format '%format%'" => "'%value%' não se encaixa no formato de data '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Não foram encontrados registros para %value%', - "A record matching '%value%' was found" => 'Um registro foi encontrado para %value%', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'O tipo especificado é inválido, o valor deve ser string, inteiro ou float', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' contém caracteres que não são dígitos, mas apenas dígitos são permitidos", - "'%value%' is an empty string" => "'%value%' é uma string vazia", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' não é um endereço de e-mail válido no formato local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' não é um nome de host válido para o endereço de e-mail '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' não parece ter um registro MX válido para o endereço de e-mail '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' não é um segmento de rede roteável. O endereço de e-mail '%value%' não deve ser resolvido a partir de um rede pública.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' não corresponde com o formato dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' não corresponde com o formato quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' não é uma parte local válida para o endereço de e-mail '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' excede o comprimento permitido", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Há muitos arquivos, são permitidos no máximo '%max%', mas '%count%' foram fornecidos", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Há poucos arquivos, são esperados no mínimo '%min%', mas '%count%' foram fornecidos", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "O arquivo '%value%' não corresponde ao hash crc32 fornecido", - 'A crc32 hash could not be evaluated for the given file' => 'Não foi possível avaliar um hash crc32 para o arquivo fornecido', - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "O arquivo '%value%' possui a extensão incorreta", - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "O arquivo '%value%' tem o mimetype incorreto: '%type%'", - "The mimetype of file '%value%' could not be detected" => "O mimetype do arquivo '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "O arquivo '%value%' não existe", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "O arquivo '%value%' possui a extensão incorreta", - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Todos os arquivos devem ter um tamanho máximo de '%max%', mas um tamanho de '%size%' foi detectado", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Todos os arquivos devem ter um tamanho mínimo de '%min%', mas um tamanho de '%size%' foi detectado", - 'One or more files can not be read' => 'Um ou mais arquivos não puderam ser lidos', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "O arquivo '%value%' não corresponde ao hash fornecido", - 'A hash could not be evaluated for the given file' => 'Não foi possível avaliar um hash para o arquivo fornecido', - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "A largura máxima permitida para a imagem '%value%' deve ser '%maxwidth%', mas '%width%' foi detectada", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "A largura mínima esperada para a imagem '%value%' deve ser '%minwidth%', mas '%width%' foi detectada", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "A altura máxima permitida para a imagem '%value%' deve ser '%maxheight%', mas '%height%' foi detectada", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "A altura mínima esperada para a imagem '%value%' deve ser '%minheight%', mas '%height%' foi detectada", - "The size of image '%value%' could not be detected" => "O tamanho da imagem '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "O arquivo '%value%' não está compactado: '%type%' detectado", - "The mimetype of file '%value%' could not be detected" => "O mimetype do arquivo '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "O arquivo '%value%' não é uma imagem: '%type%' detectado", - "The mimetype of file '%value%' could not be detected" => "O mimetype do arquivo '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "O arquivo '%value%' não corresponde ao hash md5 fornecido", - 'A md5 hash could not be evaluated for the given file' => 'Não foi possível avaliar um hash md5 para o arquivo fornecido', - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "O arquivo '%value%' tem o mimetype incorreto: '%type%'", - "The mimetype of file '%value%' could not be detected" => "O mimetype do arquivo '%value%' não pôde ser detectado", - "File '%value%' can not be read" => "O arquivo '%value%' não pôde ser lido", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "O arquivo '%value%' existe", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "O arquivo '%value%' não corresponde ao hash sha1 fornecido", - 'A sha1 hash could not be evaluated for the given file' => 'Não foi possível avaliar um hash sha1 para o arquivo fornecido', - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "O tamanho máximo permitido para o arquivo '%value%' é '%max%', mas '%size%' foram detectados", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "O tamanho mínimo esperado para o arquivo '%value%' é '%min%', mas '%size%' foram detectados", - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "O arquivo '%value%' excede o tamanho definido na configuração", - "File '%value%' exceeds the defined form size" => "O arquivo '%value%' excede o tamanho definido do formulário", - "File '%value%' was only partially uploaded" => "O arquivo '%value%' foi apenas parcialmente enviado", - "File '%value%' was not uploaded" => "O arquivo '%value%' não foi enviado", - "No temporary directory was found for file '%value%'" => "Nenhum diretório temporário foi encontrado para o arquivo '%value%'", - "File '%value%' can't be written" => "O arquivo '%value%' não pôde ser escrito", - "A PHP extension returned an error while uploading the file '%value%'" => "Uma extensão do PHP retornou um erro enquanto o arquivo '%value%' era enviado", - "File '%value%' was illegally uploaded. This could be a possible attack" => "O arquivo '%value%' foi enviado ilegalmente. Este poderia ser um possível ataque", - "File '%value%' was not found" => "O arquivo '%value%' não foi encontrado", - "Unknown error while uploading file '%value%'" => "Erro desconhecido ao enviar o arquivo '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Há muitas palavras, são permitidas no máximo '%max%', mas '%count%' foram contadas", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Há poucas palavras, são esperadas no mínimo '%min%', mas '%count%' foram contadas", - "File '%value%' could not be found" => "O arquivo '%value%' não pôde ser encontrado", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'O tipo especificado é inválido, o valor deve ser float, string, ou inteiro', - "'%value%' does not appear to be a float" => "'%value%' não parece ser um float", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' não é maior que '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' has not only hexadecimal digit characters" => "'%value%' não contém somente caracteres hexadecimais", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' parece ser um endereço de IP, mas endereços de IP não são permitidos", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' parece ser um hostname de DNS, mas o TLD não corresponde a nenhum TLD conhecido", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' parece ser um hostname de DNS, mas contém um traço em uma posição inválida", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' parece ser um hostname de DNS, mas não corresponde ao esquema de hostname para o TLD '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' parece ser um hostname de DNS, mas o TLD não pôde ser extraído", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' não corresponde com a estrutura esperada para um hostname de DNS", - "'%value%' does not appear to be a valid local network name" => "'%value%' não parece ser um nome de rede local válido", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' parece ser um nome de rede local, mas os nomes de rede local não são permitidos", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' parece ser um hostname de DNS, mas a notação punycode fornecida não pode ser decodificada", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "País desconhecido para o IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' não é um formato IBAN válido", - "'%value%' has failed the IBAN check" => "'%value%' falhou na verificação do IBAN", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Os dois tokens fornecidos não combinam', - 'No token was provided to match against' => 'Nenhum token foi fornecido para a comparação', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' não faz parte dos valores esperados", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'O tipo especificado é inválido, o valor deve ser string ou inteiro', - "'%value%' does not appear to be an integer" => "'%value%' não parece ser um número inteiro", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' does not appear to be a valid IP address" => "'%value%' não parece ser um endereço de IP válido", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'O tipo especificado é inválido, o valor deve ser string ou inteiro', - "'%value%' is not a valid ISBN number" => "'%value%' não é um número ISBN válido", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' não é menor que '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'O tipo especificado é inválido, o valor deve ser float, string, matriz, booleano ou inteiro', - "Value is required and can't be empty" => 'O valor é obrigatório e não pode estar vazio', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'O tipo especificado é inválido. O valor deve ser uma string ou um inteiro', - "'%value%' does not appear to be a postal code" => "'%value%' não parece ser um código postal", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'O tipo especificado é inválido, o valor deve ser string, inteiro ou float', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' não corresponde ao padrão '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Houve um erro interno durante o uso do padrão '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' não é um changefreq de sitemap válido", - 'Invalid type given, the value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' não é um lastmod de sitemap válido", - 'Invalid type given, the value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' não é uma localização de sitemap válida", - 'Invalid type given, the value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' não é uma prioridade de sitemap válida", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'O tipo especificado é inválido, o valor deve ser um inteiro, um float ou uma string numérica', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'O tipo especificado é inválido, o valor deve ser uma string', - "'%value%' is less than %min% characters long" => "O tamanho de '%value%' é inferior a %min% caracteres", - "'%value%' is more than %max% characters long" => "O tamanho de '%value%' é superior a %max% caracteres", -]; diff --git a/resources/languages/ru/Zend_Validate.php b/resources/languages/ru/Zend_Validate.php deleted file mode 100644 index 3f526a59..00000000 --- a/resources/languages/ru/Zend_Validate.php +++ /dev/null @@ -1,254 +0,0 @@ - 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой или целым числом', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' содержит недопустимые символы. Разрешены только буквенные символы и цифры", - "'%value%' is an empty string" => "'%value%' - пустая строка", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' contains non alphabetic characters" => "'%value%' содержит не буквенные символы", - "'%value%' is an empty string" => "'%value%' - пустая строка", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' ошибка проверки контрольной суммы", - "'%value%' contains invalid characters" => "'%value%' содержит недопустимые символы", - "'%value%' should have a length of %length% characters" => "Длина '%value%' должна составлять %length% символов", - 'Invalid type given, value should be string' => 'Недопустимый тип данных, значение должно быть строкой', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' не в диапазоне от '%min%' до '%max%', включительно", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' не в диапазоне от '%min%' до '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' недопустимое значение", - 'Failure within the callback, exception returned' => 'Ошибка в обратном вызове, возвращено исключение', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' должно содержать от 13 до 19 цифр", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Алгоритм Луна (вычисление контрольной цифры) вернул ошибку для '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Алгоритм Луна (вычисление контрольной цифры) вернул ошибку для '%value%'", - "'%value%' must contain only digits" => "'%value%' должно содержать только цифры", - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' contains an invalid amount of digits" => "'%value%' содержит недопустимое количество цифр", - "'%value%' is not from an allowed institute" => "'%value%' не входит в список разрешенных платежных систем", - "Validation of '%value%' has been failed by the service" => "Проверка '%value%' закончилась ошибкой сервиса", - "The service returned a failure while validating '%value%'" => "Сервис возвратил ошибку во время проверки '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'Недопустимый тип данных, значение должно быть строкой, целым числом, массивом или объектом Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' не является корректной датой", - "'%value%' does not fit the date format '%format%'" => "'%value%' не соответствует формату даты '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Не найдено записей, совпадающих с '%value%'", - "A record matching '%value%' was found" => "Найдена запись, совпадающая со значением '%value%'", - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой, или целым числом', - "'%value%' contains not only digit characters" => "Значение '%value%' должно содержать только цифровые символы", - "'%value%' is an empty string" => "'%value%' - пустая строка", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' недопустимый адрес электронной почты. Введите его в формате имя@домен", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' недопустимое имя хоста для адреса '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' не имеет корректной MX-записи об адресе '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' не является маршрутизируемым сегментом сети. Адрес электронной почты '%value%' не может быть получен из публичной сети.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart% не соответствует формату dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' не соответствует формату quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' недопустимое имя для адреса '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' превышает допустимую длину", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Слишком много файлов, максимально разрешено - '%max%', а получено - '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Слишком мало файлов, минимально разрешено - '%min%', а получено - '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Файл '%value%' не соответствует заданному crc32 хешу", - 'A crc32 hash could not be evaluated for the given file' => 'crc32 хеш не может быть вычислен для данного файла', - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Файл '%value%' имеет недопустимое расширение", - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "MIME-тип '%type%' файла '%value%' недопустим", - "The mimetype of file '%value%' could not be detected" => "Не удается определить MIME-тип файла '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Файл '%value%' не существует", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Файл '%value%' имеет недопустимое расширение", - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Общий размер файлов не должен превышать '%max%', сейчас - '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Общий размер файлов не должен быть менее '%min%', сейчас - '%size%'", - 'One or more files can not be read' => 'Один или более файлов не могут быть прочитаны', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Файл '%value%' не соответствует указанному хешу", - 'A hash could not be evaluated for the given file' => 'Хеш не может быть подсчитан для указанного файла', - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Максимально разрешённая ширина изображения '%value%' должна быть '%maxwidth%', сейчас - '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Минимально ожидаемая ширина изображения '%value%' должна быть '%minwidth%', сейчас - '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Максимально разрешённая высота изображения '%value%' должна быть '%maxheight%', сейчас - '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Минимально ожидаемая высота изображения '%value%' должна быть '%minheight%', сейчас - '%height%'", - "The size of image '%value%' could not be detected" => "Невозможно определить размер изображения '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Файл '%value%' не является сжатым. MIME-тип файла - '%type%'", - "The mimetype of file '%value%' could not be detected" => "Не удается определить MIME-тип файла '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Файл '%value%' не является изображением. MIME-тип файла - '%type%'", - "The mimetype of file '%value%' could not be detected" => "Не удается определить MIME-тип файла '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Файл '%value%' не соответствует указанному md5 хешу", - 'A md5 hash could not be evaluated for the given file' => 'md5 хеш не может быть вычислен для указанного файла', - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "MIME-тип '%type%' файла '%value%' недопустим", - "The mimetype of file '%value%' could not be detected" => "Не удается определить MIME-тип файла '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не может быть прочитан", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Файл '%value%' уже существует", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Файл '%value%' не соответствует указаному хешу sha1", - 'A sha1 hash could not be evaluated for the given file' => 'Хеш sha1 не может быть подсчитан для указанного файла', - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Максимальный разрешенный размер файла '%value%' это '%max%', сейчас - '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Минимальный разрешенный размер файла '%value%' это '%min%', сейчас - '%size%'", - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Размер файла '%value%' превышает допустимый размер, указанный в php.ini", - "File '%value%' exceeds the defined form size" => "Размер файла '%value%' превышает допустимый размер, указанный в форме", - "File '%value%' was only partially uploaded" => "Файл '%value%' был загружен только частично", - "File '%value%' was not uploaded" => "Файл '%value%' не был загружен", - "No temporary directory was found for file '%value%'" => "Не найдена временная директория для файла '%value%'", - "File '%value%' can't be written" => "Файл '%value%' не может быть записан", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP расширение возвратило ошибку во время загрузки файла '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Файл '%value%' загружен некорректно. Возможна атака", - "File '%value%' was not found" => "Файл '%value%' не найден", - "Unknown error while uploading file '%value%'" => "Произошла неизвестная ошибка во время загрузки файла '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Слишком много слов, разрешено максимум '%max%' слов, но сейчас - '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Слишком мало слов, разрешено минимум '%min%' слов, но сейчас - '%count%'", - "File '%value%' could not be found" => "Файл '%value%' не найден", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой, или целым числом', - "'%value%' does not appear to be a float" => "'%value%' не является числом с плавающей точкой", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' не превышает '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' has not only hexadecimal digit characters" => "Значение '%value%' должно содержать только шестнадцатиричные символы", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "Значение '%value%' выглядит как IP-адрес, но IP-адреса не разрешены", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' выглядит как DNS имя хоста, но оно не дожно быть из списка доменов верхнего уровня", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' выглядит как DNS имя хоста, но знак '-' находится в недопустимом месте", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' выглядит как DNS имя хоста, но оно не соответствует шаблону для доменных имен верхнего уровня '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' выглядит как DNS имя хоста, но не удаётся извлечь домен верхнего уровня", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' не соответствует ожидаемой структуре для DNS имени хоста", - "'%value%' does not appear to be a valid local network name" => "'%value%' является недопустимым локальным сетевым адресом", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' выглядит как локальный сетевой адрес, но локальные сетевые адреса не разрешены", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' выглядит как DNS имя хоста, но указанное значение не может быть преобразованно в допустимый для DNS набор символов", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Не известная страна IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' имеет недопустимый IBAN формат", - "'%value%' has failed the IBAN check" => "'%value%' не прошло IBAN проверку", - - // Zend_Validate_Identical - "The token '%token%' does not match the given token '%value%'" => "Значение '%token%' не совпадает с указанным значением '%value%'", - 'No token was provided to match against' => 'Не было указано значение для проверки на идентичность', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' не найдено в перечисленных допустимых значениях", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Недопустимый тип данных, значение должно быть строкой или целым числом', - "'%value%' does not appear to be an integer" => "'%value%' не является целым числом", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' does not appear to be a valid IP address" => "'%value%' не является корректным IP-адресом", - - // Zend_Validate_Isbn - "'%value%' is not a valid ISBN number" => "'%value%' не является корректным номером ISBN", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' не меньше, чем '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой, массивом, булевым значением или целым числом', - "Value is required and can't be empty" => 'Значение обязательно для заполнения и не может быть пустым', - - // Zend_Validate_PostCode - 'Invalid type given, value should be string or integer' => 'Недопустимый тип данных, значение должно быть строкой или целым числом', - "'%value%' does not appear to be an postal code" => "'%value%' не является корректным почтовым кодом", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Недопустимый тип данных, значение должно быть числом с плавающей точкой, строкой, или целым числом', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' не соответствует шаблону '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' недопустимое значение для sitemap changefreq", - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' недопустимое значение для sitemap lastmod", - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' недопустимое значение для sitemap location", - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' недопустимое значение для sitemap priority", - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Недопустимый тип данных, значение должно быть строкой', - "'%value%' is less than %min% characters long" => "'%value%' меньше разрешенной минимальной длины в %min% символов", - "'%value%' is more than %max% characters long" => "'%value%' больше разрешенной максимальной длины в %max% символов", -]; diff --git a/resources/languages/sk/Zend_Captcha.php b/resources/languages/sk/Zend_Captcha.php deleted file mode 100644 index b89c114d..00000000 --- a/resources/languages/sk/Zend_Captcha.php +++ /dev/null @@ -1,31 +0,0 @@ - 'Chýba captcha pole', - 'Failed to validate captcha' => 'Captchu sa nepodarilo overiť', - 'Captcha value is wrong: %value%' => 'Hodnota captchy neni správna: %value%', - - // Zend_Captcha_Word - 'Empty captcha value' => 'Hodnota captchy nebola zadaná', - 'Captcha ID field is missing' => 'Chýba pole captcha ID', - 'Captcha value is wrong' => 'Chybná hodnota catpchy', -]; diff --git a/resources/languages/sk/Zend_Validate.php b/resources/languages/sk/Zend_Validate.php deleted file mode 100644 index 501de96c..00000000 --- a/resources/languages/sk/Zend_Validate.php +++ /dev/null @@ -1,260 +0,0 @@ - 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' obsahuje aj iné znaky ako písmena a číslice", - "'%value%' is an empty string" => "'%value%' je prázdny reťazec", - - // Zend_Validate_Alpha - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' contains non alphabetic characters" => "'%value%' obsahuje aj iné znaky ako písmena", - "'%value%' is an empty string" => "'%value%' je prázdny reťazec", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' má chybný kontrolný súčet", - "'%value%' contains invalid characters" => "'%value%' obsahuje neplatné znaky", - "'%value%' should have a length of %length% characters" => "'%value%' by mal mať dĺžku %length% znakov", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec.', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' nie je medzi '%min%' a '%max%', vrátane", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' nie je medzi '%min%' a '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "Hodnota '%value%' je neplatná", - 'An exception has been raised within the callback' => 'Počas validácie došlo chybe', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' musí obsahovať 13 až 19 číslic", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhnov algoritmus (kontrolný súčet mod-10) nevyšiel pre '%value%'", - - // Zend_Validate_CreditCard - "'%value%' seems to contain an invalid checksum" => "'%value%' obsahuje neplatný kontrolný súčet", - "'%value%' must contain only digits" => "'%value%' musí obsahovať len čísla", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' contains an invalid amount of digits" => "'%value%' obsahuje neplatný počet číslic", - "'%value%' is not from an allowed institute" => "'%value%' je od nepovolenej spoločnosti", - "'%value%' seems to be an invalid creditcard number" => "'%value%' je neplatné číslo kreditnej karty", - "An exception has been raised while validating '%value%'" => "Počas validácie '%value%' došlo k chybe", - - // Zend_Validate_Date - 'Invalid type given. String, integer, array or Zend_Date expected' => 'Chybný typ. Bol očakávaný reťazec, číslo, pole alebo objekt typu Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' je neplatný dátum", - "'%value%' does not fit the date format '%format%'" => "'%value%' nie je formátu '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Nebol nájdený žiadny záznam zhodný s '%value%'", - "A record matching '%value%' was found" => "Bol nájdený záznam zhodný s '%value%'", - - // Zend_Validate_Digits - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo', - "'%value%' must contain only digits" => "'%value%' musí obsahovať iba číslice", - "'%value%' is an empty string" => "'%value%' je prázdny reťazec", - - // Zend_Validate_EmailAddress - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' nie je platná e-mailová adresa v tvare local-part@hostname", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' je neplatný hostname pre emailovou adresu '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' neobsahuje platný MX záznam pre e-mailovou adresu '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network" => "'%hostname%' nie je v smerovateľnom úseku siete. E-mailová adresa '%value%' by nemala byť požadovaná z verejnej siete", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' nemôže byť porovnaný proti dot-atom formátu", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' nemôže byť porovnaný proti quoted-string formátu", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' je neplatná 'local part' pre e-mailovou adresu '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' prekročil dovolenú dĺžku", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Príliš veľa súborov. Maximum je '%max%', ale bolo zadaných '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Píliš málo súborov. Minimum je '%min%', ale bolo zadaných len '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Súbor '%value%' nezodpovedá zadanému crc32 hashu", - 'A crc32 hash could not be evaluated for the given file' => 'Pre zadaný súbor nemohol byť vypočítaný crc32 hash', - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Súbor '%value%' má nesprávnu príponu", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Súbor '%value%' má nesprávny mimetyp '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp súboru '%value%' nebolo možne zistiť", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Súbor '%value%' neexistuje", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Súbor '%value%' má nesprávnu príponu", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Súčet veľkostí všetkých súborov by mal byť maximálne '%max%', ale je '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Súčet veľkosti všetkých súborov by mal byť minimálne '%min%', ale je '%size%'", - 'One or more files can not be read' => 'Jeden alebo viac súborov nie je možné načítať', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Súbor '%value%' neodpovedá danému hashu", - 'A hash could not be evaluated for the given file' => 'Hash nemohol byť pre daný súbor vypočítaný', - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maximálna šírka obrázka '%value%' by mala byť '%maxwidth%', ale je '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimálna šírka obrázka '%value%' by mala byť '%minwidth%', ale je '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maximálna výška obrázka '%value%' by mala byť '%maxheight%', ale je '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimálna výška obrázka '%value%' by mala byť '%minheight%', ale je '%height%'", - "The size of image '%value%' could not be detected" => "Rozmery obrázka '%value%' nebolo možné zistiť", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Súbor '%value%' nie je komprimovaný, typ súboru '%type%' bol zistený", - "The mimetype of file '%value%' could not be detected" => "Mimetyp súboru '%value%' nebolo možné zistiť", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Súbor '%value%' nie je obrázok, typ súboru '%type%' bol zistený", - "The mimetype of file '%value%' could not be detected" => "Mimetyp súboru '%value%' nebolo možné zistiť", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Súbor '%value%' neodpovedá danému md5 hashu", - 'A md5 hash could not be evaluated for the given file' => 'md5 hash nemohol byť pre daný súbor vypočítaný', - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Súbor '%value%' má neplatný mimetyp '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mimetyp súboru '%value%' nebolo možne zistiť", - "File '%value%' is not readable or does not exist" => "Soubor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Súbor '%value%' už existuje", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Súbor '%value%' neodpovedá danému sha1 hashu", - 'A sha1 hash could not be evaluated for the given file' => 'sha1 hash nemohol byť pre daný súbor vypočítaný', - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maximálna povolená veľkosť súboru je '%max%', ale '%value%' má '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimálna veľkosť súboru je '%min%', ale '%value%' má '%size%'", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Súbor '%value%' prekročil veľkosť definovanú v ini súbore", - "File '%value%' exceeds the defined form size" => "Súbor '%value%' prekročil veľkosť definovanú vo formulári", - "File '%value%' was only partially uploaded" => "Súbor '%value%' bol nahraný len čiastočne", - "File '%value%' was not uploaded" => "Súbor '%value%' nebol nahraný", - "No temporary directory was found for file '%value%'" => "Pre súbor '%value%' nebol nájdený žiadny dočasný adresár", - "File '%value%' can't be written" => "Súbor '%value%' nemôže byť zapísaný", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP rozšírenie vrátilo chybu počas nahrávania súboru '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Súbor '%value%' bol nahraný neoprávnene. Môže sa jednať o útok", - "File '%value%' was not found" => "Súbor '%value%' nebol nalezený", - "Unknown error while uploading file '%value%'" => "Počas nahrávania súboru '%value%' došlo k chybe", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Príliš mnoho slov. Je ich dovolené maximálne '%max%', ale bolo zadaných '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Príliš málo slov. Musí ich byť minimálne '%min%', ale bolo zadaných len '%count%'", - "File '%value%' is not readable or does not exist" => "Súbor '%value%' je nečitateľný alebo neexistuje", - - // Zend_Validate_Float - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo', - "'%value%' does not appear to be a float" => "'%value%' nie je desatinné číslo", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' nie je viac ako '%min%'", - - // Zend_Validate_Hex - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' has not only hexadecimal digit characters" => "'%value%' musí obsahovať len znaky hexadecimálnych čísel.", - - // Zend_Validate_Hostname - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' vyzerá ako IP adresa, ale tie nie sú dovolené", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' vyzerá ako hostname, ale nemohol byť overený proti známym TLD", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' vyzerá ako hostname, ale obsahuje pomlčku na nepovolenom mieste", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' vyzerá ako hostname, ale neodpovedá formátu hostname pre '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' síce vyzerá ako hostname, ale nebolo možné určiť TLD", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' nezodpovedá očakávanej štruktúre hostname", - "'%value%' does not appear to be a valid local network name" => "'%value%' nevyzerá ako platné sieťové meno", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' vyzerá ako hostname lokálnej siete, tie ale nie sú dovolené", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' vyzerá ako DNS hostname ale zadanú punycode notáciu nie je možné dekódovať", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Neznámy štát v IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' je neplatný formát IBAN", - "'%value%' has failed the IBAN check" => "'%value%' neprešiel kontrolou IBAN", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Zadané položky sú rozdielne', - 'No token was provided to match against' => 'Nebola zadaná položka na porovnanie', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' nebola nájdená v zozname", - - // Zend_Validate_Int - 'Invalid type given. String or integer expected' => 'Chybný typ. Bol očakávaný reťazec alebo celé číslo', - "'%value%' does not appear to be an integer" => "'%value%' nie je celé číslo", - - // Zend_Validate_Ip - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' does not appear to be a valid IP address" => "'%value%' je neplatná IP adresa", - - // Zend_Validate_Isbn - 'Invalid type given. String or integer expected' => 'Chybný typ. Bol očakávaný reťazec alebo celé číslo', - "'%value%' is not a valid ISBN number" => "'%value%' je neplatný ISBN", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' nie je menej ako '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given. String, integer, float, boolean or array expected' => 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo, boolean alebo pole', - "Value is required and can't be empty" => 'Položka je povinná a nemôže byť prázdna', - - // Zend_Validate_PostCode - 'Invalid type given. String or integer expected' => 'Chybný typ. Bol očakávaný reťazec alebo celé číslo', - "'%value%' does not appear to be a postal code" => "'%value%' nevyzerá ako PSČ", - - // Zend_Validate_Regex - 'Invalid type given. String, integer or float expected' => 'Chybný typ. Bol očakávaný reťazec, celé alebo desatinné číslo', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' neodpovedá šablóne '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Počas spracovania šablóny '%pattern%' došlo k interní chybe", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' je neplatný 'changefreq' pre sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' je neplatný 'lastmod' pre sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' je neplatný 'location' pre sitemapu", - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' je neplatná 'priority' pre sitemapu", - 'Invalid type given. Numeric string, integer or float expected' => 'Chybný typ. Bol očakávaný číselný reťazec, celé alebo desatinné číslo.', - - // Zend_Validate_StringLength - 'Invalid type given. String expected' => 'Chybný typ. Bol očakávaný reťazec', - "'%value%' is less than %min% characters long" => "'%value%' ma menej ako %min% znakov", - "'%value%' is more than %max% characters long" => "'%value%' ma viac ako %max% znakov", -]; diff --git a/resources/languages/sr/Zend_Validate.php b/resources/languages/sr/Zend_Validate.php deleted file mode 100644 index c74cdc56..00000000 --- a/resources/languages/sr/Zend_Validate.php +++ /dev/null @@ -1,261 +0,0 @@ - 'Nevalidan tip, vrednost treba da bude tekst ili broj', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' sadrži karaktere koji nisu slova niti cifre", - "'%value%' is an empty string" => "'%value%' je prazan tekst", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' contains non alphabetic characters" => "'%value%' sadrži karaktere koji nisu slova", - "'%value%' is an empty string" => "'%value%' je prazan tekst", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' greška u checksum validaciji", - "'%value%' contains invalid characters" => "'%value%' sadrži nevalidne karaktere", - "'%value%' should have a length of %length% characters" => "'%value%' treba da bude dužine %length%", - 'Invalid type given, value should be string' => 'Nevalidan tip, vrednost treba da bude tekst', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' nije između '%min%' i '%max%', uključivo", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' nije strogo između '%min%' i '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' nije validno", - 'Failure within the callback, exception returned' => 'Greška u pozivu', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' treba da sadrži između 13 i 19 cifara", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algoritam ne prolazi na '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Luhn algoritam ne prolazi na '%value%'", - "'%value%' must contain only digits" => "'%value%' treba da sadrži samo cifre", - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' contains an invalid amount of digits" => "'%value%' sadrži nevalidu količinu cifara", - "'%value%' is not from an allowed institute" => "'%value%' nije iz dozvoljene institucije", - "Validation of '%value%' has been failed by the service" => "Validacija '%value%' nije uspela od strane servisa", - "The service returned a failure while validating '%value%'" => "Servis je vratio grešku pri validaciji '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => 'Nevalidan tip, vrednost treba da bude tekst, ceo broj, niz ili Zend_Date', - "'%value%' does not appear to be a valid date" => "'%value%' nije validan datum", - "'%value%' does not fit the date format '%format%'" => "'%value%' nije u formatu datuma '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => 'Zapis koji se poklapa sa %value% nije pronađen', - "A record matching '%value%' was found" => 'Zapis koji se poklapa sa %value% je pronađen', - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Nevalidan tip, vrednost treba da bude tekst ili broj', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' sadrži karaktere koji nisu cifre, a samo cifre su dozvoljene", - "'%value%' contains not only digit characters" => "'%value%' ne sadrži samo cifre", - "'%value%' is an empty string" => "'%value%' je prazan tekst", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' nije validna adresa elektronske pošte u formatu adresa@imehosta", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' nije validno ime hosta za adresu elektronske pošte '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' nema validan MX zapis za adresu elektronske pošte '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' nije rutabilan mrežni segment. Adresa elektronske pošte '%value%' ne treba da bude razrešena sa javne mreže", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart%' se ne poklapa sa dot-atom formatom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' se ne poklapa sa quoted-string formatom", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' nije validan deo adrese elektronske pošte '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' prelazi dozvoljenu dužinu", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Preveliki broj fajlova, maksimalno '%max%' je dozvoljeno, a '%count%' je prosleđeno", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Premali broj fajlova, minimalno '%min%' je očekivano, a '%count%' je prosleđeno", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Fajl '%value%' ne prolazi crc32 proveru", - 'A crc32 hash could not be evaluated for the given file' => 'Nema crc32 kodova za dati fajl', - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Fajl '%value%' ima nevalidnu ekstenziju", - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Fajl '%value%' ima nevalidan mime-tip '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mime-tip fajla '%value%' ne može biti detektovan", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Fajl '%value%' ne postoji", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Fajl '%value%' ima nevalidnu ekstenziju", - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Svi fajlovi u zbiru treba da imaju maksimalnu veličinu '%max%', veličina poslatih fajlova je '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Svi fajlovi u zbiru treba da imaju minimalnu veličinu '%min%', veličina poslatih fajlova je '%size%'", - 'One or more files can not be read' => 'Jedan ili više fajlova ne može biti pročitan', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Fajl '%value%' je nepravilno kodiran", - 'A hash could not be evaluated for the given file' => 'Heševi nisu pronađeni za dati fajl', - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Maksimalna dozvoljena širina slike '%value%' je '%maxwidth%', data slika ima širinu '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Minimalna očekivana širina slike '%value%' je '%minwidth%', data slika ima širinu '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Maksimalna dozvoljena visina slike '%value%' je '%maxheight%', data slika ima visinu '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Minimalna očekivana visina slike '%value%' je '%minheight%', data slika ima visinu '%height%'", - "The size of image '%value%' could not be detected" => "Veličina slike '%value%' ne može biti određena", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Fajl '%value%' nije kompresovan, '%type%' detektovan", - "The mimetype of file '%value%' could not be detected" => "Mime-tip fajla '%value%' ne može biti detektovan", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Fajl '%value%' nije slika, '%type%' detektovan", - "The mimetype of file '%value%' could not be detected" => "Mime-tip fajla '%value%' ne može biti detektovan", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Fajl '%value%' ne prolazi md5 proveru", - 'A md5 hash could not be evaluated for the given file' => 'Nema md5 heševa za dati fajl', - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "Fajl '%value%' ima nevalidan mime-tip '%type%'", - "The mimetype of file '%value%' could not be detected" => "Mime-tip fajla '%value%' ne može biti detektovan", - "File '%value%' can not be read" => "Fajl '%value%' ne može biti pročitan", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Fajl '%value%' postoji", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Fajl '%value%' ne prolazi sha1 proveru", - 'A sha1 hash could not be evaluated for the given file' => 'Nema sha1 heševa za dati fajl', - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Maksimalna dozvoljena veličina fajla '%value%' je '%max%', data veličina je '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Minimalna očekivana veličina fajla '%value%' je '%min%', data veličina je '%size%'", - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Fajl '%value%' prevazilazi maksimalnu dozvoljenu veličinu", - "File '%value%' exceeds the defined form size" => "Fajl '%value%' prevazilazi maksimalnu dozvoljenu veličinu", - "File '%value%' was only partially uploaded" => "Fajl '%value%' je samo parcijalno uploadovan", - "File '%value%' was not uploaded" => "Fajl '%value%' nije uploadovan", - "No temporary directory was found for file '%value%'" => "Privremeni direktorijum nije pronađen za fajl '%value%'", - "File '%value%' can't be written" => "Fajl '%value%' ne može biti izmenjen", - "A PHP extension returned an error while uploading the file '%value%'" => "Ekstenzija je vratila grešku tokom uploada fajla '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Fajl '%value%' je ilegalno uploadovan, moguć napad", - "File '%value%' was not found" => "Fajl '%value%' nije pronađen", - "Unknown error while uploading file '%value%'" => "Nepoznata greška pri uploadu fajla '%value%'", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Previše reči, maksimalno '%max%' je dozvoljeno, '%count%' je izbrojano", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Premalo reči, minimalno '%min%' je očekivano, '%count%' je izbrojano", - "File '%value%' could not be found" => "Fajl '%value%' ne može biti pronađen", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Nevalidan tip, vrednost treba da bude tekst ili broj', - "'%value%' does not appear to be a float" => "'%value%' nije razlomljeni broj", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' nije veće od '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' has not only hexadecimal digit characters" => "'%value%' se ne sastoji samo od heksadecimalnih karaktera", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "'%value%' je IP adresa, IP adrese nisu dozvoljene", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' je DNS ime hosta, ali TLD nije u listi poznatih", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' je DNS ime hosta, ali sadrži srednju crtu (-) na nedozvoljenoj poziciji", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' je DNS ime hosta, ali se ne poklapa sa šemom za '%tld%' TLD", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' je DNS ime hosta, ali ne može da se ekstraktuje TLD deo '%tld%'", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' se ne poklapa sa očekivanom strukturom DNS imena hosta", - "'%value%' does not appear to be a valid local network name" => "'%value%' nije validno ime lokalne mreže", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' je ime lokalne mreže, lokalna imena mreža nisu dozvoljena", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' je DNS ime hosta, ali data punikod notacija ne može biti dekodirana", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Nepoznata zemlja u IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' nije u validnom IBAN formatu", - "'%value%' has failed the IBAN check" => "'%value%' ne prolazi IBAN proveru", - - // Zend_Validate_Identical - 'The two given tokens do not match' => 'Tokeni se ne poklapaju', - 'No token was provided to match against' => 'Token za proveru nije prosleđen', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' nije pronađeno u gomili", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Nevalidan tip, vrednost treba da bude tekst ili ceo broj', - "'%value%' does not appear to be an integer" => "'%value%' nije ceo broj", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' does not appear to be a valid IP address" => "'%value%' nije validna IP adresa", - - // Zend_Validate_Isbn - 'Invalid type given, value should be string or integer' => 'Nevalidan tip, vrednost treba da bude tekst ili ceo broj', - "'%value%' is not a valid ISBN number" => "'%value%' nije validan ISBN broj", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' je manje od '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'Nevalidan tip, vrednost treba da bude tekst, broj ili logička vrednost', - "Value is required and can't be empty" => 'Vrednost je obavezna i ne sme biti prazna', - - // Zend_Validate_PostCode - 'Invalid type given. The value should be a string or a integer' => 'Nevalidan tip. Vrednost treba da bude tekst ili ceo broj', - "'%value%' does not appear to be a postal code" => "'%value%' nije poštanski broj", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Nevalidan tip, vrednost treba da bude tekst ili broj', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' se ne poklapa sa formatom '%pattern%'", - "There was an internal error while using the pattern '%pattern%'" => "Dogodila se greška pri korišćenju formata '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' nije validna frekvencija promene mape sajta", - 'Invalid type given, the value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' nije validan datum izmene mape sajta", - 'Invalid type given, the value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' nije validna lokacija mape sajta", - 'Invalid type given, the value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' nije validan prioritet mape sajta", - 'Invalid type given, the value should be a integer, a float or a numeric string' => 'Nevalidan tip, vrednost treba da bude broj ili numerički niz', - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Nevalidan tip, vrednost treba da bude tekst', - "'%value%' is less than %min% characters long" => "'%value%' ima manje od %min% karaktera", - "'%value%' is more than %max% characters long" => "'%value%' ima više od %max% karaktera", -]; diff --git a/resources/languages/uk/Zend_Validate.php b/resources/languages/uk/Zend_Validate.php deleted file mode 100644 index 635a23bc..00000000 --- a/resources/languages/uk/Zend_Validate.php +++ /dev/null @@ -1,254 +0,0 @@ - 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком чи цілим числом', - "'%value%' contains characters which are non alphabetic and no digits" => "'%value%' містить символи які не є літерами чи цифрами", - "'%value%' is an empty string" => "'%value%' - пустий рядок", - - // Zend_Validate_Alpha - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' contains non alphabetic characters" => "'%value%' містить символи які не є літерами", - "'%value%' is an empty string" => "'%value%' - пустий рядок", - - // Zend_Validate_Barcode - "'%value%' failed checksum validation" => "'%value%' помилка перевірки контрольної суми", - "'%value%' contains invalid characters" => "'%value%' містить неприпустимі символи", - "'%value%' should have a length of %length% characters" => "Довжина '%value%' повинна складати %length% символів", - 'Invalid type given, value should be string' => 'Неприпустимий тип даних, значення повинно бути рядком', - - // Zend_Validate_Between - "'%value%' is not between '%min%' and '%max%', inclusively" => "'%value%' за межами діапазону від '%min%' до '%max%', включно", - "'%value%' is not strictly between '%min%' and '%max%'" => "'%value%' за межами діапазону від '%min%' до '%max%'", - - // Zend_Validate_Callback - "'%value%' is not valid" => "'%value%' - неприпустиме значення", - 'Failure within the callback, exception returned' => 'Помилка в зворотньому виклику, повернено виключення', - - // Zend_Validate_Ccnum - "'%value%' must contain between 13 and 19 digits" => "'%value%' має містити від 13 до 19 цифр", - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Алгоритм Луна (обчислення контрольної цифри) повернув помилку для '%value%'", - - // Zend_Validate_CreditCard - "Luhn algorithm (mod-10 checksum) failed on '%value%'" => "Алгоритм Луна (обчислення контрольної цифри) повернув помилку для '%value%'", - "'%value%' must contain only digits" => "'%value%' має містити тільки цифри", - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' contains an invalid amount of digits" => "'%value%' містить неприпустиму кількість цифр", - "'%value%' is not from an allowed institute" => "'%value%' не відноситься до дозволенних платіжних систем", - "Validation of '%value%' has been failed by the service" => "Перевірка '%value%' закінчилась помилкою сервісу", - "The service returned a failure while validating '%value%'" => "Сервіс повернув помилку під час перевірки '%value%'", - - // Zend_Validate_Date - 'Invalid type given, value should be string, integer, array or Zend_Date' => "Неприпустимий тип даних, значення повинно бути рядком, цілим числом, масивом чи об'єктом Zend_Date", - "'%value%' does not appear to be a valid date" => "'%value%' - некоректна дата", - "'%value%' does not fit the date format '%format%'" => "'%value%' не відповідає формату дати '%format%'", - - // Zend_Validate_Db_Abstract - "No record matching '%value%' was found" => "Не знайдено записів, що відповідають '%value%'", - "A record matching '%value%' was found" => "Знайдено запис, що відповідає '%value%'", - - // Zend_Validate_Digits - 'Invalid type given, value should be string, integer or float' => 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком чи цілим числом', - "'%value%' contains characters which are not digits; but only digits are allowed" => "'%value%' має містити тільки цифри", - "'%value%' is an empty string" => "'%value%' - пустий рядок", - - // Zend_Validate_EmailAddress - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно рядком', - "'%value%' is not a valid email address in the basic format local-part@hostname" => "'%value%' неприпустима адреса електронної пошти для формату ім'я@домен", - "'%hostname%' is not a valid hostname for email address '%value%'" => "'%hostname%' неприпустиме ім'я хоста для адреси '%value%'", - "'%hostname%' does not appear to have a valid MX record for the email address '%value%'" => "'%hostname%' не має коректного MX-запису про адресу '%value%'", - "'%hostname%' is not in a routable network segment. The email address '%value%' should not be resolved from public network." => "'%hostname%' не є маршрутизованим сегментом мережі. Адреса електронної пошти '%value%' не може бути отримана з публічної мережі.", - "'%localPart%' can not be matched against dot-atom format" => "'%localPart% не відповідає формату dot-atom", - "'%localPart%' can not be matched against quoted-string format" => "'%localPart%' не відповідає формату quoted-string", - "'%localPart%' is not a valid local part for email address '%value%'" => "'%localPart%' неприпустиме ім'я для адреси '%value%'", - "'%value%' exceeds the allowed length" => "'%value%' перевищує дозволену довжину", - - // Zend_Validate_File_Count - "Too many files, maximum '%max%' are allowed but '%count%' are given" => "Занадто багато файлів, дозволено максимум - '%max%', отримано - '%count%'", - "Too few files, minimum '%min%' are expected but '%count%' are given" => "Занадто мало файлів, дозволено мінімум - '%min%', отримано - '%count%'", - - // Zend_Validate_File_Crc32 - "File '%value%' does not match the given crc32 hashes" => "Файл '%value%' не відповідає заданому crc32 хешу", - 'A crc32 hash could not be evaluated for the given file' => 'crc32 хеш не може бути обчисленний для цього файлу', - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_ExcludeExtension - "File '%value%' has a false extension" => "Файл '%value%' має неприпустиме розширення", - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_ExcludeMimeType - "File '%value%' has a false mimetype of '%type%'" => "Файл '%value%' має неприпустимий MIME-тип '%type%'", - "The mimetype of file '%value%' could not be detected" => "Не вдається визначити MIME-тип файлу '%value%'", - "File '%value%' can not be read" => "Файл '%value%' неможливо прочитати", - - // Zend_Validate_File_Exists - "File '%value%' does not exist" => "Файл '%value%' не існує", - - // Zend_Validate_File_Extension - "File '%value%' has a false extension" => "Файл '%value%' має неприпустиме розширення", - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_FilesSize - "All files in sum should have a maximum size of '%max%' but '%size%' were detected" => "Загальний розмір файлів не повинен перевищувати '%max%', зараз - '%size%'", - "All files in sum should have a minimum size of '%min%' but '%size%' were detected" => "Загальний розмір файлів має бути менше '%min%', зараз - '%size%'", - 'One or more files can not be read' => 'Неможливо прочитати один чи декілька файлів', - - // Zend_Validate_File_Hash - "File '%value%' does not match the given hashes" => "Файл '%value%' не відповідає вказаному хешу", - 'A hash could not be evaluated for the given file' => 'Не можливо обчислити хеш для вказаного файла', - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_ImageSize - "Maximum allowed width for image '%value%' should be '%maxwidth%' but '%width%' detected" => "Максимально допустима ширина для зображення '%value%' - '%maxwidth%', зараз - '%width%'", - "Minimum expected width for image '%value%' should be '%minwidth%' but '%width%' detected" => "Мінімально очікувана ширина для зображення '%value%' - '%minwidth%', зараз - '%width%'", - "Maximum allowed height for image '%value%' should be '%maxheight%' but '%height%' detected" => "Максимально допустима висота для зображення '%value%' - '%maxheight%', зараз - '%height%'", - "Minimum expected height for image '%value%' should be '%minheight%' but '%height%' detected" => "Мінімально очікувана ширина для зображення '%value%' - '%minheight%', зараз - '%height%'", - "The size of image '%value%' could not be detected" => "Неможливо визначити розмір зображення '%value%'", - "File '%value%' can not be read" => "Файл '%value%' неможливо прочитати", - - // Zend_Validate_File_IsCompressed - "File '%value%' is not compressed, '%type%' detected" => "Файл '%value%' не є стислий. MIME-тип файлу - '%type%'", - "The mimetype of file '%value%' could not be detected" => "Неможливо визначити MIME-тип файлу '%value%'", - "File '%value%' can not be read" => "Файл '%value%' неможливо прочитати", - - // Zend_Validate_File_IsImage - "File '%value%' is no image, '%type%' detected" => "Файл '%value%' не є зображенням. MIME-тип файлу - '%type%'", - "The mimetype of file '%value%' could not be detected" => "Неможливо визначити MIME-тип файлу '%value%'", - "File '%value%' can not be read" => "Файл '%value%' неможливо прочитати", - - // Zend_Validate_File_Md5 - "File '%value%' does not match the given md5 hashes" => "Файл '%value%' не відповідає вказаному md5 хешу", - 'A md5 hash could not be evaluated for the given file' => 'md5 хеш не може бути визначений для вказаного файлу', - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_MimeType - "File '%value%' has a false mimetype of '%type%'" => "MIME-тип '%type%' файлу '%value%' неприпустимий", - "The mimetype of file '%value%' could not be detected" => "Неможливо визначити MIME-тип файлу '%value%'", - "File '%value%' can not be read" => "Файл '%value%' не можливо прочитати", - - // Zend_Validate_File_NotExists - "File '%value%' exists" => "Файл '%value%' вже існує", - - // Zend_Validate_File_Sha1 - "File '%value%' does not match the given sha1 hashes" => "Файл '%value%' не відповідає хешу sha1", - 'A sha1 hash could not be evaluated for the given file' => 'Неможливо визначити sha1 хеш для вказаного файлу', - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_Size - "Maximum allowed size for file '%value%' is '%max%' but '%size%' detected" => "Максимально дозволений розмір файлу '%value%' - '%max%', зараз - '%size%'", - "Minimum expected size for file '%value%' is '%min%' but '%size%' detected" => "Мінімально дозволений розмір файлу '%value%' - '%min%', зараз - '%size%'", - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_File_Upload - "File '%value%' exceeds the defined ini size" => "Розмір файлу '%value%' більше ніж дозволений, що вказаний в php.ini", - "File '%value%' exceeds the defined form size" => "Розмір файлу '%value%' більше ніж дозволений, що вказаний в формі", - "File '%value%' was only partially uploaded" => "Файл '%value%' був завантажений тільки частково", - "File '%value%' was not uploaded" => "Файл '%value%' не був завантажений", - "No temporary directory was found for file '%value%'" => "Не знайдено тимчасову директорію для файлу '%value%'", - "File '%value%' can't be written" => "Файл '%value%' не може бути записаний", - "A PHP extension returned an error while uploading the file '%value%'" => "PHP розширення повернуло помилку під час завантаження фалу '%value%'", - "File '%value%' was illegally uploaded. This could be a possible attack" => "Файл '%value%' завантажений некоректно. Можлива атака", - "File '%value%' was not found" => "Файл '%value%' не знайдено", - "Unknown error while uploading file '%value%'" => "Під час завантаження файлу '%value%' виникла невідома помилка", - - // Zend_Validate_File_WordCount - "Too much words, maximum '%max%' are allowed but '%count%' were counted" => "Занадто багато слів, дозволено максимум '%max%' слів, зараз - '%count%'", - "Too less words, minimum '%min%' are expected but '%count%' were counted" => "Занадто мало слів, дозволено мінімум '%min%' слів, зараз - '%count%'", - "File '%value%' could not be found" => "Файл '%value%' не знайдено", - - // Zend_Validate_Float - 'Invalid type given, value should be float, string, or integer' => 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком, або цілим числом', - "'%value%' does not appear to be a float" => "'%value%' не є числом з плаваючою крапкою", - - // Zend_Validate_GreaterThan - "'%value%' is not greater than '%min%'" => "'%value%' не більше ніж '%min%'", - - // Zend_Validate_Hex - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' has not only hexadecimal digit characters" => "Значення '%value%' повинно містити тільки шістнадцятирічні символи", - - // Zend_Validate_Hostname - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' appears to be an IP address, but IP addresses are not allowed" => "Значення '%value%' виглядає як IP-адреса, але IP-адреси не дозволені", - "'%value%' appears to be a DNS hostname but cannot match TLD against known list" => "'%value%' виглядає як DNS ім’я хоста, але воно не повинно бути зі списку доменів верхнього рівня", - "'%value%' appears to be a DNS hostname but contains a dash in an invalid position" => "'%value%' виглядає як DNS ім’я хоста, але знак '-' знаходиться в неприпустимому місці", - "'%value%' appears to be a DNS hostname but cannot match against hostname schema for TLD '%tld%'" => "'%value%' виглядає як DNS ім’я хоста, але воно не відповідає шаблону для доменних імен верхнього рівня '%tld%'", - "'%value%' appears to be a DNS hostname but cannot extract TLD part" => "'%value%' виглядає як DNS ім’я хоста, але не вдається визначити домен верхнього рівня", - "'%value%' does not match the expected structure for a DNS hostname" => "'%value%' не відповідає очікуваній структурі для DNS імені хоста", - "'%value%' does not appear to be a valid local network name" => "'%value%' є неприпустимим іменем локальної мережі", - "'%value%' appears to be a local network name but local network names are not allowed" => "'%value%' виглядає як ім’я локальної мережі, але імена локальних мереж не дозволені", - "'%value%' appears to be a DNS hostname but the given punycode notation cannot be decoded" => "'%value%' виглядає як DNS ім’я хоста, але вказане значення не може бути перетворене в припустимий для DNS набір символів", - - // Zend_Validate_Iban - "Unknown country within the IBAN '%value%'" => "Невідома країна IBAN '%value%'", - "'%value%' has a false IBAN format" => "'%value%' має неприпустимий IBAN формат", - "'%value%' has failed the IBAN check" => "'%value%' не пройшло IBAN перевірку", - - // Zend_Validate_Identical - "The token '%token%' does not match the given token '%value%'" => "Значення '%token%' не співпадає з вказаним значенням '%value%'", - 'No token was provided to match against' => 'Не вказано значення для перевірки на ідентичність', - - // Zend_Validate_InArray - "'%value%' was not found in the haystack" => "'%value%' не знайдено в списку допустимих значень", - - // Zend_Validate_Int - 'Invalid type given, value should be string or integer' => 'Неприпустимий тип даних, значення повинно бути рядком чи цілим числом', - "'%value%' does not appear to be an integer" => "'%value%' не є цілим числом", - - // Zend_Validate_Ip - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' does not appear to be a valid IP address" => "'%value%' - некоректна IP-адреса", - - // Zend_Validate_Isbn - "'%value%' is not a valid ISBN number" => "'%value%' - некоректний номер ISBN", - - // Zend_Validate_LessThan - "'%value%' is not less than '%max%'" => "'%value%' не менше ніж '%max%'", - - // Zend_Validate_NotEmpty - 'Invalid type given, value should be float, string, array, boolean or integer' => 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком, масивом чи цілим числом', - "Value is required and can't be empty" => "Значення обов'язкове і не може бути порожнім", - - // Zend_Validate_PostCode - 'Invalid type given, value should be string or integer' => 'Неприпустимий тип даних, значення повинно бути рядком чи цілим числом', - "'%value%' does not appear to be an postal code" => "'%value%' не являється поштовим індексом", - - // Zend_Validate_Regex - 'Invalid type given, value should be string, integer or float' => 'Неприпустимий тип даних, значення повинно бути числом з плаваючою крапкою, рядком чи цілим числом', - "'%value%' does not match against pattern '%pattern%'" => "'%value%' не відповідає шаблону '%pattern%'", - - // Zend_Validate_Sitemap_Changefreq - "'%value%' is not a valid sitemap changefreq" => "'%value%' неприпустиме значення для sitemap changefreq", - - // Zend_Validate_Sitemap_Lastmod - "'%value%' is not a valid sitemap lastmod" => "'%value%' неприпустиме значення для sitemap lastmod", - - // Zend_Validate_Sitemap_Loc - "'%value%' is not a valid sitemap location" => "'%value%' неприпустиме значення для sitemap location", - - // Zend_Validate_Sitemap_Priority - "'%value%' is not a valid sitemap priority" => "'%value%' неприпустиме значення для sitemap priority", - - // Zend_Validate_StringLength - 'Invalid type given, value should be a string' => 'Неприпустимий тип даних, значення повинно бути рядком', - "'%value%' is less than %min% characters long" => "Довжина '%value%' менше %min% символів", - "'%value%' is more than %max% characters long" => "Довжина '%value%' перевищує %max% символів", -]; From 699ec822edb7cd1a01b360dabb2541014ab191bd Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Tue, 10 Jun 2025 14:42:09 +0200 Subject: [PATCH 10/28] Fix style --- library/Zend/Locale/Format.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Locale/Format.php b/library/Zend/Locale/Format.php index 252c4b1d..1c8ff1b5 100644 --- a/library/Zend/Locale/Format.php +++ b/library/Zend/Locale/Format.php @@ -1184,7 +1184,7 @@ public static function getDate($date, array $options = []) /** * Returns if the given datestring contains all date parts from the given format. - * If no format is given, the default date format from the locale is used + * If no format is given, the default date format from the locale is used. * * @param string $date Date string * @param array $options Options: format_type, fix_date, locale, date_format. See {@link setOptions()} for details. From e7d6165c506c67c4fa600a8c76ba066929c30736 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Wed, 31 Dec 2025 14:20:37 +0900 Subject: [PATCH 11/28] Drop Zend_Captcha and non-HTML5 doctype #12152 Because we only use HTML5 doctype and unit tests were inter-dependent on globally set doctypes --- library/Zend/Captcha/Adapter.php | 69 -- library/Zend/Captcha/Base.php | 172 ----- library/Zend/Captcha/Dumb.php | 72 -- library/Zend/Captcha/Exception.php | 31 - library/Zend/Captcha/Figlet.php | 77 --- library/Zend/Captcha/Image.php | 652 ------------------ library/Zend/Captcha/Word.php | 441 ------------ library/Zend/Form/Decorator/Captcha.php | 68 -- library/Zend/Form/Decorator/Captcha/Word.php | 74 -- library/Zend/Form/Element/Captcha.php | 301 -------- library/Zend/View/Helper/Doctype.php | 67 +- tests/Zend/Application/Resource/ViewTest.php | 36 +- tests/Zend/Captcha/DumbTest.php | 145 ---- tests/Zend/Captcha/FigletTest.php | 335 --------- tests/Zend/Captcha/ImageTest.php | 350 ---------- .../Zend/Form/Element/_files/Captcha/Foo.php | 26 - tests/Zend/Form/FormTest.php | 30 +- tests/Zend/View/Helper/DoctypeTest.php | 86 +-- tests/Zend/View/Helper/FormCheckboxTest.php | 7 - tests/Zend/View/Helper/FormFileTest.php | 9 - tests/Zend/View/Helper/FormImageTest.php | 13 - .../View/Helper/FormMultiCheckboxTest.php | 22 - tests/Zend/View/Helper/FormPasswordTest.php | 7 - tests/Zend/View/Helper/FormRadioTest.php | 65 -- tests/Zend/View/Helper/FormResetTest.php | 7 - tests/Zend/View/Helper/FormSubmitTest.php | 7 - tests/Zend/View/Helper/FormTest.php | 21 - tests/Zend/View/Helper/FormTextTest.php | 7 - tests/Zend/View/Helper/GravatarTest.php | 10 - tests/Zend/View/Helper/HeadLinkTest.php | 1 - tests/Zend/View/Helper/HeadMetaTest.php | 89 +-- tests/Zend/View/Helper/HtmlObjectTest.php | 21 - .../Zend/View/Helper/Navigation/LinksTest.php | 15 - .../uiwidgetcontainer/with_content.html | 2 +- tests/ZendX/JQuery/View/jQueryTest.php | 13 - 35 files changed, 23 insertions(+), 3325 deletions(-) delete mode 100644 library/Zend/Captcha/Adapter.php delete mode 100644 library/Zend/Captcha/Base.php delete mode 100644 library/Zend/Captcha/Dumb.php delete mode 100755 library/Zend/Captcha/Exception.php delete mode 100644 library/Zend/Captcha/Figlet.php delete mode 100644 library/Zend/Captcha/Image.php delete mode 100644 library/Zend/Captcha/Word.php delete mode 100644 library/Zend/Form/Decorator/Captcha.php delete mode 100644 library/Zend/Form/Decorator/Captcha/Word.php delete mode 100644 library/Zend/Form/Element/Captcha.php delete mode 100644 tests/Zend/Captcha/DumbTest.php delete mode 100644 tests/Zend/Captcha/FigletTest.php delete mode 100644 tests/Zend/Captcha/ImageTest.php delete mode 100644 tests/Zend/Form/Element/_files/Captcha/Foo.php diff --git a/library/Zend/Captcha/Adapter.php b/library/Zend/Captcha/Adapter.php deleted file mode 100644 index 87bb9b57..00000000 --- a/library/Zend/Captcha/Adapter.php +++ /dev/null @@ -1,69 +0,0 @@ -_name; - } - - /** - * Set name. - * - * @param string $name - * - * @return Zend_Captcha_Adapter - */ - public function setName($name) - { - $this->_name = $name; - - return $this; - } - - /** - * Constructor. - * - * @param array|Zend_Config $options - */ - public function __construct($options = null) - { - // Set options - if (is_array($options)) { - $this->setOptions($options); - } elseif ($options instanceof Zend_Config) { - $this->setConfig($options); - } - } - - /** - * Set single option for the object. - * - * @param string $key - * @param string $value - * - * @return Zend_Form_Element - */ - public function setOption($key, $value) - { - if (in_array(strtolower($key), $this->_skipOptions)) { - return $this; - } - - $method = 'set' . ucfirst($key); - if (method_exists($this, $method)) { - // Setter exists; use it - $this->$method($value); - $this->_options[$key] = $value; - } elseif (property_exists($this, $key)) { - // Assume it's metadata - $this->$key = $value; - $this->_options[$key] = $value; - } - - return $this; - } - - /** - * Set object state from options array. - * - * @param array $options - * - * @return Zend_Form_Element - */ - public function setOptions($options = null) - { - foreach ($options as $key => $value) { - $this->setOption($key, $value); - } - - return $this; - } - - /** - * Retrieve options representing object state. - * - * @return array - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Set object state from config object. - * - * @return Zend_Captcha_Base - */ - public function setConfig(Zend_Config $config) - { - return $this->setOptions($config->toArray()); - } - - /** - * Get optional decorator. - * - * By default, return null, indicating no extra decorator needed. - */ - public function getDecorator() - { - return null; - } -} diff --git a/library/Zend/Captcha/Dumb.php b/library/Zend/Captcha/Dumb.php deleted file mode 100644 index 185b6cda..00000000 --- a/library/Zend/Captcha/Dumb.php +++ /dev/null @@ -1,72 +0,0 @@ -_label = $label; - } - - /** - * Retrieve the label for the CAPTCHA. - * - * @return string - */ - public function getLabel() - { - return $this->_label; - } - - /** - * Render the captcha. - * - * @param mixed $element - * - * @return string - */ - public function render(?Zend_View_Interface $view = null, $element = null) - { - return $this->getLabel() . ': ' - . strrev($this->getWord()) - . ''; - } -} diff --git a/library/Zend/Captcha/Exception.php b/library/Zend/Captcha/Exception.php deleted file mode 100755 index a965a539..00000000 --- a/library/Zend/Captcha/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ -_figlet = new Zend_Text_Figlet($options); - } - - /** - * Generate new captcha. - * - * @return string - */ - public function generate() - { - $this->_useNumbers = false; - - return parent::generate(); - } - - /** - * Display the captcha. - * - * @param mixed $element - * - * @return string - */ - public function render(?Zend_View_Interface $view = null, $element = null) - { - return '
'
-             . $this->_figlet->render($this->getWord())
-             . "
\n"; - } -} diff --git a/library/Zend/Captcha/Image.php b/library/Zend/Captcha/Image.php deleted file mode 100644 index 8548f3f1..00000000 --- a/library/Zend/Captcha/Image.php +++ /dev/null @@ -1,652 +0,0 @@ -_imgAlt; - } - - /** - * @return string - */ - public function getStartImage() - { - return $this->_startImage; - } - - /** - * @return int - */ - public function getDotNoiseLevel() - { - return $this->_dotNoiseLevel; - } - - /** - * @return int - */ - public function getLineNoiseLevel() - { - return $this->_lineNoiseLevel; - } - - /** - * Get captcha expiration. - * - * @return int - */ - public function getExpiration() - { - return $this->_expiration; - } - - /** - * Get garbage collection frequency. - * - * @return int - */ - public function getGcFreq() - { - return $this->_gcFreq; - } - - /** - * Get font to use when generating captcha. - * - * @return string - */ - public function getFont() - { - return $this->_font; - } - - /** - * Get font size. - * - * @return int - */ - public function getFontSize() - { - return $this->_fsize; - } - - /** - * Get captcha image height. - * - * @return int - */ - public function getHeight() - { - return $this->_height; - } - - /** - * Get captcha image directory. - * - * @return string - */ - public function getImgDir() - { - return $this->_imgDir; - } - - /** - * Get captcha image base URL. - * - * @return string - */ - public function getImgUrl() - { - return $this->_imgUrl; - } - - /** - * Get captcha image file suffix. - * - * @return string - */ - public function getSuffix() - { - return $this->_suffix; - } - - /** - * Get captcha image width. - * - * @return int - */ - public function getWidth() - { - return $this->_width; - } - - /** - * Set start image. - * - * @param string $startImage - * - * @return Zend_Captcha_Image - */ - public function setStartImage($startImage) - { - $this->_startImage = $startImage; - - return $this; - } - - /** - * Set dot noise level. - * - * @param int $dotNoiseLevel - * - * @return Zend_Captcha_Image - */ - public function setDotNoiseLevel($dotNoiseLevel) - { - $this->_dotNoiseLevel = $dotNoiseLevel; - - return $this; - } - - /** - * Set line noise level. - * - * @param int $lineNoiseLevel - * - * @return Zend_Captcha_Image - */ - public function setLineNoiseLevel($lineNoiseLevel) - { - $this->_lineNoiseLevel = $lineNoiseLevel; - - return $this; - } - - /** - * Set captcha expiration. - * - * @param int $expiration - * - * @return Zend_Captcha_Image - */ - public function setExpiration($expiration) - { - $this->_expiration = $expiration; - - return $this; - } - - /** - * Set garbage collection frequency. - * - * @param int $gcFreq - * - * @return Zend_Captcha_Image - */ - public function setGcFreq($gcFreq) - { - $this->_gcFreq = $gcFreq; - - return $this; - } - - /** - * Set captcha font. - * - * @param string $font - * - * @return Zend_Captcha_Image - */ - public function setFont($font) - { - $this->_font = $font; - - return $this; - } - - /** - * Set captcha font size. - * - * @param int $fsize - * - * @return Zend_Captcha_Image - */ - public function setFontSize($fsize) - { - $this->_fsize = $fsize; - - return $this; - } - - /** - * Set captcha image height. - * - * @param int $height - * - * @return Zend_Captcha_Image - */ - public function setHeight($height) - { - $this->_height = $height; - - return $this; - } - - /** - * Set captcha image storage directory. - * - * @param string $imgDir - * - * @return Zend_Captcha_Image - */ - public function setImgDir($imgDir) - { - $this->_imgDir = rtrim($imgDir, '/\\') . '/'; - - return $this; - } - - /** - * Set captcha image base URL. - * - * @param string $imgUrl - * - * @return Zend_Captcha_Image - */ - public function setImgUrl($imgUrl) - { - $this->_imgUrl = rtrim($imgUrl, '/\\') . '/'; - - return $this; - } - - /** - * Set image alternative text. - * - * @param string $imgAlt - * - * @return Zend_Captcha_Image - */ - public function setImgAlt($imgAlt) - { - $this->_imgAlt = $imgAlt; - - return $this; - } - - /** - * Set captch image filename suffix. - * - * @param string $suffix - * - * @return Zend_Captcha_Image - */ - public function setSuffix($suffix) - { - $this->_suffix = $suffix; - - return $this; - } - - /** - * Set captcha image width. - * - * @param int $width - * - * @return Zend_Captcha_Image - */ - public function setWidth($width) - { - $this->_width = $width; - - return $this; - } - - /** - * Generate random frequency. - * - * @return float - */ - protected function _randomFreq() - { - return random_int(700000, 1_000_000) / 15_000_000; - } - - /** - * Generate random phase. - * - * @return float - */ - protected function _randomPhase() - { - // random phase from 0 to pi - return random_int(0, 3_141_592) / 1_000_000; - } - - /** - * Generate random character size. - * - * @return int - */ - protected function _randomSize() - { - return random_int(300, 700) / 100; - } - - /** - * Generate captcha. - * - * @return string captcha ID - */ - public function generate() - { - $id = parent::generate(); - $tries = 5; - // If there's already such file, try creating a new ID - while ($tries-- && file_exists($this->getImgDir() . $id . $this->getSuffix())) { - $id = $this->_generateRandomId(); - $this->_setId($id); - } - $this->_generateImage($id, $this->getWord()); - - if (random_int(1, $this->getGcFreq()) == 1) { - $this->_gc(); - } - - return $id; - } - - /** - * Generate image captcha. - * - * Override this function if you want different image generator - * Wave transform from http://www.captcha.ru/captchas/multiwave/ - * - * @param string $id Captcha ID - * @param string $word Captcha word - */ - protected function _generateImage($id, $word) - { - if (!extension_loaded('gd')) { - throw new Zend_Captcha_Exception('Image CAPTCHA requires GD extension'); - } - - if (!function_exists('imagepng')) { - throw new Zend_Captcha_Exception('Image CAPTCHA requires PNG support'); - } - - if (!function_exists('imageftbbox')) { - throw new Zend_Captcha_Exception('Image CAPTCHA requires FT fonts support'); - } - - $font = $this->getFont(); - - if (empty($font)) { - throw new Zend_Captcha_Exception('Image CAPTCHA requires font'); - } - - $w = $this->getWidth(); - $h = $this->getHeight(); - $fsize = $this->getFontSize(); - - $img_file = $this->getImgDir() . $id . $this->getSuffix(); - if (empty($this->_startImage)) { - $img = imagecreatetruecolor($w, $h); - } else { - $img = imagecreatefrompng($this->_startImage); - if (!$img) { - throw new Zend_Captcha_Exception('Can not load start image'); - } - $w = imagesx($img); - $h = imagesy($img); - } - $text_color = imagecolorallocate($img, 0, 0, 0); - $bg_color = imagecolorallocate($img, 255, 255, 255); - imagefilledrectangle($img, 0, 0, $w - 1, $h - 1, $bg_color); - $textbox = imageftbbox($fsize, 0, $font, $word); - $x = ($w - ($textbox[2] - $textbox[0])) / 2; - $y = ($h - ($textbox[7] - $textbox[1])) / 2; - imagefttext($img, $fsize, 0, (int) $x,(int) $y, $text_color, $font, $word); - - // generate noise - for ($i = 0; $i < $this->_dotNoiseLevel; ++$i) { - imagefilledellipse($img, random_int(0,$w), random_int(0,$h), 2, 2, $text_color); - } - for ($i = 0; $i < $this->_lineNoiseLevel; ++$i) { - imageline($img, random_int(0,$w), random_int(0,$h), random_int(0,$w), random_int(0,$h), $text_color); - } - - // transformed image - $img2 = imagecreatetruecolor($w, $h); - $bg_color = imagecolorallocate($img2, 255, 255, 255); - imagefilledrectangle($img2, 0, 0, $w - 1, $h - 1, $bg_color); - // apply wave transforms - $freq1 = $this->_randomFreq(); - $freq2 = $this->_randomFreq(); - $freq3 = $this->_randomFreq(); - $freq4 = $this->_randomFreq(); - - $ph1 = $this->_randomPhase(); - $ph2 = $this->_randomPhase(); - $ph3 = $this->_randomPhase(); - $ph4 = $this->_randomPhase(); - - $szx = $this->_randomSize(); - $szy = $this->_randomSize(); - - for ($x = 0; $x < $w; ++$x) { - for ($y = 0; $y < $h; ++$y) { - $sx = $x + (sin($x * $freq1 + $ph1) + sin($y * $freq3 + $ph3)) * $szx; - $sy = $y + (sin($x * $freq2 + $ph2) + sin($y * $freq4 + $ph4)) * $szy; - - if ($sx < 0 || $sy < 0 || $sx >= $w - 1 || $sy >= $h - 1) { - continue; - } - $color = (imagecolorat($img, (int) $sx,(int) $sy) >> 16) & 0xFF; - $color_x = (imagecolorat($img, (int) $sx + 1,(int) $sy) >> 16) & 0xFF; - $color_y = (imagecolorat($img, (int) $sx,(int) $sy + 1) >> 16) & 0xFF; - $color_xy = (imagecolorat($img, (int) $sx + 1,(int) $sy + 1) >> 16) & 0xFF; - - if ($color == 255 && $color_x == 255 && $color_y == 255 && $color_xy == 255) { - // ignore background - continue; - } - if ($color == 0 && $color_x == 0 && $color_y == 0 && $color_xy == 0) { - // transfer inside of the image as-is - $newcolor = 0; - } else { - // do antialiasing for border items - $frac_x = $sx - floor($sx); - $frac_y = $sy - floor($sy); - $frac_x1 = 1 - $frac_x; - $frac_y1 = 1 - $frac_y; - - $newcolor = $color * $frac_x1 * $frac_y1 - + $color_x * $frac_x * $frac_y1 - + $color_y * $frac_x1 * $frac_y - + $color_xy * $frac_x * $frac_y; - } - imagesetpixel($img2, $x, $y, imagecolorallocate($img2,(int) $newcolor,(int) $newcolor,(int) $newcolor)); - } - } - - // generate noise - for ($i = 0; $i < $this->_dotNoiseLevel; ++$i) { - imagefilledellipse($img2, random_int(0,$w), random_int(0,$h), 2, 2, $text_color); - } - for ($i = 0; $i < $this->_lineNoiseLevel; ++$i) { - imageline($img2, random_int(0,$w), random_int(0,$h), random_int(0,$w), random_int(0,$h), $text_color); - } - - imagepng($img2, $img_file); - imagedestroy($img); - imagedestroy($img2); - } - - /** - * Remove old files from image directory. - */ - protected function _gc() - { - $expire = time() - $this->getExpiration(); - $imgdir = $this->getImgDir(); - if (!$imgdir || strlen($imgdir) < 2) { - // safety guard - return; - } - $suffixLength = strlen($this->_suffix); - foreach (new DirectoryIterator($imgdir) as $file) { - if (!$file->isDot() && !$file->isDir()) { - if (file_exists($file->getPathname()) && $file->getMTime() < $expire) { - // only deletes files ending with $this->_suffix - if (substr($file->getFilename(), -($suffixLength)) == $this->_suffix) { - unlink($file->getPathname()); - } - } - } - } - } - - /** - * Display the captcha. - * - * @param mixed $element - * - * @return string - */ - public function render(?Zend_View_Interface $view = null, $element = null) - { - $endTag = ' />'; - if (($view instanceof Zend_View_Abstract) && !$view->doctype()->isXhtml()) { - $endTag = '>'; - } - - return '' . $this->getImgAlt()
-             . ' 'Empty captcha value', - self::MISSING_ID => 'Captcha ID field is missing', - self::BAD_CAPTCHA => 'Captcha value is wrong', - ]; - - /** - * Length of the word to generate. - * - * @var int - */ - protected $_wordlen = 8; - - /** - * Retrieve session class to utilize. - * - * @return string - */ - public function getSessionClass() - { - return $this->_sessionClass; - } - - /** - * Set session class for persistence. - * - * @param string $_sessionClass - * - * @return Zend_Captcha_Word - */ - public function setSessionClass($_sessionClass) - { - $this->_sessionClass = $_sessionClass; - - return $this; - } - - /** - * Retrieve word length to use when genrating captcha. - * - * @return int - */ - public function getWordlen() - { - return $this->_wordlen; - } - - /** - * Set word length of captcha. - * - * @param int $wordlen - * - * @return Zend_Captcha_Word - */ - public function setWordlen($wordlen) - { - $this->_wordlen = $wordlen; - - return $this; - } - - /** - * Retrieve captcha ID. - * - * @return string - */ - public function getId() - { - if (null === $this->_id) { - $this->_setId($this->_generateRandomId()); - } - - return $this->_id; - } - - /** - * Set captcha identifier. - * - * @param string $id - * - * @return Zend_Captcha_Word - */ - protected function _setId($id) - { - $this->_id = $id; - - return $this; - } - - /** - * Set timeout for session token. - * - * @param int $ttl - * - * @return Zend_Captcha_Word - */ - public function setTimeout($ttl) - { - $this->_timeout = (int) $ttl; - - return $this; - } - - /** - * Get session token timeout. - * - * @return int - */ - public function getTimeout() - { - return $this->_timeout; - } - - /** - * Sets if session should be preserved on generate(). - * - * @param bool $keepSession Should session be kept on generate()? - * - * @return Zend_Captcha_Word - */ - public function setKeepSession($keepSession) - { - $this->_keepSession = $keepSession; - - return $this; - } - - /** - * Numbers should be included in the pattern? - * - * @return bool - */ - public function getUseNumbers() - { - return $this->_useNumbers; - } - - /** - * Set if numbers should be included in the pattern. - * - * @param bool $_useNumbers numbers should be included in the pattern? - * - * @return Zend_Captcha_Word - */ - public function setUseNumbers($_useNumbers) - { - $this->_useNumbers = $_useNumbers; - - return $this; - } - - /** - * Get session object. - * - * @return Zend_Session_Namespace - */ - public function getSession() - { - if (!isset($this->_session) || (null === $this->_session)) { - $id = $this->getId(); - if (!class_exists($this->_sessionClass)) { - Zend_Loader::loadClass($this->_sessionClass); - } - $this->_session = new $this->_sessionClass('Zend_Form_Captcha_' . $id); - $this->_session->setExpirationHops(1, null, true); - $this->_session->setExpirationSeconds($this->getTimeout()); - } - - return $this->_session; - } - - /** - * Set session namespace object. - * - * @return Zend_Captcha_Word - */ - public function setSession(Zend_Session_Namespace $session) - { - $this->_session = $session; - if ($session) { - $this->_keepSession = true; - } - - return $this; - } - - /** - * Get captcha word. - * - * @return string - */ - public function getWord() - { - if (empty($this->_word)) { - $session = $this->getSession(); - $this->_word = $session->word; - } - - return $this->_word; - } - - /** - * Set captcha word. - * - * @param string $word - * - * @return Zend_Captcha_Word - */ - protected function _setWord($word) - { - $session = $this->getSession(); - $session->word = $word; - $this->_word = $word; - - return $this; - } - - /** - * Generate new random word. - * - * @return string - */ - protected function _generateWord() - { - $word = ''; - $wordLen = $this->getWordLen(); - $vowels = $this->_useNumbers ? self::$VN : self::$V; - $consonants = $this->_useNumbers ? self::$CN : self::$C; - - $totIndexCon = count($consonants) - 1; - $totIndexVow = count($vowels) - 1; - for ($i = 0; $i < $wordLen; $i = $i + 2) { - // generate word with mix of vowels and consonants - $consonant = $consonants[random_int(0, $totIndexCon)]; - $vowel = $vowels[random_int(0, $totIndexVow)]; - $word .= $consonant . $vowel; - } - - if (strlen($word) > $wordLen) { - $word = substr($word, 0, $wordLen); - } - - return $word; - } - - /** - * Generate new session ID and new word. - * - * @return string session ID - */ - public function generate() - { - if (!$this->_keepSession) { - $this->_session = null; - } - $id = $this->_generateRandomId(); - $this->_setId($id); - $word = $this->_generateWord(); - $this->_setWord($word); - - return $id; - } - - protected function _generateRandomId() - { - return md5(random_bytes(32)); - } - - /** - * Validate the word. - * - * @see Zend_Validate_Interface::isValid() - * - * @param mixed $value - * @param null|array $context - * - * @return bool - */ - public function isValid($value, $context = null) - { - if (!is_array($value) && !is_array($context)) { - $this->_error(self::MISSING_VALUE); - - return false; - } - if (!is_array($value) && is_array($context)) { - $value = $context; - } - - $name = $this->getName(); - - if (isset($value[$name])) { - $value = $value[$name]; - } - - if (!isset($value['input'])) { - $this->_error(self::MISSING_VALUE); - - return false; - } - $input = strtolower($value['input']); - $this->_setValue($input); - - if (!isset($value['id'])) { - $this->_error(self::MISSING_ID); - - return false; - } - - $this->_id = $value['id']; - if ($input !== $this->getWord()) { - $this->_error(self::BAD_CAPTCHA); - - return false; - } - - return true; - } - - /** - * Get captcha decorator. - * - * @return string - */ - public function getDecorator() - { - return 'Captcha_Word'; - } -} diff --git a/library/Zend/Form/Decorator/Captcha.php b/library/Zend/Form/Decorator/Captcha.php deleted file mode 100644 index 49f70800..00000000 --- a/library/Zend/Form/Decorator/Captcha.php +++ /dev/null @@ -1,68 +0,0 @@ -getElement(); - if (!method_exists($element, 'getCaptcha')) { - return $content; - } - - $view = $element->getView(); - if (null === $view) { - return $content; - } - - $placement = $this->getPlacement(); - $separator = $this->getSeparator(); - - $captcha = $element->getCaptcha(); - $markup = $captcha->render($view, $element); - switch ($placement) { - case 'PREPEND': - $content = $markup . $separator . $content; - - break; - case 'APPEND': - default: - $content = $content . $separator . $markup; - } - - return $content; - } -} diff --git a/library/Zend/Form/Decorator/Captcha/Word.php b/library/Zend/Form/Decorator/Captcha/Word.php deleted file mode 100644 index 7860880a..00000000 --- a/library/Zend/Form/Decorator/Captcha/Word.php +++ /dev/null @@ -1,74 +0,0 @@ -getElement(); - $view = $element->getView(); - if (null === $view) { - return $content; - } - - $name = $element->getFullyQualifiedName(); - - $hiddenName = $name . '[id]'; - $textName = $name . '[input]'; - - $label = $element->getDecorator('Label'); - if ($label) { - $label->setOption('id', $element->getId() . '-input'); - } - - $placement = $this->getPlacement(); - $separator = $this->getSeparator(); - - $hidden = $view->formHidden($hiddenName, $element->getValue(), $element->getAttribs()); - $text = $view->formText($textName, '', $element->getAttribs()); - switch ($placement) { - case 'PREPEND': - $content = $hidden . $separator . $text . $separator . $content; - - break; - case 'APPEND': - default: - $content = $content . $separator . $hidden . $separator . $text; - } - - return $content; - } -} diff --git a/library/Zend/Form/Element/Captcha.php b/library/Zend/Form/Element/Captcha.php deleted file mode 100644 index 61915def..00000000 --- a/library/Zend/Form/Element/Captcha.php +++ /dev/null @@ -1,301 +0,0 @@ -_captcha; - } - - /** - * Set captcha adapter. - * - * @param array|string|Zend_Captcha_Adapter $captcha - * @param array $options - */ - public function setCaptcha($captcha, $options = []) - { - if ($captcha instanceof Zend_Captcha_Adapter) { - $instance = $captcha; - } else { - if (is_array($captcha)) { - if (array_key_exists('captcha', $captcha)) { - $name = $captcha['captcha']; - unset($captcha['captcha']); - } else { - $name = array_shift($captcha); - } - $options = array_merge($options, $captcha); - } else { - $name = $captcha; - } - - $name = $this->getPluginLoader(self::CAPTCHA)->load($name); - if (empty($options)) { - $instance = new $name(); - } else { - $r = new ReflectionClass($name); - if ($r->hasMethod('__construct')) { - $instance = $r->newInstanceArgs([$options]); - } else { - $instance = $r->newInstance(); - } - } - } - - $this->_captcha = $instance; - $this->_captcha->setName($this->getName()); - - return $this; - } - - /** - * Constructor. - * - * $spec may be: - * - string: name of element - * - array: options with which to configure element - * - Zend_Config: Zend_Config with options for configuring element - * - * @param array|string|Zend_Config $spec - * @param null|mixed $options - */ - public function __construct($spec, $options = null) - { - parent::__construct($spec, $options); - $this->setAllowEmpty(true) - ->setRequired(true) - ->setAutoInsertNotEmptyValidator(false) - ->addValidator($this->getCaptcha(), true); - } - - /** - * Set options. - * - * Overrides to allow passing captcha options - * - * @return Zend_Form_Element_Captcha - */ - public function setOptions(array $options) - { - $captcha = null; - $captchaOptions = []; - - if (array_key_exists('captcha', $options)) { - $captcha = $options['captcha']; - if (array_key_exists('captchaOptions', $options)) { - $captchaOptions = $options['captchaOptions']; - unset($options['captchaOptions']); - } - unset($options['captcha']); - } - parent::setOptions($options); - - if (null !== $captcha) { - $this->setCaptcha($captcha, $captchaOptions); - } - - return $this; - } - - /** - * Render form element. - * - * @return string - */ - public function render(?Zend_View_Interface $view = null) - { - $captcha = $this->getCaptcha(); - $captcha->setName($this->getFullyQualifiedName()); - - if (!$this->loadDefaultDecoratorsIsDisabled()) { - $decorators = $this->getDecorators(); - $decorator = $captcha->getDecorator(); - $key = get_class($this->_getDecorator($decorator, null)); - - if (!empty($decorator) && !array_key_exists($key, $decorators)) { - array_unshift($decorators, $decorator); - } - - $decorator = ['Captcha', ['captcha' => $captcha]]; - $key = get_class($this->_getDecorator($decorator[0], $decorator[1])); - - if ($captcha instanceof Zend_Captcha_Word && !array_key_exists($key, $decorators)) { - array_unshift($decorators, $decorator); - } - - $this->setDecorators($decorators); - } - - $this->setValue($this->getCaptcha()->generate()); - - return parent::render($view); - } - - /** - * Retrieve plugin loader for validator or filter chain. - * - * Support for plugin loader for Captcha adapters - * - * @param string $type - * - * @return Zend_Loader_PluginLoader - */ - public function getPluginLoader($type) - { - $type = strtoupper($type); - if ($type == self::CAPTCHA) { - if (!isset($this->_loaders[$type])) { - $this->_loaders[$type] = new Zend_Loader_PluginLoader( - ['Zend_Captcha' => 'Zend/Captcha/'] - ); - } - - return $this->_loaders[$type]; - } - - return parent::getPluginLoader($type); - } - - /** - * Add prefix path for plugin loader for captcha adapters. - * - * This method handles the captcha type, the rest is handled by - * the parent - * - * @param string $prefix - * @param string $path - * @param string $type - * - * @return Zend_Form_Element - * - * @see Zend_Form_Element::addPrefixPath - */ - public function addPrefixPath($prefix, $path, $type = null) - { - $type = strtoupper($type); - switch ($type) { - case null: - $loader = $this->getPluginLoader(self::CAPTCHA); - $nsSeparator = (false !== strpos($prefix, '\\')) ? '\\' : '_'; - $cPrefix = rtrim($prefix, $nsSeparator) . $nsSeparator . 'Captcha'; - $cPath = rtrim($path, '/\\') . '/Captcha'; - $loader->addPrefixPath($cPrefix, $cPath); - - return parent::addPrefixPath($prefix, $path); - case self::CAPTCHA: - $loader = $this->getPluginLoader($type); - $loader->addPrefixPath($prefix, $path); - - return $this; - default: - return parent::addPrefixPath($prefix, $path, $type); - } - } - - /** - * Load default decorators. - * - * @return Zend_Form_Element_Captcha - */ - public function loadDefaultDecorators() - { - if ($this->loadDefaultDecoratorsIsDisabled()) { - return $this; - } - - $decorators = $this->getDecorators(); - if (empty($decorators)) { - $this->addDecorator('Errors') - ->addDecorator('Description', ['tag' => 'p', 'class' => 'description']) - ->addDecorator('HtmlTag', ['tag' => 'dd', 'id' => $this->getName() . '-element']) - ->addDecorator('Label', ['tag' => 'dt']); - } - - return $this; - } - - /** - * Is the captcha valid? - * - * @param mixed $value - * @param mixed $context - * - * @return bool - */ - public function isValid($value, $context = null) - { - $this->getCaptcha()->setName($this->getName()); - $belongsTo = $this->getBelongsTo(); - if (empty($belongsTo) || !is_array($context)) { - return parent::isValid($value, $context); - } - - $name = $this->getFullyQualifiedName(); - $root = substr($name, 0, strpos($name, '[')); - $segments = substr($name, strpos($name, '[')); - $segments = ltrim($segments, '['); - $segments = rtrim($segments, ']'); - $segments = explode('][', $segments); - array_unshift($segments, $root); - array_pop($segments); - $newContext = $context; - foreach ($segments as $segment) { - if (array_key_exists($segment, $newContext)) { - $newContext = $newContext[$segment]; - } - } - - return parent::isValid($value, $newContext); - } -} diff --git a/library/Zend/View/Helper/Doctype.php b/library/Zend/View/Helper/Doctype.php index d3444d76..8b8ded4a 100644 --- a/library/Zend/View/Helper/Doctype.php +++ b/library/Zend/View/Helper/Doctype.php @@ -32,28 +32,14 @@ class Zend_View_Helper_Doctype extends Zend_View_Helper_Abstract /**#@+ * DocType constants */ - public const XHTML11 = 'XHTML11'; - public const XHTML1_STRICT = 'XHTML1_STRICT'; - public const XHTML1_TRANSITIONAL = 'XHTML1_TRANSITIONAL'; - public const XHTML1_FRAMESET = 'XHTML1_FRAMESET'; - public const XHTML1_RDFA = 'XHTML1_RDFA'; - public const XHTML1_RDFA11 = 'XHTML1_RDFA11'; - public const XHTML_BASIC1 = 'XHTML_BASIC1'; - public const XHTML5 = 'XHTML5'; - public const HTML4_STRICT = 'HTML4_STRICT'; - public const HTML4_LOOSE = 'HTML4_LOOSE'; - public const HTML4_FRAMESET = 'HTML4_FRAMESET'; public const HTML5 = 'HTML5'; - public const CUSTOM_XHTML = 'CUSTOM_XHTML'; - public const CUSTOM = 'CUSTOM'; - // #@- /** * Default DocType. * * @var string */ - protected $_defaultDoctype = self::HTML4_LOOSE; + protected $_defaultDoctype = self::HTML5; /** * Registry containing current doctype and mappings. @@ -79,17 +65,6 @@ public function __construct() if (!Zend_Registry::isRegistered($this->_regKey)) { $this->_registry = new ArrayObject([ 'doctypes' => [ - self::XHTML11 => '', - self::XHTML1_STRICT => '', - self::XHTML1_TRANSITIONAL => '', - self::XHTML1_FRAMESET => '', - self::XHTML1_RDFA => '', - self::XHTML1_RDFA11 => '', - self::XHTML_BASIC1 => '', - self::XHTML5 => '', - self::HTML4_STRICT => '', - self::HTML4_LOOSE => '', - self::HTML4_FRAMESET => '', self::HTML5 => '', ], ]); @@ -103,7 +78,7 @@ public function __construct() /** * Set or retrieve doctype. * - * @param string $doctype + * @param string $doctype * * @return Zend_View_Helper_Doctype */ @@ -111,36 +86,9 @@ public function doctype($doctype = null) { if (null !== $doctype) { switch ($doctype) { - case self::XHTML11: - case self::XHTML1_STRICT: - case self::XHTML1_TRANSITIONAL: - case self::XHTML1_FRAMESET: - case self::XHTML_BASIC1: - case self::XHTML1_RDFA: - case self::XHTML1_RDFA11: - case self::XHTML5: - case self::HTML4_STRICT: - case self::HTML4_LOOSE: - case self::HTML4_FRAMESET: case self::HTML5: $this->setDoctype($doctype); - break; - default: - if (substr($doctype, 0, 9) != 'setView($this->view); - - throw $e; - } - if (stristr($doctype, 'xhtml')) { - $type = self::CUSTOM_XHTML; - } else { - $type = self::CUSTOM; - } - $this->setDoctype($type); - $this->_registry['doctypes'][$type] = $doctype; - break; } } @@ -151,7 +99,7 @@ public function doctype($doctype = null) /** * Set doctype. * - * @param string $doctype + * @param string $doctype * * @return Zend_View_Helper_Doctype */ @@ -199,14 +147,7 @@ public function isXhtml() */ public function isStrict() { - switch ($this->getDoctype()) { - case self::XHTML1_STRICT: - case self::XHTML11: - case self::HTML4_STRICT: - return true; - default: - return false; - } + return false; } /** diff --git a/tests/Zend/Application/Resource/ViewTest.php b/tests/Zend/Application/Resource/ViewTest.php index fe42f459..ead49754 100644 --- a/tests/Zend/Application/Resource/ViewTest.php +++ b/tests/Zend/Application/Resource/ViewTest.php @@ -105,11 +105,11 @@ public function testOptionsPassedToResourceAreUsedToSetViewState() public function testDoctypeIsSet() { - $options = ['doctype' => 'XHTML1_FRAMESET']; + $options = ['doctype' => 'HTML5']; $resource = new Zend_Application_Resource_View($options); $resource->init(); $view = $resource->getView(); - $this->assertEquals('XHTML1_FRAMESET', $view->doctype()->getDoctype()); + $this->assertEquals('HTML5', $view->doctype()->getDoctype()); } /** @@ -170,38 +170,6 @@ public function testSetMetaCharsetForHtml5() $registry->deleteContainer(\Zend_View_Helper_Doctype::class); } - /** - * @group ZF-10343 - */ - public function testSetMetaCharsetShouldOnlyAvailableForHtml5() - { - $charset = 'UTF-8'; - $options = [ - 'doctype' => 'XHTML1_STRICT', - 'charset' => $charset, - ]; - $resource = new Zend_Application_Resource_View($options); - $view = $resource->init(); - $headMetaHelper = $view->headMeta(); - - $actual = null; - $container = $headMetaHelper->getContainer(); - foreach ($container as $item) { - if ('charset' == $item->type) { - $actual = $item->charset; - - break; - } - } - - $this->assertFalse($view->doctype()->isHtml5()); - $this->assertNull($actual); - - $registry = Zend_View_Helper_Placeholder_Registry::getRegistry(); - $registry->deleteContainer(\Zend_View_Helper_HeadMeta::class); - $registry->deleteContainer(\Zend_View_Helper_Doctype::class); - } - /** * @group ZF-10042 */ diff --git a/tests/Zend/Captcha/DumbTest.php b/tests/Zend/Captcha/DumbTest.php deleted file mode 100644 index 154fa738..00000000 --- a/tests/Zend/Captcha/DumbTest.php +++ /dev/null @@ -1,145 +0,0 @@ -run($suite); - } - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - */ - public function setUp(): void - { - if (isset($this->word)) { - unset($this->word); - } - - $this->element = new Zend_Form_Element_Captcha( - 'captchaD', - [ - 'captcha' => [ - 'Dumb', - 'sessionClass' => 'Zend_Captcha_DumbTest_SessionContainer', - ], - ] - ); - $this->captcha = $this->element->getCaptcha(); - } - - /** - * Tears down the fixture, for example, close a network connection. - * This method is called after a test is executed. - */ - public function tearDown(): void - { - } - - public function testRendersWordInReverse() - { - $id = $this->captcha->generate('test'); - $word = $this->captcha->getWord(); - $html = $this->captcha->render(new Zend_View()); - $this->assertStringContainsString(strrev($word), $html); - $this->assertStringNotContainsString($word, $html); - } - - /** - * @group ZF-11522 - */ - public function testDefaultLabelIsUsedWhenNoAlternateLabelSet() - { - $this->assertEquals('Please type this word backwards', $this->captcha->getLabel()); - } - - /** - * @group ZF-11522 - */ - public function testChangeLabelViaSetterMethod() - { - $this->captcha->setLabel('Testing'); - $this->assertEquals('Testing', $this->captcha->getLabel()); - } - - /** - * @group ZF-11522 - */ - public function testRendersLabelUsingProvidedValue() - { - $this->captcha->setLabel('Testing 123'); - - $id = $this->captcha->generate('test'); - $html = $this->captcha->render(new Zend_View()); - $this->assertStringContainsString('Testing 123', $html); - } -} - -#[AllowDynamicProperties] -class Zend_Captcha_DumbTest_SessionContainer -{ - protected static $_word; - - public function __get($name) - { - if ('word' == $name) { - return self::$_word; - } - - return null; - } - - public function __set($name, $value) - { - if ('word' == $name) { - self::$_word = $value; - } else { - $this->$name = $value; - } - } - - public function __isset($name) - { - if (('word' == $name) && (null !== self::$_word)) { - return true; - } - - return false; - } - - public function __call($method, $args) - { - $this->$method = match ($method) { - 'setExpirationHops', 'setExpirationSeconds' => array_shift($args), - }; - } -} diff --git a/tests/Zend/Captcha/FigletTest.php b/tests/Zend/Captcha/FigletTest.php deleted file mode 100644 index 1d9ecbd8..00000000 --- a/tests/Zend/Captcha/FigletTest.php +++ /dev/null @@ -1,335 +0,0 @@ -run($suite); - } - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - */ - public function setUp(): void - { - if (isset($this->word)) { - unset($this->word); - } - - $this->element = new Zend_Form_Element_Captcha( - 'captchaF', - [ - 'captcha' => [ - 'Figlet', - 'sessionClass' => 'Zend_Captcha_FigletTest_SessionContainer', - ], - ] - ); - $this->captcha = $this->element->getCaptcha(); - } - - /** - * Tears down the fixture, for example, close a network connection. - * This method is called after a test is executed. - */ - public function tearDown(): void - { - } - - public function testCaptchaAdapterCreated() - { - $this->assertTrue($this->element->getCaptcha() instanceof Zend_Captcha_Adapter); - } - - public function getView() - { - $view = new Zend_View(); - $view->addHelperPath(__DIR__ . '/../../../../library/Zend/View/Helper'); - - return $view; - } - - public function testCaptchaIsRendered() - { - $html = $this->element->render($this->getView()); - $this->assertStringContainsString($this->element->getName(), $html); - } - - public function testCaptchaHasIdAndInput() - { - $html = $this->element->render($this->getView()); - $expect = sprintf('type="hidden" name="%s\[id\]" value="%s"', $this->element->getName(), $this->captcha->getId()); - $this->assertMatchesRegularExpression("/]*?$expect/", $html, $html); - $expect = sprintf('type="text" name="%s\[input\]"', $this->element->getName()); - $this->assertMatchesRegularExpression("/]*?$expect/", $html, $html); - } - - // @group ZF-8268 - public function testLabelIdIsCorrect() - { - $form = new Zend_Form(); - $form->setElementsBelongTo('comment'); - $this->element->setLabel('My Captcha'); - $form->addElement($this->element); - $html = $form->render($this->getView()); - $expect = sprintf('for="comment-%s-input"', $this->element->getName()); - $this->assertMatchesRegularExpression("/