From a4513ba5cf767a73bce825318e684c376410210d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 8 Dec 2016 14:16:04 +0100 Subject: [PATCH] Replace Zend w/ icingaweb2-vendor-zf1 refs #13461 --- icingaweb2.spec | 20 +- library/vendor/Zend/Acl.php | 1224 ---------- library/vendor/Zend/Acl/Assert/Interface.php | 61 - library/vendor/Zend/Acl/Exception.php | 35 - library/vendor/Zend/Acl/Resource.php | 73 - .../vendor/Zend/Acl/Resource/Interface.php | 37 - library/vendor/Zend/Acl/Role.php | 73 - library/vendor/Zend/Acl/Role/Interface.php | 37 - library/vendor/Zend/Acl/Role/Registry.php | 265 --- .../Zend/Acl/Role/Registry/Exception.php | 35 - library/vendor/Zend/Application.php | 438 ---- .../Zend/Application/Bootstrap/Bootstrap.php | 167 -- .../Bootstrap/BootstrapAbstract.php | 782 ------ .../Application/Bootstrap/Bootstrapper.php | 93 - .../Zend/Application/Bootstrap/Exception.php | 37 - .../Bootstrap/ResourceBootstrapper.php | 95 - library/vendor/Zend/Application/Exception.php | 37 - .../Zend/Application/Module/Autoloader.php | 94 - .../Zend/Application/Module/Bootstrap.php | 126 - .../Application/Resource/Cachemanager.php | 81 - .../vendor/Zend/Application/Resource/Db.php | 197 -- .../vendor/Zend/Application/Resource/Dojo.php | 75 - .../Zend/Application/Resource/Exception.php | 39 - .../Application/Resource/Frontcontroller.php | 176 -- .../Zend/Application/Resource/Layout.php | 69 - .../Zend/Application/Resource/Locale.php | 116 - .../vendor/Zend/Application/Resource/Log.php | 82 - .../vendor/Zend/Application/Resource/Mail.php | 150 -- .../Zend/Application/Resource/Modules.php | 157 -- .../Zend/Application/Resource/Multidb.php | 208 -- .../Zend/Application/Resource/Navigation.php | 130 - .../Zend/Application/Resource/Resource.php | 79 - .../Application/Resource/ResourceAbstract.php | 160 -- .../Zend/Application/Resource/Router.php | 86 - .../Zend/Application/Resource/Session.php | 118 - .../Zend/Application/Resource/Translate.php | 138 -- .../Zend/Application/Resource/Useragent.php | 72 - .../vendor/Zend/Application/Resource/View.php | 85 - library/vendor/Zend/Auth.php | 168 -- library/vendor/Zend/Auth/Adapter/DbTable.php | 553 ----- library/vendor/Zend/Auth/Adapter/Digest.php | 248 -- .../vendor/Zend/Auth/Adapter/Exception.php | 37 - library/vendor/Zend/Auth/Adapter/Http.php | 853 ------- .../Auth/Adapter/Http/Resolver/Exception.php | 39 - .../Zend/Auth/Adapter/Http/Resolver/File.php | 159 -- .../Auth/Adapter/Http/Resolver/Interface.php | 47 - .../vendor/Zend/Auth/Adapter/Interface.php | 45 - library/vendor/Zend/Auth/Adapter/Ldap.php | 526 ---- library/vendor/Zend/Auth/Adapter/OpenId.php | 281 --- library/vendor/Zend/Auth/Exception.php | 35 - library/vendor/Zend/Auth/Result.php | 147 -- .../vendor/Zend/Auth/Storage/Exception.php | 37 - .../vendor/Zend/Auth/Storage/Interface.php | 66 - .../Zend/Auth/Storage/NonPersistent.php | 94 - library/vendor/Zend/Auth/Storage/Session.php | 147 -- library/vendor/Zend/Barcode.php | 343 --- library/vendor/Zend/Barcode/Exception.php | 62 - .../vendor/Zend/Barcode/Object/Code128.php | 393 --- library/vendor/Zend/Barcode/Object/Code25.php | 141 -- .../Zend/Barcode/Object/Code25interleaved.php | 177 -- library/vendor/Zend/Barcode/Object/Code39.php | 186 -- library/vendor/Zend/Barcode/Object/Ean13.php | 223 -- library/vendor/Zend/Barcode/Object/Ean2.php | 63 - library/vendor/Zend/Barcode/Object/Ean5.php | 145 -- library/vendor/Zend/Barcode/Object/Ean8.php | 174 -- library/vendor/Zend/Barcode/Object/Error.php | 103 - .../vendor/Zend/Barcode/Object/Exception.php | 34 - .../vendor/Zend/Barcode/Object/Identcode.php | 93 - library/vendor/Zend/Barcode/Object/Itf14.php | 47 - .../vendor/Zend/Barcode/Object/Leitcode.php | 62 - .../Zend/Barcode/Object/ObjectAbstract.php | 1427 ----------- library/vendor/Zend/Barcode/Object/Planet.php | 60 - .../vendor/Zend/Barcode/Object/Postnet.php | 134 -- .../vendor/Zend/Barcode/Object/Royalmail.php | 161 -- library/vendor/Zend/Barcode/Object/Upca.php | 170 -- library/vendor/Zend/Barcode/Object/Upce.php | 227 -- .../Zend/Barcode/Renderer/Exception.php | 34 - .../vendor/Zend/Barcode/Renderer/Image.php | 462 ---- library/vendor/Zend/Barcode/Renderer/Pdf.php | 240 -- .../Barcode/Renderer/RendererAbstract.php | 543 ----- library/vendor/Zend/Barcode/Renderer/Svg.php | 377 --- library/vendor/Zend/Cache.php | 1 + .../vendor/Zend/Cache/Backend/ZendServer.php | 0 .../Zend/Cache/Backend/ZendServer/Disk.php | 0 .../Zend/Cache/Backend/ZendServer/ShMem.php | 0 library/vendor/Zend/Captcha/Adapter.php | 75 - library/vendor/Zend/Captcha/Base.php | 174 -- library/vendor/Zend/Captcha/Dumb.php | 74 - library/vendor/Zend/Captcha/Exception.php | 36 - library/vendor/Zend/Captcha/Figlet.php | 82 - library/vendor/Zend/Captcha/Image.php | 619 ----- library/vendor/Zend/Captcha/ReCaptcha.php | 278 --- library/vendor/Zend/Captcha/Word.php | 417 ---- library/vendor/Zend/Config/Json.php | 233 -- library/vendor/Zend/Config/Writer/Json.php | 104 - library/vendor/Zend/Config/Writer/Xml.php | 124 - library/vendor/Zend/Config/Writer/Yaml.php | 141 -- library/vendor/Zend/Config/Xml.php | 300 --- library/vendor/Zend/Config/Yaml.php | 406 ---- library/vendor/Zend/Console/Getopt.php | 979 -------- .../vendor/Zend/Console/Getopt/Exception.php | 65 - .../Action/Helper/AutoCompleteDojo.php | 83 - .../Helper/AutoCompleteScriptaculous.php | 80 - .../Action/Helper/FlashMessenger.php | 311 --- library/vendor/Zend/Crypt/Math.php | 97 +- library/vendor/Zend/Crypt/Math/BigInteger.php | 1 + library/vendor/Zend/Currency.php | 884 ------- .../Zend/Currency/CurrencyInterface.php | 39 - library/vendor/Zend/Currency/Exception.php | 36 - .../vendor/Zend/Db/Adapter/Pdo/Abstract.php | 1 - library/vendor/Zend/Db/Adapter/Pdo/Mssql.php | 17 +- library/vendor/Zend/Db/Adapter/Pdo/Sqlite.php | 14 + library/vendor/Zend/Db/Profiler/Firebug.php | 158 -- library/vendor/Zend/Db/Select.php | 30 +- library/vendor/Zend/Debug.php | 113 - library/vendor/Zend/Dom/Exception.php | 34 - library/vendor/Zend/Dom/Query.php | 326 --- library/vendor/Zend/Dom/Query/Css2Xpath.php | 169 -- library/vendor/Zend/Dom/Query/Result.php | 182 -- library/vendor/Zend/EventManager/Event.php | 223 -- .../Zend/EventManager/EventCollection.php | 108 - .../Zend/EventManager/EventDescription.php | 108 - .../vendor/Zend/EventManager/EventManager.php | 540 ----- .../Zend/EventManager/EventManagerAware.php | 40 - .../vendor/Zend/EventManager/Exception.php | 31 - .../Exception/InvalidArgumentException.php | 40 - library/vendor/Zend/EventManager/Filter.php | 77 - .../EventManager/Filter/FilterIterator.php | 111 - .../vendor/Zend/EventManager/FilterChain.php | 135 -- .../Zend/EventManager/GlobalEventManager.php | 147 -- .../Zend/EventManager/ListenerAggregate.php | 53 - .../Zend/EventManager/ResponseCollection.php | 424 ---- .../EventManager/SharedEventCollection.php | 32 - .../SharedEventCollectionAware.php | 41 - .../Zend/EventManager/SharedEventManager.php | 146 -- .../Zend/EventManager/StaticEventManager.php | 77 - library/vendor/Zend/Feed.php | 395 --- library/vendor/Zend/Feed/Abstract.php | 295 --- library/vendor/Zend/Feed/Atom.php | 386 --- library/vendor/Zend/Feed/Builder.php | 390 --- library/vendor/Zend/Feed/Builder/Entry.php | 295 --- .../vendor/Zend/Feed/Builder/Exception.php | 39 - library/vendor/Zend/Feed/Builder/Header.php | 410 ---- .../Zend/Feed/Builder/Header/Itunes.php | 281 --- .../vendor/Zend/Feed/Builder/Interface.php | 52 - library/vendor/Zend/Feed/Element.php | 436 ---- library/vendor/Zend/Feed/Entry/Abstract.php | 121 - library/vendor/Zend/Feed/Entry/Atom.php | 272 --- library/vendor/Zend/Feed/Entry/Rss.php | 121 - library/vendor/Zend/Feed/Exception.php | 41 - library/vendor/Zend/Feed/Pubsubhubbub.php | 147 -- .../Feed/Pubsubhubbub/CallbackAbstract.php | 309 --- .../Feed/Pubsubhubbub/CallbackInterface.php | 69 - .../Zend/Feed/Pubsubhubbub/Exception.php | 33 - .../Zend/Feed/Pubsubhubbub/HttpResponse.php | 232 -- .../Feed/Pubsubhubbub/Model/ModelAbstract.php | 61 - .../Feed/Pubsubhubbub/Model/Subscription.php | 135 -- .../Model/SubscriptionInterface.php | 65 - .../Zend/Feed/Pubsubhubbub/Publisher.php | 414 ---- .../Zend/Feed/Pubsubhubbub/Subscriber.php | 852 ------- .../Feed/Pubsubhubbub/Subscriber/Callback.php | 327 --- library/vendor/Zend/Feed/Reader.php | 733 ------ .../vendor/Zend/Feed/Reader/Collection.php | 33 - .../Zend/Feed/Reader/Collection/Author.php | 50 - .../Zend/Feed/Reader/Collection/Category.php | 56 - .../Reader/Collection/CollectionAbstract.php | 41 - .../vendor/Zend/Feed/Reader/Entry/Atom.php | 396 ---- library/vendor/Zend/Feed/Reader/Entry/Rss.php | 656 ----- .../vendor/Zend/Feed/Reader/EntryAbstract.php | 241 -- .../Zend/Feed/Reader/EntryInterface.php | 143 -- .../Zend/Feed/Reader/Extension/Atom/Entry.php | 653 ----- .../Zend/Feed/Reader/Extension/Atom/Feed.php | 586 ----- .../Feed/Reader/Extension/Content/Entry.php | 59 - .../Extension/CreativeCommons/Entry.php | 95 - .../Reader/Extension/CreativeCommons/Feed.php | 88 - .../Reader/Extension/DublinCore/Entry.php | 263 -- .../Feed/Reader/Extension/DublinCore/Feed.php | 306 --- .../Feed/Reader/Extension/EntryAbstract.php | 200 -- .../Feed/Reader/Extension/FeedAbstract.php | 186 -- .../Feed/Reader/Extension/Podcast/Entry.php | 200 -- .../Feed/Reader/Extension/Podcast/Feed.php | 292 --- .../Feed/Reader/Extension/Slash/Entry.php | 142 -- .../Reader/Extension/Syndication/Feed.php | 166 -- .../Feed/Reader/Extension/Thread/Entry.php | 90 - .../Reader/Extension/WellFormedWeb/Entry.php | 71 - library/vendor/Zend/Feed/Reader/Feed/Atom.php | 419 ---- .../Zend/Feed/Reader/Feed/Atom/Source.php | 101 - library/vendor/Zend/Feed/Reader/Feed/Rss.php | 726 ------ .../vendor/Zend/Feed/Reader/FeedAbstract.php | 318 --- .../vendor/Zend/Feed/Reader/FeedInterface.php | 122 - library/vendor/Zend/Feed/Reader/FeedSet.php | 146 -- library/vendor/Zend/Feed/Rss.php | 526 ---- library/vendor/Zend/Feed/Writer.php | 265 --- library/vendor/Zend/Feed/Writer/Deleted.php | 195 -- library/vendor/Zend/Feed/Writer/Entry.php | 734 ------ .../Exception/InvalidMethodException.php | 40 - .../Writer/Extension/Atom/Renderer/Feed.php | 122 - .../Extension/Content/Renderer/Entry.php | 91 - .../Extension/DublinCore/Renderer/Entry.php | 95 - .../Extension/DublinCore/Renderer/Feed.php | 95 - .../Feed/Writer/Extension/ITunes/Entry.php | 232 -- .../Feed/Writer/Extension/ITunes/Feed.php | 343 --- .../Extension/ITunes/Renderer/Entry.php | 215 -- .../Writer/Extension/ITunes/Renderer/Feed.php | 319 --- .../Writer/Extension/RendererAbstract.php | 179 -- .../Writer/Extension/RendererInterface.php | 60 - .../Writer/Extension/Slash/Renderer/Entry.php | 90 - .../Extension/Threading/Renderer/Entry.php | 144 -- .../WellFormedWeb/Renderer/Entry.php | 95 - library/vendor/Zend/Feed/Writer/Feed.php | 271 --- .../Zend/Feed/Writer/Feed/FeedAbstract.php | 834 ------- .../Zend/Feed/Writer/Renderer/Entry/Atom.php | 440 ---- .../Writer/Renderer/Entry/Atom/Deleted.php | 120 - .../Zend/Feed/Writer/Renderer/Entry/Rss.php | 340 --- .../Zend/Feed/Writer/Renderer/Feed/Atom.php | 124 - .../Renderer/Feed/Atom/AtomAbstract.php | 437 ---- .../Feed/Writer/Renderer/Feed/Atom/Source.php | 109 - .../Zend/Feed/Writer/Renderer/Feed/Rss.php | 492 ---- .../Feed/Writer/Renderer/RendererAbstract.php | 247 -- .../Writer/Renderer/RendererInterface.php | 111 - library/vendor/Zend/Feed/Writer/Source.php | 32 - library/vendor/Zend/Filter/Encrypt/Mcrypt.php | 5 +- .../Zend/Form/Decorator/Captcha/ReCaptcha.php | 127 - .../Zend/Form/Decorator/Captcha/Word.php | 77 - .../vendor/Zend/Form/Decorator/ViewHelper.php | 2 +- library/vendor/Zend/Form/Element/Captcha.php | 299 --- library/vendor/Zend/Form/Element/Hash.php | 257 -- library/vendor/Zend/Http/Client.php | 1582 ------------ .../vendor/Zend/Http/Client/Adapter/Curl.php | 526 ---- .../Zend/Http/Client/Adapter/Exception.php | 37 - .../Zend/Http/Client/Adapter/Interface.php | 78 - .../vendor/Zend/Http/Client/Adapter/Proxy.php | 333 --- .../Zend/Http/Client/Adapter/Socket.php | 527 ---- .../Zend/Http/Client/Adapter/Stream.php | 46 - .../vendor/Zend/Http/Client/Adapter/Test.php | 242 -- library/vendor/Zend/Http/Client/Exception.php | 35 - library/vendor/Zend/Http/Cookie.php | 414 ---- library/vendor/Zend/Http/CookieJar.php | 420 ---- library/vendor/Zend/Http/Exception.php | 35 - .../Exception/InvalidArgumentException.php | 35 - .../Header/Exception/RuntimeException.php | 35 - .../vendor/Zend/Http/Header/HeaderValue.php | 126 - library/vendor/Zend/Http/Header/SetCookie.php | 551 ----- library/vendor/Zend/Http/Response.php | 695 ------ library/vendor/Zend/Http/Response/Stream.php | 235 -- library/vendor/Zend/Http/UserAgent.php | 840 ------- .../Zend/Http/UserAgent/AbstractDevice.php | 993 -------- library/vendor/Zend/Http/UserAgent/Bot.php | 128 - .../vendor/Zend/Http/UserAgent/Checker.php | 75 - .../vendor/Zend/Http/UserAgent/Console.php | 66 - .../vendor/Zend/Http/UserAgent/Desktop.php | 55 - library/vendor/Zend/Http/UserAgent/Device.php | 200 -- library/vendor/Zend/Http/UserAgent/Email.php | 64 - .../vendor/Zend/Http/UserAgent/Exception.php | 35 - .../Zend/Http/UserAgent/Features/Adapter.php | 39 - .../UserAgent/Features/Adapter/Browscap.php | 95 - .../Features/Adapter/DeviceAtlas.php | 73 - .../UserAgent/Features/Adapter/TeraWurfl.php | 98 - .../Http/UserAgent/Features/Exception.php | 35 - library/vendor/Zend/Http/UserAgent/Feed.php | 80 - library/vendor/Zend/Http/UserAgent/Mobile.php | 535 ----- .../vendor/Zend/Http/UserAgent/Offline.php | 69 - library/vendor/Zend/Http/UserAgent/Probe.php | 80 - library/vendor/Zend/Http/UserAgent/Spam.php | 78 - .../vendor/Zend/Http/UserAgent/Storage.php | 65 - .../Zend/Http/UserAgent/Storage/Exception.php | 36 - .../Http/UserAgent/Storage/NonPersistent.php | 96 - .../Zend/Http/UserAgent/Storage/Session.php | 163 -- library/vendor/Zend/Http/UserAgent/Text.php | 131 - .../vendor/Zend/Http/UserAgent/Validator.php | 72 - library/vendor/Zend/Json/Server.php | 556 ----- library/vendor/Zend/Json/Server/Cache.php | 101 - library/vendor/Zend/Json/Server/Error.php | 197 -- library/vendor/Zend/Json/Server/Exception.php | 35 - library/vendor/Zend/Json/Server/Request.php | 287 --- .../vendor/Zend/Json/Server/Request/Http.php | 65 - library/vendor/Zend/Json/Server/Response.php | 248 -- .../vendor/Zend/Json/Server/Response/Http.php | 80 - library/vendor/Zend/Json/Server/Smd.php | 473 ---- .../vendor/Zend/Json/Server/Smd/Service.php | 463 ---- library/vendor/Zend/LICENSE.txt | 27 + library/vendor/Zend/Ldap.php | 1560 ------------ library/vendor/Zend/Ldap/Attribute.php | 416 ---- library/vendor/Zend/Ldap/Collection.php | 239 -- .../Zend/Ldap/Collection/Iterator/Default.php | 308 --- library/vendor/Zend/Ldap/Converter.php | 410 ---- .../vendor/Zend/Ldap/Converter/Exception.php | 34 - library/vendor/Zend/Ldap/Dn.php | 785 ------ library/vendor/Zend/Ldap/Exception.php | 171 -- library/vendor/Zend/Ldap/Filter.php | 261 -- library/vendor/Zend/Ldap/Filter/Abstract.php | 152 -- library/vendor/Zend/Ldap/Filter/And.php | 47 - library/vendor/Zend/Ldap/Filter/Exception.php | 36 - library/vendor/Zend/Ldap/Filter/Logical.php | 104 - library/vendor/Zend/Ldap/Filter/Mask.php | 65 - library/vendor/Zend/Ldap/Filter/Not.php | 74 - library/vendor/Zend/Ldap/Filter/Or.php | 47 - library/vendor/Zend/Ldap/Filter/String.php | 64 - library/vendor/Zend/Ldap/Ldif/Encoder.php | 304 --- library/vendor/Zend/Ldap/Node.php | 1170 --------- library/vendor/Zend/Ldap/Node/Abstract.php | 483 ---- .../Zend/Ldap/Node/ChildrenIterator.php | 208 -- library/vendor/Zend/Ldap/Node/Collection.php | 65 - library/vendor/Zend/Ldap/Node/RootDse.php | 153 -- .../Ldap/Node/RootDse/ActiveDirectory.php | 245 -- .../Zend/Ldap/Node/RootDse/OpenLdap.php | 101 - .../Zend/Ldap/Node/RootDse/eDirectory.php | 159 -- library/vendor/Zend/Ldap/Node/Schema.php | 117 - .../Zend/Ldap/Node/Schema/ActiveDirectory.php | 100 - .../Schema/AttributeType/ActiveDirectory.php | 102 - .../Node/Schema/AttributeType/Interface.php | 75 - .../Node/Schema/AttributeType/OpenLdap.php | 127 - library/vendor/Zend/Ldap/Node/Schema/Item.php | 163 -- .../Schema/ObjectClass/ActiveDirectory.php | 113 - .../Node/Schema/ObjectClass/Interface.php | 83 - .../Ldap/Node/Schema/ObjectClass/OpenLdap.php | 173 -- .../vendor/Zend/Ldap/Node/Schema/OpenLdap.php | 499 ---- .../Zend/Loader/Autoloader/Resource.php | 459 ---- .../vendor/Zend/Loader/AutoloaderFactory.php | 218 -- .../vendor/Zend/Loader/ClassMapAutoloader.php | 243 -- library/vendor/Zend/Loader/SplAutoloader.php | 75 - .../vendor/Zend/Loader/StandardAutoloader.php | 363 --- library/vendor/Zend/Log.php | 25 +- library/vendor/Zend/Log/Formatter/Firebug.php | 60 - library/vendor/Zend/Log/Writer/Firebug.php | 200 -- library/vendor/Zend/Mail.php | 31 +- library/vendor/Zend/Mail/Storage/Mbox.php | 1 + library/vendor/Zend/Markup.php | 133 -- library/vendor/Zend/Markup/Exception.php | 37 - library/vendor/Zend/Markup/Parser/Bbcode.php | 500 ---- .../vendor/Zend/Markup/Parser/Exception.php | 39 - .../Zend/Markup/Parser/ParserInterface.php | 67 - .../vendor/Zend/Markup/Renderer/Exception.php | 39 - library/vendor/Zend/Markup/Renderer/Html.php | 524 ---- .../vendor/Zend/Markup/Renderer/Html/Code.php | 52 - .../Markup/Renderer/Html/HtmlAbstract.php | 68 - .../vendor/Zend/Markup/Renderer/Html/Img.php | 82 - .../vendor/Zend/Markup/Renderer/Html/List.php | 102 - .../vendor/Zend/Markup/Renderer/Html/Url.php | 75 - .../Zend/Markup/Renderer/RendererAbstract.php | 695 ------ .../Renderer/TokenConverterInterface.php | 44 - library/vendor/Zend/Markup/Token.php | 305 --- library/vendor/Zend/Markup/TokenList.php | 123 - library/vendor/Zend/Measure/Abstract.php | 409 ---- library/vendor/Zend/Measure/Acceleration.php | 89 - library/vendor/Zend/Measure/Angle.php | 76 - library/vendor/Zend/Measure/Area.php | 308 --- library/vendor/Zend/Measure/Binary.php | 120 - library/vendor/Zend/Measure/Capacitance.php | 96 - .../vendor/Zend/Measure/Cooking/Volume.php | 188 -- .../vendor/Zend/Measure/Cooking/Weight.php | 68 - library/vendor/Zend/Measure/Current.php | 100 - library/vendor/Zend/Measure/Density.php | 204 -- library/vendor/Zend/Measure/Energy.php | 250 -- library/vendor/Zend/Measure/Exception.php | 36 - library/vendor/Zend/Measure/Flow/Mass.php | 120 - library/vendor/Zend/Measure/Flow/Mole.php | 88 - library/vendor/Zend/Measure/Flow/Volume.php | 400 ---- library/vendor/Zend/Measure/Force.php | 124 - library/vendor/Zend/Measure/Frequency.php | 84 - library/vendor/Zend/Measure/Illumination.php | 70 - library/vendor/Zend/Measure/Length.php | 672 ------ library/vendor/Zend/Measure/Lightness.php | 78 - library/vendor/Zend/Measure/Number.php | 417 ---- library/vendor/Zend/Measure/Power.php | 186 -- library/vendor/Zend/Measure/Pressure.php | 248 -- library/vendor/Zend/Measure/Speed.php | 188 -- library/vendor/Zend/Measure/Temperature.php | 58 - library/vendor/Zend/Measure/Time.php | 115 - library/vendor/Zend/Measure/Torque.php | 80 - .../vendor/Zend/Measure/Viscosity/Dynamic.php | 118 - .../Zend/Measure/Viscosity/Kinematic.php | 104 - library/vendor/Zend/Measure/Volume.php | 211 -- library/vendor/Zend/Measure/Weight.php | 478 ---- library/vendor/Zend/Memory.php | 76 - .../vendor/Zend/Memory/AccessController.php | 148 -- library/vendor/Zend/Memory/Container.php | 34 - .../Zend/Memory/Container/Interface.php | 66 - .../vendor/Zend/Memory/Container/Locked.php | 112 - .../vendor/Zend/Memory/Container/Movable.php | 293 --- library/vendor/Zend/Memory/Exception.php | 34 - library/vendor/Zend/Memory/Manager.php | 459 ---- library/vendor/Zend/Memory/Value.php | 177 -- library/vendor/Zend/Mobile/Exception.php | 32 - library/vendor/Zend/Mobile/Push/Abstract.php | 110 - library/vendor/Zend/Mobile/Push/Apns.php | 388 --- library/vendor/Zend/Mobile/Push/Exception.php | 34 - .../Push/Exception/DeviceQuotaExceeded.php | 34 - .../Push/Exception/InvalidAuthToken.php | 34 - .../Mobile/Push/Exception/InvalidPayload.php | 34 - .../Push/Exception/InvalidRegistration.php | 34 - .../Mobile/Push/Exception/InvalidToken.php | 34 - .../Mobile/Push/Exception/InvalidTopic.php | 34 - .../Mobile/Push/Exception/QuotaExceeded.php | 34 - .../Push/Exception/ServerUnavailable.php | 34 - library/vendor/Zend/Mobile/Push/Gcm.php | 160 -- library/vendor/Zend/Mobile/Push/Interface.php | 64 - .../Zend/Mobile/Push/Message/Abstract.php | 134 -- .../vendor/Zend/Mobile/Push/Message/Apns.php | 284 --- .../Zend/Mobile/Push/Message/Exception.php | 34 - .../vendor/Zend/Mobile/Push/Message/Gcm.php | 276 --- .../Zend/Mobile/Push/Message/Interface.php | 79 - .../vendor/Zend/Mobile/Push/Message/Mpns.php | 115 - .../Zend/Mobile/Push/Message/Mpns/Raw.php | 150 -- .../Zend/Mobile/Push/Message/Mpns/Tile.php | 364 --- .../Zend/Mobile/Push/Message/Mpns/Toast.php | 224 -- library/vendor/Zend/Mobile/Push/Mpns.php | 148 -- .../vendor/Zend/Mobile/Push/Response/Gcm.php | 242 -- .../Zend/Mobile/Push/Test/ApnsProxy.php | 101 - library/vendor/Zend/Navigation.php | 52 - library/vendor/Zend/Navigation/Container.php | 617 ----- library/vendor/Zend/Navigation/Exception.php | 37 - library/vendor/Zend/Navigation/Page.php | 1341 ----------- library/vendor/Zend/Navigation/Page/Mvc.php | 687 ------ library/vendor/Zend/Navigation/Page/Uri.php | 109 - library/vendor/Zend/Oauth.php | 89 - library/vendor/Zend/Oauth/Client.php | 322 --- library/vendor/Zend/Oauth/Config.php | 679 ------ .../Zend/Oauth/Config/ConfigInterface.php | 79 - library/vendor/Zend/Oauth/Consumer.php | 268 --- library/vendor/Zend/Oauth/Exception.php | 32 - library/vendor/Zend/Oauth/Http.php | 261 -- .../vendor/Zend/Oauth/Http/AccessToken.php | 187 -- .../vendor/Zend/Oauth/Http/RequestToken.php | 160 -- .../Zend/Oauth/Http/UserAuthorization.php | 76 - library/vendor/Zend/Oauth/Http/Utility.php | 214 -- library/vendor/Zend/Oauth/Signature/Hmac.php | 52 - .../vendor/Zend/Oauth/Signature/Plaintext.php | 48 - library/vendor/Zend/Oauth/Signature/Rsa.php | 63 - .../Oauth/Signature/SignatureAbstract.php | 181 -- library/vendor/Zend/Oauth/Token.php | 284 --- library/vendor/Zend/Oauth/Token/Access.php | 93 - .../Zend/Oauth/Token/AuthorizedRequest.php | 101 - library/vendor/Zend/Oauth/Token/Request.php | 49 - library/vendor/Zend/OpenId.php | 750 ------ library/vendor/Zend/OpenId/Consumer.php | 992 -------- .../vendor/Zend/OpenId/Consumer/Storage.php | 132 -- .../Zend/OpenId/Consumer/Storage/File.php | 506 ---- library/vendor/Zend/OpenId/Exception.php | 57 - library/vendor/Zend/OpenId/Extension.php | 137 -- library/vendor/Zend/OpenId/Extension/Sreg.php | 299 --- library/vendor/Zend/OpenId/Provider.php | 799 ------- .../vendor/Zend/OpenId/Provider/Storage.php | 106 - .../Zend/OpenId/Provider/Storage/File.php | 441 ---- library/vendor/Zend/OpenId/Provider/User.php | 57 - .../Zend/OpenId/Provider/User/Session.php | 102 - .../Zend/ProgressBar/Adapter/Console.php | 527 ---- library/vendor/Zend/Queue.php | 560 ----- .../vendor/Zend/Queue/Adapter/Activemq.php | 354 --- .../Zend/Queue/Adapter/AdapterAbstract.php | 187 -- .../Zend/Queue/Adapter/AdapterInterface.php | 174 -- library/vendor/Zend/Queue/Adapter/Array.php | 350 --- library/vendor/Zend/Queue/Adapter/Db.php | 516 ---- .../vendor/Zend/Queue/Adapter/Db/Message.php | 50 - .../vendor/Zend/Queue/Adapter/Db/Queue.php | 50 - .../vendor/Zend/Queue/Adapter/Db/mysql.sql | 75 - .../Zend/Queue/Adapter/Db/postgresql.sql | 49 - .../Zend/Queue/Adapter/Db/queue_sqlite.sql | 41 - .../vendor/Zend/Queue/Adapter/Db/sqlsrv.sql | 44 - .../vendor/Zend/Queue/Adapter/Memcacheq.php | 418 ---- library/vendor/Zend/Queue/Adapter/Null.php | 165 -- .../Zend/Queue/Adapter/PlatformJobQueue.php | 322 --- library/vendor/Zend/Queue/Exception.php | 34 - library/vendor/Zend/Queue/Message.php | 226 -- .../vendor/Zend/Queue/Message/Iterator.php | 283 --- .../vendor/Zend/Queue/Message/PlatformJob.php | 191 -- library/vendor/Zend/Queue/Stomp/Client.php | 172 -- .../Zend/Queue/Stomp/Client/Connection.php | 273 --- .../Stomp/Client/ConnectionInterface.php | 103 - library/vendor/Zend/Queue/Stomp/Frame.php | 354 --- .../Zend/Queue/Stomp/FrameInterface.php | 154 -- library/vendor/Zend/README.md | 8 + library/vendor/Zend/Reflection/Class.php | 235 -- library/vendor/Zend/Reflection/Docblock.php | 290 --- .../vendor/Zend/Reflection/Docblock/Tag.php | 142 -- .../Zend/Reflection/Docblock/Tag/Param.php | 90 - .../Zend/Reflection/Docblock/Tag/Return.php | 69 - library/vendor/Zend/Reflection/Exception.php | 35 - library/vendor/Zend/Reflection/Extension.php | 81 - library/vendor/Zend/Reflection/File.php | 422 ---- library/vendor/Zend/Reflection/Function.php | 124 - library/vendor/Zend/Reflection/Method.php | 180 -- library/vendor/Zend/Reflection/Parameter.php | 120 - library/vendor/Zend/Reflection/Property.php | 66 - library/vendor/Zend/Rest/Client.php | 283 --- library/vendor/Zend/Rest/Client/Exception.php | 39 - library/vendor/Zend/Rest/Client/Result.php | 237 -- .../Zend/Rest/Client/Result/Exception.php | 35 - library/vendor/Zend/Rest/Controller.php | 76 - library/vendor/Zend/Rest/Exception.php | 36 - library/vendor/Zend/Rest/Route.php | 409 ---- library/vendor/Zend/Rest/Server.php | 668 ------ library/vendor/Zend/Rest/Server/Exception.php | 40 - library/vendor/Zend/SOURCE | 16 - library/vendor/Zend/Search/Exception.php | 36 - library/vendor/Zend/Search/Lucene.php | 1537 ------------ .../Zend/Search/Lucene/Analysis/Analyzer.php | 166 -- .../Lucene/Analysis/Analyzer/Common.php | 91 - .../Lucene/Analysis/Analyzer/Common/Text.php | 95 - .../Analyzer/Common/Text/CaseInsensitive.php | 45 - .../Analysis/Analyzer/Common/TextNum.php | 94 - .../Common/TextNum/CaseInsensitive.php | 45 - .../Lucene/Analysis/Analyzer/Common/Utf8.php | 124 - .../Analyzer/Common/Utf8/CaseInsensitive.php | 47 - .../Analysis/Analyzer/Common/Utf8Num.php | 124 - .../Common/Utf8Num/CaseInsensitive.php | 47 - .../Zend/Search/Lucene/Analysis/Token.php | 166 -- .../Search/Lucene/Analysis/TokenFilter.php | 46 - .../Lucene/Analysis/TokenFilter/LowerCase.php | 51 - .../Analysis/TokenFilter/LowerCaseUtf8.php | 62 - .../Analysis/TokenFilter/ShortWords.php | 68 - .../Lucene/Analysis/TokenFilter/StopWords.php | 97 - .../vendor/Zend/Search/Lucene/Document.php | 129 - .../Zend/Search/Lucene/Document/Docx.php | 149 -- .../Zend/Search/Lucene/Document/Exception.php | 36 - .../Zend/Search/Lucene/Document/Html.php | 476 ---- .../Zend/Search/Lucene/Document/OpenXml.php | 129 - .../Zend/Search/Lucene/Document/Pptx.php | 198 -- .../Zend/Search/Lucene/Document/Xlsx.php | 262 -- .../vendor/Zend/Search/Lucene/Exception.php | 36 - library/vendor/Zend/Search/Lucene/FSM.php | 428 ---- .../vendor/Zend/Search/Lucene/FSMAction.php | 66 - library/vendor/Zend/Search/Lucene/Field.php | 226 -- .../Search/Lucene/Index/DictionaryLoader.php | 264 --- .../Zend/Search/Lucene/Index/DocsFilter.php | 59 - .../Zend/Search/Lucene/Index/FieldInfo.php | 50 - .../Zend/Search/Lucene/Index/SegmentInfo.php | 2110 ----------------- .../Search/Lucene/Index/SegmentMerger.php | 266 --- .../Search/Lucene/Index/SegmentWriter.php | 631 ----- .../Index/SegmentWriter/DocumentWriter.php | 225 -- .../Index/SegmentWriter/StreamWriter.php | 92 - .../vendor/Zend/Search/Lucene/Index/Term.php | 144 -- .../Zend/Search/Lucene/Index/TermInfo.php | 80 - .../Lucene/Index/TermsPriorityQueue.php | 48 - .../Lucene/Index/TermsStream/Interface.php | 66 - .../Zend/Search/Lucene/Index/Writer.php | 836 ------- .../vendor/Zend/Search/Lucene/Interface.php | 413 ---- .../Search/Lucene/Interface/MultiSearcher.php | 24 - .../vendor/Zend/Search/Lucene/LockManager.php | 231 -- .../Zend/Search/Lucene/MultiSearcher.php | 965 -------- .../Zend/Search/Lucene/PriorityQueue.php | 171 -- library/vendor/Zend/Search/Lucene/Proxy.php | 611 ----- .../Search/BooleanExpressionRecognizer.php | 274 --- .../Lucene/Search/Highlighter/Default.php | 93 - .../Lucene/Search/Highlighter/Interface.php | 53 - .../Zend/Search/Lucene/Search/Query.php | 229 -- .../Search/Lucene/Search/Query/Boolean.php | 802 ------- .../Zend/Search/Lucene/Search/Query/Empty.php | 136 -- .../Zend/Search/Lucene/Search/Query/Fuzzy.php | 472 ---- .../Lucene/Search/Query/Insignificant.php | 137 -- .../Search/Lucene/Search/Query/MultiTerm.php | 657 ----- .../Search/Lucene/Search/Query/Phrase.php | 563 ----- .../Lucene/Search/Query/Preprocessing.php | 120 - .../Search/Query/Preprocessing/Fuzzy.php | 270 --- .../Search/Query/Preprocessing/Phrase.php | 257 -- .../Search/Query/Preprocessing/Term.php | 319 --- .../Zend/Search/Lucene/Search/Query/Range.php | 360 --- .../Zend/Search/Lucene/Search/Query/Term.php | 223 -- .../Search/Lucene/Search/Query/Wildcard.php | 347 --- .../Zend/Search/Lucene/Search/QueryEntry.php | 67 - .../Lucene/Search/QueryEntry/Phrase.php | 114 - .../Lucene/Search/QueryEntry/Subquery.php | 75 - .../Search/Lucene/Search/QueryEntry/Term.php | 126 - .../Zend/Search/Lucene/Search/QueryHit.php | 109 - .../Zend/Search/Lucene/Search/QueryLexer.php | 502 ---- .../Zend/Search/Lucene/Search/QueryParser.php | 603 ----- .../Lucene/Search/QueryParserContext.php | 385 --- .../Lucene/Search/QueryParserException.php | 40 - .../Zend/Search/Lucene/Search/QueryToken.php | 223 -- .../Zend/Search/Lucene/Search/Similarity.php | 550 ----- .../Lucene/Search/Similarity/Default.php | 109 - .../Zend/Search/Lucene/Search/Weight.php | 85 - .../Search/Lucene/Search/Weight/Boolean.php | 136 -- .../Search/Lucene/Search/Weight/Empty.php | 56 - .../Search/Lucene/Search/Weight/MultiTerm.php | 137 -- .../Search/Lucene/Search/Weight/Phrase.php | 107 - .../Zend/Search/Lucene/Search/Weight/Term.php | 124 - .../Zend/Search/Lucene/Storage/Directory.php | 136 -- .../Lucene/Storage/Directory/Filesystem.php | 355 --- .../Zend/Search/Lucene/Storage/File.php | 470 ---- .../Search/Lucene/Storage/File/Filesystem.php | 226 -- .../Search/Lucene/Storage/File/Memory.php | 597 ----- .../Lucene/TermStreamsPriorityQueue.php | 170 -- library/vendor/Zend/Serializer.php | 185 -- .../Serializer/Adapter/AdapterAbstract.php | 110 - .../Serializer/Adapter/AdapterInterface.php | 92 - .../vendor/Zend/Serializer/Adapter/Amf0.php | 81 - .../vendor/Zend/Serializer/Adapter/Amf3.php | 80 - .../Zend/Serializer/Adapter/Igbinary.php | 94 - .../vendor/Zend/Serializer/Adapter/Json.php | 85 - .../Zend/Serializer/Adapter/PhpCode.php | 65 - .../Zend/Serializer/Adapter/PhpSerialize.php | 91 - .../Zend/Serializer/Adapter/PythonPickle.php | 1463 ------------ .../vendor/Zend/Serializer/Adapter/Wddx.php | 118 - library/vendor/Zend/Serializer/Exception.php | 32 - library/vendor/Zend/Server/Cache.php | 2 + .../vendor/Zend/Stdlib/CallbackHandler.php | 300 --- library/vendor/Zend/Stdlib/Exception.php | 31 - .../Exception/InvalidCallbackException.php | 34 - library/vendor/Zend/Stdlib/PriorityQueue.php | 318 --- .../vendor/Zend/Stdlib/SplPriorityQueue.php | 499 ---- library/vendor/Zend/Tag/Cloud.php | 403 ---- .../vendor/Zend/Tag/Cloud/Decorator/Cloud.php | 88 - .../Zend/Tag/Cloud/Decorator/Exception.php | 38 - .../Zend/Tag/Cloud/Decorator/HtmlCloud.php | 154 -- .../Zend/Tag/Cloud/Decorator/HtmlTag.php | 300 --- .../vendor/Zend/Tag/Cloud/Decorator/Tag.php | 88 - library/vendor/Zend/Tag/Cloud/Exception.php | 37 - library/vendor/Zend/Tag/Exception.php | 37 - library/vendor/Zend/Tag/Item.php | 214 -- library/vendor/Zend/Tag/ItemList.php | 235 -- library/vendor/Zend/Tag/Taggable.php | 60 - library/vendor/Zend/Test/DbAdapter.php | 342 --- library/vendor/Zend/Test/DbStatement.php | 402 ---- .../Zend/Test/PHPUnit/Constraint/DomQuery.php | 38 - .../Test/PHPUnit/Constraint/DomQuery34.php | 422 ---- .../Test/PHPUnit/Constraint/DomQuery37.php | 434 ---- .../Test/PHPUnit/Constraint/DomQuery41.php | 436 ---- .../Test/PHPUnit/Constraint/Exception.php | 35 - .../Zend/Test/PHPUnit/Constraint/Redirect.php | 38 - .../Test/PHPUnit/Constraint/Redirect34.php | 303 --- .../Test/PHPUnit/Constraint/Redirect37.php | 315 --- .../Test/PHPUnit/Constraint/Redirect41.php | 317 --- .../PHPUnit/Constraint/ResponseHeader.php | 38 - .../PHPUnit/Constraint/ResponseHeader34.php | 406 ---- .../PHPUnit/Constraint/ResponseHeader37.php | 419 ---- .../PHPUnit/Constraint/ResponseHeader41.php | 421 ---- .../Zend/Test/PHPUnit/ControllerTestCase.php | 1165 --------- .../Zend/Test/PHPUnit/DatabaseTestCase.php | 146 -- .../Zend/Test/PHPUnit/Db/Connection.php | 144 -- .../Zend/Test/PHPUnit/Db/DataSet/DbRowset.php | 73 - .../Zend/Test/PHPUnit/Db/DataSet/DbTable.php | 120 - .../PHPUnit/Db/DataSet/DbTableDataSet.php | 98 - .../Test/PHPUnit/Db/DataSet/QueryDataSet.php | 80 - .../Test/PHPUnit/Db/DataSet/QueryTable.php | 82 - .../vendor/Zend/Test/PHPUnit/Db/Exception.php | 40 - .../Zend/Test/PHPUnit/Db/Metadata/Generic.php | 182 -- .../Test/PHPUnit/Db/Operation/DeleteAll.php | 60 - .../Zend/Test/PHPUnit/Db/Operation/Insert.php | 84 - .../Test/PHPUnit/Db/Operation/Truncate.php | 110 - .../Zend/Test/PHPUnit/Db/SimpleTester.php | 75 - library/vendor/Zend/Text/Exception.php | 38 - library/vendor/Zend/Text/Figlet.php | 1232 ---------- library/vendor/Zend/Text/Figlet/Exception.php | 38 - .../Zend/Text/Figlet/zend-framework.flf | 753 ------ library/vendor/Zend/Text/MultiByte.php | 143 -- library/vendor/Zend/Text/Table.php | 533 ----- library/vendor/Zend/Text/Table/Column.php | 243 -- .../Zend/Text/Table/Decorator/Ascii.php | 147 -- .../Zend/Text/Table/Decorator/Interface.php | 108 - .../Zend/Text/Table/Decorator/Unicode.php | 176 -- library/vendor/Zend/Text/Table/Exception.php | 38 - library/vendor/Zend/Text/Table/Row.php | 215 -- library/vendor/Zend/TimeSync.php | 8 - library/vendor/Zend/TimeSync/Exception.php | 1 - library/vendor/Zend/TimeSync/Ntp.php | 1 - library/vendor/Zend/TimeSync/Sntp.php | 1 - .../Zend/Tool/Framework/Action/Base.php | 95 - .../Zend/Tool/Framework/Action/Exception.php | 37 - .../Zend/Tool/Framework/Action/Interface.php | 32 - .../Zend/Tool/Framework/Action/Repository.php | 138 -- .../Zend/Tool/Framework/Client/Abstract.php | 333 --- .../Zend/Tool/Framework/Client/Config.php | 244 -- .../Zend/Tool/Framework/Client/Console.php | 312 --- .../Client/Console/ArgumentParser.php | 539 ----- .../Framework/Client/Console/HelpSystem.php | 378 --- .../Framework/Client/Console/Manifest.php | 209 -- .../Console/ResponseDecorator/AlignCenter.php | 66 - .../Console/ResponseDecorator/Blockize.php | 69 - .../Console/ResponseDecorator/Colorizer.php | 92 - .../Console/ResponseDecorator/Indention.php | 56 - .../Zend/Tool/Framework/Client/Exception.php | 36 - .../Client/Interactive/InputHandler.php | 74 - .../Client/Interactive/InputInterface.php | 41 - .../Client/Interactive/InputRequest.php | 54 - .../Client/Interactive/InputResponse.php | 52 - .../Client/Interactive/OutputInterface.php | 33 - .../Zend/Tool/Framework/Client/Manifest.php | 206 -- .../Zend/Tool/Framework/Client/Request.php | 299 --- .../Zend/Tool/Framework/Client/Response.php | 223 -- .../Response/ContentDecorator/Interface.php | 35 - .../Response/ContentDecorator/Separator.php | 93 - .../Zend/Tool/Framework/Client/Storage.php | 117 - .../Client/Storage/AdapterInterface.php | 42 - .../Framework/Client/Storage/Directory.php | 73 - .../vendor/Zend/Tool/Framework/Exception.php | 36 - .../Zend/Tool/Framework/Loader/Abstract.php | 156 -- .../Tool/Framework/Loader/BasicLoader.php | 157 -- .../Framework/Loader/IncludePathLoader.php | 139 -- .../RecursiveFilterIterator.php | 91 - .../Zend/Tool/Framework/Loader/Interface.php | 42 - .../Framework/Manifest/ActionManifestable.php | 47 - .../Framework/Manifest/ActionMetadata.php | 31 - .../Tool/Framework/Manifest/Exception.php | 37 - .../Tool/Framework/Manifest/Indexable.php | 42 - .../Tool/Framework/Manifest/Interface.php | 82 - .../Zend/Tool/Framework/Manifest/Metadata.php | 31 - .../Manifest/MetadataManifestable.php | 47 - .../Manifest/ProviderManifestable.php | 47 - .../Framework/Manifest/ProviderMetadata.php | 31 - .../Tool/Framework/Manifest/Repository.php | 313 --- .../Tool/Framework/Metadata/Attributable.php | 33 - .../Zend/Tool/Framework/Metadata/Basic.php | 227 -- .../Zend/Tool/Framework/Metadata/Dynamic.php | 219 -- .../Tool/Framework/Metadata/Interface.php | 52 - .../Zend/Tool/Framework/Metadata/Tool.php | 218 -- .../Zend/Tool/Framework/Provider/Abstract.php | 68 - .../Provider/DocblockManifestable.php | 30 - .../Tool/Framework/Provider/Exception.php | 37 - .../Tool/Framework/Provider/Initializable.php | 31 - .../Tool/Framework/Provider/Interactable.php | 30 - .../Tool/Framework/Provider/Interface.php | 31 - .../Tool/Framework/Provider/Pretendable.php | 31 - .../Tool/Framework/Provider/Repository.php | 275 --- .../Tool/Framework/Provider/Signature.php | 394 --- .../vendor/Zend/Tool/Framework/Registry.php | 419 ---- .../Framework/Registry/EnabledInterface.php | 40 - .../Tool/Framework/Registry/Exception.php | 33 - .../Tool/Framework/Registry/Interface.php | 137 -- .../Tool/Framework/System/Action/Create.php | 44 - .../Tool/Framework/System/Action/Delete.php | 44 - .../Zend/Tool/Framework/System/Manifest.php | 63 - .../Tool/Framework/System/Provider/Config.php | 323 --- .../Framework/System/Provider/Manifest.php | 114 - .../Framework/System/Provider/Phpinfo.php | 38 - .../Framework/System/Provider/Version.php | 111 - .../Tool/Project/Context/Content/Engine.php | 106 - .../Context/Content/Engine/CodeGenerator.php | 98 - .../Project/Context/Content/Engine/Phtml.php | 89 - .../Zend/Tool/Project/Context/Exception.php | 33 - .../Project/Context/Filesystem/Abstract.php | 165 -- .../Project/Context/Filesystem/Directory.php | 87 - .../Tool/Project/Context/Filesystem/File.php | 174 -- .../Zend/Tool/Project/Context/Interface.php | 38 - .../Zend/Tool/Project/Context/Repository.php | 189 -- .../Tool/Project/Context/System/Interface.php | 37 - .../Context/System/NotOverwritable.php | 37 - .../Context/System/ProjectDirectory.php | 128 - .../Context/System/ProjectProfileFile.php | 118 - .../System/ProjectProvidersDirectory.php | 87 - .../Context/System/TopLevelRestrictable.php | 37 - .../Project/Context/Zf/AbstractClassFile.php | 84 - .../Tool/Project/Context/Zf/ActionMethod.php | 224 -- .../Tool/Project/Context/Zf/ApisDirectory.php | 55 - .../Context/Zf/ApplicationConfigFile.php | 285 --- .../Context/Zf/ApplicationDirectory.php | 81 - .../Tool/Project/Context/Zf/BootstrapFile.php | 119 - .../Project/Context/Zf/CacheDirectory.php | 57 - .../Tool/Project/Context/Zf/ConfigFile.php | 67 - .../Project/Context/Zf/ConfigsDirectory.php | 57 - .../Project/Context/Zf/ControllerFile.php | 223 -- .../Context/Zf/ControllersDirectory.php | 57 - .../Tool/Project/Context/Zf/DataDirectory.php | 57 - .../Project/Context/Zf/DbTableDirectory.php | 57 - .../Tool/Project/Context/Zf/DbTableFile.php | 92 - .../Tool/Project/Context/Zf/DocsDirectory.php | 61 - .../Zend/Tool/Project/Context/Zf/FormFile.php | 113 - .../Project/Context/Zf/FormsDirectory.php | 57 - .../Tool/Project/Context/Zf/HtaccessFile.php | 87 - .../Project/Context/Zf/LayoutScriptFile.php | 109 - .../Context/Zf/LayoutScriptsDirectory.php | 57 - .../Project/Context/Zf/LayoutsDirectory.php | 57 - .../Project/Context/Zf/LibraryDirectory.php | 57 - .../Project/Context/Zf/LocalesDirectory.php | 57 - .../Tool/Project/Context/Zf/LogsDirectory.php | 57 - .../Tool/Project/Context/Zf/ModelFile.php | 107 - .../Project/Context/Zf/ModelsDirectory.php | 57 - .../Project/Context/Zf/ModuleDirectory.php | 97 - .../Project/Context/Zf/ModulesDirectory.php | 57 - .../Context/Zf/ProjectProviderFile.php | 152 -- .../Project/Context/Zf/PublicDirectory.php | 57 - .../Context/Zf/PublicImagesDirectory.php | 57 - .../Project/Context/Zf/PublicIndexFile.php | 95 - .../Context/Zf/PublicScriptsDirectory.php | 57 - .../Context/Zf/PublicStylesheetsDirectory.php | 57 - .../Context/Zf/SearchIndexesDirectory.php | 57 - .../Project/Context/Zf/ServicesDirectory.php | 55 - .../Project/Context/Zf/SessionsDirectory.php | 57 - .../Project/Context/Zf/TemporaryDirectory.php | 57 - .../Zf/TestApplicationActionMethod.php | 229 -- .../Zf/TestApplicationBootstrapFile.php | 57 - .../Zf/TestApplicationControllerDirectory.php | 57 - .../Zf/TestApplicationControllerFile.php | 131 - .../Context/Zf/TestApplicationDirectory.php | 57 - .../Zf/TestApplicationModuleDirectory.php | 98 - .../Zf/TestApplicationModulesDirectory.php | 57 - .../Context/Zf/TestLibraryBootstrapFile.php | 57 - .../Context/Zf/TestLibraryDirectory.php | 57 - .../Project/Context/Zf/TestLibraryFile.php | 107 - .../Zf/TestLibraryNamespaceDirectory.php | 88 - .../Context/Zf/TestPHPUnitBootstrapFile.php | 88 - .../Context/Zf/TestPHPUnitConfigFile.php | 81 - .../Project/Context/Zf/TestsDirectory.php | 57 - .../Project/Context/Zf/UploadsDirectory.php | 57 - .../Zf/ViewControllerScriptsDirectory.php | 111 - .../Context/Zf/ViewFiltersDirectory.php | 57 - .../Context/Zf/ViewHelpersDirectory.php | 57 - .../Project/Context/Zf/ViewScriptFile.php | 247 -- .../Context/Zf/ViewScriptsDirectory.php | 57 - .../Project/Context/Zf/ViewsDirectory.php | 57 - .../Context/Zf/ZfStandardLibraryDirectory.php | 104 - .../vendor/Zend/Tool/Project/Exception.php | 37 - library/vendor/Zend/Tool/Project/Profile.php | 237 -- .../Zend/Tool/Project/Profile/Exception.php | 37 - .../Project/Profile/FileParser/Interface.php | 54 - .../Tool/Project/Profile/FileParser/Xml.php | 240 -- .../Profile/Iterator/ContextFilter.php | 211 -- .../Iterator/EnabledResourceFilter.php | 43 - .../Zend/Tool/Project/Profile/Resource.php | 262 -- .../Project/Profile/Resource/Container.php | 421 ---- .../Profile/Resource/SearchConstraints.php | 117 - .../Zend/Tool/Project/Provider/Abstract.php | 279 --- .../Zend/Tool/Project/Provider/Action.php | 242 -- .../Tool/Project/Provider/Application.php | 87 - .../Zend/Tool/Project/Provider/Controller.php | 209 -- .../Zend/Tool/Project/Provider/DbAdapter.php | 139 -- .../Zend/Tool/Project/Provider/DbTable.php | 225 -- .../Zend/Tool/Project/Provider/Exception.php | 37 - .../Zend/Tool/Project/Provider/Form.php | 180 -- .../Zend/Tool/Project/Provider/Layout.php | 140 -- .../Zend/Tool/Project/Provider/Manifest.php | 75 - .../Zend/Tool/Project/Provider/Model.php | 178 -- .../Zend/Tool/Project/Provider/Module.php | 181 -- .../Zend/Tool/Project/Provider/Profile.php | 54 - .../Zend/Tool/Project/Provider/Project.php | 254 -- .../Tool/Project/Provider/ProjectProvider.php | 97 - .../Zend/Tool/Project/Provider/Test.php | 198 -- .../Zend/Tool/Project/Provider/View.php | 118 - library/vendor/Zend/Translate.php | 4 - library/vendor/Zend/Translate/Adapter.php | 9 - .../vendor/Zend/Translate/Adapter/Array.php | 81 - library/vendor/Zend/Translate/Adapter/Csv.php | 121 - .../vendor/Zend/Translate/Adapter/Gettext.php | 169 -- library/vendor/Zend/Translate/Adapter/Ini.php | 74 - library/vendor/Zend/Translate/Adapter/Qt.php | 175 -- library/vendor/Zend/Translate/Adapter/Tbx.php | 180 -- library/vendor/Zend/Translate/Adapter/Tmx.php | 248 -- .../vendor/Zend/Translate/Adapter/Xliff.php | 244 -- .../vendor/Zend/Translate/Adapter/XmlTm.php | 154 -- library/vendor/Zend/Translate/Exception.php | 1 - library/vendor/Zend/Translate/Plural.php | 1 - library/vendor/Zend/Uri.php | 6 - library/vendor/Zend/Uri/Exception.php | 1 - library/vendor/Zend/Uri/Http.php | 20 - library/vendor/Zend/VERSION | 1 + library/vendor/Zend/Validate.php | 7 - library/vendor/Zend/Validate/Abstract.php | 6 - library/vendor/Zend/Validate/Alnum.php | 2 - library/vendor/Zend/Validate/Alpha.php | 2 - library/vendor/Zend/Validate/Barcode.php | 5 - .../Zend/Validate/Barcode/AdapterAbstract.php | 1 - .../vendor/Zend/Validate/Barcode/Code25.php | 1 - .../Validate/Barcode/Code25interleaved.php | 1 - .../vendor/Zend/Validate/Barcode/Code39.php | 1 - .../Zend/Validate/Barcode/Code39ext.php | 1 - .../vendor/Zend/Validate/Barcode/Code93.php | 1 - .../Zend/Validate/Barcode/Code93ext.php | 1 - .../vendor/Zend/Validate/Barcode/Ean12.php | 1 - .../vendor/Zend/Validate/Barcode/Ean13.php | 1 - .../vendor/Zend/Validate/Barcode/Ean14.php | 1 - .../vendor/Zend/Validate/Barcode/Ean18.php | 1 - library/vendor/Zend/Validate/Barcode/Ean2.php | 1 - library/vendor/Zend/Validate/Barcode/Ean5.php | 1 - library/vendor/Zend/Validate/Barcode/Ean8.php | 1 - .../vendor/Zend/Validate/Barcode/Gtin12.php | 1 - .../vendor/Zend/Validate/Barcode/Gtin13.php | 1 - .../vendor/Zend/Validate/Barcode/Gtin14.php | 1 - .../Zend/Validate/Barcode/Identcode.php | 1 - .../Zend/Validate/Barcode/Intelligentmail.php | 1 - library/vendor/Zend/Validate/Barcode/Issn.php | 1 - .../vendor/Zend/Validate/Barcode/Itf14.php | 1 - .../vendor/Zend/Validate/Barcode/Leitcode.php | 1 - .../vendor/Zend/Validate/Barcode/Planet.php | 1 - .../vendor/Zend/Validate/Barcode/Postnet.php | 1 - .../Zend/Validate/Barcode/Royalmail.php | 1 - library/vendor/Zend/Validate/Barcode/Sscc.php | 1 - library/vendor/Zend/Validate/Barcode/Upca.php | 1 - library/vendor/Zend/Validate/Barcode/Upce.php | 1 - library/vendor/Zend/Validate/Between.php | 2 - library/vendor/Zend/Validate/Callback.php | 3 - library/vendor/Zend/Validate/Ccnum.php | 2 - library/vendor/Zend/Validate/CreditCard.php | 3 - library/vendor/Zend/Validate/Date.php | 5 - library/vendor/Zend/Validate/Db/Abstract.php | 5 - .../Zend/Validate/Db/NoRecordExists.php | 1 - .../vendor/Zend/Validate/Db/RecordExists.php | 1 - library/vendor/Zend/Validate/Digits.php | 2 - library/vendor/Zend/Validate/EmailAddress.php | 3 - library/vendor/Zend/Validate/Exception.php | 1 - library/vendor/Zend/Validate/File/Count.php | 6 - library/vendor/Zend/Validate/File/Crc32.php | 3 - .../Zend/Validate/File/ExcludeExtension.php | 2 - .../Zend/Validate/File/ExcludeMimeType.php | 2 - library/vendor/Zend/Validate/File/Exists.php | 3 - .../vendor/Zend/Validate/File/Extension.php | 2 - .../vendor/Zend/Validate/File/FilesSize.php | 3 - library/vendor/Zend/Validate/File/Hash.php | 5 - .../vendor/Zend/Validate/File/ImageSize.php | 7 - .../Zend/Validate/File/IsCompressed.php | 1 - library/vendor/Zend/Validate/File/IsImage.php | 1 - library/vendor/Zend/Validate/File/Md5.php | 3 - .../vendor/Zend/Validate/File/MimeType.php | 8 - .../vendor/Zend/Validate/File/NotExists.php | 1 - library/vendor/Zend/Validate/File/Sha1.php | 3 - library/vendor/Zend/Validate/File/Size.php | 7 - library/vendor/Zend/Validate/File/Upload.php | 2 - .../vendor/Zend/Validate/File/WordCount.php | 2 - library/vendor/Zend/Validate/Float.php | 4 - library/vendor/Zend/Validate/GreaterThan.php | 2 - library/vendor/Zend/Validate/Hex.php | 1 - library/vendor/Zend/Validate/Hostname.php | 340 ++- library/vendor/Zend/Validate/Iban.php | 6 +- library/vendor/Zend/Validate/Identical.php | 1 - library/vendor/Zend/Validate/InArray.php | 2 - library/vendor/Zend/Validate/Int.php | 4 - library/vendor/Zend/Validate/Ip.php | 2 - library/vendor/Zend/Validate/Isbn.php | 4 - library/vendor/Zend/Validate/Ldap/Dn.php | 65 - library/vendor/Zend/Validate/LessThan.php | 2 - library/vendor/Zend/Validate/NotEmpty.php | 2 - library/vendor/Zend/Validate/PostCode.php | 8 - library/vendor/Zend/Validate/Regex.php | 3 - .../Zend/Validate/Sitemap/Changefreq.php | 1 - .../vendor/Zend/Validate/Sitemap/Lastmod.php | 1 - library/vendor/Zend/Validate/Sitemap/Loc.php | 2 - .../vendor/Zend/Validate/Sitemap/Priority.php | 1 - library/vendor/Zend/Validate/StringLength.php | 14 +- library/vendor/Zend/Version.php | 81 - library/vendor/Zend/View.php | 2 - library/vendor/Zend/View/Abstract.php | 14 - library/vendor/Zend/View/Exception.php | 1 - library/vendor/Zend/View/Helper/Abstract.php | 1 - library/vendor/Zend/View/Helper/Action.php | 3 - library/vendor/Zend/View/Helper/BaseUrl.php | 2 - library/vendor/Zend/View/Helper/Currency.php | 120 - .../vendor/Zend/View/Helper/DeclareVars.php | 1 - library/vendor/Zend/View/Helper/Doctype.php | 3 - library/vendor/Zend/View/Helper/Fieldset.php | 1 - library/vendor/Zend/View/Helper/Form.php | 1 - .../vendor/Zend/View/Helper/FormButton.php | 1 - .../vendor/Zend/View/Helper/FormCheckbox.php | 1 - .../vendor/Zend/View/Helper/FormElement.php | 2 - .../vendor/Zend/View/Helper/FormErrors.php | 1 - library/vendor/Zend/View/Helper/FormFile.php | 1 - .../vendor/Zend/View/Helper/FormHidden.php | 1 - library/vendor/Zend/View/Helper/FormImage.php | 1 - library/vendor/Zend/View/Helper/FormLabel.php | 1 - .../Zend/View/Helper/FormMultiCheckbox.php | 1 - library/vendor/Zend/View/Helper/FormNote.php | 1 - .../vendor/Zend/View/Helper/FormPassword.php | 1 - library/vendor/Zend/View/Helper/FormRadio.php | 2 - library/vendor/Zend/View/Helper/FormReset.php | 1 - .../vendor/Zend/View/Helper/FormSelect.php | 1 - .../vendor/Zend/View/Helper/FormSubmit.php | 1 - library/vendor/Zend/View/Helper/FormText.php | 1 - .../vendor/Zend/View/Helper/FormTextarea.php | 1 - library/vendor/Zend/View/Helper/Gravatar.php | 2 - library/vendor/Zend/View/Helper/HeadLink.php | 7 - library/vendor/Zend/View/Helper/HeadMeta.php | 10 - .../vendor/Zend/View/Helper/HeadScript.php | 8 - library/vendor/Zend/View/Helper/HeadStyle.php | 7 - library/vendor/Zend/View/Helper/HeadTitle.php | 4 - .../vendor/Zend/View/Helper/HtmlElement.php | 2 - library/vendor/Zend/View/Helper/HtmlFlash.php | 1 - library/vendor/Zend/View/Helper/HtmlList.php | 2 - .../vendor/Zend/View/Helper/HtmlObject.php | 1 - library/vendor/Zend/View/Helper/HtmlPage.php | 1 - .../vendor/Zend/View/Helper/HtmlQuicktime.php | 1 - .../vendor/Zend/View/Helper/InlineScript.php | 1 - library/vendor/Zend/View/Helper/Json.php | 4 - library/vendor/Zend/View/Helper/Layout.php | 2 - .../vendor/Zend/View/Helper/Navigation.php | 350 --- .../View/Helper/Navigation/Breadcrumbs.php | 331 --- .../Zend/View/Helper/Navigation/Helper.php | 212 -- .../View/Helper/Navigation/HelperAbstract.php | 976 -------- .../Zend/View/Helper/Navigation/Links.php | 783 ------ .../Zend/View/Helper/Navigation/Menu.php | 1099 --------- .../Zend/View/Helper/Navigation/Sitemap.php | 444 ---- .../Zend/View/Helper/PaginationControl.php | 3 - library/vendor/Zend/View/Helper/Partial.php | 3 - .../Zend/View/Helper/Partial/Exception.php | 1 - .../vendor/Zend/View/Helper/PartialLoop.php | 2 - .../vendor/Zend/View/Helper/Placeholder.php | 2 - .../View/Helper/Placeholder/Container.php | 1 - .../Helper/Placeholder/Container/Abstract.php | 1 - .../Placeholder/Container/Exception.php | 1 - .../Placeholder/Container/Standalone.php | 3 - .../Zend/View/Helper/Placeholder/Registry.php | 5 - .../Helper/Placeholder/Registry/Exception.php | 1 - .../Zend/View/Helper/RenderToPlaceholder.php | 1 - library/vendor/Zend/View/Helper/Translate.php | 6 - library/vendor/Zend/View/Helper/Url.php | 1 - library/vendor/Zend/View/Helper/UserAgent.php | 83 - .../Zend/Wildfire/Channel/HttpHeaders.php | 343 --- .../Zend/Wildfire/Channel/Interface.php | 38 - library/vendor/Zend/Wildfire/Exception.php | 35 - .../vendor/Zend/Wildfire/Plugin/FirePhp.php | 823 ------- .../Zend/Wildfire/Plugin/FirePhp/Message.php | 246 -- .../Wildfire/Plugin/FirePhp/TableMessage.php | 165 -- .../vendor/Zend/Wildfire/Plugin/Interface.php | 48 - .../Zend/Wildfire/Protocol/JsonStream.php | 235 -- library/vendor/Zend/Xml/Exception.php | 1 - library/vendor/Zend/Xml/Security.php | 2 - library/vendor/Zend/XmlRpc/Client.php | 403 ---- .../vendor/Zend/XmlRpc/Client/Exception.php | 40 - .../Zend/XmlRpc/Client/FaultException.php | 38 - .../Zend/XmlRpc/Client/HttpException.php | 41 - .../XmlRpc/Client/IntrospectException.php | 40 - .../XmlRpc/Client/ServerIntrospection.php | 166 -- .../vendor/Zend/XmlRpc/Client/ServerProxy.php | 95 - library/vendor/Zend/XmlRpc/Exception.php | 37 - library/vendor/Zend/XmlRpc/Fault.php | 307 --- .../Zend/XmlRpc/Generator/DomDocument.php | 101 - .../XmlRpc/Generator/GeneratorAbstract.php | 150 -- .../Zend/XmlRpc/Generator/XmlWriter.php | 93 - library/vendor/Zend/XmlRpc/Request.php | 445 ---- library/vendor/Zend/XmlRpc/Request/Http.php | 124 - library/vendor/Zend/XmlRpc/Request/Stdin.php | 84 - library/vendor/Zend/XmlRpc/Response.php | 255 -- library/vendor/Zend/XmlRpc/Response/Http.php | 51 - library/vendor/Zend/XmlRpc/Server.php | 615 ----- library/vendor/Zend/XmlRpc/Server/Cache.php | 46 - .../vendor/Zend/XmlRpc/Server/Exception.php | 42 - library/vendor/Zend/XmlRpc/Server/Fault.php | 201 -- library/vendor/Zend/XmlRpc/Server/System.php | 162 -- library/vendor/Zend/XmlRpc/Value.php | 525 ---- library/vendor/Zend/XmlRpc/Value/Array.php | 73 - library/vendor/Zend/XmlRpc/Value/Base64.php | 68 - .../vendor/Zend/XmlRpc/Value/BigInteger.php | 58 - library/vendor/Zend/XmlRpc/Value/Boolean.php | 63 - .../vendor/Zend/XmlRpc/Value/Collection.php | 73 - library/vendor/Zend/XmlRpc/Value/DateTime.php | 91 - library/vendor/Zend/XmlRpc/Value/Double.php | 62 - .../vendor/Zend/XmlRpc/Value/Exception.php | 39 - library/vendor/Zend/XmlRpc/Value/Integer.php | 65 - library/vendor/Zend/XmlRpc/Value/Nil.php | 60 - library/vendor/Zend/XmlRpc/Value/Scalar.php | 53 - library/vendor/Zend/XmlRpc/Value/String.php | 60 - library/vendor/Zend/XmlRpc/Value/Struct.php | 75 - 1039 files changed, 581 insertions(+), 174437 deletions(-) delete mode 100644 library/vendor/Zend/Acl.php delete mode 100644 library/vendor/Zend/Acl/Assert/Interface.php delete mode 100644 library/vendor/Zend/Acl/Exception.php delete mode 100644 library/vendor/Zend/Acl/Resource.php delete mode 100644 library/vendor/Zend/Acl/Resource/Interface.php delete mode 100644 library/vendor/Zend/Acl/Role.php delete mode 100644 library/vendor/Zend/Acl/Role/Interface.php delete mode 100644 library/vendor/Zend/Acl/Role/Registry.php delete mode 100644 library/vendor/Zend/Acl/Role/Registry/Exception.php delete mode 100644 library/vendor/Zend/Application.php delete mode 100644 library/vendor/Zend/Application/Bootstrap/Bootstrap.php delete mode 100644 library/vendor/Zend/Application/Bootstrap/BootstrapAbstract.php delete mode 100644 library/vendor/Zend/Application/Bootstrap/Bootstrapper.php delete mode 100644 library/vendor/Zend/Application/Bootstrap/Exception.php delete mode 100644 library/vendor/Zend/Application/Bootstrap/ResourceBootstrapper.php delete mode 100644 library/vendor/Zend/Application/Exception.php delete mode 100644 library/vendor/Zend/Application/Module/Autoloader.php delete mode 100644 library/vendor/Zend/Application/Module/Bootstrap.php delete mode 100644 library/vendor/Zend/Application/Resource/Cachemanager.php delete mode 100644 library/vendor/Zend/Application/Resource/Db.php delete mode 100644 library/vendor/Zend/Application/Resource/Dojo.php delete mode 100644 library/vendor/Zend/Application/Resource/Exception.php delete mode 100644 library/vendor/Zend/Application/Resource/Frontcontroller.php delete mode 100644 library/vendor/Zend/Application/Resource/Layout.php delete mode 100644 library/vendor/Zend/Application/Resource/Locale.php delete mode 100644 library/vendor/Zend/Application/Resource/Log.php delete mode 100644 library/vendor/Zend/Application/Resource/Mail.php delete mode 100644 library/vendor/Zend/Application/Resource/Modules.php delete mode 100644 library/vendor/Zend/Application/Resource/Multidb.php delete mode 100644 library/vendor/Zend/Application/Resource/Navigation.php delete mode 100644 library/vendor/Zend/Application/Resource/Resource.php delete mode 100644 library/vendor/Zend/Application/Resource/ResourceAbstract.php delete mode 100644 library/vendor/Zend/Application/Resource/Router.php delete mode 100644 library/vendor/Zend/Application/Resource/Session.php delete mode 100644 library/vendor/Zend/Application/Resource/Translate.php delete mode 100644 library/vendor/Zend/Application/Resource/Useragent.php delete mode 100644 library/vendor/Zend/Application/Resource/View.php delete mode 100644 library/vendor/Zend/Auth.php delete mode 100644 library/vendor/Zend/Auth/Adapter/DbTable.php delete mode 100644 library/vendor/Zend/Auth/Adapter/Digest.php delete mode 100644 library/vendor/Zend/Auth/Adapter/Exception.php delete mode 100644 library/vendor/Zend/Auth/Adapter/Http.php delete mode 100644 library/vendor/Zend/Auth/Adapter/Http/Resolver/Exception.php delete mode 100644 library/vendor/Zend/Auth/Adapter/Http/Resolver/File.php delete mode 100644 library/vendor/Zend/Auth/Adapter/Http/Resolver/Interface.php delete mode 100644 library/vendor/Zend/Auth/Adapter/Interface.php delete mode 100644 library/vendor/Zend/Auth/Adapter/Ldap.php delete mode 100644 library/vendor/Zend/Auth/Adapter/OpenId.php delete mode 100644 library/vendor/Zend/Auth/Exception.php delete mode 100644 library/vendor/Zend/Auth/Result.php delete mode 100644 library/vendor/Zend/Auth/Storage/Exception.php delete mode 100644 library/vendor/Zend/Auth/Storage/Interface.php delete mode 100644 library/vendor/Zend/Auth/Storage/NonPersistent.php delete mode 100644 library/vendor/Zend/Auth/Storage/Session.php delete mode 100644 library/vendor/Zend/Barcode.php delete mode 100644 library/vendor/Zend/Barcode/Exception.php delete mode 100644 library/vendor/Zend/Barcode/Object/Code128.php delete mode 100644 library/vendor/Zend/Barcode/Object/Code25.php delete mode 100644 library/vendor/Zend/Barcode/Object/Code25interleaved.php delete mode 100644 library/vendor/Zend/Barcode/Object/Code39.php delete mode 100644 library/vendor/Zend/Barcode/Object/Ean13.php delete mode 100644 library/vendor/Zend/Barcode/Object/Ean2.php delete mode 100644 library/vendor/Zend/Barcode/Object/Ean5.php delete mode 100644 library/vendor/Zend/Barcode/Object/Ean8.php delete mode 100644 library/vendor/Zend/Barcode/Object/Error.php delete mode 100644 library/vendor/Zend/Barcode/Object/Exception.php delete mode 100644 library/vendor/Zend/Barcode/Object/Identcode.php delete mode 100644 library/vendor/Zend/Barcode/Object/Itf14.php delete mode 100644 library/vendor/Zend/Barcode/Object/Leitcode.php delete mode 100644 library/vendor/Zend/Barcode/Object/ObjectAbstract.php delete mode 100644 library/vendor/Zend/Barcode/Object/Planet.php delete mode 100644 library/vendor/Zend/Barcode/Object/Postnet.php delete mode 100644 library/vendor/Zend/Barcode/Object/Royalmail.php delete mode 100644 library/vendor/Zend/Barcode/Object/Upca.php delete mode 100644 library/vendor/Zend/Barcode/Object/Upce.php delete mode 100644 library/vendor/Zend/Barcode/Renderer/Exception.php delete mode 100644 library/vendor/Zend/Barcode/Renderer/Image.php delete mode 100644 library/vendor/Zend/Barcode/Renderer/Pdf.php delete mode 100644 library/vendor/Zend/Barcode/Renderer/RendererAbstract.php delete mode 100644 library/vendor/Zend/Barcode/Renderer/Svg.php mode change 100644 => 100755 library/vendor/Zend/Cache/Backend/ZendServer.php mode change 100644 => 100755 library/vendor/Zend/Cache/Backend/ZendServer/Disk.php mode change 100644 => 100755 library/vendor/Zend/Cache/Backend/ZendServer/ShMem.php delete mode 100644 library/vendor/Zend/Captcha/Adapter.php delete mode 100644 library/vendor/Zend/Captcha/Base.php delete mode 100644 library/vendor/Zend/Captcha/Dumb.php delete mode 100644 library/vendor/Zend/Captcha/Exception.php delete mode 100644 library/vendor/Zend/Captcha/Figlet.php delete mode 100644 library/vendor/Zend/Captcha/Image.php delete mode 100644 library/vendor/Zend/Captcha/ReCaptcha.php delete mode 100644 library/vendor/Zend/Captcha/Word.php delete mode 100644 library/vendor/Zend/Config/Json.php delete mode 100644 library/vendor/Zend/Config/Writer/Json.php delete mode 100644 library/vendor/Zend/Config/Writer/Xml.php delete mode 100644 library/vendor/Zend/Config/Writer/Yaml.php delete mode 100644 library/vendor/Zend/Config/Xml.php delete mode 100644 library/vendor/Zend/Config/Yaml.php delete mode 100644 library/vendor/Zend/Console/Getopt.php delete mode 100644 library/vendor/Zend/Console/Getopt/Exception.php delete mode 100644 library/vendor/Zend/Controller/Action/Helper/AutoCompleteDojo.php delete mode 100644 library/vendor/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php delete mode 100644 library/vendor/Zend/Controller/Action/Helper/FlashMessenger.php delete mode 100644 library/vendor/Zend/Currency.php delete mode 100644 library/vendor/Zend/Currency/CurrencyInterface.php delete mode 100644 library/vendor/Zend/Currency/Exception.php delete mode 100644 library/vendor/Zend/Db/Profiler/Firebug.php delete mode 100644 library/vendor/Zend/Debug.php delete mode 100644 library/vendor/Zend/Dom/Exception.php delete mode 100644 library/vendor/Zend/Dom/Query.php delete mode 100644 library/vendor/Zend/Dom/Query/Css2Xpath.php delete mode 100644 library/vendor/Zend/Dom/Query/Result.php delete mode 100644 library/vendor/Zend/EventManager/Event.php delete mode 100644 library/vendor/Zend/EventManager/EventCollection.php delete mode 100644 library/vendor/Zend/EventManager/EventDescription.php delete mode 100644 library/vendor/Zend/EventManager/EventManager.php delete mode 100644 library/vendor/Zend/EventManager/EventManagerAware.php delete mode 100644 library/vendor/Zend/EventManager/Exception.php delete mode 100644 library/vendor/Zend/EventManager/Exception/InvalidArgumentException.php delete mode 100644 library/vendor/Zend/EventManager/Filter.php delete mode 100644 library/vendor/Zend/EventManager/Filter/FilterIterator.php delete mode 100644 library/vendor/Zend/EventManager/FilterChain.php delete mode 100644 library/vendor/Zend/EventManager/GlobalEventManager.php delete mode 100644 library/vendor/Zend/EventManager/ListenerAggregate.php delete mode 100644 library/vendor/Zend/EventManager/ResponseCollection.php delete mode 100644 library/vendor/Zend/EventManager/SharedEventCollection.php delete mode 100644 library/vendor/Zend/EventManager/SharedEventCollectionAware.php delete mode 100644 library/vendor/Zend/EventManager/SharedEventManager.php delete mode 100644 library/vendor/Zend/EventManager/StaticEventManager.php delete mode 100644 library/vendor/Zend/Feed.php delete mode 100644 library/vendor/Zend/Feed/Abstract.php delete mode 100644 library/vendor/Zend/Feed/Atom.php delete mode 100644 library/vendor/Zend/Feed/Builder.php delete mode 100644 library/vendor/Zend/Feed/Builder/Entry.php delete mode 100644 library/vendor/Zend/Feed/Builder/Exception.php delete mode 100644 library/vendor/Zend/Feed/Builder/Header.php delete mode 100644 library/vendor/Zend/Feed/Builder/Header/Itunes.php delete mode 100644 library/vendor/Zend/Feed/Builder/Interface.php delete mode 100644 library/vendor/Zend/Feed/Element.php delete mode 100644 library/vendor/Zend/Feed/Entry/Abstract.php delete mode 100644 library/vendor/Zend/Feed/Entry/Atom.php delete mode 100644 library/vendor/Zend/Feed/Entry/Rss.php delete mode 100644 library/vendor/Zend/Feed/Exception.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/CallbackAbstract.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/CallbackInterface.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/Exception.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/HttpResponse.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/Model/Subscription.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/Publisher.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/Subscriber.php delete mode 100644 library/vendor/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php delete mode 100644 library/vendor/Zend/Feed/Reader.php delete mode 100644 library/vendor/Zend/Feed/Reader/Collection.php delete mode 100644 library/vendor/Zend/Feed/Reader/Collection/Author.php delete mode 100644 library/vendor/Zend/Feed/Reader/Collection/Category.php delete mode 100644 library/vendor/Zend/Feed/Reader/Collection/CollectionAbstract.php delete mode 100644 library/vendor/Zend/Feed/Reader/Entry/Atom.php delete mode 100644 library/vendor/Zend/Feed/Reader/Entry/Rss.php delete mode 100644 library/vendor/Zend/Feed/Reader/EntryAbstract.php delete mode 100644 library/vendor/Zend/Feed/Reader/EntryInterface.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/Atom/Entry.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/Atom/Feed.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/Content/Entry.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/DublinCore/Entry.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/DublinCore/Feed.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/EntryAbstract.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/FeedAbstract.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/Podcast/Entry.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/Podcast/Feed.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/Slash/Entry.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/Syndication/Feed.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/Thread/Entry.php delete mode 100644 library/vendor/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php delete mode 100644 library/vendor/Zend/Feed/Reader/Feed/Atom.php delete mode 100644 library/vendor/Zend/Feed/Reader/Feed/Atom/Source.php delete mode 100644 library/vendor/Zend/Feed/Reader/Feed/Rss.php delete mode 100644 library/vendor/Zend/Feed/Reader/FeedAbstract.php delete mode 100644 library/vendor/Zend/Feed/Reader/FeedInterface.php delete mode 100644 library/vendor/Zend/Feed/Reader/FeedSet.php delete mode 100644 library/vendor/Zend/Feed/Rss.php delete mode 100644 library/vendor/Zend/Feed/Writer.php delete mode 100644 library/vendor/Zend/Feed/Writer/Deleted.php delete mode 100644 library/vendor/Zend/Feed/Writer/Entry.php delete mode 100644 library/vendor/Zend/Feed/Writer/Exception/InvalidMethodException.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/Atom/Renderer/Feed.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/Content/Renderer/Entry.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/DublinCore/Renderer/Entry.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/DublinCore/Renderer/Feed.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/ITunes/Entry.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/ITunes/Feed.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/ITunes/Renderer/Entry.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/ITunes/Renderer/Feed.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/RendererAbstract.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/RendererInterface.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/Slash/Renderer/Entry.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.php delete mode 100644 library/vendor/Zend/Feed/Writer/Extension/WellFormedWeb/Renderer/Entry.php delete mode 100644 library/vendor/Zend/Feed/Writer/Feed.php delete mode 100644 library/vendor/Zend/Feed/Writer/Feed/FeedAbstract.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/Entry/Atom.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/Entry/Rss.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/Feed/Rss.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/RendererAbstract.php delete mode 100644 library/vendor/Zend/Feed/Writer/Renderer/RendererInterface.php delete mode 100644 library/vendor/Zend/Feed/Writer/Source.php delete mode 100644 library/vendor/Zend/Form/Decorator/Captcha/ReCaptcha.php delete mode 100644 library/vendor/Zend/Form/Decorator/Captcha/Word.php delete mode 100644 library/vendor/Zend/Form/Element/Captcha.php delete mode 100644 library/vendor/Zend/Form/Element/Hash.php delete mode 100644 library/vendor/Zend/Http/Client.php delete mode 100644 library/vendor/Zend/Http/Client/Adapter/Curl.php delete mode 100644 library/vendor/Zend/Http/Client/Adapter/Exception.php delete mode 100644 library/vendor/Zend/Http/Client/Adapter/Interface.php delete mode 100644 library/vendor/Zend/Http/Client/Adapter/Proxy.php delete mode 100644 library/vendor/Zend/Http/Client/Adapter/Socket.php delete mode 100644 library/vendor/Zend/Http/Client/Adapter/Stream.php delete mode 100644 library/vendor/Zend/Http/Client/Adapter/Test.php delete mode 100644 library/vendor/Zend/Http/Client/Exception.php delete mode 100644 library/vendor/Zend/Http/Cookie.php delete mode 100644 library/vendor/Zend/Http/CookieJar.php delete mode 100644 library/vendor/Zend/Http/Exception.php delete mode 100644 library/vendor/Zend/Http/Header/Exception/InvalidArgumentException.php delete mode 100644 library/vendor/Zend/Http/Header/Exception/RuntimeException.php delete mode 100644 library/vendor/Zend/Http/Header/HeaderValue.php delete mode 100644 library/vendor/Zend/Http/Header/SetCookie.php delete mode 100644 library/vendor/Zend/Http/Response.php delete mode 100644 library/vendor/Zend/Http/Response/Stream.php delete mode 100644 library/vendor/Zend/Http/UserAgent.php delete mode 100644 library/vendor/Zend/Http/UserAgent/AbstractDevice.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Bot.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Checker.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Console.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Desktop.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Device.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Email.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Exception.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Features/Adapter.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Features/Adapter/Browscap.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Features/Exception.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Feed.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Mobile.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Offline.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Probe.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Spam.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Storage.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Storage/Exception.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Storage/NonPersistent.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Storage/Session.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Text.php delete mode 100644 library/vendor/Zend/Http/UserAgent/Validator.php delete mode 100644 library/vendor/Zend/Json/Server.php delete mode 100644 library/vendor/Zend/Json/Server/Cache.php delete mode 100644 library/vendor/Zend/Json/Server/Error.php delete mode 100644 library/vendor/Zend/Json/Server/Exception.php delete mode 100644 library/vendor/Zend/Json/Server/Request.php delete mode 100644 library/vendor/Zend/Json/Server/Request/Http.php delete mode 100644 library/vendor/Zend/Json/Server/Response.php delete mode 100644 library/vendor/Zend/Json/Server/Response/Http.php delete mode 100644 library/vendor/Zend/Json/Server/Smd.php delete mode 100644 library/vendor/Zend/Json/Server/Smd/Service.php create mode 100644 library/vendor/Zend/LICENSE.txt delete mode 100644 library/vendor/Zend/Ldap.php delete mode 100644 library/vendor/Zend/Ldap/Attribute.php delete mode 100644 library/vendor/Zend/Ldap/Collection.php delete mode 100644 library/vendor/Zend/Ldap/Collection/Iterator/Default.php delete mode 100644 library/vendor/Zend/Ldap/Converter.php delete mode 100644 library/vendor/Zend/Ldap/Converter/Exception.php delete mode 100644 library/vendor/Zend/Ldap/Dn.php delete mode 100644 library/vendor/Zend/Ldap/Exception.php delete mode 100644 library/vendor/Zend/Ldap/Filter.php delete mode 100644 library/vendor/Zend/Ldap/Filter/Abstract.php delete mode 100644 library/vendor/Zend/Ldap/Filter/And.php delete mode 100644 library/vendor/Zend/Ldap/Filter/Exception.php delete mode 100644 library/vendor/Zend/Ldap/Filter/Logical.php delete mode 100644 library/vendor/Zend/Ldap/Filter/Mask.php delete mode 100644 library/vendor/Zend/Ldap/Filter/Not.php delete mode 100644 library/vendor/Zend/Ldap/Filter/Or.php delete mode 100644 library/vendor/Zend/Ldap/Filter/String.php delete mode 100644 library/vendor/Zend/Ldap/Ldif/Encoder.php delete mode 100644 library/vendor/Zend/Ldap/Node.php delete mode 100644 library/vendor/Zend/Ldap/Node/Abstract.php delete mode 100644 library/vendor/Zend/Ldap/Node/ChildrenIterator.php delete mode 100644 library/vendor/Zend/Ldap/Node/Collection.php delete mode 100644 library/vendor/Zend/Ldap/Node/RootDse.php delete mode 100644 library/vendor/Zend/Ldap/Node/RootDse/ActiveDirectory.php delete mode 100644 library/vendor/Zend/Ldap/Node/RootDse/OpenLdap.php delete mode 100644 library/vendor/Zend/Ldap/Node/RootDse/eDirectory.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/ActiveDirectory.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/AttributeType/ActiveDirectory.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/AttributeType/Interface.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/AttributeType/OpenLdap.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/Item.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/ObjectClass/ActiveDirectory.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/ObjectClass/Interface.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/ObjectClass/OpenLdap.php delete mode 100644 library/vendor/Zend/Ldap/Node/Schema/OpenLdap.php delete mode 100644 library/vendor/Zend/Loader/Autoloader/Resource.php delete mode 100644 library/vendor/Zend/Loader/AutoloaderFactory.php delete mode 100644 library/vendor/Zend/Loader/ClassMapAutoloader.php delete mode 100644 library/vendor/Zend/Loader/SplAutoloader.php delete mode 100644 library/vendor/Zend/Loader/StandardAutoloader.php delete mode 100644 library/vendor/Zend/Log/Formatter/Firebug.php delete mode 100644 library/vendor/Zend/Log/Writer/Firebug.php delete mode 100644 library/vendor/Zend/Markup.php delete mode 100644 library/vendor/Zend/Markup/Exception.php delete mode 100644 library/vendor/Zend/Markup/Parser/Bbcode.php delete mode 100644 library/vendor/Zend/Markup/Parser/Exception.php delete mode 100644 library/vendor/Zend/Markup/Parser/ParserInterface.php delete mode 100644 library/vendor/Zend/Markup/Renderer/Exception.php delete mode 100644 library/vendor/Zend/Markup/Renderer/Html.php delete mode 100644 library/vendor/Zend/Markup/Renderer/Html/Code.php delete mode 100644 library/vendor/Zend/Markup/Renderer/Html/HtmlAbstract.php delete mode 100644 library/vendor/Zend/Markup/Renderer/Html/Img.php delete mode 100644 library/vendor/Zend/Markup/Renderer/Html/List.php delete mode 100644 library/vendor/Zend/Markup/Renderer/Html/Url.php delete mode 100644 library/vendor/Zend/Markup/Renderer/RendererAbstract.php delete mode 100644 library/vendor/Zend/Markup/Renderer/TokenConverterInterface.php delete mode 100644 library/vendor/Zend/Markup/Token.php delete mode 100644 library/vendor/Zend/Markup/TokenList.php delete mode 100644 library/vendor/Zend/Measure/Abstract.php delete mode 100644 library/vendor/Zend/Measure/Acceleration.php delete mode 100644 library/vendor/Zend/Measure/Angle.php delete mode 100644 library/vendor/Zend/Measure/Area.php delete mode 100644 library/vendor/Zend/Measure/Binary.php delete mode 100644 library/vendor/Zend/Measure/Capacitance.php delete mode 100644 library/vendor/Zend/Measure/Cooking/Volume.php delete mode 100644 library/vendor/Zend/Measure/Cooking/Weight.php delete mode 100644 library/vendor/Zend/Measure/Current.php delete mode 100644 library/vendor/Zend/Measure/Density.php delete mode 100644 library/vendor/Zend/Measure/Energy.php delete mode 100644 library/vendor/Zend/Measure/Exception.php delete mode 100644 library/vendor/Zend/Measure/Flow/Mass.php delete mode 100644 library/vendor/Zend/Measure/Flow/Mole.php delete mode 100644 library/vendor/Zend/Measure/Flow/Volume.php delete mode 100644 library/vendor/Zend/Measure/Force.php delete mode 100644 library/vendor/Zend/Measure/Frequency.php delete mode 100644 library/vendor/Zend/Measure/Illumination.php delete mode 100644 library/vendor/Zend/Measure/Length.php delete mode 100644 library/vendor/Zend/Measure/Lightness.php delete mode 100644 library/vendor/Zend/Measure/Number.php delete mode 100644 library/vendor/Zend/Measure/Power.php delete mode 100644 library/vendor/Zend/Measure/Pressure.php delete mode 100644 library/vendor/Zend/Measure/Speed.php delete mode 100644 library/vendor/Zend/Measure/Temperature.php delete mode 100644 library/vendor/Zend/Measure/Time.php delete mode 100644 library/vendor/Zend/Measure/Torque.php delete mode 100644 library/vendor/Zend/Measure/Viscosity/Dynamic.php delete mode 100644 library/vendor/Zend/Measure/Viscosity/Kinematic.php delete mode 100644 library/vendor/Zend/Measure/Volume.php delete mode 100644 library/vendor/Zend/Measure/Weight.php delete mode 100644 library/vendor/Zend/Memory.php delete mode 100644 library/vendor/Zend/Memory/AccessController.php delete mode 100644 library/vendor/Zend/Memory/Container.php delete mode 100644 library/vendor/Zend/Memory/Container/Interface.php delete mode 100644 library/vendor/Zend/Memory/Container/Locked.php delete mode 100644 library/vendor/Zend/Memory/Container/Movable.php delete mode 100644 library/vendor/Zend/Memory/Exception.php delete mode 100644 library/vendor/Zend/Memory/Manager.php delete mode 100644 library/vendor/Zend/Memory/Value.php delete mode 100644 library/vendor/Zend/Mobile/Exception.php delete mode 100644 library/vendor/Zend/Mobile/Push/Abstract.php delete mode 100644 library/vendor/Zend/Mobile/Push/Apns.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception/DeviceQuotaExceeded.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception/InvalidAuthToken.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception/InvalidPayload.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception/InvalidRegistration.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception/InvalidToken.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception/InvalidTopic.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception/QuotaExceeded.php delete mode 100644 library/vendor/Zend/Mobile/Push/Exception/ServerUnavailable.php delete mode 100644 library/vendor/Zend/Mobile/Push/Gcm.php delete mode 100644 library/vendor/Zend/Mobile/Push/Interface.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Abstract.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Apns.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Exception.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Gcm.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Interface.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Mpns.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Mpns/Raw.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Mpns/Tile.php delete mode 100644 library/vendor/Zend/Mobile/Push/Message/Mpns/Toast.php delete mode 100644 library/vendor/Zend/Mobile/Push/Mpns.php delete mode 100644 library/vendor/Zend/Mobile/Push/Response/Gcm.php delete mode 100644 library/vendor/Zend/Mobile/Push/Test/ApnsProxy.php delete mode 100644 library/vendor/Zend/Navigation.php delete mode 100644 library/vendor/Zend/Navigation/Container.php delete mode 100644 library/vendor/Zend/Navigation/Exception.php delete mode 100644 library/vendor/Zend/Navigation/Page.php delete mode 100644 library/vendor/Zend/Navigation/Page/Mvc.php delete mode 100644 library/vendor/Zend/Navigation/Page/Uri.php delete mode 100644 library/vendor/Zend/Oauth.php delete mode 100644 library/vendor/Zend/Oauth/Client.php delete mode 100644 library/vendor/Zend/Oauth/Config.php delete mode 100644 library/vendor/Zend/Oauth/Config/ConfigInterface.php delete mode 100644 library/vendor/Zend/Oauth/Consumer.php delete mode 100644 library/vendor/Zend/Oauth/Exception.php delete mode 100644 library/vendor/Zend/Oauth/Http.php delete mode 100644 library/vendor/Zend/Oauth/Http/AccessToken.php delete mode 100644 library/vendor/Zend/Oauth/Http/RequestToken.php delete mode 100644 library/vendor/Zend/Oauth/Http/UserAuthorization.php delete mode 100644 library/vendor/Zend/Oauth/Http/Utility.php delete mode 100644 library/vendor/Zend/Oauth/Signature/Hmac.php delete mode 100644 library/vendor/Zend/Oauth/Signature/Plaintext.php delete mode 100644 library/vendor/Zend/Oauth/Signature/Rsa.php delete mode 100644 library/vendor/Zend/Oauth/Signature/SignatureAbstract.php delete mode 100644 library/vendor/Zend/Oauth/Token.php delete mode 100644 library/vendor/Zend/Oauth/Token/Access.php delete mode 100644 library/vendor/Zend/Oauth/Token/AuthorizedRequest.php delete mode 100644 library/vendor/Zend/Oauth/Token/Request.php delete mode 100644 library/vendor/Zend/OpenId.php delete mode 100644 library/vendor/Zend/OpenId/Consumer.php delete mode 100644 library/vendor/Zend/OpenId/Consumer/Storage.php delete mode 100644 library/vendor/Zend/OpenId/Consumer/Storage/File.php delete mode 100644 library/vendor/Zend/OpenId/Exception.php delete mode 100644 library/vendor/Zend/OpenId/Extension.php delete mode 100644 library/vendor/Zend/OpenId/Extension/Sreg.php delete mode 100644 library/vendor/Zend/OpenId/Provider.php delete mode 100644 library/vendor/Zend/OpenId/Provider/Storage.php delete mode 100644 library/vendor/Zend/OpenId/Provider/Storage/File.php delete mode 100644 library/vendor/Zend/OpenId/Provider/User.php delete mode 100644 library/vendor/Zend/OpenId/Provider/User/Session.php delete mode 100644 library/vendor/Zend/ProgressBar/Adapter/Console.php delete mode 100644 library/vendor/Zend/Queue.php delete mode 100644 library/vendor/Zend/Queue/Adapter/Activemq.php delete mode 100644 library/vendor/Zend/Queue/Adapter/AdapterAbstract.php delete mode 100644 library/vendor/Zend/Queue/Adapter/AdapterInterface.php delete mode 100644 library/vendor/Zend/Queue/Adapter/Array.php delete mode 100644 library/vendor/Zend/Queue/Adapter/Db.php delete mode 100644 library/vendor/Zend/Queue/Adapter/Db/Message.php delete mode 100644 library/vendor/Zend/Queue/Adapter/Db/Queue.php delete mode 100644 library/vendor/Zend/Queue/Adapter/Db/mysql.sql delete mode 100644 library/vendor/Zend/Queue/Adapter/Db/postgresql.sql delete mode 100644 library/vendor/Zend/Queue/Adapter/Db/queue_sqlite.sql delete mode 100644 library/vendor/Zend/Queue/Adapter/Db/sqlsrv.sql delete mode 100644 library/vendor/Zend/Queue/Adapter/Memcacheq.php delete mode 100644 library/vendor/Zend/Queue/Adapter/Null.php delete mode 100644 library/vendor/Zend/Queue/Adapter/PlatformJobQueue.php delete mode 100644 library/vendor/Zend/Queue/Exception.php delete mode 100644 library/vendor/Zend/Queue/Message.php delete mode 100644 library/vendor/Zend/Queue/Message/Iterator.php delete mode 100644 library/vendor/Zend/Queue/Message/PlatformJob.php delete mode 100644 library/vendor/Zend/Queue/Stomp/Client.php delete mode 100644 library/vendor/Zend/Queue/Stomp/Client/Connection.php delete mode 100644 library/vendor/Zend/Queue/Stomp/Client/ConnectionInterface.php delete mode 100644 library/vendor/Zend/Queue/Stomp/Frame.php delete mode 100644 library/vendor/Zend/Queue/Stomp/FrameInterface.php create mode 100644 library/vendor/Zend/README.md delete mode 100644 library/vendor/Zend/Reflection/Class.php delete mode 100644 library/vendor/Zend/Reflection/Docblock.php delete mode 100644 library/vendor/Zend/Reflection/Docblock/Tag.php delete mode 100644 library/vendor/Zend/Reflection/Docblock/Tag/Param.php delete mode 100644 library/vendor/Zend/Reflection/Docblock/Tag/Return.php delete mode 100644 library/vendor/Zend/Reflection/Exception.php delete mode 100644 library/vendor/Zend/Reflection/Extension.php delete mode 100644 library/vendor/Zend/Reflection/File.php delete mode 100644 library/vendor/Zend/Reflection/Function.php delete mode 100644 library/vendor/Zend/Reflection/Method.php delete mode 100644 library/vendor/Zend/Reflection/Parameter.php delete mode 100644 library/vendor/Zend/Reflection/Property.php delete mode 100644 library/vendor/Zend/Rest/Client.php delete mode 100644 library/vendor/Zend/Rest/Client/Exception.php delete mode 100644 library/vendor/Zend/Rest/Client/Result.php delete mode 100644 library/vendor/Zend/Rest/Client/Result/Exception.php delete mode 100644 library/vendor/Zend/Rest/Controller.php delete mode 100644 library/vendor/Zend/Rest/Exception.php delete mode 100644 library/vendor/Zend/Rest/Route.php delete mode 100644 library/vendor/Zend/Rest/Server.php delete mode 100644 library/vendor/Zend/Rest/Server/Exception.php delete mode 100644 library/vendor/Zend/SOURCE delete mode 100644 library/vendor/Zend/Search/Exception.php delete mode 100644 library/vendor/Zend/Search/Lucene.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/Token.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/TokenFilter.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/LowerCase.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php delete mode 100644 library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php delete mode 100644 library/vendor/Zend/Search/Lucene/Document.php delete mode 100644 library/vendor/Zend/Search/Lucene/Document/Docx.php delete mode 100644 library/vendor/Zend/Search/Lucene/Document/Exception.php delete mode 100644 library/vendor/Zend/Search/Lucene/Document/Html.php delete mode 100644 library/vendor/Zend/Search/Lucene/Document/OpenXml.php delete mode 100644 library/vendor/Zend/Search/Lucene/Document/Pptx.php delete mode 100644 library/vendor/Zend/Search/Lucene/Document/Xlsx.php delete mode 100644 library/vendor/Zend/Search/Lucene/Exception.php delete mode 100644 library/vendor/Zend/Search/Lucene/FSM.php delete mode 100644 library/vendor/Zend/Search/Lucene/FSMAction.php delete mode 100644 library/vendor/Zend/Search/Lucene/Field.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/DictionaryLoader.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/DocsFilter.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/FieldInfo.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/SegmentInfo.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/SegmentMerger.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/SegmentWriter.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/Term.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/TermInfo.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/TermsPriorityQueue.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/TermsStream/Interface.php delete mode 100644 library/vendor/Zend/Search/Lucene/Index/Writer.php delete mode 100644 library/vendor/Zend/Search/Lucene/Interface.php delete mode 100644 library/vendor/Zend/Search/Lucene/Interface/MultiSearcher.php delete mode 100644 library/vendor/Zend/Search/Lucene/LockManager.php delete mode 100644 library/vendor/Zend/Search/Lucene/MultiSearcher.php delete mode 100644 library/vendor/Zend/Search/Lucene/PriorityQueue.php delete mode 100644 library/vendor/Zend/Search/Lucene/Proxy.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Highlighter/Default.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Highlighter/Interface.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Boolean.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Empty.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Fuzzy.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Insignificant.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/MultiTerm.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Phrase.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Fuzzy.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Phrase.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Term.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Range.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Term.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Query/Wildcard.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryEntry.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryEntry/Phrase.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryEntry/Subquery.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryEntry/Term.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryHit.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryLexer.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryParser.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryParserContext.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryParserException.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/QueryToken.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Similarity.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Similarity/Default.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Weight.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Weight/Boolean.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Weight/Empty.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Weight/MultiTerm.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Weight/Phrase.php delete mode 100644 library/vendor/Zend/Search/Lucene/Search/Weight/Term.php delete mode 100644 library/vendor/Zend/Search/Lucene/Storage/Directory.php delete mode 100644 library/vendor/Zend/Search/Lucene/Storage/Directory/Filesystem.php delete mode 100644 library/vendor/Zend/Search/Lucene/Storage/File.php delete mode 100644 library/vendor/Zend/Search/Lucene/Storage/File/Filesystem.php delete mode 100644 library/vendor/Zend/Search/Lucene/Storage/File/Memory.php delete mode 100644 library/vendor/Zend/Search/Lucene/TermStreamsPriorityQueue.php delete mode 100644 library/vendor/Zend/Serializer.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/AdapterAbstract.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/AdapterInterface.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/Amf0.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/Amf3.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/Igbinary.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/Json.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/PhpCode.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/PhpSerialize.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/PythonPickle.php delete mode 100644 library/vendor/Zend/Serializer/Adapter/Wddx.php delete mode 100644 library/vendor/Zend/Serializer/Exception.php delete mode 100644 library/vendor/Zend/Stdlib/CallbackHandler.php delete mode 100644 library/vendor/Zend/Stdlib/Exception.php delete mode 100644 library/vendor/Zend/Stdlib/Exception/InvalidCallbackException.php delete mode 100644 library/vendor/Zend/Stdlib/PriorityQueue.php delete mode 100644 library/vendor/Zend/Stdlib/SplPriorityQueue.php delete mode 100644 library/vendor/Zend/Tag/Cloud.php delete mode 100644 library/vendor/Zend/Tag/Cloud/Decorator/Cloud.php delete mode 100644 library/vendor/Zend/Tag/Cloud/Decorator/Exception.php delete mode 100644 library/vendor/Zend/Tag/Cloud/Decorator/HtmlCloud.php delete mode 100644 library/vendor/Zend/Tag/Cloud/Decorator/HtmlTag.php delete mode 100644 library/vendor/Zend/Tag/Cloud/Decorator/Tag.php delete mode 100644 library/vendor/Zend/Tag/Cloud/Exception.php delete mode 100644 library/vendor/Zend/Tag/Exception.php delete mode 100644 library/vendor/Zend/Tag/Item.php delete mode 100644 library/vendor/Zend/Tag/ItemList.php delete mode 100644 library/vendor/Zend/Tag/Taggable.php delete mode 100644 library/vendor/Zend/Test/DbAdapter.php delete mode 100644 library/vendor/Zend/Test/DbStatement.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery34.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery37.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery41.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/Exception.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/Redirect.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/Redirect34.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/Redirect37.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/Redirect41.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader34.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader37.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/ControllerTestCase.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/DatabaseTestCase.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/Connection.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbRowset.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbTable.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbTableDataSet.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/DataSet/QueryDataSet.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/DataSet/QueryTable.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/Exception.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/Metadata/Generic.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/Operation/DeleteAll.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/Operation/Insert.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/Operation/Truncate.php delete mode 100644 library/vendor/Zend/Test/PHPUnit/Db/SimpleTester.php delete mode 100644 library/vendor/Zend/Text/Exception.php delete mode 100644 library/vendor/Zend/Text/Figlet.php delete mode 100644 library/vendor/Zend/Text/Figlet/Exception.php delete mode 100644 library/vendor/Zend/Text/Figlet/zend-framework.flf delete mode 100644 library/vendor/Zend/Text/MultiByte.php delete mode 100644 library/vendor/Zend/Text/Table.php delete mode 100644 library/vendor/Zend/Text/Table/Column.php delete mode 100644 library/vendor/Zend/Text/Table/Decorator/Ascii.php delete mode 100644 library/vendor/Zend/Text/Table/Decorator/Interface.php delete mode 100644 library/vendor/Zend/Text/Table/Decorator/Unicode.php delete mode 100644 library/vendor/Zend/Text/Table/Exception.php delete mode 100644 library/vendor/Zend/Text/Table/Row.php delete mode 100644 library/vendor/Zend/Tool/Framework/Action/Base.php delete mode 100644 library/vendor/Zend/Tool/Framework/Action/Exception.php delete mode 100644 library/vendor/Zend/Tool/Framework/Action/Interface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Action/Repository.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Abstract.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Config.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Console.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Console/ArgumentParser.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Console/HelpSystem.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Console/Manifest.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/AlignCenter.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/Blockize.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/Colorizer.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/Indention.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Exception.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Interactive/InputHandler.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Interactive/InputInterface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Interactive/InputRequest.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Interactive/InputResponse.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Interactive/OutputInterface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Manifest.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Request.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Response.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Response/ContentDecorator/Interface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Response/ContentDecorator/Separator.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Storage.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Storage/AdapterInterface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Client/Storage/Directory.php delete mode 100644 library/vendor/Zend/Tool/Framework/Exception.php delete mode 100644 library/vendor/Zend/Tool/Framework/Loader/Abstract.php delete mode 100644 library/vendor/Zend/Tool/Framework/Loader/BasicLoader.php delete mode 100644 library/vendor/Zend/Tool/Framework/Loader/IncludePathLoader.php delete mode 100644 library/vendor/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php delete mode 100644 library/vendor/Zend/Tool/Framework/Loader/Interface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/ActionManifestable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/ActionMetadata.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/Exception.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/Indexable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/Interface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/Metadata.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/MetadataManifestable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/ProviderManifestable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/ProviderMetadata.php delete mode 100644 library/vendor/Zend/Tool/Framework/Manifest/Repository.php delete mode 100644 library/vendor/Zend/Tool/Framework/Metadata/Attributable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Metadata/Basic.php delete mode 100644 library/vendor/Zend/Tool/Framework/Metadata/Dynamic.php delete mode 100644 library/vendor/Zend/Tool/Framework/Metadata/Interface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Metadata/Tool.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/Abstract.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/DocblockManifestable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/Exception.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/Initializable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/Interactable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/Interface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/Pretendable.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/Repository.php delete mode 100644 library/vendor/Zend/Tool/Framework/Provider/Signature.php delete mode 100644 library/vendor/Zend/Tool/Framework/Registry.php delete mode 100644 library/vendor/Zend/Tool/Framework/Registry/EnabledInterface.php delete mode 100644 library/vendor/Zend/Tool/Framework/Registry/Exception.php delete mode 100644 library/vendor/Zend/Tool/Framework/Registry/Interface.php delete mode 100644 library/vendor/Zend/Tool/Framework/System/Action/Create.php delete mode 100644 library/vendor/Zend/Tool/Framework/System/Action/Delete.php delete mode 100644 library/vendor/Zend/Tool/Framework/System/Manifest.php delete mode 100644 library/vendor/Zend/Tool/Framework/System/Provider/Config.php delete mode 100644 library/vendor/Zend/Tool/Framework/System/Provider/Manifest.php delete mode 100644 library/vendor/Zend/Tool/Framework/System/Provider/Phpinfo.php delete mode 100644 library/vendor/Zend/Tool/Framework/System/Provider/Version.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Content/Engine.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Content/Engine/Phtml.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Exception.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Filesystem/Abstract.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Filesystem/Directory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Filesystem/File.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Interface.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Repository.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/System/Interface.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/System/NotOverwritable.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/System/ProjectDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/System/ProjectProfileFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/System/ProjectProvidersDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/System/TopLevelRestrictable.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/AbstractClassFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ActionMethod.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ApisDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ApplicationConfigFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ApplicationDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/BootstrapFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/CacheDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ConfigFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ConfigsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ControllerFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ControllersDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/DataDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/DbTableDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/DbTableFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/DocsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/FormFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/FormsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/HtaccessFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/LayoutScriptFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/LayoutScriptsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/LayoutsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/LibraryDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/LocalesDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/LogsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ModelFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ModelsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ModuleDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ModulesDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ProjectProviderFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/PublicDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/PublicImagesDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/PublicIndexFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/PublicScriptsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/PublicStylesheetsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/SearchIndexesDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ServicesDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/SessionsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TemporaryDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationActionMethod.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationBootstrapFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationControllerDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationControllerFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationModuleDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationModulesDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestLibraryBootstrapFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestLibraryDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestLibraryFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestLibraryNamespaceDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestPHPUnitBootstrapFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestPHPUnitConfigFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/TestsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/UploadsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ViewControllerScriptsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ViewFiltersDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ViewHelpersDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ViewScriptFile.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ViewScriptsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ViewsDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Context/Zf/ZfStandardLibraryDirectory.php delete mode 100644 library/vendor/Zend/Tool/Project/Exception.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile/Exception.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile/FileParser/Interface.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile/FileParser/Xml.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile/Iterator/ContextFilter.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile/Resource.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile/Resource/Container.php delete mode 100644 library/vendor/Zend/Tool/Project/Profile/Resource/SearchConstraints.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Abstract.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Action.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Application.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Controller.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/DbAdapter.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/DbTable.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Exception.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Form.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Layout.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Manifest.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Model.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Module.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Profile.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Project.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/ProjectProvider.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/Test.php delete mode 100644 library/vendor/Zend/Tool/Project/Provider/View.php delete mode 100644 library/vendor/Zend/Translate/Adapter/Array.php delete mode 100644 library/vendor/Zend/Translate/Adapter/Csv.php delete mode 100644 library/vendor/Zend/Translate/Adapter/Gettext.php delete mode 100644 library/vendor/Zend/Translate/Adapter/Ini.php delete mode 100644 library/vendor/Zend/Translate/Adapter/Qt.php delete mode 100644 library/vendor/Zend/Translate/Adapter/Tbx.php delete mode 100644 library/vendor/Zend/Translate/Adapter/Tmx.php delete mode 100644 library/vendor/Zend/Translate/Adapter/Xliff.php delete mode 100644 library/vendor/Zend/Translate/Adapter/XmlTm.php create mode 100644 library/vendor/Zend/VERSION delete mode 100644 library/vendor/Zend/Validate/Ldap/Dn.php delete mode 100644 library/vendor/Zend/Version.php delete mode 100644 library/vendor/Zend/View/Helper/Currency.php delete mode 100644 library/vendor/Zend/View/Helper/Navigation.php delete mode 100644 library/vendor/Zend/View/Helper/Navigation/Breadcrumbs.php delete mode 100644 library/vendor/Zend/View/Helper/Navigation/Helper.php delete mode 100644 library/vendor/Zend/View/Helper/Navigation/HelperAbstract.php delete mode 100644 library/vendor/Zend/View/Helper/Navigation/Links.php delete mode 100644 library/vendor/Zend/View/Helper/Navigation/Menu.php delete mode 100644 library/vendor/Zend/View/Helper/Navigation/Sitemap.php delete mode 100644 library/vendor/Zend/View/Helper/UserAgent.php delete mode 100644 library/vendor/Zend/Wildfire/Channel/HttpHeaders.php delete mode 100644 library/vendor/Zend/Wildfire/Channel/Interface.php delete mode 100644 library/vendor/Zend/Wildfire/Exception.php delete mode 100644 library/vendor/Zend/Wildfire/Plugin/FirePhp.php delete mode 100644 library/vendor/Zend/Wildfire/Plugin/FirePhp/Message.php delete mode 100644 library/vendor/Zend/Wildfire/Plugin/FirePhp/TableMessage.php delete mode 100644 library/vendor/Zend/Wildfire/Plugin/Interface.php delete mode 100644 library/vendor/Zend/Wildfire/Protocol/JsonStream.php delete mode 100644 library/vendor/Zend/XmlRpc/Client.php delete mode 100644 library/vendor/Zend/XmlRpc/Client/Exception.php delete mode 100644 library/vendor/Zend/XmlRpc/Client/FaultException.php delete mode 100644 library/vendor/Zend/XmlRpc/Client/HttpException.php delete mode 100644 library/vendor/Zend/XmlRpc/Client/IntrospectException.php delete mode 100644 library/vendor/Zend/XmlRpc/Client/ServerIntrospection.php delete mode 100644 library/vendor/Zend/XmlRpc/Client/ServerProxy.php delete mode 100644 library/vendor/Zend/XmlRpc/Exception.php delete mode 100644 library/vendor/Zend/XmlRpc/Fault.php delete mode 100644 library/vendor/Zend/XmlRpc/Generator/DomDocument.php delete mode 100644 library/vendor/Zend/XmlRpc/Generator/GeneratorAbstract.php delete mode 100644 library/vendor/Zend/XmlRpc/Generator/XmlWriter.php delete mode 100644 library/vendor/Zend/XmlRpc/Request.php delete mode 100644 library/vendor/Zend/XmlRpc/Request/Http.php delete mode 100644 library/vendor/Zend/XmlRpc/Request/Stdin.php delete mode 100644 library/vendor/Zend/XmlRpc/Response.php delete mode 100644 library/vendor/Zend/XmlRpc/Response/Http.php delete mode 100644 library/vendor/Zend/XmlRpc/Server.php delete mode 100644 library/vendor/Zend/XmlRpc/Server/Cache.php delete mode 100644 library/vendor/Zend/XmlRpc/Server/Exception.php delete mode 100644 library/vendor/Zend/XmlRpc/Server/Fault.php delete mode 100644 library/vendor/Zend/XmlRpc/Server/System.php delete mode 100644 library/vendor/Zend/XmlRpc/Value.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Array.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Base64.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/BigInteger.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Boolean.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Collection.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/DateTime.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Double.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Exception.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Integer.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Nil.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Scalar.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/String.php delete mode 100644 library/vendor/Zend/XmlRpc/Value/Struct.php diff --git a/icingaweb2.spec b/icingaweb2.spec index b6d49b73a..3096aaf47 100644 --- a/icingaweb2.spec +++ b/icingaweb2.spec @@ -19,13 +19,11 @@ Packager: Icinga Team %define php_cli php-cli %define wwwconfigdir %{_sysconfdir}/httpd/conf.d %define wwwuser apache -%define zend php-ZendFramework %endif %if 0%{?suse_version} %define wwwconfigdir %{_sysconfdir}/apache2/conf.d %define wwwuser wwwrun -%define zend %{name}-vendor-Zend %if 0%{?suse_version} == 1110 %define php php53 Requires: apache2-mod_php53 @@ -78,14 +76,11 @@ Summary: Icinga Web 2 PHP library Group: Development/Libraries Requires: %{php} >= 5.3.0 Requires: %{php}-gd %{php}-intl +Requires: %{name}-vendor-zf1 = 1.12.20-1%{?dist} %{?amzn:Requires: %{php}-pecl-imagick} %{?fedora:Requires: php-pecl-imagick} %{?rhel:Requires: php-pecl-imagick} %{?suse_version:Requires: %{php}-gettext %{php}-json %{php}-openssl %{php}-posix} -Requires: %{zend} -%{?amzn:Requires: %{zend}-Db-Adapter-Pdo-Mysql %{zend}-Db-Adapter-Pdo-Pgsql} -%{?fedora:Requires: %{zend}-Db-Adapter-Pdo-Mysql %{zend}-Db-Adapter-Pdo-Pgsql} -%{?rhel:Requires: %{zend}-Db-Adapter-Pdo-Mysql %{zend}-Db-Adapter-Pdo-Pgsql} %description -n php-Icinga Icinga Web 2 PHP library @@ -165,16 +160,17 @@ Requires: %{php} >= 5.3.0 Icinga Web 2 vendor library Parsedown -%package vendor-Zend -Version: 1.12.15 +%package vendor-zf1 +Version: 1.12.20 Release: 1%{?dist} -Summary: Icinga Web 2 vendor library Zend Framework +Summary: Icinga Web 2's fork of Zend Framework 1 Group: Development/Libraries License: BSD Requires: %{php} >= 5.3.0 +Obsoletes: %{name}-vendor-Zend -%description vendor-Zend -Icinga Web 2 vendor library Zend +%description vendor-zf1 +Icinga Web 2's fork of Zend Framework 1 %prep @@ -281,6 +277,6 @@ exit 0 %{basedir}/library/vendor/Parsedown -%files vendor-Zend +%files vendor-zf1 %defattr(-,root,root) %{basedir}/library/vendor/Zend diff --git a/library/vendor/Zend/Acl.php b/library/vendor/Zend/Acl.php deleted file mode 100644 index 4cc608da3..000000000 --- a/library/vendor/Zend/Acl.php +++ /dev/null @@ -1,1224 +0,0 @@ - array( - 'allRoles' => array( - 'allPrivileges' => array( - 'type' => self::TYPE_DENY, - 'assert' => null - ), - 'byPrivilegeId' => array() - ), - 'byRoleId' => array() - ), - 'byResourceId' => array() - ); - - /** - * Adds a Role having an identifier unique to the registry - * - * The $parents parameter may be a reference to, or the string identifier for, - * a Role existing in the registry, or $parents may be passed as an array of - * these - mixing string identifiers and objects is ok - to indicate the Roles - * from which the newly added Role will directly inherit. - * - * In order to resolve potential ambiguities with conflicting rules inherited - * from different parents, the most recently added parent takes precedence over - * parents that were previously added. In other words, the first parent added - * will have the least priority, and the last parent added will have the - * highest priority. - * - * @param Zend_Acl_Role_Interface|string $role - * @param Zend_Acl_Role_Interface|string|array $parents - * @uses Zend_Acl_Role_Registry::add() - * @return Zend_Acl Provides a fluent interface - */ - public function addRole($role, $parents = null) - { - if (is_string($role)) { - $role = new Zend_Acl_Role($role); - } - - if (!$role instanceof Zend_Acl_Role_Interface) { - throw new Zend_Acl_Exception('addRole() expects $role to be of type Zend_Acl_Role_Interface'); - } - - - $this->_getRoleRegistry()->add($role, $parents); - - return $this; - } - - /** - * Returns the identified Role - * - * The $role parameter can either be a Role or Role identifier. - * - * @param Zend_Acl_Role_Interface|string $role - * @uses Zend_Acl_Role_Registry::get() - * @return Zend_Acl_Role_Interface - */ - public function getRole($role) - { - return $this->_getRoleRegistry()->get($role); - } - - /** - * Returns true if and only if the Role exists in the registry - * - * The $role parameter can either be a Role or a Role identifier. - * - * @param Zend_Acl_Role_Interface|string $role - * @uses Zend_Acl_Role_Registry::has() - * @return boolean - */ - public function hasRole($role) - { - return $this->_getRoleRegistry()->has($role); - } - - /** - * Returns true if and only if $role inherits from $inherit - * - * Both parameters may be either a Role or a Role identifier. If - * $onlyParents is true, then $role must inherit directly from - * $inherit in order to return true. By default, this method looks - * through the entire inheritance DAG to determine whether $role - * inherits from $inherit through its ancestor Roles. - * - * @param Zend_Acl_Role_Interface|string $role - * @param Zend_Acl_Role_Interface|string $inherit - * @param boolean $onlyParents - * @uses Zend_Acl_Role_Registry::inherits() - * @return boolean - */ - public function inheritsRole($role, $inherit, $onlyParents = false) - { - return $this->_getRoleRegistry()->inherits($role, $inherit, $onlyParents); - } - - /** - * Removes the Role from the registry - * - * The $role parameter can either be a Role or a Role identifier. - * - * @param Zend_Acl_Role_Interface|string $role - * @uses Zend_Acl_Role_Registry::remove() - * @return Zend_Acl Provides a fluent interface - */ - public function removeRole($role) - { - $this->_getRoleRegistry()->remove($role); - - if ($role instanceof Zend_Acl_Role_Interface) { - $roleId = $role->getRoleId(); - } else { - $roleId = $role; - } - - foreach ($this->_rules['allResources']['byRoleId'] as $roleIdCurrent => $rules) { - if ($roleId === $roleIdCurrent) { - unset($this->_rules['allResources']['byRoleId'][$roleIdCurrent]); - } - } - foreach ($this->_rules['byResourceId'] as $resourceIdCurrent => $visitor) { - if (array_key_exists('byRoleId', $visitor)) { - foreach ($visitor['byRoleId'] as $roleIdCurrent => $rules) { - if ($roleId === $roleIdCurrent) { - unset($this->_rules['byResourceId'][$resourceIdCurrent]['byRoleId'][$roleIdCurrent]); - } - } - } - } - - return $this; - } - - /** - * Removes all Roles from the registry - * - * @uses Zend_Acl_Role_Registry::removeAll() - * @return Zend_Acl Provides a fluent interface - */ - public function removeRoleAll() - { - $this->_getRoleRegistry()->removeAll(); - - foreach ($this->_rules['allResources']['byRoleId'] as $roleIdCurrent => $rules) { - unset($this->_rules['allResources']['byRoleId'][$roleIdCurrent]); - } - foreach ($this->_rules['byResourceId'] as $resourceIdCurrent => $visitor) { - foreach ($visitor['byRoleId'] as $roleIdCurrent => $rules) { - unset($this->_rules['byResourceId'][$resourceIdCurrent]['byRoleId'][$roleIdCurrent]); - } - } - - return $this; - } - - /** - * Adds a Resource having an identifier unique to the ACL - * - * The $parent parameter may be a reference to, or the string identifier for, - * the existing Resource from which the newly added Resource will inherit. - * - * @param Zend_Acl_Resource_Interface|string $resource - * @param Zend_Acl_Resource_Interface|string $parent - * @throws Zend_Acl_Exception - * @return Zend_Acl Provides a fluent interface - */ - public function addResource($resource, $parent = null) - { - if (is_string($resource)) { - $resource = new Zend_Acl_Resource($resource); - } - - if (!$resource instanceof Zend_Acl_Resource_Interface) { - throw new Zend_Acl_Exception('addResource() expects $resource to be of type Zend_Acl_Resource_Interface'); - } - - $resourceId = $resource->getResourceId(); - - if ($this->has($resourceId)) { - throw new Zend_Acl_Exception("Resource id '$resourceId' already exists in the ACL"); - } - - $resourceParent = null; - - if (null !== $parent) { - try { - if ($parent instanceof Zend_Acl_Resource_Interface) { - $resourceParentId = $parent->getResourceId(); - } else { - $resourceParentId = $parent; - } - $resourceParent = $this->get($resourceParentId); - } catch (Zend_Acl_Exception $e) { - throw new Zend_Acl_Exception("Parent Resource id '$resourceParentId' does not exist", 0, $e); - } - $this->_resources[$resourceParentId]['children'][$resourceId] = $resource; - } - - $this->_resources[$resourceId] = array( - 'instance' => $resource, - 'parent' => $resourceParent, - 'children' => array() - ); - - return $this; - } - - /** - * Adds a Resource having an identifier unique to the ACL - * - * The $parent parameter may be a reference to, or the string identifier for, - * the existing Resource from which the newly added Resource will inherit. - * - * @deprecated in version 1.9.1 and will be available till 2.0. New code - * should use addResource() instead. - * - * @param Zend_Acl_Resource_Interface $resource - * @param Zend_Acl_Resource_Interface|string $parent - * @throws Zend_Acl_Exception - * @return Zend_Acl Provides a fluent interface - */ - public function add(Zend_Acl_Resource_Interface $resource, $parent = null) - { - return $this->addResource($resource, $parent); - } - - /** - * Returns the identified Resource - * - * The $resource parameter can either be a Resource or a Resource identifier. - * - * @param Zend_Acl_Resource_Interface|string $resource - * @throws Zend_Acl_Exception - * @return Zend_Acl_Resource_Interface - */ - public function get($resource) - { - if ($resource instanceof Zend_Acl_Resource_Interface) { - $resourceId = $resource->getResourceId(); - } else { - $resourceId = (string) $resource; - } - - if (!$this->has($resource)) { - throw new Zend_Acl_Exception("Resource '$resourceId' not found"); - } - - return $this->_resources[$resourceId]['instance']; - } - - /** - * Returns true if and only if the Resource exists in the ACL - * - * The $resource parameter can either be a Resource or a Resource identifier. - * - * @param Zend_Acl_Resource_Interface|string $resource - * @return boolean - */ - public function has($resource) - { - if ($resource instanceof Zend_Acl_Resource_Interface) { - $resourceId = $resource->getResourceId(); - } else { - $resourceId = (string) $resource; - } - - return isset($this->_resources[$resourceId]); - } - - /** - * Returns true if and only if $resource inherits from $inherit - * - * Both parameters may be either a Resource or a Resource identifier. If - * $onlyParent is true, then $resource must inherit directly from - * $inherit in order to return true. By default, this method looks - * through the entire inheritance tree to determine whether $resource - * inherits from $inherit through its ancestor Resources. - * - * @param Zend_Acl_Resource_Interface|string $resource - * @param Zend_Acl_Resource_Interface|string $inherit - * @param boolean $onlyParent - * @throws Zend_Acl_Resource_Registry_Exception - * @return boolean - */ - public function inherits($resource, $inherit, $onlyParent = false) - { - try { - $resourceId = $this->get($resource)->getResourceId(); - $inheritId = $this->get($inherit)->getResourceId(); - } catch (Zend_Acl_Exception $e) { - throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e); - } - - if (null !== $this->_resources[$resourceId]['parent']) { - $parentId = $this->_resources[$resourceId]['parent']->getResourceId(); - if ($inheritId === $parentId) { - return true; - } else if ($onlyParent) { - return false; - } - } else { - return false; - } - - while (null !== $this->_resources[$parentId]['parent']) { - $parentId = $this->_resources[$parentId]['parent']->getResourceId(); - if ($inheritId === $parentId) { - return true; - } - } - - return false; - } - - /** - * Removes a Resource and all of its children - * - * The $resource parameter can either be a Resource or a Resource identifier. - * - * @param Zend_Acl_Resource_Interface|string $resource - * @throws Zend_Acl_Exception - * @return Zend_Acl Provides a fluent interface - */ - public function remove($resource) - { - try { - $resourceId = $this->get($resource)->getResourceId(); - } catch (Zend_Acl_Exception $e) { - throw new Zend_Acl_Exception($e->getMessage(), $e->getCode(), $e); - } - - $resourcesRemoved = array($resourceId); - if (null !== ($resourceParent = $this->_resources[$resourceId]['parent'])) { - unset($this->_resources[$resourceParent->getResourceId()]['children'][$resourceId]); - } - foreach ($this->_resources[$resourceId]['children'] as $childId => $child) { - $this->remove($childId); - $resourcesRemoved[] = $childId; - } - - foreach ($resourcesRemoved as $resourceIdRemoved) { - foreach ($this->_rules['byResourceId'] as $resourceIdCurrent => $rules) { - if ($resourceIdRemoved === $resourceIdCurrent) { - unset($this->_rules['byResourceId'][$resourceIdCurrent]); - } - } - } - - unset($this->_resources[$resourceId]); - - return $this; - } - - /** - * Removes all Resources - * - * @return Zend_Acl Provides a fluent interface - */ - public function removeAll() - { - foreach ($this->_resources as $resourceId => $resource) { - foreach ($this->_rules['byResourceId'] as $resourceIdCurrent => $rules) { - if ($resourceId === $resourceIdCurrent) { - unset($this->_rules['byResourceId'][$resourceIdCurrent]); - } - } - } - - $this->_resources = array(); - - return $this; - } - - /** - * Adds an "allow" rule to the ACL - * - * @param Zend_Acl_Role_Interface|string|array $roles - * @param Zend_Acl_Resource_Interface|string|array $resources - * @param string|array $privileges - * @param Zend_Acl_Assert_Interface $assert - * @uses Zend_Acl::setRule() - * @return Zend_Acl Provides a fluent interface - */ - public function allow($roles = null, $resources = null, $privileges = null, Zend_Acl_Assert_Interface $assert = null) - { - return $this->setRule(self::OP_ADD, self::TYPE_ALLOW, $roles, $resources, $privileges, $assert); - } - - /** - * Adds a "deny" rule to the ACL - * - * @param Zend_Acl_Role_Interface|string|array $roles - * @param Zend_Acl_Resource_Interface|string|array $resources - * @param string|array $privileges - * @param Zend_Acl_Assert_Interface $assert - * @uses Zend_Acl::setRule() - * @return Zend_Acl Provides a fluent interface - */ - public function deny($roles = null, $resources = null, $privileges = null, Zend_Acl_Assert_Interface $assert = null) - { - return $this->setRule(self::OP_ADD, self::TYPE_DENY, $roles, $resources, $privileges, $assert); - } - - /** - * Removes "allow" permissions from the ACL - * - * @param Zend_Acl_Role_Interface|string|array $roles - * @param Zend_Acl_Resource_Interface|string|array $resources - * @param string|array $privileges - * @uses Zend_Acl::setRule() - * @return Zend_Acl Provides a fluent interface - */ - public function removeAllow($roles = null, $resources = null, $privileges = null) - { - return $this->setRule(self::OP_REMOVE, self::TYPE_ALLOW, $roles, $resources, $privileges); - } - - /** - * Removes "deny" restrictions from the ACL - * - * @param Zend_Acl_Role_Interface|string|array $roles - * @param Zend_Acl_Resource_Interface|string|array $resources - * @param string|array $privileges - * @uses Zend_Acl::setRule() - * @return Zend_Acl Provides a fluent interface - */ - public function removeDeny($roles = null, $resources = null, $privileges = null) - { - return $this->setRule(self::OP_REMOVE, self::TYPE_DENY, $roles, $resources, $privileges); - } - - /** - * Performs operations on ACL rules - * - * The $operation parameter may be either OP_ADD or OP_REMOVE, depending on whether the - * user wants to add or remove a rule, respectively: - * - * OP_ADD specifics: - * - * A rule is added that would allow one or more Roles access to [certain $privileges - * upon] the specified Resource(s). - * - * OP_REMOVE specifics: - * - * The rule is removed only in the context of the given Roles, Resources, and privileges. - * Existing rules to which the remove operation does not apply would remain in the - * ACL. - * - * The $type parameter may be either TYPE_ALLOW or TYPE_DENY, depending on whether the - * rule is intended to allow or deny permission, respectively. - * - * The $roles and $resources parameters may be references to, or the string identifiers for, - * existing Resources/Roles, or they may be passed as arrays of these - mixing string identifiers - * and objects is ok - to indicate the Resources and Roles to which the rule applies. If either - * $roles or $resources is null, then the rule applies to all Roles or all Resources, respectively. - * Both may be null in order to work with the default rule of the ACL. - * - * The $privileges parameter may be used to further specify that the rule applies only - * to certain privileges upon the Resource(s) in question. This may be specified to be a single - * privilege with a string, and multiple privileges may be specified as an array of strings. - * - * If $assert is provided, then its assert() method must return true in order for - * the rule to apply. If $assert is provided with $roles, $resources, and $privileges all - * equal to null, then a rule having a type of: - * - * TYPE_ALLOW will imply a type of TYPE_DENY, and - * - * TYPE_DENY will imply a type of TYPE_ALLOW - * - * when the rule's assertion fails. This is because the ACL needs to provide expected - * behavior when an assertion upon the default ACL rule fails. - * - * @param string $operation - * @param string $type - * @param Zend_Acl_Role_Interface|string|array $roles - * @param Zend_Acl_Resource_Interface|string|array $resources - * @param string|array $privileges - * @param Zend_Acl_Assert_Interface $assert - * @throws Zend_Acl_Exception - * @uses Zend_Acl_Role_Registry::get() - * @uses Zend_Acl::get() - * @return Zend_Acl Provides a fluent interface - */ - public function setRule($operation, $type, $roles = null, $resources = null, $privileges = null, - Zend_Acl_Assert_Interface $assert = null) - { - // ensure that the rule type is valid; normalize input to uppercase - $type = strtoupper($type); - if (self::TYPE_ALLOW !== $type && self::TYPE_DENY !== $type) { - throw new Zend_Acl_Exception("Unsupported rule type; must be either '" . self::TYPE_ALLOW . "' or '" - . self::TYPE_DENY . "'"); - } - - // ensure that all specified Roles exist; normalize input to array of Role objects or null - if (!is_array($roles)) { - $roles = array($roles); - } else if (0 === count($roles)) { - $roles = array(null); - } - $rolesTemp = $roles; - $roles = array(); - foreach ($rolesTemp as $role) { - if (null !== $role) { - $roles[] = $this->_getRoleRegistry()->get($role); - } else { - $roles[] = null; - } - } - unset($rolesTemp); - - // ensure that all specified Resources exist; normalize input to array of Resource objects or null - if ($resources !== null) { - if (!is_array($resources)) { - $resources = array($resources); - } else if (0 === count($resources)) { - $resources = array(null); - } - $resourcesTemp = $resources; - $resources = array(); - foreach ($resourcesTemp as $resource) { - if (null !== $resource) { - $resources[] = $this->get($resource); - } else { - $resources[] = null; - } - } - unset($resourcesTemp, $resource); - } else { - $allResources = array(); // this might be used later if resource iteration is required - foreach ($this->_resources as $rTarget) { - $allResources[] = $rTarget['instance']; - } - unset($rTarget); - } - - // normalize privileges to array - if (null === $privileges) { - $privileges = array(); - } else if (!is_array($privileges)) { - $privileges = array($privileges); - } - - switch ($operation) { - - // add to the rules - case self::OP_ADD: - if ($resources !== null) { - // this block will iterate the provided resources - foreach ($resources as $resource) { - foreach ($roles as $role) { - $rules =& $this->_getRules($resource, $role, true); - if (0 === count($privileges)) { - $rules['allPrivileges']['type'] = $type; - $rules['allPrivileges']['assert'] = $assert; - if (!isset($rules['byPrivilegeId'])) { - $rules['byPrivilegeId'] = array(); - } - } else { - foreach ($privileges as $privilege) { - $rules['byPrivilegeId'][$privilege]['type'] = $type; - $rules['byPrivilegeId'][$privilege]['assert'] = $assert; - } - } - } - } - } else { - // this block will apply to all resources in a global rule - foreach ($roles as $role) { - $rules =& $this->_getRules(null, $role, true); - if (0 === count($privileges)) { - $rules['allPrivileges']['type'] = $type; - $rules['allPrivileges']['assert'] = $assert; - } else { - foreach ($privileges as $privilege) { - $rules['byPrivilegeId'][$privilege]['type'] = $type; - $rules['byPrivilegeId'][$privilege]['assert'] = $assert; - } - } - } - } - break; - - // remove from the rules - case self::OP_REMOVE: - if ($resources !== null) { - // this block will iterate the provided resources - foreach ($resources as $resource) { - foreach ($roles as $role) { - $rules =& $this->_getRules($resource, $role); - if (null === $rules) { - continue; - } - if (0 === count($privileges)) { - if (null === $resource && null === $role) { - if ($type === $rules['allPrivileges']['type']) { - $rules = array( - 'allPrivileges' => array( - 'type' => self::TYPE_DENY, - 'assert' => null - ), - 'byPrivilegeId' => array() - ); - } - continue; - } - - if (isset($rules['allPrivileges']['type']) && - $type === $rules['allPrivileges']['type']) - { - unset($rules['allPrivileges']); - } - } else { - foreach ($privileges as $privilege) { - if (isset($rules['byPrivilegeId'][$privilege]) && - $type === $rules['byPrivilegeId'][$privilege]['type']) - { - unset($rules['byPrivilegeId'][$privilege]); - } - } - } - } - } - } else { - // this block will apply to all resources in a global rule - foreach ($roles as $role) { - /** - * since null (all resources) was passed to this setRule() call, we need - * clean up all the rules for the global allResources, as well as the indivually - * set resources (per privilege as well) - */ - foreach (array_merge(array(null), $allResources) as $resource) { - $rules =& $this->_getRules($resource, $role, true); - if (null === $rules) { - continue; - } - if (0 === count($privileges)) { - if (null === $role) { - if ($type === $rules['allPrivileges']['type']) { - $rules = array( - 'allPrivileges' => array( - 'type' => self::TYPE_DENY, - 'assert' => null - ), - 'byPrivilegeId' => array() - ); - } - continue; - } - - if (isset($rules['allPrivileges']['type']) && $type === $rules['allPrivileges']['type']) { - unset($rules['allPrivileges']); - } - } else { - foreach ($privileges as $privilege) { - if (isset($rules['byPrivilegeId'][$privilege]) && - $type === $rules['byPrivilegeId'][$privilege]['type']) - { - unset($rules['byPrivilegeId'][$privilege]); - } - } - } - } - } - } - break; - - default: - throw new Zend_Acl_Exception("Unsupported operation; must be either '" . self::OP_ADD . "' or '" - . self::OP_REMOVE . "'"); - } - - return $this; - } - - /** - * Returns true if and only if the Role has access to the Resource - * - * The $role and $resource parameters may be references to, or the string identifiers for, - * an existing Resource and Role combination. - * - * If either $role or $resource is null, then the query applies to all Roles or all Resources, - * respectively. Both may be null to query whether the ACL has a "blacklist" rule - * (allow everything to all). By default, Zend_Acl creates a "whitelist" rule (deny - * everything to all), and this method would return false unless this default has - * been overridden (i.e., by executing $acl->allow()). - * - * If a $privilege is not provided, then this method returns false if and only if the - * Role is denied access to at least one privilege upon the Resource. In other words, this - * method returns true if and only if the Role is allowed all privileges on the Resource. - * - * This method checks Role inheritance using a depth-first traversal of the Role registry. - * The highest priority parent (i.e., the parent most recently added) is checked first, - * and its respective parents are checked similarly before the lower-priority parents of - * the Role are checked. - * - * @param Zend_Acl_Role_Interface|string $role - * @param Zend_Acl_Resource_Interface|string $resource - * @param string $privilege - * @uses Zend_Acl::get() - * @uses Zend_Acl_Role_Registry::get() - * @return boolean - */ - public function isAllowed($role = null, $resource = null, $privilege = null) - { - // reset role & resource to null - $this->_isAllowedRole = null; - $this->_isAllowedResource = null; - $this->_isAllowedPrivilege = null; - - if (null !== $role) { - // keep track of originally called role - $this->_isAllowedRole = $role; - $role = $this->_getRoleRegistry()->get($role); - if (!$this->_isAllowedRole instanceof Zend_Acl_Role_Interface) { - $this->_isAllowedRole = $role; - } - } - - if (null !== $resource) { - // keep track of originally called resource - $this->_isAllowedResource = $resource; - $resource = $this->get($resource); - if (!$this->_isAllowedResource instanceof Zend_Acl_Resource_Interface) { - $this->_isAllowedResource = $resource; - } - } - - if (null === $privilege) { - // query on all privileges - do { - // depth-first search on $role if it is not 'allRoles' pseudo-parent - if (null !== $role && null !== ($result = $this->_roleDFSAllPrivileges($role, $resource, $privilege))) { - return $result; - } - - // look for rule on 'allRoles' psuedo-parent - if (null !== ($rules = $this->_getRules($resource, null))) { - foreach ($rules['byPrivilegeId'] as $privilege => $rule) { - if (self::TYPE_DENY === ($ruleTypeOnePrivilege = $this->_getRuleType($resource, null, $privilege))) { - return false; - } - } - if (null !== ($ruleTypeAllPrivileges = $this->_getRuleType($resource, null, null))) { - return self::TYPE_ALLOW === $ruleTypeAllPrivileges; - } - } - - // try next Resource - $resource = $this->_resources[$resource->getResourceId()]['parent']; - - } while (true); // loop terminates at 'allResources' pseudo-parent - } else { - $this->_isAllowedPrivilege = $privilege; - // query on one privilege - do { - // depth-first search on $role if it is not 'allRoles' pseudo-parent - if (null !== $role && null !== ($result = $this->_roleDFSOnePrivilege($role, $resource, $privilege))) { - return $result; - } - - // look for rule on 'allRoles' pseudo-parent - if (null !== ($ruleType = $this->_getRuleType($resource, null, $privilege))) { - return self::TYPE_ALLOW === $ruleType; - } else if (null !== ($ruleTypeAllPrivileges = $this->_getRuleType($resource, null, null))) { - return self::TYPE_ALLOW === $ruleTypeAllPrivileges; - } - - // try next Resource - $resource = $this->_resources[$resource->getResourceId()]['parent']; - - } while (true); // loop terminates at 'allResources' pseudo-parent - } - } - - /** - * Returns the Role registry for this ACL - * - * If no Role registry has been created yet, a new default Role registry - * is created and returned. - * - * @return Zend_Acl_Role_Registry - */ - protected function _getRoleRegistry() - { - if (null === $this->_roleRegistry) { - $this->_roleRegistry = new Zend_Acl_Role_Registry(); - } - return $this->_roleRegistry; - } - - /** - * Performs a depth-first search of the Role DAG, starting at $role, in order to find a rule - * allowing/denying $role access to all privileges upon $resource - * - * This method returns true if a rule is found and allows access. If a rule exists and denies access, - * then this method returns false. If no applicable rule is found, then this method returns null. - * - * @param Zend_Acl_Role_Interface $role - * @param Zend_Acl_Resource_Interface $resource - * @return boolean|null - */ - protected function _roleDFSAllPrivileges(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null) - { - $dfs = array( - 'visited' => array(), - 'stack' => array() - ); - - if (null !== ($result = $this->_roleDFSVisitAllPrivileges($role, $resource, $dfs))) { - return $result; - } - - while (null !== ($role = array_pop($dfs['stack']))) { - if (!isset($dfs['visited'][$role->getRoleId()])) { - if (null !== ($result = $this->_roleDFSVisitAllPrivileges($role, $resource, $dfs))) { - return $result; - } - } - } - - return null; - } - - /** - * Visits an $role in order to look for a rule allowing/denying $role access to all privileges upon $resource - * - * This method returns true if a rule is found and allows access. If a rule exists and denies access, - * then this method returns false. If no applicable rule is found, then this method returns null. - * - * This method is used by the internal depth-first search algorithm and may modify the DFS data structure. - * - * @param Zend_Acl_Role_Interface $role - * @param Zend_Acl_Resource_Interface $resource - * @param array $dfs - * @return boolean|null - * @throws Zend_Acl_Exception - */ - protected function _roleDFSVisitAllPrivileges(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null, - &$dfs = null) - { - if (null === $dfs) { - /** - * @see Zend_Acl_Exception - */ - throw new Zend_Acl_Exception('$dfs parameter may not be null'); - } - - if (null !== ($rules = $this->_getRules($resource, $role))) { - foreach ($rules['byPrivilegeId'] as $privilege => $rule) { - if (self::TYPE_DENY === ($ruleTypeOnePrivilege = $this->_getRuleType($resource, $role, $privilege))) { - return false; - } - } - if (null !== ($ruleTypeAllPrivileges = $this->_getRuleType($resource, $role, null))) { - return self::TYPE_ALLOW === $ruleTypeAllPrivileges; - } - } - - $dfs['visited'][$role->getRoleId()] = true; - foreach ($this->_getRoleRegistry()->getParents($role) as $roleParentId => $roleParent) { - $dfs['stack'][] = $roleParent; - } - - return null; - } - - /** - * Performs a depth-first search of the Role DAG, starting at $role, in order to find a rule - * allowing/denying $role access to a $privilege upon $resource - * - * This method returns true if a rule is found and allows access. If a rule exists and denies access, - * then this method returns false. If no applicable rule is found, then this method returns null. - * - * @param Zend_Acl_Role_Interface $role - * @param Zend_Acl_Resource_Interface $resource - * @param string $privilege - * @return boolean|null - * @throws Zend_Acl_Exception - */ - protected function _roleDFSOnePrivilege(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null, - $privilege = null) - { - if (null === $privilege) { - /** - * @see Zend_Acl_Exception - */ - throw new Zend_Acl_Exception('$privilege parameter may not be null'); - } - - $dfs = array( - 'visited' => array(), - 'stack' => array() - ); - - if (null !== ($result = $this->_roleDFSVisitOnePrivilege($role, $resource, $privilege, $dfs))) { - return $result; - } - - while (null !== ($role = array_pop($dfs['stack']))) { - if (!isset($dfs['visited'][$role->getRoleId()])) { - if (null !== ($result = $this->_roleDFSVisitOnePrivilege($role, $resource, $privilege, $dfs))) { - return $result; - } - } - } - - return null; - } - - /** - * Visits an $role in order to look for a rule allowing/denying $role access to a $privilege upon $resource - * - * This method returns true if a rule is found and allows access. If a rule exists and denies access, - * then this method returns false. If no applicable rule is found, then this method returns null. - * - * This method is used by the internal depth-first search algorithm and may modify the DFS data structure. - * - * @param Zend_Acl_Role_Interface $role - * @param Zend_Acl_Resource_Interface $resource - * @param string $privilege - * @param array $dfs - * @return boolean|null - * @throws Zend_Acl_Exception - */ - protected function _roleDFSVisitOnePrivilege(Zend_Acl_Role_Interface $role, Zend_Acl_Resource_Interface $resource = null, - $privilege = null, &$dfs = null) - { - if (null === $privilege) { - /** - * @see Zend_Acl_Exception - */ - throw new Zend_Acl_Exception('$privilege parameter may not be null'); - } - - if (null === $dfs) { - /** - * @see Zend_Acl_Exception - */ - throw new Zend_Acl_Exception('$dfs parameter may not be null'); - } - - if (null !== ($ruleTypeOnePrivilege = $this->_getRuleType($resource, $role, $privilege))) { - return self::TYPE_ALLOW === $ruleTypeOnePrivilege; - } else if (null !== ($ruleTypeAllPrivileges = $this->_getRuleType($resource, $role, null))) { - return self::TYPE_ALLOW === $ruleTypeAllPrivileges; - } - - $dfs['visited'][$role->getRoleId()] = true; - foreach ($this->_getRoleRegistry()->getParents($role) as $roleParentId => $roleParent) { - $dfs['stack'][] = $roleParent; - } - - return null; - } - - /** - * Returns the rule type associated with the specified Resource, Role, and privilege - * combination. - * - * If a rule does not exist or its attached assertion fails, which means that - * the rule is not applicable, then this method returns null. Otherwise, the - * rule type applies and is returned as either TYPE_ALLOW or TYPE_DENY. - * - * If $resource or $role is null, then this means that the rule must apply to - * all Resources or Roles, respectively. - * - * If $privilege is null, then the rule must apply to all privileges. - * - * If all three parameters are null, then the default ACL rule type is returned, - * based on whether its assertion method passes. - * - * @param Zend_Acl_Resource_Interface $resource - * @param Zend_Acl_Role_Interface $role - * @param string $privilege - * @return string|null - */ - protected function _getRuleType(Zend_Acl_Resource_Interface $resource = null, Zend_Acl_Role_Interface $role = null, - $privilege = null) - { - // get the rules for the $resource and $role - if (null === ($rules = $this->_getRules($resource, $role))) { - return null; - } - - // follow $privilege - if (null === $privilege) { - if (isset($rules['allPrivileges'])) { - $rule = $rules['allPrivileges']; - } else { - return null; - } - } else if (!isset($rules['byPrivilegeId'][$privilege])) { - return null; - } else { - $rule = $rules['byPrivilegeId'][$privilege]; - } - - // check assertion first - if ($rule['assert']) { - $assertion = $rule['assert']; - $assertionValue = $assertion->assert( - $this, - ($this->_isAllowedRole instanceof Zend_Acl_Role_Interface) ? $this->_isAllowedRole : $role, - ($this->_isAllowedResource instanceof Zend_Acl_Resource_Interface) ? $this->_isAllowedResource : $resource, - $this->_isAllowedPrivilege - ); - } - - if (null === $rule['assert'] || $assertionValue) { - return $rule['type']; - } else if (null !== $resource || null !== $role || null !== $privilege) { - return null; - } else if (self::TYPE_ALLOW === $rule['type']) { - return self::TYPE_DENY; - } else { - return self::TYPE_ALLOW; - } - } - - /** - * Returns the rules associated with a Resource and a Role, or null if no such rules exist - * - * If either $resource or $role is null, this means that the rules returned are for all Resources or all Roles, - * respectively. Both can be null to return the default rule set for all Resources and all Roles. - * - * If the $create parameter is true, then a rule set is first created and then returned to the caller. - * - * @param Zend_Acl_Resource_Interface $resource - * @param Zend_Acl_Role_Interface $role - * @param boolean $create - * @return array|null - */ - protected function &_getRules(Zend_Acl_Resource_Interface $resource = null, Zend_Acl_Role_Interface $role = null, - $create = false) - { - // create a reference to null - $null = null; - $nullRef =& $null; - - // follow $resource - do { - if (null === $resource) { - $visitor =& $this->_rules['allResources']; - break; - } - $resourceId = $resource->getResourceId(); - if (!isset($this->_rules['byResourceId'][$resourceId])) { - if (!$create) { - return $nullRef; - } - $this->_rules['byResourceId'][$resourceId] = array(); - } - $visitor =& $this->_rules['byResourceId'][$resourceId]; - } while (false); - - - // follow $role - if (null === $role) { - if (!isset($visitor['allRoles'])) { - if (!$create) { - return $nullRef; - } - $visitor['allRoles']['byPrivilegeId'] = array(); - } - return $visitor['allRoles']; - } - $roleId = $role->getRoleId(); - if (!isset($visitor['byRoleId'][$roleId])) { - if (!$create) { - return $nullRef; - } - $visitor['byRoleId'][$roleId]['byPrivilegeId'] = array(); - $visitor['byRoleId'][$roleId]['allPrivileges'] = array('type' => null, 'assert' => null); - } - return $visitor['byRoleId'][$roleId]; - } - - - /** - * @return array of registered roles (Deprecated) - * @deprecated Deprecated since version 1.10 (December 2009) - */ - public function getRegisteredRoles() - { - trigger_error('The method getRegisteredRoles() was deprecated as of ' - . 'version 1.0, and may be removed. You\'re encouraged ' - . 'to use getRoles() instead.'); - - return $this->_getRoleRegistry()->getRoles(); - } - - /** - * Returns an array of registered roles. - * - * Note that this method does not return instances of registered roles, - * but only the role identifiers. - * - * @return array of registered roles - */ - public function getRoles() - { - return array_keys($this->_getRoleRegistry()->getRoles()); - } - - /** - * @return array of registered resources - */ - public function getResources() - { - return array_keys($this->_resources); - } - -} - diff --git a/library/vendor/Zend/Acl/Assert/Interface.php b/library/vendor/Zend/Acl/Assert/Interface.php deleted file mode 100644 index 35ce9a510..000000000 --- a/library/vendor/Zend/Acl/Assert/Interface.php +++ /dev/null @@ -1,61 +0,0 @@ -_resourceId = (string) $resourceId; - } - - /** - * Defined by Zend_Acl_Resource_Interface; returns the Resource identifier - * - * @return string - */ - public function getResourceId() - { - return $this->_resourceId; - } - - /** - * Defined by Zend_Acl_Resource_Interface; returns the Resource identifier - * Proxies to getResourceId() - * - * @return string - */ - public function __toString() - { - return $this->getResourceId(); - } -} diff --git a/library/vendor/Zend/Acl/Resource/Interface.php b/library/vendor/Zend/Acl/Resource/Interface.php deleted file mode 100644 index dcf10586d..000000000 --- a/library/vendor/Zend/Acl/Resource/Interface.php +++ /dev/null @@ -1,37 +0,0 @@ -_roleId = (string) $roleId; - } - - /** - * Defined by Zend_Acl_Role_Interface; returns the Role identifier - * - * @return string - */ - public function getRoleId() - { - return $this->_roleId; - } - - /** - * Defined by Zend_Acl_Role_Interface; returns the Role identifier - * Proxies to getRoleId() - * - * @return string - */ - public function __toString() - { - return $this->getRoleId(); - } -} diff --git a/library/vendor/Zend/Acl/Role/Interface.php b/library/vendor/Zend/Acl/Role/Interface.php deleted file mode 100644 index e2510003c..000000000 --- a/library/vendor/Zend/Acl/Role/Interface.php +++ /dev/null @@ -1,37 +0,0 @@ -getRoleId(); - - if ($this->has($roleId)) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - throw new Zend_Acl_Role_Registry_Exception("Role id '$roleId' already exists in the registry"); - } - - $roleParents = array(); - - if (null !== $parents) { - if (!is_array($parents)) { - $parents = array($parents); - } - /** - * @see Zend_Acl_Role_Registry_Exception - */ - foreach ($parents as $parent) { - try { - if ($parent instanceof Zend_Acl_Role_Interface) { - $roleParentId = $parent->getRoleId(); - } else { - $roleParentId = $parent; - } - $roleParent = $this->get($roleParentId); - } catch (Zend_Acl_Role_Registry_Exception $e) { - throw new Zend_Acl_Role_Registry_Exception("Parent Role id '$roleParentId' does not exist", 0, $e); - } - $roleParents[$roleParentId] = $roleParent; - $this->_roles[$roleParentId]['children'][$roleId] = $role; - } - } - - $this->_roles[$roleId] = array( - 'instance' => $role, - 'parents' => $roleParents, - 'children' => array() - ); - - return $this; - } - - /** - * Returns the identified Role - * - * The $role parameter can either be a Role or a Role identifier. - * - * @param Zend_Acl_Role_Interface|string $role - * @throws Zend_Acl_Role_Registry_Exception - * @return Zend_Acl_Role_Interface - */ - public function get($role) - { - if ($role instanceof Zend_Acl_Role_Interface) { - $roleId = $role->getRoleId(); - } else { - $roleId = (string) $role; - } - - if (!$this->has($role)) { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - throw new Zend_Acl_Role_Registry_Exception("Role '$roleId' not found"); - } - - return $this->_roles[$roleId]['instance']; - } - - /** - * Returns true if and only if the Role exists in the registry - * - * The $role parameter can either be a Role or a Role identifier. - * - * @param Zend_Acl_Role_Interface|string $role - * @return boolean - */ - public function has($role) - { - if ($role instanceof Zend_Acl_Role_Interface) { - $roleId = $role->getRoleId(); - } else { - $roleId = (string) $role; - } - - return isset($this->_roles[$roleId]); - } - - /** - * Returns an array of an existing Role's parents - * - * The array keys are the identifiers of the parent Roles, and the values are - * the parent Role instances. The parent Roles are ordered in this array by - * ascending priority. The highest priority parent Role, last in the array, - * corresponds with the parent Role most recently added. - * - * If the Role does not have any parents, then an empty array is returned. - * - * @param Zend_Acl_Role_Interface|string $role - * @uses Zend_Acl_Role_Registry::get() - * @return array - */ - public function getParents($role) - { - $roleId = $this->get($role)->getRoleId(); - - return $this->_roles[$roleId]['parents']; - } - - /** - * Returns true if and only if $role inherits from $inherit - * - * Both parameters may be either a Role or a Role identifier. If - * $onlyParents is true, then $role must inherit directly from - * $inherit in order to return true. By default, this method looks - * through the entire inheritance DAG to determine whether $role - * inherits from $inherit through its ancestor Roles. - * - * @param Zend_Acl_Role_Interface|string $role - * @param Zend_Acl_Role_Interface|string $inherit - * @param boolean $onlyParents - * @throws Zend_Acl_Role_Registry_Exception - * @return boolean - */ - public function inherits($role, $inherit, $onlyParents = false) - { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - try { - $roleId = $this->get($role)->getRoleId(); - $inheritId = $this->get($inherit)->getRoleId(); - } catch (Zend_Acl_Role_Registry_Exception $e) { - throw new Zend_Acl_Role_Registry_Exception($e->getMessage(), $e->getCode(), $e); - } - - $inherits = isset($this->_roles[$roleId]['parents'][$inheritId]); - - if ($inherits || $onlyParents) { - return $inherits; - } - - foreach ($this->_roles[$roleId]['parents'] as $parentId => $parent) { - if ($this->inherits($parentId, $inheritId)) { - return true; - } - } - - return false; - } - - /** - * Removes the Role from the registry - * - * The $role parameter can either be a Role or a Role identifier. - * - * @param Zend_Acl_Role_Interface|string $role - * @throws Zend_Acl_Role_Registry_Exception - * @return Zend_Acl_Role_Registry Provides a fluent interface - */ - public function remove($role) - { - /** - * @see Zend_Acl_Role_Registry_Exception - */ - try { - $roleId = $this->get($role)->getRoleId(); - } catch (Zend_Acl_Role_Registry_Exception $e) { - throw new Zend_Acl_Role_Registry_Exception($e->getMessage(), $e->getCode(), $e); - } - - foreach ($this->_roles[$roleId]['children'] as $childId => $child) { - unset($this->_roles[$childId]['parents'][$roleId]); - } - foreach ($this->_roles[$roleId]['parents'] as $parentId => $parent) { - unset($this->_roles[$parentId]['children'][$roleId]); - } - - unset($this->_roles[$roleId]); - - return $this; - } - - /** - * Removes all Roles from the registry - * - * @return Zend_Acl_Role_Registry Provides a fluent interface - */ - public function removeAll() - { - $this->_roles = array(); - - return $this; - } - - public function getRoles() - { - return $this->_roles; - } - -} diff --git a/library/vendor/Zend/Acl/Role/Registry/Exception.php b/library/vendor/Zend/Acl/Role/Registry/Exception.php deleted file mode 100644 index 972d65410..000000000 --- a/library/vendor/Zend/Acl/Role/Registry/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ -_environment = (string) $environment; - - $this->_autoloader = Zend_Loader_Autoloader::getInstance(); - $this->_autoloader->suppressNotFoundWarnings($suppressNotFoundWarnings); - - if (null !== $options) { - if (is_string($options)) { - $options = $this->_loadConfig($options); - } elseif ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (!is_array($options)) { - throw new Zend_Application_Exception( - 'Invalid options provided; must be location of config file,' - . ' a config object, or an array' - ); - } - - $this->setOptions($options); - } - } - - /** - * Retrieve current environment - * - * @return string - */ - public function getEnvironment() - { - return $this->_environment; - } - - /** - * Retrieve autoloader instance - * - * @return Zend_Loader_Autoloader - */ - public function getAutoloader() - { - return $this->_autoloader; - } - - /** - * Set application options - * - * @param array $options - * @throws Zend_Application_Exception When no bootstrap path is provided - * @throws Zend_Application_Exception When invalid bootstrap information are provided - * @return Zend_Application - */ - public function setOptions(array $options) - { - if (!empty($options['config'])) { - if (is_array($options['config'])) { - $_options = array(); - foreach ($options['config'] as $tmp) { - $_options = $this->mergeOptions( - $_options, $this->_loadConfig($tmp) - ); - } - $options = $this->mergeOptions($_options, $options); - } else { - $options = $this->mergeOptions( - $this->_loadConfig($options['config']), $options - ); - } - } - - $this->_options = $options; - - $options = array_change_key_case($options, CASE_LOWER); - - $this->_optionKeys = array_keys($options); - - if (!empty($options['phpsettings'])) { - $this->setPhpSettings($options['phpsettings']); - } - - if (!empty($options['includepaths'])) { - $this->setIncludePaths($options['includepaths']); - } - - if (!empty($options['autoloadernamespaces'])) { - $this->setAutoloaderNamespaces($options['autoloadernamespaces']); - } - - if (!empty($options['autoloaderzfpath'])) { - $autoloader = $this->getAutoloader(); - if (method_exists($autoloader, 'setZfPath')) { - $zfPath = $options['autoloaderzfpath']; - $zfVersion = !empty($options['autoloaderzfversion']) - ? $options['autoloaderzfversion'] - : 'latest'; - $autoloader->setZfPath($zfPath, $zfVersion); - } - } - - if (!empty($options['bootstrap'])) { - $bootstrap = $options['bootstrap']; - - if (is_string($bootstrap)) { - $this->setBootstrap($bootstrap); - } elseif (is_array($bootstrap)) { - if (empty($bootstrap['path'])) { - throw new Zend_Application_Exception( - 'No bootstrap path provided' - ); - } - - $path = $bootstrap['path']; - $class = null; - - if (!empty($bootstrap['class'])) { - $class = $bootstrap['class']; - } - - $this->setBootstrap($path, $class); - } else { - throw new Zend_Application_Exception( - 'Invalid bootstrap information provided' - ); - } - } - - return $this; - } - - /** - * Retrieve application options (for caching) - * - * @return array - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Is an option present? - * - * @param string $key - * @return bool - */ - public function hasOption($key) - { - return in_array(strtolower($key), $this->_optionKeys); - } - - /** - * Retrieve a single option - * - * @param string $key - * @return mixed - */ - public function getOption($key) - { - if ($this->hasOption($key)) { - $options = $this->getOptions(); - $options = array_change_key_case($options, CASE_LOWER); - return $options[strtolower($key)]; - } - return null; - } - - /** - * Merge options recursively - * - * @param array $array1 - * @param mixed $array2 - * @return array - */ - public function mergeOptions(array $array1, $array2 = null) - { - if (is_array($array2)) { - foreach ($array2 as $key => $val) { - if (is_array($array2[$key])) { - $array1[$key] = (array_key_exists($key, $array1) && is_array($array1[$key])) - ? $this->mergeOptions($array1[$key], $array2[$key]) - : $array2[$key]; - } else { - $array1[$key] = $val; - } - } - } - return $array1; - } - - /** - * Set PHP configuration settings - * - * @param array $settings - * @param string $prefix Key prefix to prepend to array values (used to map . separated INI values) - * @return Zend_Application - */ - public function setPhpSettings(array $settings, $prefix = '') - { - foreach ($settings as $key => $value) { - $key = empty($prefix) ? $key : $prefix . $key; - if (is_scalar($value)) { - ini_set($key, $value); - } elseif (is_array($value)) { - $this->setPhpSettings($value, $key . '.'); - } - } - - return $this; - } - - /** - * Set include path - * - * @param array $paths - * @return Zend_Application - */ - public function setIncludePaths(array $paths) - { - $path = implode(PATH_SEPARATOR, $paths); - set_include_path($path . PATH_SEPARATOR . get_include_path()); - return $this; - } - - /** - * Set autoloader namespaces - * - * @param array $namespaces - * @return Zend_Application - */ - public function setAutoloaderNamespaces(array $namespaces) - { - $autoloader = $this->getAutoloader(); - - foreach ($namespaces as $namespace) { - $autoloader->registerNamespace($namespace); - } - - return $this; - } - - /** - * Set bootstrap path/class - * - * @param string $path - * @param string $class - * @return Zend_Application - */ - public function setBootstrap($path, $class = null) - { - // setOptions() can potentially send a null value; specify default - // here - if (null === $class) { - $class = 'Bootstrap'; - } - - if (!class_exists($class, false)) { - if (!class_exists($class, false)) { - throw new Zend_Application_Exception( - 'Bootstrap class not found' - ); - } - } - $this->_bootstrap = new $class($this); - - if (!$this->_bootstrap instanceof Zend_Application_Bootstrap_Bootstrapper) { - throw new Zend_Application_Exception( - 'Bootstrap class does not implement' - . ' Zend_Application_Bootstrap_Bootstrapper' - ); - } - - return $this; - } - - /** - * Get bootstrap object - * - * @return Zend_Application_Bootstrap_BootstrapAbstract - */ - public function getBootstrap() - { - if (null === $this->_bootstrap) { - $this->_bootstrap = new Zend_Application_Bootstrap_Bootstrap($this); - } - return $this->_bootstrap; - } - - /** - * Bootstrap application - * - * @param null|string|array $resource - * @return Zend_Application - */ - public function bootstrap($resource = null) - { - $this->getBootstrap()->bootstrap($resource); - return $this; - } - - /** - * Run the application - * - * @return void - */ - public function run() - { - $this->getBootstrap()->run(); - } - - /** - * Load configuration file of options - * - * @param string $file - * @throws Zend_Application_Exception When invalid configuration file is provided - * @return array - */ - protected function _loadConfig($file) - { - $environment = $this->getEnvironment(); - $suffix = pathinfo($file, PATHINFO_EXTENSION); - $suffix = ($suffix === 'dist') - ? pathinfo(basename($file, ".$suffix"), PATHINFO_EXTENSION) - : $suffix; - - switch (strtolower($suffix)) { - case 'ini': - $config = new Zend_Config_Ini($file, $environment); - break; - - case 'xml': - $config = new Zend_Config_Xml($file, $environment); - break; - - case 'json': - $config = new Zend_Config_Json($file, $environment); - break; - - case 'yaml': - case 'yml': - $config = new Zend_Config_Yaml($file, $environment); - break; - - case 'php': - case 'inc': - $config = include $file; - if (!is_array($config)) { - throw new Zend_Application_Exception( - 'Invalid configuration file provided; PHP file does not' - . ' return array value' - ); - } - return $config; - break; - - default: - throw new Zend_Application_Exception( - 'Invalid configuration file provided; unknown config type' - ); - } - - return $config->toArray(); - } -} diff --git a/library/vendor/Zend/Application/Bootstrap/Bootstrap.php b/library/vendor/Zend/Application/Bootstrap/Bootstrap.php deleted file mode 100644 index ffab23d9c..000000000 --- a/library/vendor/Zend/Application/Bootstrap/Bootstrap.php +++ /dev/null @@ -1,167 +0,0 @@ -hasOption('resourceloader')) { - $this->setOptions( - array( - 'resourceloader' => $application->getOption( - 'resourceloader' - ) - ) - ); - } - $this->getResourceLoader(); - - if (!$this->hasPluginResource('FrontController')) { - $this->registerPluginResource('FrontController'); - } - } - - /** - * Run the application - * - * Checks to see that we have a default controller directory. If not, an - * exception is thrown. - * - * If so, it registers the bootstrap with the 'bootstrap' parameter of - * the front controller, and dispatches the front controller. - * - * @return mixed - * @throws Zend_Application_Bootstrap_Exception - */ - public function run() - { - $front = $this->getResource('FrontController'); - $default = $front->getDefaultModule(); - if (null === $front->getControllerDirectory($default)) { - throw new Zend_Application_Bootstrap_Exception( - 'No default controller directory registered with front controller' - ); - } - - $front->setParam('bootstrap', $this); - $response = $front->dispatch(); - if ($front->returnResponse()) { - return $response; - } - } - - /** - * Set module resource loader - * - * @param Zend_Loader_Autoloader_Resource $loader - * @return Zend_Application_Module_Bootstrap - */ - public function setResourceLoader(Zend_Loader_Autoloader_Resource $loader) - { - $this->_resourceLoader = $loader; - return $this; - } - - /** - * Retrieve module resource loader - * - * @return Zend_Loader_Autoloader_Resource - */ - public function getResourceLoader() - { - if ((null === $this->_resourceLoader) - && (false !== ($namespace = $this->getAppNamespace())) - ) { - $r = new ReflectionClass($this); - $path = $r->getFileName(); - $this->setResourceLoader( - new Zend_Application_Module_Autoloader( - array( - 'namespace' => $namespace, - 'basePath' => dirname($path), - ) - ) - ); - } - return $this->_resourceLoader; - } - - /** - * Get application namespace (used for module autoloading) - * - * @return string - */ - public function getAppNamespace() - { - return $this->_appNamespace; - } - - /** - * Set application namespace (for module autoloading) - * - * @param string - * @return Zend_Application_Bootstrap_Bootstrap - */ - public function setAppNamespace($value) - { - $this->_appNamespace = (string) $value; - return $this; - } -} diff --git a/library/vendor/Zend/Application/Bootstrap/BootstrapAbstract.php b/library/vendor/Zend/Application/Bootstrap/BootstrapAbstract.php deleted file mode 100644 index 2b1477cf4..000000000 --- a/library/vendor/Zend/Application/Bootstrap/BootstrapAbstract.php +++ /dev/null @@ -1,782 +0,0 @@ -setApplication($application); - $options = $application->getOptions(); - $this->setOptions($options); - } - - /** - * Set class state - * - * @param array $options - * @return Zend_Application_Bootstrap_BootstrapAbstract - */ - public function setOptions(array $options) - { - $this->_options = $this->mergeOptions($this->_options, $options); - - $options = array_change_key_case($options, CASE_LOWER); - $this->_optionKeys = array_merge($this->_optionKeys, array_keys($options)); - - $methods = get_class_methods($this); - foreach ($methods as $key => $method) { - $methods[$key] = strtolower($method); - } - - if (array_key_exists('pluginpaths', $options)) { - $pluginLoader = $this->getPluginLoader(); - - foreach ($options['pluginpaths'] as $prefix => $path) { - $pluginLoader->addPrefixPath($prefix, $path); - } - unset($options['pluginpaths']); - } - - foreach ($options as $key => $value) { - $method = 'set' . strtolower($key); - - if (in_array($method, $methods)) { - $this->$method($value); - } elseif ('resources' == $key) { - foreach ($value as $resource => $resourceOptions) { - $this->registerPluginResource($resource, $resourceOptions); - } - } - } - return $this; - } - - /** - * Get current options from bootstrap - * - * @return array - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Is an option present? - * - * @param string $key - * @return bool - */ - public function hasOption($key) - { - return in_array(strtolower($key), $this->_optionKeys); - } - - /** - * Retrieve a single option - * - * @param string $key - * @return mixed - */ - public function getOption($key) - { - if ($this->hasOption($key)) { - $options = $this->getOptions(); - $options = array_change_key_case($options, CASE_LOWER); - return $options[strtolower($key)]; - } - return null; - } - - /** - * Merge options recursively - * - * @param array $array1 - * @param mixed $array2 - * @return array - */ - public function mergeOptions(array $array1, $array2 = null) - { - if (is_array($array2)) { - foreach ($array2 as $key => $val) { - if (is_array($array2[$key])) { - $array1[$key] = (array_key_exists($key, $array1) && is_array($array1[$key])) - ? $this->mergeOptions($array1[$key], $array2[$key]) - : $array2[$key]; - } else { - $array1[$key] = $val; - } - } - } - return $array1; - } - - /** - * Get class resources (as resource/method pairs) - * - * Uses get_class_methods() by default, reflection on prior to 5.2.6, - * as a bug prevents the usage of get_class_methods() there. - * - * @return array - */ - public function getClassResources() - { - if (null === $this->_classResources) { - if (version_compare(PHP_VERSION, '5.2.6') === -1) { - $class = new ReflectionObject($this); - $classMethods = $class->getMethods(); - $methodNames = array(); - - foreach ($classMethods as $method) { - $methodNames[] = $method->getName(); - } - } else { - $methodNames = get_class_methods($this); - } - - $this->_classResources = array(); - foreach ($methodNames as $method) { - if (5 < strlen($method) && '_init' === substr($method, 0, 5)) { - $this->_classResources[strtolower(substr($method, 5))] = $method; - } - } - } - - return $this->_classResources; - } - - /** - * Get class resource names - * - * @return array - */ - public function getClassResourceNames() - { - $resources = $this->getClassResources(); - return array_keys($resources); - } - - /** - * Register a new resource plugin - * - * @param string|Zend_Application_Resource_Resource $resource - * @param mixed $options - * @return Zend_Application_Bootstrap_BootstrapAbstract - * @throws Zend_Application_Bootstrap_Exception When invalid resource is provided - */ - public function registerPluginResource($resource, $options = null) - { - if ($resource instanceof Zend_Application_Resource_Resource) { - $resource->setBootstrap($this); - $pluginName = $this->_resolvePluginResourceName($resource); - $this->_pluginResources[$pluginName] = $resource; - return $this; - } - - if (!is_string($resource)) { - throw new Zend_Application_Bootstrap_Exception('Invalid resource provided to ' . __METHOD__); - } - - $this->_pluginResources[$resource] = $options; - return $this; - } - - /** - * Unregister a resource from the bootstrap - * - * @param string|Zend_Application_Resource_Resource $resource - * @return Zend_Application_Bootstrap_BootstrapAbstract - * @throws Zend_Application_Bootstrap_Exception When unknown resource type is provided - */ - public function unregisterPluginResource($resource) - { - if ($resource instanceof Zend_Application_Resource_Resource) { - if ($index = array_search($resource, $this->_pluginResources, true)) { - unset($this->_pluginResources[$index]); - } - return $this; - } - - if (!is_string($resource)) { - throw new Zend_Application_Bootstrap_Exception('Unknown resource type provided to ' . __METHOD__); - } - - $resource = strtolower($resource); - if (array_key_exists($resource, $this->_pluginResources)) { - unset($this->_pluginResources[$resource]); - } - - return $this; - } - - /** - * Is the requested plugin resource registered? - * - * @param string $resource - * @return bool - */ - public function hasPluginResource($resource) - { - return (null !== $this->getPluginResource($resource)); - } - - /** - * Get a registered plugin resource - * - * @param string $resource - * @return Zend_Application_Resource_Resource - * @throws Zend_Application_Bootstrap_Exception - */ - public function getPluginResource($resource) - { - if (array_key_exists(strtolower($resource), $this->_pluginResources)) { - $resource = strtolower($resource); - if (!$this->_pluginResources[$resource] instanceof Zend_Application_Resource_Resource) { - $resourceName = $this->_loadPluginResource($resource, $this->_pluginResources[$resource]); - if (!$resourceName) { - throw new Zend_Application_Bootstrap_Exception(sprintf('Unable to resolve plugin "%s"; no corresponding plugin with that name', $resource)); - } - $resource = $resourceName; - } - return $this->_pluginResources[$resource]; - } - - foreach ($this->_pluginResources as $plugin => $spec) { - if ($spec instanceof Zend_Application_Resource_Resource) { - $pluginName = $this->_resolvePluginResourceName($spec); - if (0 === strcasecmp($resource, $pluginName)) { - unset($this->_pluginResources[$plugin]); - $this->_pluginResources[$pluginName] = $spec; - return $spec; - } - continue; - } - - if (false !== $pluginName = $this->_loadPluginResource($plugin, $spec)) { - if (0 === strcasecmp($resource, $pluginName)) { - return $this->_pluginResources[$pluginName]; - } - continue; - } - - if (class_exists($plugin) - && is_subclass_of($plugin, 'Zend_Application_Resource_Resource') - ) { //@SEE ZF-7550 - $spec = (array) $spec; - $spec['bootstrap'] = $this; - $instance = new $plugin($spec); - $pluginName = $this->_resolvePluginResourceName($instance); - unset($this->_pluginResources[$plugin]); - $this->_pluginResources[$pluginName] = $instance; - - if (0 === strcasecmp($resource, $pluginName)) { - return $instance; - } - } - } - - return null; - } - - /** - * Retrieve all plugin resources - * - * @return array - */ - public function getPluginResources() - { - foreach (array_keys($this->_pluginResources) as $resource) { - $this->getPluginResource($resource); - } - return $this->_pluginResources; - } - - /** - * Retrieve plugin resource names - * - * @return array - */ - public function getPluginResourceNames() - { - $this->getPluginResources(); - return array_keys($this->_pluginResources); - } - - /** - * Set plugin loader for loading resources - * - * @param Zend_Loader_PluginLoader_Interface $loader - * @return Zend_Application_Bootstrap_BootstrapAbstract - */ - public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) - { - $this->_pluginLoader = $loader; - return $this; - } - - /** - * Get the plugin loader for resources - * - * @return Zend_Loader_PluginLoader_Interface - */ - public function getPluginLoader() - { - if ($this->_pluginLoader === null) { - $options = array( - 'Zend_Application_Resource' => 'Zend/Application/Resource', - 'ZendX_Application_Resource' => 'ZendX/Application/Resource' - ); - - $this->_pluginLoader = new Zend_Loader_PluginLoader($options); - } - - return $this->_pluginLoader; - } - - /** - * Set application/parent bootstrap - * - * @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application - * @return Zend_Application_Bootstrap_BootstrapAbstract - * @throws Zend_Application_Bootstrap_Exception - */ - public function setApplication($application) - { - if (($application instanceof Zend_Application) - || ($application instanceof Zend_Application_Bootstrap_Bootstrapper) - ) { - if ($application === $this) { - throw new Zend_Application_Bootstrap_Exception('Cannot set application to same object; creates recursion'); - } - $this->_application = $application; - } else { - throw new Zend_Application_Bootstrap_Exception('Invalid application provided to bootstrap constructor (received "' . get_class($application) . '" instance)'); - } - return $this; - } - - /** - * Retrieve parent application instance - * - * @return Zend_Application|Zend_Application_Bootstrap_Bootstrapper - */ - public function getApplication() - { - return $this->_application; - } - - /** - * Retrieve application environment - * - * @return string - */ - public function getEnvironment() - { - if (null === $this->_environment) { - $this->_environment = $this->getApplication()->getEnvironment(); - } - return $this->_environment; - } - - /** - * Set resource container - * - * By default, if a resource callback has a non-null return value, this - * value will be stored in a container using the resource name as the - * key. - * - * Containers must be objects, and must allow setting public properties. - * - * @param object $container - * @return Zend_Application_Bootstrap_BootstrapAbstract - * @throws Zend_Application_Bootstrap_Exception - */ - public function setContainer($container) - { - if (!is_object($container)) { - throw new Zend_Application_Bootstrap_Exception('Resource containers must be objects'); - } - $this->_container = $container; - return $this; - } - - /** - * Retrieve resource container - * - * @return object - */ - public function getContainer() - { - if (null === $this->_container) { - $this->setContainer(new Zend_Registry()); - } - return $this->_container; - } - - /** - * Determine if a resource has been stored in the container - * - * During bootstrap resource initialization, you may return a value. If - * you do, it will be stored in the {@link setContainer() container}. - * You can use this method to determine if a value was stored. - * - * @param string $name - * @return bool - */ - public function hasResource($name) - { - $resource = strtolower($name); - $container = $this->getContainer(); - return isset($container->{$resource}); - } - - /** - * Retrieve a resource from the container - * - * During bootstrap resource initialization, you may return a value. If - * you do, it will be stored in the {@link setContainer() container}. - * You can use this method to retrieve that value. - * - * If no value was returned, this will return a null value. - * - * @param string $name - * @return null|mixed - */ - public function getResource($name) - { - $resource = strtolower($name); - $container = $this->getContainer(); - if ($this->hasResource($resource)) { - return $container->{$resource}; - } - return null; - } - - /** - * Implement PHP's magic to retrieve a resource - * in the bootstrap - * - * @param string $prop - * @return null|mixed - */ - public function __get($prop) - { - return $this->getResource($prop); - } - - /** - * Implement PHP's magic to ask for the - * existence of a resource in the bootstrap - * - * @param string $prop - * @return bool - */ - public function __isset($prop) - { - return $this->hasResource($prop); - } - - /** - * Bootstrap individual, all, or multiple resources - * - * Marked as final to prevent issues when subclassing and naming the - * child class 'Bootstrap' (in which case, overriding this method - * would result in it being treated as a constructor). - * - * If you need to override this functionality, override the - * {@link _bootstrap()} method. - * - * @param null|string|array $resource - * @return Zend_Application_Bootstrap_BootstrapAbstract - * @throws Zend_Application_Bootstrap_Exception When invalid argument was passed - */ - final public function bootstrap($resource = null) - { - $this->_bootstrap($resource); - return $this; - } - - /** - * Overloading: intercept calls to bootstrap() methods - * - * @param string $method - * @param array $args - * @return Zend_Application_Bootstrap_BootstrapAbstract - * @throws Zend_Application_Bootstrap_Exception On invalid method name - */ - public function __call($method, $args) - { - if (9 < strlen($method) && 'bootstrap' === substr($method, 0, 9)) { - $resource = substr($method, 9); - return $this->bootstrap($resource); - } - - throw new Zend_Application_Bootstrap_Exception('Invalid method "' . $method . '"'); - } - - /** - * Bootstrap implementation - * - * This method may be overridden to provide custom bootstrapping logic. - * It is the sole method called by {@link bootstrap()}. - * - * @param null|string|array $resource - * @return void - * @throws Zend_Application_Bootstrap_Exception When invalid argument was passed - */ - protected function _bootstrap($resource = null) - { - if (null === $resource) { - foreach ($this->getClassResourceNames() as $resource) { - $this->_executeResource($resource); - } - - foreach ($this->getPluginResourceNames() as $resource) { - $this->_executeResource($resource); - } - } elseif (is_string($resource)) { - $this->_executeResource($resource); - } elseif (is_array($resource)) { - foreach ($resource as $r) { - $this->_executeResource($r); - } - } else { - throw new Zend_Application_Bootstrap_Exception('Invalid argument passed to ' . __METHOD__); - } - } - - /** - * Execute a resource - * - * Checks to see if the resource has already been run. If not, it searches - * first to see if a local method matches the resource, and executes that. - * If not, it checks to see if a plugin resource matches, and executes that - * if found. - * - * Finally, if not found, it throws an exception. - * - * @param string $resource - * @return void - * @throws Zend_Application_Bootstrap_Exception When resource not found - */ - protected function _executeResource($resource) - { - $resourceName = strtolower($resource); - - if (in_array($resourceName, $this->_run)) { - return; - } - - if (isset($this->_started[$resourceName]) && $this->_started[$resourceName]) { - throw new Zend_Application_Bootstrap_Exception('Circular resource dependency detected'); - } - - $classResources = $this->getClassResources(); - if (array_key_exists($resourceName, $classResources)) { - $this->_started[$resourceName] = true; - $method = $classResources[$resourceName]; - $return = $this->$method(); - unset($this->_started[$resourceName]); - $this->_markRun($resourceName); - - if (null !== $return) { - $this->getContainer()->{$resourceName} = $return; - } - - return; - } - - if ($this->hasPluginResource($resource)) { - $this->_started[$resourceName] = true; - $plugin = $this->getPluginResource($resource); - $return = $plugin->init(); - unset($this->_started[$resourceName]); - $this->_markRun($resourceName); - - if (null !== $return) { - $this->getContainer()->{$resourceName} = $return; - } - - return; - } - - throw new Zend_Application_Bootstrap_Exception('Resource matching "' . $resource . '" not found'); - } - - /** - * Load a plugin resource - * - * @param string $resource - * @param array|object|null $options - * @return string|false - */ - protected function _loadPluginResource($resource, $options) - { - $options = (array) $options; - $options['bootstrap'] = $this; - $className = $this->getPluginLoader()->load(strtolower($resource), false); - - if (!$className) { - return false; - } - - $instance = new $className($options); - - unset($this->_pluginResources[$resource]); - - if (isset($instance->_explicitType)) { - $resource = $instance->_explicitType; - } - $resource = strtolower($resource); - $this->_pluginResources[$resource] = $instance; - - return $resource; - } - - /** - * Mark a resource as having run - * - * @param string $resource - * @return void - */ - protected function _markRun($resource) - { - if (!in_array($resource, $this->_run)) { - $this->_run[] = $resource; - } - } - - /** - * Resolve a plugin resource name - * - * Uses, in order of preference - * - $_explicitType property of resource - * - Short name of resource (if a matching prefix path is found) - * - class name (if none of the above are true) - * - * The name is then cast to lowercase. - * - * @param Zend_Application_Resource_Resource $resource - * @return string - */ - protected function _resolvePluginResourceName($resource) - { - if (isset($resource->_explicitType)) { - $pluginName = $resource->_explicitType; - } else { - $className = get_class($resource); - $pluginName = $className; - $loader = $this->getPluginLoader(); - foreach ($loader->getPaths() as $prefix => $paths) { - if (0 === strpos($className, $prefix)) { - $pluginName = substr($className, strlen($prefix)); - $pluginName = trim($pluginName, '_'); - break; - } - } - } - $pluginName = strtolower($pluginName); - return $pluginName; - } -} diff --git a/library/vendor/Zend/Application/Bootstrap/Bootstrapper.php b/library/vendor/Zend/Application/Bootstrap/Bootstrapper.php deleted file mode 100644 index edf56d15e..000000000 --- a/library/vendor/Zend/Application/Bootstrap/Bootstrapper.php +++ /dev/null @@ -1,93 +0,0 @@ -initDefaultResourceTypes(); - } - - /** - * Initialize default resource types for module resource classes - * - * @return void - */ - public function initDefaultResourceTypes() - { - $basePath = $this->getBasePath(); - $this->addResourceTypes( - array( - 'dbtable' => array( - 'namespace' => 'Model_DbTable', - 'path' => 'models/DbTable', - ), - 'mappers' => array( - 'namespace' => 'Model_Mapper', - 'path' => 'models/mappers', - ), - 'form' => array( - 'namespace' => 'Form', - 'path' => 'forms', - ), - 'model' => array( - 'namespace' => 'Model', - 'path' => 'models', - ), - 'plugin' => array( - 'namespace' => 'Plugin', - 'path' => 'plugins', - ), - 'service' => array( - 'namespace' => 'Service', - 'path' => 'services', - ), - 'viewhelper' => array( - 'namespace' => 'View_Helper', - 'path' => 'views/helpers', - ), - 'viewfilter' => array( - 'namespace' => 'View_Filter', - 'path' => 'views/filters', - ), - ) - ); - $this->setDefaultResourceType('model'); - } -} diff --git a/library/vendor/Zend/Application/Module/Bootstrap.php b/library/vendor/Zend/Application/Module/Bootstrap.php deleted file mode 100644 index a5d2c8971..000000000 --- a/library/vendor/Zend/Application/Module/Bootstrap.php +++ /dev/null @@ -1,126 +0,0 @@ -setApplication($application); - - // Use same plugin loader as parent bootstrap - if ($application instanceof Zend_Application_Bootstrap_ResourceBootstrapper) { - $this->setPluginLoader($application->getPluginLoader()); - } - - $key = strtolower($this->getModuleName()); - if ($application->hasOption($key)) { - // Don't run via setOptions() to prevent duplicate initialization - $this->setOptions($application->getOption($key)); - } - - if ($application->hasOption('resourceloader')) { - $this->setOptions(array( - 'resourceloader' => $application->getOption('resourceloader') - )); - } - $this->initResourceLoader(); - - // ZF-6545: ensure front controller resource is loaded - if (!$this->hasPluginResource('FrontController')) { - $this->registerPluginResource('FrontController'); - } - - // ZF-6545: prevent recursive registration of modules - if ($this->hasPluginResource('modules')) { - $this->unregisterPluginResource('modules'); - } - } - - /** - * Ensure resource loader is loaded - * - * @return void - */ - public function initResourceLoader() - { - $this->getResourceLoader(); - } - - /** - * Get default application namespace - * - * Proxies to {@link getModuleName()}, and returns the current module - * name - * - * @return string - */ - public function getAppNamespace() - { - return $this->getModuleName(); - } - - /** - * Retrieve module name - * - * @return string - */ - public function getModuleName() - { - if (empty($this->_moduleName)) { - $class = get_class($this); - if (preg_match('/^([a-z][a-z0-9]*)_/i', $class, $matches)) { - $prefix = $matches[1]; - } else { - $prefix = $class; - } - $this->_moduleName = $prefix; - } - return $this->_moduleName; - } -} diff --git a/library/vendor/Zend/Application/Resource/Cachemanager.php b/library/vendor/Zend/Application/Resource/Cachemanager.php deleted file mode 100644 index 490ab073d..000000000 --- a/library/vendor/Zend/Application/Resource/Cachemanager.php +++ /dev/null @@ -1,81 +0,0 @@ -getCacheManager(); - } - - /** - * Retrieve Zend_Cache_Manager instance - * - * @return Zend_Cache_Manager - */ - public function getCacheManager() - { - if (null === $this->_manager) { - $this->_manager = new Zend_Cache_Manager; - - $options = $this->getOptions(); - foreach ($options as $key => $value) { - // Logger - if (isset($value['frontend']['options']['logger'])) { - $logger = $value['frontend']['options']['logger']; - if (is_array($logger)) { - $value['frontend']['options']['logger'] = Zend_Log::factory($logger); - } - } - - // Cache templates - if ($this->_manager->hasCacheTemplate($key)) { - $this->_manager->setTemplateOptions($key, $value); - } else { - $this->_manager->setCacheTemplate($key, $value); - } - } - } - - return $this->_manager; - } -} diff --git a/library/vendor/Zend/Application/Resource/Db.php b/library/vendor/Zend/Application/Resource/Db.php deleted file mode 100644 index 55137c438..000000000 --- a/library/vendor/Zend/Application/Resource/Db.php +++ /dev/null @@ -1,197 +0,0 @@ -_adapter = $adapter; - return $this; - } - - /** - * Adapter type to use - * - * @return string - */ - public function getAdapter() - { - return $this->_adapter; - } - - /** - * Set the adapter params - * - * @param array $params - * @return Zend_Application_Resource_Db - */ - public function setParams(array $params) - { - $this->_params = $params; - return $this; - } - - /** - * Adapter parameters - * - * @return array - */ - public function getParams() - { - return $this->_params; - } - - /** - * Set whether to use this as default table adapter - * - * @param bool $isDefaultTableAdapter - * @return Zend_Application_Resource_Db - */ - public function setIsDefaultTableAdapter($isDefaultTableAdapter) - { - $this->_isDefaultTableAdapter = $isDefaultTableAdapter; - return $this; - } - - /** - * Is this adapter the default table adapter? - * - * @return bool - */ - public function isDefaultTableAdapter() - { - return $this->_isDefaultTableAdapter; - } - - /** - * Retrieve initialized DB connection - * - * @return null|Zend_Db_Adapter_Abstract - */ - public function getDbAdapter() - { - if ((null === $this->_db) - && (null !== ($adapter = $this->getAdapter())) - ) { - $this->_db = Zend_Db::factory($adapter, $this->getParams()); - - if ($this->_db instanceof Zend_Db_Adapter_Abstract - && $this->isDefaultTableAdapter() - ) { - Zend_Db_Table::setDefaultAdapter($this->_db); - } - } - return $this->_db; - } - - /** - * Defined by Zend_Application_Resource_Resource - * - * @return Zend_Db_Adapter_Abstract|null - */ - public function init() - { - if (null !== ($db = $this->getDbAdapter())) { - return $db; - } - - return null; - } - - /** - * Set the default metadata cache - * - * @param string|Zend_Cache_Core $cache - * @return Zend_Application_Resource_Db - */ - public function setDefaultMetadataCache($cache) - { - $metadataCache = null; - - if (is_string($cache)) { - $bootstrap = $this->getBootstrap(); - if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper - && $bootstrap->hasPluginResource('CacheManager') - ) { - $cacheManager = $bootstrap->bootstrap('CacheManager') - ->getResource('CacheManager'); - if (null !== $cacheManager && $cacheManager->hasCache($cache)) { - $metadataCache = $cacheManager->getCache($cache); - } - } - } else if ($cache instanceof Zend_Cache_Core) { - $metadataCache = $cache; - } - - if ($metadataCache instanceof Zend_Cache_Core) { - Zend_Db_Table::setDefaultMetadataCache($metadataCache); - } - - return $this; - } -} diff --git a/library/vendor/Zend/Application/Resource/Dojo.php b/library/vendor/Zend/Application/Resource/Dojo.php deleted file mode 100644 index 94c39cb71..000000000 --- a/library/vendor/Zend/Application/Resource/Dojo.php +++ /dev/null @@ -1,75 +0,0 @@ -getDojo(); - } - - /** - * Retrieve Dojo View Helper - * - * @return Zend_Dojo_View_Dojo_Container - */ - public function getDojo() - { - if (null === $this->_dojo) { - $this->getBootstrap()->bootstrap('view'); - $view = $this->getBootstrap()->view; - - Zend_Dojo::enableView($view); - $view->dojo()->setOptions($this->getOptions()); - - $this->_dojo = $view->dojo(); - } - - return $this->_dojo; - } -} diff --git a/library/vendor/Zend/Application/Resource/Exception.php b/library/vendor/Zend/Application/Resource/Exception.php deleted file mode 100644 index f657cc481..000000000 --- a/library/vendor/Zend/Application/Resource/Exception.php +++ /dev/null @@ -1,39 +0,0 @@ -getFrontController(); - - foreach ($this->getOptions() as $key => $value) { - switch (strtolower($key)) { - case 'controllerdirectory': - if (is_string($value)) { - $front->setControllerDirectory($value); - } elseif (is_array($value)) { - foreach ($value as $module => $directory) { - $front->addControllerDirectory($directory, $module); - } - } - break; - - case 'modulecontrollerdirectoryname': - $front->setModuleControllerDirectoryName($value); - break; - - case 'moduledirectory': - if (is_string($value)) { - $front->addModuleDirectory($value); - } elseif (is_array($value)) { - foreach ($value as $moduleDir) { - $front->addModuleDirectory($moduleDir); - } - } - break; - - case 'defaultcontrollername': - $front->setDefaultControllerName($value); - break; - - case 'defaultaction': - $front->setDefaultAction($value); - break; - - case 'defaultmodule': - $front->setDefaultModule($value); - break; - - case 'baseurl': - if (!empty($value)) { - $front->setBaseUrl($value); - } - break; - - case 'params': - $front->setParams($value); - break; - - case 'plugins': - foreach ((array) $value as $pluginClass) { - $stackIndex = null; - if (is_array($pluginClass)) { - $pluginClass = array_change_key_case($pluginClass, CASE_LOWER); - if (isset($pluginClass['class'])) { - if (isset($pluginClass['stackindex'])) { - $stackIndex = $pluginClass['stackindex']; - } - - $pluginClass = $pluginClass['class']; - } - } - - $plugin = new $pluginClass(); - $front->registerPlugin($plugin, $stackIndex); - } - break; - - case 'returnresponse': - $front->returnResponse((bool) $value); - break; - - case 'throwexceptions': - $front->throwExceptions((bool) $value); - break; - - case 'actionhelperpaths': - if (is_array($value)) { - foreach ($value as $helperPrefix => $helperPath) { - Zend_Controller_Action_HelperBroker::addPath($helperPath, $helperPrefix); - } - } - break; - - case 'dispatcher': - if (!isset($value['class'])) { - throw new Zend_Application_Exception('You must specify both '); - } - if (!isset($value['params'])) { - $value['params'] = array(); - } - - $dispatchClass = $value['class']; - if (!class_exists($dispatchClass)) { - throw new Zend_Application_Exception('Dispatcher class not found!'); - } - $front->setDispatcher(new $dispatchClass((array)$value['params'])); - break; - default: - $front->setParam($key, $value); - break; - } - } - - if (null !== ($bootstrap = $this->getBootstrap())) { - $this->getBootstrap()->frontController = $front; - } - - return $front; - } - - /** - * Retrieve front controller instance - * - * @return Zend_Controller_Front - */ - public function getFrontController() - { - if (null === $this->_front) { - $this->_front = Zend_Controller_Front::getInstance(); - } - return $this->_front; - } -} diff --git a/library/vendor/Zend/Application/Resource/Layout.php b/library/vendor/Zend/Application/Resource/Layout.php deleted file mode 100644 index 32cd6bbca..000000000 --- a/library/vendor/Zend/Application/Resource/Layout.php +++ /dev/null @@ -1,69 +0,0 @@ -getBootstrap()->bootstrap('FrontController'); - return $this->getLayout(); - } - - /** - * Retrieve layout object - * - * @return Zend_Layout - */ - public function getLayout() - { - if (null === $this->_layout) { - $this->_layout = Zend_Layout::startMvc($this->getOptions()); - } - return $this->_layout; - } -} diff --git a/library/vendor/Zend/Application/Resource/Locale.php b/library/vendor/Zend/Application/Resource/Locale.php deleted file mode 100644 index 0e4533908..000000000 --- a/library/vendor/Zend/Application/Resource/Locale.php +++ /dev/null @@ -1,116 +0,0 @@ -getLocale(); - } - - /** - * Retrieve locale object - * - * @return Zend_Locale - */ - public function getLocale() - { - if (null === $this->_locale) { - $options = $this->getOptions(); - - if (!isset($options['default'])) { - $this->_locale = new Zend_Locale(); - } elseif (!isset($options['force']) - || (bool)$options['force'] == false - ) { - // Don't force any locale, just go for auto detection - Zend_Locale::setDefault($options['default']); - $this->_locale = new Zend_Locale(); - } else { - $this->_locale = new Zend_Locale($options['default']); - } - - $key = (isset($options['registry_key']) && !is_numeric($options['registry_key'])) - ? $options['registry_key'] - : self::DEFAULT_REGISTRY_KEY; - Zend_Registry::set($key, $this->_locale); - } - - return $this->_locale; - } - - /** - * Set the cache - * - * @param string|Zend_Cache_Core $cache - * @return Zend_Application_Resource_Locale - */ - public function setCache($cache) - { - if (is_string($cache)) { - $bootstrap = $this->getBootstrap(); - if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper - && $bootstrap->hasPluginResource('CacheManager') - ) { - $cacheManager = $bootstrap->bootstrap('CacheManager') - ->getResource('CacheManager'); - if (null !== $cacheManager && $cacheManager->hasCache($cache)) { - $cache = $cacheManager->getCache($cache); - } - } - } - - if ($cache instanceof Zend_Cache_Core) { - Zend_Locale::setCache($cache); - } - - return $this; - } -} diff --git a/library/vendor/Zend/Application/Resource/Log.php b/library/vendor/Zend/Application/Resource/Log.php deleted file mode 100644 index a1e9d8475..000000000 --- a/library/vendor/Zend/Application/Resource/Log.php +++ /dev/null @@ -1,82 +0,0 @@ -getLog(); - } - - /** - * Attach logger - * - * @param Zend_Log $log - * @return Zend_Application_Resource_Log - */ - public function setLog(Zend_Log $log) - { - $this->_log = $log; - return $this; - } - - /** - * Retrieve logger object - * - * @return Zend_Log - */ - public function getLog() - { - if (null === $this->_log) { - $options = $this->getOptions(); - $log = Zend_Log::factory($options); - $this->setLog($log); - } - return $this->_log; - } -} diff --git a/library/vendor/Zend/Application/Resource/Mail.php b/library/vendor/Zend/Application/Resource/Mail.php deleted file mode 100644 index 5ab8d1992..000000000 --- a/library/vendor/Zend/Application/Resource/Mail.php +++ /dev/null @@ -1,150 +0,0 @@ -getMail(); - } - - /** - * - * @return Zend_Mail_Transport_Abstract|null - */ - public function getMail() - { - if (null === $this->_transport) { - $options = $this->getOptions(); - foreach ($options as $key => $option) { - $options[strtolower($key)] = $option; - } - $this->setOptions($options); - - if (isset($options['transport']) - && !is_numeric($options['transport']) - ) { - $this->_transport = $this->_setupTransport($options['transport']); - if (!isset($options['transport']['register']) - || $options['transport']['register'] == '1' - || (isset($options['transport']['register']) - && !is_numeric($options['transport']['register']) - && (bool)$options['transport']['register'] == true) - ) { - Zend_Mail::setDefaultTransport($this->_transport); - } - } - - $this->_setDefaults('from'); - $this->_setDefaults('replyTo'); - } - - return $this->_transport; - } - - protected function _setDefaults($type) - { - $key = strtolower('default' . $type); - $options = $this->getOptions(); - - if (isset($options[$key]['email']) - && !is_numeric($options[$key]['email']) - ) { - $method = array('Zend_Mail', 'setDefault' . ucfirst($type)); - if (isset($options[$key]['name']) - && !is_numeric( - $options[$key]['name'] - ) - ) { - call_user_func( - $method, $options[$key]['email'], $options[$key]['name'] - ); - } else { - call_user_func($method, $options[$key]['email']); - } - } - } - - protected function _setupTransport($options) - { - if (!isset($options['type'])) { - $options['type'] = 'sendmail'; - } - - $transportName = $options['type']; - if (!Zend_Loader_Autoloader::autoload($transportName)) { - $transportName = ucfirst(strtolower($transportName)); - - if (!Zend_Loader_Autoloader::autoload($transportName)) { - $transportName = 'Zend_Mail_Transport_' . $transportName; - if (!Zend_Loader_Autoloader::autoload($transportName)) { - throw new Zend_Application_Resource_Exception( - "Specified Mail Transport '{$transportName}'" - . 'could not be found' - ); - } - } - } - - unset($options['type']); - unset($options['register']); //@see ZF-11022 - - switch($transportName) { - case 'Zend_Mail_Transport_Smtp': - if (!isset($options['host'])) { - throw new Zend_Application_Resource_Exception( - 'A host is necessary for smtp transport,' - . ' but none was given' - ); - } - - $transport = new $transportName($options['host'], $options); - break; - case 'Zend_Mail_Transport_Sendmail': - default: - $transport = new $transportName($options); - break; - } - - return $transport; - } -} diff --git a/library/vendor/Zend/Application/Resource/Modules.php b/library/vendor/Zend/Application/Resource/Modules.php deleted file mode 100644 index 7a0cf246d..000000000 --- a/library/vendor/Zend/Application/Resource/Modules.php +++ /dev/null @@ -1,157 +0,0 @@ -_bootstraps = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); - parent::__construct($options); - } - - /** - * Initialize modules - * - * @return array - * @throws Zend_Application_Resource_Exception When bootstrap class was not found - */ - public function init() - { - $bootstraps = array(); - $bootstrap = $this->getBootstrap(); - $bootstrap->bootstrap('FrontController'); - $front = $bootstrap->getResource('FrontController'); - - $modules = $front->getControllerDirectory(); - $default = $front->getDefaultModule(); - $curBootstrapClass = get_class($bootstrap); - foreach ($modules as $module => $moduleDirectory) { - $bootstrapClass = $this->_formatModuleName($module) . '_Bootstrap'; - if (!class_exists($bootstrapClass, false)) { - $bootstrapPath = dirname($moduleDirectory) . '/Bootstrap.php'; - if (file_exists($bootstrapPath)) { - $eMsgTpl = 'Bootstrap file found for module "%s" but bootstrap class "%s" not found'; - include_once $bootstrapPath; - if (($default != $module) - && !class_exists($bootstrapClass, false) - ) { - throw new Zend_Application_Resource_Exception( - sprintf( - $eMsgTpl, $module, $bootstrapClass - ) - ); - } elseif ($default == $module) { - if (!class_exists($bootstrapClass, false)) { - $bootstrapClass = 'Bootstrap'; - if (!class_exists($bootstrapClass, false)) { - throw new Zend_Application_Resource_Exception( - sprintf( - $eMsgTpl, $module, $bootstrapClass - ) - ); - } - } - } - } else { - continue; - } - } - - if ($bootstrapClass == $curBootstrapClass) { - // If the found bootstrap class matches the one calling this - // resource, don't re-execute. - continue; - } - - $bootstraps[$module] = $bootstrapClass; - } - - return $this->_bootstraps = $this->bootstrapBootstraps($bootstraps); - } - - /* - * Bootstraps the bootstraps found. Allows for easy extension. - * @param array $bootstraps Array containing the bootstraps to instantiate - */ - protected function bootstrapBootstraps($bootstraps) - { - $bootstrap = $this->getBootstrap(); - $out = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); - - foreach ($bootstraps as $module => $bootstrapClass) { - $moduleBootstrap = new $bootstrapClass($bootstrap); - $moduleBootstrap->bootstrap(); - $out[$module] = $moduleBootstrap; - } - - return $out; - } - - /** - * Get bootstraps that have been run - * - * @return ArrayObject - */ - public function getExecutedBootstraps() - { - return $this->_bootstraps; - } - - /** - * Format a module name to the module class prefix - * - * @param string $name - * @return string - */ - protected function _formatModuleName($name) - { - $name = strtolower($name); - $name = str_replace(array('-', '.'), ' ', $name); - $name = ucwords($name); - $name = str_replace(' ', '', $name); - return $name; - } -} diff --git a/library/vendor/Zend/Application/Resource/Multidb.php b/library/vendor/Zend/Application/Resource/Multidb.php deleted file mode 100644 index 4910f4feb..000000000 --- a/library/vendor/Zend/Application/Resource/Multidb.php +++ /dev/null @@ -1,208 +0,0 @@ - - * resources.multidb.defaultMetadataCache = "database" - * - * resources.multidb.db1.adapter = "pdo_mysql" - * resources.multidb.db1.host = "localhost" - * resources.multidb.db1.username = "webuser" - * resources.multidb.db1.password = "XXXX" - * resources.multidb.db1.dbname = "db1" - * resources.multidb.db1.default = true - * - * resources.multidb.db2.adapter = "pdo_pgsql" - * resources.multidb.db2.host = "example.com" - * resources.multidb.db2.username = "dba" - * resources.multidb.db2.password = "notthatpublic" - * resources.multidb.db2.dbname = "db2" - * - * - * @category Zend - * @package Zend_Application - * @subpackage Resource - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Application_Resource_Multidb extends Zend_Application_Resource_ResourceAbstract -{ - /** - * Associative array containing all configured db's - * - * @var array - */ - protected $_dbs = array(); - - /** - * An instance of the default db, if set - * - * @var null|Zend_Db_Adapter_Abstract - */ - protected $_defaultDb; - - /** - * Initialize the Database Connections (instances of Zend_Db_Table_Abstract) - * - * @return Zend_Application_Resource_Multidb - */ - public function init() - { - $options = $this->getOptions(); - - if (isset($options['defaultMetadataCache'])) { - $this->_setDefaultMetadataCache($options['defaultMetadataCache']); - unset($options['defaultMetadataCache']); - } - - foreach ($options as $id => $params) { - $adapter = $params['adapter']; - $default = (int) ( - isset($params['isDefaultTableAdapter']) && $params['isDefaultTableAdapter'] - || isset($params['default']) && $params['default'] - ); - unset( - $params['adapter'], - $params['default'], - $params['isDefaultTableAdapter'] - ); - - $this->_dbs[$id] = Zend_Db::factory($adapter, $params); - - if ($default) { - $this->_setDefault($this->_dbs[$id]); - } - } - - return $this; - } - - /** - * Determine if the given db(identifier) is the default db. - * - * @param string|Zend_Db_Adapter_Abstract $db The db to determine whether it's set as default - * @return boolean True if the given parameter is configured as default. False otherwise - */ - public function isDefault($db) - { - if (!$db instanceof Zend_Db_Adapter_Abstract) { - $db = $this->getDb($db); - } - - return $db === $this->_defaultDb; - } - - /** - * Retrieve the specified database connection - * - * @param null|string|Zend_Db_Adapter_Abstract $db The adapter to retrieve. - * Null to retrieve the default connection - * @return Zend_Db_Adapter_Abstract - * @throws Zend_Application_Resource_Exception if the given parameter could not be found - */ - public function getDb($db = null) - { - if ($db === null) { - return $this->getDefaultDb(); - } - - if (isset($this->_dbs[$db])) { - return $this->_dbs[$db]; - } - - throw new Zend_Application_Resource_Exception( - 'A DB adapter was tried to retrieve, but was not configured' - ); - } - - /** - * Get the default db connection - * - * @param boolean $justPickOne If true, a random (the first one in the stack) - * connection is returned if no default was set. - * If false, null is returned if no default was set. - * @return null|Zend_Db_Adapter_Abstract - */ - public function getDefaultDb($justPickOne = true) - { - if ($this->_defaultDb !== null) { - return $this->_defaultDb; - } - - if ($justPickOne) { - return reset($this->_dbs); // Return first db in db pool - } - - return null; - } - - /** - * Set the default db adapter - * - * @var Zend_Db_Adapter_Abstract $adapter Adapter to set as default - */ - protected function _setDefault(Zend_Db_Adapter_Abstract $adapter) - { - Zend_Db_Table::setDefaultAdapter($adapter); - $this->_defaultDb = $adapter; - } - - /** - * Set the default metadata cache - * - * @param string|Zend_Cache_Core $cache - * @return Zend_Application_Resource_Multidb - */ - protected function _setDefaultMetadataCache($cache) - { - $metadataCache = null; - - if (is_string($cache)) { - $bootstrap = $this->getBootstrap(); - if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper && - $bootstrap->hasPluginResource('CacheManager') - ) { - $cacheManager = $bootstrap->bootstrap('CacheManager') - ->getResource('CacheManager'); - if (null !== $cacheManager && $cacheManager->hasCache($cache)) { - $metadataCache = $cacheManager->getCache($cache); - } - } - } else if ($cache instanceof Zend_Cache_Core) { - $metadataCache = $cache; - } - - if ($metadataCache instanceof Zend_Cache_Core) { - Zend_Db_Table::setDefaultMetadataCache($metadataCache); - } - - return $this; - } -} diff --git a/library/vendor/Zend/Application/Resource/Navigation.php b/library/vendor/Zend/Application/Resource/Navigation.php deleted file mode 100644 index b926c597e..000000000 --- a/library/vendor/Zend/Application/Resource/Navigation.php +++ /dev/null @@ -1,130 +0,0 @@ -_container) { - $options = $this->getOptions(); - - if (isset($options['defaultPageType'])) { - Zend_Navigation_Page::setDefaultPageType( - $options['defaultPageType'] - ); - } - - $pages = isset($options['pages']) ? $options['pages'] : array(); - $this->_container = new Zend_Navigation($pages); - } - - $this->store(); - return $this->_container; - } - - /** - * Stores navigation container in registry or Navigation view helper - * - * @return void - */ - public function store() - { - $options = $this->getOptions(); - if (isset($options['storage']['registry']) && - $options['storage']['registry'] == true) { - $this->_storeRegistry(); - } else { - $this->_storeHelper(); - } - } - - /** - * Stores navigation container in the registry - * - * @return void - */ - protected function _storeRegistry() - { - $options = $this->getOptions(); - // see ZF-7461 - if (isset($options['storage']['registry']['key']) - && !is_numeric($options['storage']['registry']['key']) - ) { - $key = $options['storage']['registry']['key']; - } else { - $key = self::DEFAULT_REGISTRY_KEY; - } - - Zend_Registry::set($key, $this->getContainer()); - } - - /** - * Stores navigation container in the Navigation helper - * - * @return void - */ - protected function _storeHelper() - { - $this->getBootstrap()->bootstrap('view'); - $view = $this->getBootstrap()->view; - $view->getHelper('navigation')->navigation($this->getContainer()); - } - - /** - * Returns navigation container - * - * @return Zend_Navigation - */ - public function getContainer() - { - return $this->_container; - } -} diff --git a/library/vendor/Zend/Application/Resource/Resource.php b/library/vendor/Zend/Application/Resource/Resource.php deleted file mode 100644 index 7c7367566..000000000 --- a/library/vendor/Zend/Application/Resource/Resource.php +++ /dev/null @@ -1,79 +0,0 @@ -setOptions($options); - } else if ($options instanceof Zend_Config) { - $this->setOptions($options->toArray()); - } - } - - /** - * Set options from array - * - * @param array $options Configuration for resource - * @return Zend_Application_Resource_ResourceAbstract - */ - public function setOptions(array $options) - { - if (array_key_exists('bootstrap', $options)) { - $this->setBootstrap($options['bootstrap']); - unset($options['bootstrap']); - } - - foreach ($options as $key => $value) { - if (in_array(strtolower($key), $this->_skipOptions)) { - continue; - } - - $method = 'set' . strtolower($key); - if (method_exists($this, $method)) { - $this->$method($value); - } - } - - $this->_options = $this->mergeOptions($this->_options, $options); - - return $this; - } - - /** - * Retrieve resource options - * - * @return array - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Merge options recursively - * - * @param array $array1 - * @param mixed $array2 - * @return array - */ - public function mergeOptions(array $array1, $array2 = null) - { - if (is_array($array2)) { - foreach ($array2 as $key => $val) { - if (is_array($array2[$key])) { - $array1[$key] = (array_key_exists($key, $array1) && is_array($array1[$key])) - ? $this->mergeOptions($array1[$key], $array2[$key]) - : $array2[$key]; - } else { - $array1[$key] = $val; - } - } - } - return $array1; - } - - /** - * Set the bootstrap to which the resource is attached - * - * @param Zend_Application_Bootstrap_Bootstrapper $bootstrap - * @return Zend_Application_Resource_Resource - */ - public function setBootstrap(Zend_Application_Bootstrap_Bootstrapper $bootstrap) - { - $this->_bootstrap = $bootstrap; - return $this; - } - - /** - * Retrieve the bootstrap to which the resource is attached - * - * @return null|Zend_Application_Bootstrap_Bootstrapper - */ - public function getBootstrap() - { - return $this->_bootstrap; - } -} diff --git a/library/vendor/Zend/Application/Resource/Router.php b/library/vendor/Zend/Application/Resource/Router.php deleted file mode 100644 index 436ede985..000000000 --- a/library/vendor/Zend/Application/Resource/Router.php +++ /dev/null @@ -1,86 +0,0 @@ -getRouter(); - } - - /** - * Retrieve router object - * - * @return Zend_Controller_Router_Rewrite - */ - public function getRouter() - { - if (null === $this->_router) { - $bootstrap = $this->getBootstrap(); - $bootstrap->bootstrap('FrontController'); - $this->_router = $bootstrap->getContainer()->frontcontroller->getRouter(); - - $options = $this->getOptions(); - if (!isset($options['routes'])) { - $options['routes'] = array(); - } - - if (isset($options['chainNameSeparator'])) { - $this->_router->setChainNameSeparator($options['chainNameSeparator']); - } - - if (isset($options['useRequestParametersAsGlobal'])) { - $this->_router->useRequestParametersAsGlobal($options['useRequestParametersAsGlobal']); - } - - $this->_router->addConfig(new Zend_Config($options['routes'])); - } - - return $this->_router; - } -} diff --git a/library/vendor/Zend/Application/Resource/Session.php b/library/vendor/Zend/Application/Resource/Session.php deleted file mode 100644 index 02e483b56..000000000 --- a/library/vendor/Zend/Application/Resource/Session.php +++ /dev/null @@ -1,118 +0,0 @@ -_saveHandler = $saveHandler; - return $this; - } - - /** - * Get session save handler - * - * @return Zend_Session_SaveHandler_Interface - * @throws Zend_Application_Resource_Exception - */ - public function getSaveHandler() - { - if (!$this->_saveHandler instanceof Zend_Session_SaveHandler_Interface) { - if (is_array($this->_saveHandler)) { - if (!array_key_exists('class', $this->_saveHandler)) { - throw new Zend_Application_Resource_Exception('Session save handler class not provided in options'); - } - $options = array(); - if (array_key_exists('options', $this->_saveHandler)) { - $options = $this->_saveHandler['options']; - } - $this->_saveHandler = $this->_saveHandler['class']; - $this->_saveHandler = new $this->_saveHandler($options); - } elseif (is_string($this->_saveHandler)) { - $this->_saveHandler = new $this->_saveHandler(); - } - - if (!$this->_saveHandler instanceof Zend_Session_SaveHandler_Interface) { - throw new Zend_Application_Resource_Exception('Invalid session save handler'); - } - } - return $this->_saveHandler; - } - - /** - * @return bool - */ - protected function _hasSaveHandler() - { - return ($this->_saveHandler !== null); - } - - /** - * Defined by Zend_Application_Resource_Resource - * - * @return void - */ - public function init() - { - $options = array_change_key_case($this->getOptions(), CASE_LOWER); - if (isset($options['savehandler'])) { - unset($options['savehandler']); - } - - if (count($options) > 0) { - Zend_Session::setOptions($options); - } - - if ($this->_hasSaveHandler()) { - Zend_Session::setSaveHandler($this->getSaveHandler()); - } - } -} diff --git a/library/vendor/Zend/Application/Resource/Translate.php b/library/vendor/Zend/Application/Resource/Translate.php deleted file mode 100644 index 98fff902c..000000000 --- a/library/vendor/Zend/Application/Resource/Translate.php +++ /dev/null @@ -1,138 +0,0 @@ -getTranslate(); - } - - /** - * Retrieve translate object - * - * @return Zend_Translate - * @throws Zend_Application_Resource_Exception if registry key was used - * already but is no instance of Zend_Translate - */ - public function getTranslate() - { - if (null === $this->_translate) { - $options = $this->getOptions(); - - if (!isset($options['content']) && !isset($options['data'])) { - throw new Zend_Application_Resource_Exception('No translation source data provided.'); - } else if (array_key_exists('content', $options) && array_key_exists('data', $options)) { - throw new Zend_Application_Resource_Exception( - 'Conflict on translation source data: choose only one key between content and data.' - ); - } - - if (empty($options['adapter'])) { - $options['adapter'] = Zend_Translate::AN_ARRAY; - } - - if (!empty($options['data'])) { - $options['content'] = $options['data']; - unset($options['data']); - } - - if (isset($options['log'])) { - if (is_array($options['log'])) { - $options['log'] = Zend_Log::factory($options['log']); - } - } - - if (isset($options['options'])) { - foreach ($options['options'] as $key => $value) { - $options[$key] = $value; - } - } - - if (!empty($options['cache']) && is_string($options['cache'])) { - $bootstrap = $this->getBootstrap(); - if ($bootstrap instanceof Zend_Application_Bootstrap_ResourceBootstrapper && - $bootstrap->hasPluginResource('CacheManager') - ) { - $cacheManager = $bootstrap->bootstrap('CacheManager') - ->getResource('CacheManager'); - if (null !== $cacheManager && - $cacheManager->hasCache($options['cache']) - ) { - $options['cache'] = $cacheManager->getCache($options['cache']); - } - } - } - - $key = (isset($options['registry_key']) && !is_numeric($options['registry_key'])) - ? $options['registry_key'] - : self::DEFAULT_REGISTRY_KEY; - unset($options['registry_key']); - - if (Zend_Registry::isRegistered($key)) { - $translate = Zend_Registry::get($key); - if (!$translate instanceof Zend_Translate) { - throw new Zend_Application_Resource_Exception( - $key - . ' already registered in registry but is ' - . 'no instance of Zend_Translate' - ); - } - - $translate->addTranslation($options); - $this->_translate = $translate; - } else { - $this->_translate = new Zend_Translate($options); - Zend_Registry::set($key, $this->_translate); - } - } - - return $this->_translate; - } -} diff --git a/library/vendor/Zend/Application/Resource/Useragent.php b/library/vendor/Zend/Application/Resource/Useragent.php deleted file mode 100644 index 1ac40a325..000000000 --- a/library/vendor/Zend/Application/Resource/Useragent.php +++ /dev/null @@ -1,72 +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/vendor/Zend/Application/Resource/View.php b/library/vendor/Zend/Application/Resource/View.php deleted file mode 100644 index 78f280f61..000000000 --- a/library/vendor/Zend/Application/Resource/View.php +++ /dev/null @@ -1,85 +0,0 @@ -getView(); - - $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); - $viewRenderer->setView($view); - return $view; - } - - /** - * Retrieve view object - * - * @return Zend_View - */ - public function getView() - { - if (null === $this->_view) { - $options = $this->getOptions(); - $this->_view = new Zend_View($options); - - if (isset($options['doctype'])) { - $this->_view->doctype()->setDoctype(strtoupper($options['doctype'])); - if (isset($options['charset']) && $this->_view->doctype()->isHtml5()) { - $this->_view->headMeta()->setCharset($options['charset']); - } - } - if (isset($options['contentType'])) { - $this->_view->headMeta()->appendHttpEquiv('Content-Type', $options['contentType']); - } - if (isset($options['assign']) && is_array($options['assign'])) { - $this->_view->assign($options['assign']); - } - } - return $this->_view; - } -} diff --git a/library/vendor/Zend/Auth.php b/library/vendor/Zend/Auth.php deleted file mode 100644 index 78f439c2f..000000000 --- a/library/vendor/Zend/Auth.php +++ /dev/null @@ -1,168 +0,0 @@ -_storage) { - /** - * @see Zend_Auth_Storage_Session - */ - $this->setStorage(new Zend_Auth_Storage_Session()); - } - - return $this->_storage; - } - - /** - * Sets the persistent storage handler - * - * @param Zend_Auth_Storage_Interface $storage - * @return Zend_Auth Provides a fluent interface - */ - public function setStorage(Zend_Auth_Storage_Interface $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * Authenticates against the supplied adapter - * - * @param Zend_Auth_Adapter_Interface $adapter - * @return Zend_Auth_Result - */ - public function authenticate(Zend_Auth_Adapter_Interface $adapter) - { - $result = $adapter->authenticate(); - - /** - * ZF-7546 - prevent multiple succesive calls from storing inconsistent results - * Ensure storage has clean state - */ - if ($this->hasIdentity()) { - $this->clearIdentity(); - } - - if ($result->isValid()) { - $this->getStorage()->write($result->getIdentity()); - } - - return $result; - } - - /** - * Returns true if and only if an identity is available from storage - * - * @return boolean - */ - public function hasIdentity() - { - return !$this->getStorage()->isEmpty(); - } - - /** - * Returns the identity from storage or null if no identity is available - * - * @return mixed|null - */ - public function getIdentity() - { - $storage = $this->getStorage(); - - if ($storage->isEmpty()) { - return null; - } - - return $storage->read(); - } - - /** - * Clears the identity from persistent storage - * - * @return void - */ - public function clearIdentity() - { - $this->getStorage()->clear(); - } -} diff --git a/library/vendor/Zend/Auth/Adapter/DbTable.php b/library/vendor/Zend/Auth/Adapter/DbTable.php deleted file mode 100644 index f6af67b19..000000000 --- a/library/vendor/Zend/Auth/Adapter/DbTable.php +++ /dev/null @@ -1,553 +0,0 @@ -_setDbAdapter($zendDb); - - if (null !== $tableName) { - $this->setTableName($tableName); - } - - if (null !== $identityColumn) { - $this->setIdentityColumn($identityColumn); - } - - if (null !== $credentialColumn) { - $this->setCredentialColumn($credentialColumn); - } - - if (null !== $credentialTreatment) { - $this->setCredentialTreatment($credentialTreatment); - } - } - - /** - * _setDbAdapter() - set the database adapter to be used for quering - * - * @param Zend_Db_Adapter_Abstract - * @throws Zend_Auth_Adapter_Exception - * @return Zend_Auth_Adapter_DbTable - */ - protected function _setDbAdapter(Zend_Db_Adapter_Abstract $zendDb = null) - { - $this->_zendDb = $zendDb; - - /** - * If no adapter is specified, fetch default database adapter. - */ - if(null === $this->_zendDb) { - $this->_zendDb = Zend_Db_Table_Abstract::getDefaultAdapter(); - if (null === $this->_zendDb) { - throw new Zend_Auth_Adapter_Exception('No database adapter present'); - } - } - - return $this; - } - - /** - * setTableName() - set the table name to be used in the select query - * - * @param string $tableName - * @return Zend_Auth_Adapter_DbTable Provides a fluent interface - */ - public function setTableName($tableName) - { - $this->_tableName = $tableName; - return $this; - } - - /** - * setIdentityColumn() - set the column name to be used as the identity column - * - * @param string $identityColumn - * @return Zend_Auth_Adapter_DbTable Provides a fluent interface - */ - public function setIdentityColumn($identityColumn) - { - $this->_identityColumn = $identityColumn; - return $this; - } - - /** - * setCredentialColumn() - set the column name to be used as the credential column - * - * @param string $credentialColumn - * @return Zend_Auth_Adapter_DbTable Provides a fluent interface - */ - public function setCredentialColumn($credentialColumn) - { - $this->_credentialColumn = $credentialColumn; - return $this; - } - - /** - * setCredentialTreatment() - allows the developer to pass a parameterized string that is - * used to transform or treat the input credential data. - * - * In many cases, passwords and other sensitive data are encrypted, hashed, encoded, - * obscured, or otherwise treated through some function or algorithm. By specifying a - * parameterized treatment string with this method, a developer may apply arbitrary SQL - * upon input credential data. - * - * Examples: - * - * 'PASSWORD(?)' - * 'MD5(?)' - * - * @param string $treatment - * @return Zend_Auth_Adapter_DbTable Provides a fluent interface - */ - public function setCredentialTreatment($treatment) - { - $this->_credentialTreatment = $treatment; - return $this; - } - - /** - * setIdentity() - set the value to be used as the identity - * - * @param string $value - * @return Zend_Auth_Adapter_DbTable Provides a fluent interface - */ - public function setIdentity($value) - { - $this->_identity = $value; - return $this; - } - - /** - * setCredential() - set the credential value to be used, optionally can specify a treatment - * to be used, should be supplied in parameterized form, such as 'MD5(?)' or 'PASSWORD(?)' - * - * @param string $credential - * @return Zend_Auth_Adapter_DbTable Provides a fluent interface - */ - public function setCredential($credential) - { - $this->_credential = $credential; - return $this; - } - - /** - * setAmbiguityIdentity() - sets a flag for usage of identical identities - * with unique credentials. It accepts integers (0, 1) or boolean (true, - * false) parameters. Default is false. - * - * @param int|bool $flag - * @return Zend_Auth_Adapter_DbTable - */ - public function setAmbiguityIdentity($flag) - { - if (is_integer($flag)) { - $this->_ambiguityIdentity = (1 === $flag ? true : false); - } elseif (is_bool($flag)) { - $this->_ambiguityIdentity = $flag; - } - return $this; - } - /** - * getAmbiguityIdentity() - returns TRUE for usage of multiple identical - * identies with different credentials, FALSE if not used. - * - * @return bool - */ - public function getAmbiguityIdentity() - { - return $this->_ambiguityIdentity; - } - - /** - * getDbSelect() - Return the preauthentication Db Select object for userland select query modification - * - * @return Zend_Db_Select - */ - public function getDbSelect() - { - if ($this->_dbSelect == null) { - $this->_dbSelect = $this->_zendDb->select(); - } - - return $this->_dbSelect; - } - - /** - * getResultRowObject() - Returns the result row as a stdClass object - * - * @param string|array $returnColumns - * @param string|array $omitColumns - * @return stdClass|boolean - */ - public function getResultRowObject($returnColumns = null, $omitColumns = null) - { - if (!$this->_resultRow) { - return false; - } - - $returnObject = new stdClass(); - - if (null !== $returnColumns) { - - $availableColumns = array_keys($this->_resultRow); - foreach ( (array) $returnColumns as $returnColumn) { - if (in_array($returnColumn, $availableColumns)) { - $returnObject->{$returnColumn} = $this->_resultRow[$returnColumn]; - } - } - return $returnObject; - - } elseif (null !== $omitColumns) { - - $omitColumns = (array) $omitColumns; - foreach ($this->_resultRow as $resultColumn => $resultValue) { - if (!in_array($resultColumn, $omitColumns)) { - $returnObject->{$resultColumn} = $resultValue; - } - } - return $returnObject; - - } else { - - foreach ($this->_resultRow as $resultColumn => $resultValue) { - $returnObject->{$resultColumn} = $resultValue; - } - return $returnObject; - - } - } - - /** - * authenticate() - defined by Zend_Auth_Adapter_Interface. This method is called to - * attempt an authentication. Previous to this call, this adapter would have already - * been configured with all necessary information to successfully connect to a database - * table and attempt to find a record matching the provided identity. - * - * @throws Zend_Auth_Adapter_Exception if answering the authentication query is impossible - * @return Zend_Auth_Result - */ - public function authenticate() - { - $this->_authenticateSetup(); - $dbSelect = $this->_authenticateCreateSelect(); - $resultIdentities = $this->_authenticateQuerySelect($dbSelect); - - if ( ($authResult = $this->_authenticateValidateResultSet($resultIdentities)) instanceof Zend_Auth_Result) { - return $authResult; - } - - if (true === $this->getAmbiguityIdentity()) { - $validIdentities = array (); - $zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match'); - foreach ($resultIdentities as $identity) { - if (1 === (int) $identity[$zendAuthCredentialMatchColumn]) { - $validIdentities[] = $identity; - } - } - $resultIdentities = $validIdentities; - } - - $authResult = $this->_authenticateValidateResult(array_shift($resultIdentities)); - return $authResult; - } - - /** - * _authenticateSetup() - This method abstracts the steps involved with - * making sure that this adapter was indeed setup properly with all - * required pieces of information. - * - * @throws Zend_Auth_Adapter_Exception - in the event that setup was not done properly - * @return true - */ - protected function _authenticateSetup() - { - $exception = null; - - if ($this->_tableName == '') { - $exception = 'A table must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.'; - } elseif ($this->_identityColumn == '') { - $exception = 'An identity column must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.'; - } elseif ($this->_credentialColumn == '') { - $exception = 'A credential column must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.'; - } elseif ($this->_identity == '') { - $exception = 'A value for the identity was not provided prior to authentication with Zend_Auth_Adapter_DbTable.'; - } elseif ($this->_credential === null) { - $exception = 'A credential value was not provided prior to authentication with Zend_Auth_Adapter_DbTable.'; - } - - if (null !== $exception) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception($exception); - } - - $this->_authenticateResultInfo = array( - 'code' => Zend_Auth_Result::FAILURE, - 'identity' => $this->_identity, - 'messages' => array() - ); - - return true; - } - - /** - * _authenticateCreateSelect() - This method creates a Zend_Db_Select object that - * is completely configured to be queried against the database. - * - * @return Zend_Db_Select - */ - protected function _authenticateCreateSelect() - { - // build credential expression - if (empty($this->_credentialTreatment) || (strpos($this->_credentialTreatment, '?') === false)) { - $this->_credentialTreatment = '?'; - } - - $credentialExpression = new Zend_Db_Expr( - '(CASE WHEN ' . - $this->_zendDb->quoteInto( - $this->_zendDb->quoteIdentifier($this->_credentialColumn, true) - . ' = ' . $this->_credentialTreatment, $this->_credential - ) - . ' THEN 1 ELSE 0 END) AS ' - . $this->_zendDb->quoteIdentifier( - $this->_zendDb->foldCase('zend_auth_credential_match') - ) - ); - - // get select - $dbSelect = clone $this->getDbSelect(); - $dbSelect->from($this->_tableName, array('*', $credentialExpression)) - ->where($this->_zendDb->quoteIdentifier($this->_identityColumn, true) . ' = ?', $this->_identity); - - return $dbSelect; - } - - /** - * _authenticateQuerySelect() - This method accepts a Zend_Db_Select object and - * performs a query against the database with that object. - * - * @param Zend_Db_Select $dbSelect - * @throws Zend_Auth_Adapter_Exception - when an invalid select - * object is encountered - * @return array - */ - protected function _authenticateQuerySelect(Zend_Db_Select $dbSelect) - { - try { - if ($this->_zendDb->getFetchMode() != Zend_DB::FETCH_ASSOC) { - $origDbFetchMode = $this->_zendDb->getFetchMode(); - $this->_zendDb->setFetchMode(Zend_DB::FETCH_ASSOC); - } - $resultIdentities = $this->_zendDb->fetchAll($dbSelect); - if (isset($origDbFetchMode)) { - $this->_zendDb->setFetchMode($origDbFetchMode); - unset($origDbFetchMode); - } - } catch (Exception $e) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('The supplied parameters to Zend_Auth_Adapter_DbTable failed to ' - . 'produce a valid sql statement, please check table and column names ' - . 'for validity.', 0, $e); - } - return $resultIdentities; - } - - /** - * _authenticateValidateResultSet() - This method attempts to make - * certain that only one record was returned in the resultset - * - * @param array $resultIdentities - * @return true|Zend_Auth_Result - */ - protected function _authenticateValidateResultSet(array $resultIdentities) - { - - if (count($resultIdentities) < 1) { - $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND; - $this->_authenticateResultInfo['messages'][] = 'A record with the supplied identity could not be found.'; - return $this->_authenticateCreateAuthResult(); - } elseif (count($resultIdentities) > 1 && false === $this->getAmbiguityIdentity()) { - $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS; - $this->_authenticateResultInfo['messages'][] = 'More than one record matches the supplied identity.'; - return $this->_authenticateCreateAuthResult(); - } - - return true; - } - - /** - * _authenticateValidateResult() - This method attempts to validate that - * the record in the resultset is indeed a record that matched the - * identity provided to this adapter. - * - * @param array $resultIdentity - * @return Zend_Auth_Result - */ - protected function _authenticateValidateResult($resultIdentity) - { - $zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match'); - - if ($resultIdentity[$zendAuthCredentialMatchColumn] != '1') { - $this->_authenticateResultInfo['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID; - $this->_authenticateResultInfo['messages'][] = 'Supplied credential is invalid.'; - return $this->_authenticateCreateAuthResult(); - } - - unset($resultIdentity[$zendAuthCredentialMatchColumn]); - $this->_resultRow = $resultIdentity; - - $this->_authenticateResultInfo['code'] = Zend_Auth_Result::SUCCESS; - $this->_authenticateResultInfo['messages'][] = 'Authentication successful.'; - return $this->_authenticateCreateAuthResult(); - } - - /** - * _authenticateCreateAuthResult() - Creates a Zend_Auth_Result object from - * the information that has been collected during the authenticate() attempt. - * - * @return Zend_Auth_Result - */ - protected function _authenticateCreateAuthResult() - { - return new Zend_Auth_Result( - $this->_authenticateResultInfo['code'], - $this->_authenticateResultInfo['identity'], - $this->_authenticateResultInfo['messages'] - ); - } - -} diff --git a/library/vendor/Zend/Auth/Adapter/Digest.php b/library/vendor/Zend/Auth/Adapter/Digest.php deleted file mode 100644 index c64dc1de1..000000000 --- a/library/vendor/Zend/Auth/Adapter/Digest.php +++ /dev/null @@ -1,248 +0,0 @@ -$methodName($$option); - } - } - } - - /** - * Returns the filename option value or null if it has not yet been set - * - * @return string|null - */ - public function getFilename() - { - return $this->_filename; - } - - /** - * Sets the filename option value - * - * @param mixed $filename - * @return Zend_Auth_Adapter_Digest Provides a fluent interface - */ - public function setFilename($filename) - { - $this->_filename = (string) $filename; - return $this; - } - - /** - * Returns the realm option value or null if it has not yet been set - * - * @return string|null - */ - public function getRealm() - { - return $this->_realm; - } - - /** - * Sets the realm option value - * - * @param mixed $realm - * @return Zend_Auth_Adapter_Digest Provides a fluent interface - */ - public function setRealm($realm) - { - $this->_realm = (string) $realm; - return $this; - } - - /** - * Returns the username option value or null if it has not yet been set - * - * @return string|null - */ - public function getUsername() - { - return $this->_username; - } - - /** - * Sets the username option value - * - * @param mixed $username - * @return Zend_Auth_Adapter_Digest Provides a fluent interface - */ - public function setUsername($username) - { - $this->_username = (string) $username; - return $this; - } - - /** - * Returns the password option value or null if it has not yet been set - * - * @return string|null - */ - public function getPassword() - { - return $this->_password; - } - - /** - * Sets the password option value - * - * @param mixed $password - * @return Zend_Auth_Adapter_Digest Provides a fluent interface - */ - public function setPassword($password) - { - $this->_password = (string) $password; - return $this; - } - - /** - * Defined by Zend_Auth_Adapter_Interface - * - * @throws Zend_Auth_Adapter_Exception - * @return Zend_Auth_Result - */ - public function authenticate() - { - $optionsRequired = array('filename', 'realm', 'username', 'password'); - foreach ($optionsRequired as $optionRequired) { - if (null === $this->{"_$optionRequired"}) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception("Option '$optionRequired' must be set before authentication"); - } - } - - if (false === ($fileHandle = @fopen($this->_filename, 'r'))) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception("Cannot open '$this->_filename' for reading"); - } - - $id = "$this->_username:$this->_realm"; - $idLength = strlen($id); - - $result = array( - 'code' => Zend_Auth_Result::FAILURE, - 'identity' => array( - 'realm' => $this->_realm, - 'username' => $this->_username, - ), - 'messages' => array() - ); - - while ($line = trim(fgets($fileHandle))) { - if (substr($line, 0, $idLength) === $id) { - if ($this->_secureStringCompare(substr($line, -32), md5("$this->_username:$this->_realm:$this->_password"))) { - $result['code'] = Zend_Auth_Result::SUCCESS; - } else { - $result['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID; - $result['messages'][] = 'Password incorrect'; - } - return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']); - } - } - - $result['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND; - $result['messages'][] = "Username '$this->_username' and realm '$this->_realm' combination not found"; - return new Zend_Auth_Result($result['code'], $result['identity'], $result['messages']); - } - - /** - * Securely compare two strings for equality while avoided C level memcmp() - * optimisations capable of leaking timing information useful to an attacker - * attempting to iteratively guess the unknown string (e.g. password) being - * compared against. - * - * @param string $a - * @param string $b - * @return bool - */ - protected function _secureStringCompare($a, $b) - { - if (strlen($a) !== strlen($b)) { - return false; - } - $result = 0; - for ($i = 0; $i < strlen($a); $i++) { - $result |= ord($a[$i]) ^ ord($b[$i]); - } - return $result == 0; - } -} diff --git a/library/vendor/Zend/Auth/Adapter/Exception.php b/library/vendor/Zend/Auth/Adapter/Exception.php deleted file mode 100644 index 28e4b7067..000000000 --- a/library/vendor/Zend/Auth/Adapter/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ - 'basic'|'digest'|'basic digest' - * 'realm' => - * 'digest_domains' => Space-delimited list of URIs - * 'nonce_timeout' => - * 'use_opaque' => Whether to send the opaque value in the header - * 'alogrithm' => See $_supportedAlgos. Default: MD5 - * 'proxy_auth' => Whether to do authentication as a Proxy - * @throws Zend_Auth_Adapter_Exception - */ - public function __construct(array $config) - { - if (!extension_loaded('hash')) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception(__CLASS__ . ' requires the \'hash\' extension'); - } - - $this->_request = null; - $this->_response = null; - $this->_ieNoOpaque = false; - - - if (empty($config['accept_schemes'])) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Config key \'accept_schemes\' is required'); - } - - $schemes = explode(' ', $config['accept_schemes']); - $this->_acceptSchemes = array_intersect($schemes, $this->_supportedSchemes); - if (empty($this->_acceptSchemes)) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('No supported schemes given in \'accept_schemes\'. Valid values: ' - . implode(', ', $this->_supportedSchemes)); - } - - // Double-quotes are used to delimit the realm string in the HTTP header, - // and colons are field delimiters in the password file. - if (empty($config['realm']) || - !ctype_print($config['realm']) || - strpos($config['realm'], ':') !== false || - strpos($config['realm'], '"') !== false) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Config key \'realm\' is required, and must contain only printable ' - . 'characters, excluding quotation marks and colons'); - } else { - $this->_realm = $config['realm']; - } - - if (in_array('digest', $this->_acceptSchemes)) { - if (empty($config['digest_domains']) || - !ctype_print($config['digest_domains']) || - strpos($config['digest_domains'], '"') !== false) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Config key \'digest_domains\' is required, and must contain ' - . 'only printable characters, excluding quotation marks'); - } else { - $this->_domains = $config['digest_domains']; - } - - if (empty($config['nonce_timeout']) || - !is_numeric($config['nonce_timeout'])) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Config key \'nonce_timeout\' is required, and must be an ' - . 'integer'); - } else { - $this->_nonceTimeout = (int) $config['nonce_timeout']; - } - - // We use the opaque value unless explicitly told not to - if (isset($config['use_opaque']) && false == (bool) $config['use_opaque']) { - $this->_useOpaque = false; - } else { - $this->_useOpaque = true; - } - - if (isset($config['algorithm']) && in_array($config['algorithm'], $this->_supportedAlgos)) { - $this->_algo = $config['algorithm']; - } else { - $this->_algo = 'MD5'; - } - } - - // Don't be a proxy unless explicitly told to do so - if (isset($config['proxy_auth']) && true == (bool) $config['proxy_auth']) { - $this->_imaProxy = true; // I'm a Proxy - } else { - $this->_imaProxy = false; - } - } - - /** - * Setter for the _basicResolver property - * - * @param Zend_Auth_Adapter_Http_Resolver_Interface $resolver - * @return Zend_Auth_Adapter_Http Provides a fluent interface - */ - public function setBasicResolver(Zend_Auth_Adapter_Http_Resolver_Interface $resolver) - { - $this->_basicResolver = $resolver; - - return $this; - } - - /** - * Getter for the _basicResolver property - * - * @return Zend_Auth_Adapter_Http_Resolver_Interface - */ - public function getBasicResolver() - { - return $this->_basicResolver; - } - - /** - * Setter for the _digestResolver property - * - * @param Zend_Auth_Adapter_Http_Resolver_Interface $resolver - * @return Zend_Auth_Adapter_Http Provides a fluent interface - */ - public function setDigestResolver(Zend_Auth_Adapter_Http_Resolver_Interface $resolver) - { - $this->_digestResolver = $resolver; - - return $this; - } - - /** - * Getter for the _digestResolver property - * - * @return Zend_Auth_Adapter_Http_Resolver_Interface - */ - public function getDigestResolver() - { - return $this->_digestResolver; - } - - /** - * Setter for the Request object - * - * @param Zend_Controller_Request_Http $request - * @return Zend_Auth_Adapter_Http Provides a fluent interface - */ - public function setRequest(Zend_Controller_Request_Http $request) - { - $this->_request = $request; - - return $this; - } - - /** - * Getter for the Request object - * - * @return Zend_Controller_Request_Http - */ - public function getRequest() - { - return $this->_request; - } - - /** - * Setter for the Response object - * - * @param Zend_Controller_Response_Http $response - * @return Zend_Auth_Adapter_Http Provides a fluent interface - */ - public function setResponse(Zend_Controller_Response_Http $response) - { - $this->_response = $response; - - return $this; - } - - /** - * Getter for the Response object - * - * @return Zend_Controller_Response_Http - */ - public function getResponse() - { - return $this->_response; - } - - /** - * Authenticate - * - * @throws Zend_Auth_Adapter_Exception - * @return Zend_Auth_Result - */ - public function authenticate() - { - if (empty($this->_request) || - empty($this->_response)) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Request and Response objects must be set before calling ' - . 'authenticate()'); - } - - if ($this->_imaProxy) { - $getHeader = 'Proxy-Authorization'; - } else { - $getHeader = 'Authorization'; - } - - $authHeader = $this->_request->getHeader($getHeader); - if (!$authHeader) { - return $this->_challengeClient(); - } - - list($clientScheme) = explode(' ', $authHeader); - $clientScheme = strtolower($clientScheme); - - // The server can issue multiple challenges, but the client should - // answer with only the selected auth scheme. - if (!in_array($clientScheme, $this->_supportedSchemes)) { - $this->_response->setHttpResponseCode(400); - return new Zend_Auth_Result( - Zend_Auth_Result::FAILURE_UNCATEGORIZED, - array(), - array('Client requested an incorrect or unsupported authentication scheme') - ); - } - - // client sent a scheme that is not the one required - if (!in_array($clientScheme, $this->_acceptSchemes)) { - // challenge again the client - return $this->_challengeClient(); - } - - switch ($clientScheme) { - case 'basic': - $result = $this->_basicAuth($authHeader); - break; - case 'digest': - $result = $this->_digestAuth($authHeader); - break; - default: - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Unsupported authentication scheme'); - } - - return $result; - } - - /** - * Challenge Client - * - * Sets a 401 or 407 Unauthorized response code, and creates the - * appropriate Authenticate header(s) to prompt for credentials. - * - * @return Zend_Auth_Result Always returns a non-identity Auth result - */ - protected function _challengeClient() - { - if ($this->_imaProxy) { - $statusCode = 407; - $headerName = 'Proxy-Authenticate'; - } else { - $statusCode = 401; - $headerName = 'WWW-Authenticate'; - } - - $this->_response->setHttpResponseCode($statusCode); - - // Send a challenge in each acceptable authentication scheme - if (in_array('basic', $this->_acceptSchemes)) { - $this->_response->setHeader($headerName, $this->_basicHeader()); - } - if (in_array('digest', $this->_acceptSchemes)) { - $this->_response->setHeader($headerName, $this->_digestHeader()); - } - return new Zend_Auth_Result( - Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, - array(), - array('Invalid or absent credentials; challenging client') - ); - } - - /** - * Basic Header - * - * Generates a Proxy- or WWW-Authenticate header value in the Basic - * authentication scheme. - * - * @return string Authenticate header value - */ - protected function _basicHeader() - { - return 'Basic realm="' . $this->_realm . '"'; - } - - /** - * Digest Header - * - * Generates a Proxy- or WWW-Authenticate header value in the Digest - * authentication scheme. - * - * @return string Authenticate header value - */ - protected function _digestHeader() - { - $wwwauth = 'Digest realm="' . $this->_realm . '", ' - . 'domain="' . $this->_domains . '", ' - . 'nonce="' . $this->_calcNonce() . '", ' - . ($this->_useOpaque ? 'opaque="' . $this->_calcOpaque() . '", ' : '') - . 'algorithm="' . $this->_algo . '", ' - . 'qop="' . implode(',', $this->_supportedQops) . '"'; - - return $wwwauth; - } - - /** - * Basic Authentication - * - * @param string $header Client's Authorization header - * @throws Zend_Auth_Adapter_Exception - * @return Zend_Auth_Result - */ - protected function _basicAuth($header) - { - if (empty($header)) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('The value of the client Authorization header is required'); - } - if (empty($this->_basicResolver)) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('A basicResolver object must be set before doing Basic ' - . 'authentication'); - } - - // Decode the Authorization header - $auth = substr($header, strlen('Basic ')); - $auth = base64_decode($auth); - if (!$auth) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Unable to base64_decode Authorization header value'); - } - - // See ZF-1253. Validate the credentials the same way the digest - // implementation does. If invalid credentials are detected, - // re-challenge the client. - if (!ctype_print($auth)) { - return $this->_challengeClient(); - } - // Fix for ZF-1515: Now re-challenges on empty username or password - $creds = array_filter(explode(':', $auth)); - if (count($creds) != 2) { - return $this->_challengeClient(); - } - - $password = $this->_basicResolver->resolve($creds[0], $this->_realm); - if ($password && $this->_secureStringCompare($password, $creds[1])) { - $identity = array('username'=>$creds[0], 'realm'=>$this->_realm); - return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity); - } else { - return $this->_challengeClient(); - } - } - - /** - * Digest Authentication - * - * @param string $header Client's Authorization header - * @throws Zend_Auth_Adapter_Exception - * @return Zend_Auth_Result Valid auth result only on successful auth - */ - protected function _digestAuth($header) - { - if (empty($header)) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('The value of the client Authorization header is required'); - } - if (empty($this->_digestResolver)) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('A digestResolver object must be set before doing Digest authentication'); - } - - $data = $this->_parseDigestAuth($header); - if ($data === false) { - $this->_response->setHttpResponseCode(400); - return new Zend_Auth_Result( - Zend_Auth_Result::FAILURE_UNCATEGORIZED, - array(), - array('Invalid Authorization header format') - ); - } - - // See ZF-1052. This code was a bit too unforgiving of invalid - // usernames. Now, if the username is bad, we re-challenge the client. - if ('::invalid::' == $data['username']) { - return $this->_challengeClient(); - } - - // Verify that the client sent back the same nonce - if ($this->_calcNonce() != $data['nonce']) { - return $this->_challengeClient(); - } - // The opaque value is also required to match, but of course IE doesn't - // play ball. - if (!$this->_ieNoOpaque && $this->_calcOpaque() != $data['opaque']) { - return $this->_challengeClient(); - } - - // Look up the user's password hash. If not found, deny access. - // This makes no assumptions about how the password hash was - // constructed beyond that it must have been built in such a way as - // to be recreatable with the current settings of this object. - $ha1 = $this->_digestResolver->resolve($data['username'], $data['realm']); - if ($ha1 === false) { - return $this->_challengeClient(); - } - - // If MD5-sess is used, a1 value is made of the user's password - // hash with the server and client nonce appended, separated by - // colons. - if ($this->_algo == 'MD5-sess') { - $ha1 = hash('md5', $ha1 . ':' . $data['nonce'] . ':' . $data['cnonce']); - } - - // Calculate h(a2). The value of this hash depends on the qop - // option selected by the client and the supported hash functions - switch ($data['qop']) { - case 'auth': - $a2 = $this->_request->getMethod() . ':' . $data['uri']; - break; - case 'auth-int': - // Should be REQUEST_METHOD . ':' . uri . ':' . hash(entity-body), - // but this isn't supported yet, so fall through to default case - default: - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Client requested an unsupported qop option'); - } - // Using hash() should make parameterizing the hash algorithm - // easier - $ha2 = hash('md5', $a2); - - - // Calculate the server's version of the request-digest. This must - // match $data['response']. See RFC 2617, section 3.2.2.1 - $message = $data['nonce'] . ':' . $data['nc'] . ':' . $data['cnonce'] . ':' . $data['qop'] . ':' . $ha2; - $digest = hash('md5', $ha1 . ':' . $message); - - // If our digest matches the client's let them in, otherwise return - // a 401 code and exit to prevent access to the protected resource. - if ($this->_secureStringCompare($digest, $data['response'])) { - $identity = array('username'=>$data['username'], 'realm'=>$data['realm']); - return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity); - } else { - return $this->_challengeClient(); - } - } - - /** - * Calculate Nonce - * - * @return string The nonce value - */ - protected function _calcNonce() - { - // Once subtle consequence of this timeout calculation is that it - // actually divides all of time into _nonceTimeout-sized sections, such - // that the value of timeout is the point in time of the next - // approaching "boundary" of a section. This allows the server to - // consistently generate the same timeout (and hence the same nonce - // value) across requests, but only as long as one of those - // "boundaries" is not crossed between requests. If that happens, the - // nonce will change on its own, and effectively log the user out. This - // would be surprising if the user just logged in. - $timeout = ceil(time() / $this->_nonceTimeout) * $this->_nonceTimeout; - - $nonce = hash('md5', $timeout . ':' . $this->_request->getServer('HTTP_USER_AGENT') . ':' . __CLASS__); - return $nonce; - } - - /** - * Calculate Opaque - * - * The opaque string can be anything; the client must return it exactly as - * it was sent. It may be useful to store data in this string in some - * applications. Ideally, a new value for this would be generated each time - * a WWW-Authenticate header is sent (in order to reduce predictability), - * but we would have to be able to create the same exact value across at - * least two separate requests from the same client. - * - * @return string The opaque value - */ - protected function _calcOpaque() - { - return hash('md5', 'Opaque Data:' . __CLASS__); - } - - /** - * Parse Digest Authorization header - * - * @param string $header Client's Authorization: HTTP header - * @return array|false Data elements from header, or false if any part of - * the header is invalid - */ - protected function _parseDigestAuth($header) - { - $temp = null; - $data = array(); - - // See ZF-1052. Detect invalid usernames instead of just returning a - // 400 code. - $ret = preg_match('/username="([^"]+)"/', $header, $temp); - if (!$ret || empty($temp[1]) - || !ctype_print($temp[1]) - || strpos($temp[1], ':') !== false) { - $data['username'] = '::invalid::'; - } else { - $data['username'] = $temp[1]; - } - $temp = null; - - $ret = preg_match('/realm="([^"]+)"/', $header, $temp); - if (!$ret || empty($temp[1])) { - return false; - } - if (!ctype_print($temp[1]) || strpos($temp[1], ':') !== false) { - return false; - } else { - $data['realm'] = $temp[1]; - } - $temp = null; - - $ret = preg_match('/nonce="([^"]+)"/', $header, $temp); - if (!$ret || empty($temp[1])) { - return false; - } - if (!ctype_xdigit($temp[1])) { - return false; - } else { - $data['nonce'] = $temp[1]; - } - $temp = null; - - $ret = preg_match('/uri="([^"]+)"/', $header, $temp); - if (!$ret || empty($temp[1])) { - return false; - } - // Section 3.2.2.5 in RFC 2617 says the authenticating server must - // verify that the URI field in the Authorization header is for the - // same resource requested in the Request Line. - $rUri = @parse_url($this->_request->getRequestUri()); - $cUri = @parse_url($temp[1]); - if (false === $rUri || false === $cUri) { - return false; - } else { - // Make sure the path portion of both URIs is the same - if ($rUri['path'] != $cUri['path']) { - return false; - } - // Section 3.2.2.5 seems to suggest that the value of the URI - // Authorization field should be made into an absolute URI if the - // Request URI is absolute, but it's vague, and that's a bunch of - // code I don't want to write right now. - $data['uri'] = $temp[1]; - } - $temp = null; - - $ret = preg_match('/response="([^"]+)"/', $header, $temp); - if (!$ret || empty($temp[1])) { - return false; - } - if (32 != strlen($temp[1]) || !ctype_xdigit($temp[1])) { - return false; - } else { - $data['response'] = $temp[1]; - } - $temp = null; - - // The spec says this should default to MD5 if omitted. OK, so how does - // that square with the algo we send out in the WWW-Authenticate header, - // if it can easily be overridden by the client? - $ret = preg_match('/algorithm="?(' . $this->_algo . ')"?/', $header, $temp); - if ($ret && !empty($temp[1]) - && in_array($temp[1], $this->_supportedAlgos)) { - $data['algorithm'] = $temp[1]; - } else { - $data['algorithm'] = 'MD5'; // = $this->_algo; ? - } - $temp = null; - - // Not optional in this implementation - $ret = preg_match('/cnonce="([^"]+)"/', $header, $temp); - if (!$ret || empty($temp[1])) { - return false; - } - if (!ctype_print($temp[1])) { - return false; - } else { - $data['cnonce'] = $temp[1]; - } - $temp = null; - - // If the server sent an opaque value, the client must send it back - if ($this->_useOpaque) { - $ret = preg_match('/opaque="([^"]+)"/', $header, $temp); - if (!$ret || empty($temp[1])) { - - // Big surprise: IE isn't RFC 2617-compliant. - if (false !== strpos($this->_request->getHeader('User-Agent'), 'MSIE')) { - $temp[1] = ''; - $this->_ieNoOpaque = true; - } else { - return false; - } - } - // This implementation only sends MD5 hex strings in the opaque value - if (!$this->_ieNoOpaque && - (32 != strlen($temp[1]) || !ctype_xdigit($temp[1]))) { - return false; - } else { - $data['opaque'] = $temp[1]; - } - $temp = null; - } - - // Not optional in this implementation, but must be one of the supported - // qop types - $ret = preg_match('/qop="?(' . implode('|', $this->_supportedQops) . ')"?/', $header, $temp); - if (!$ret || empty($temp[1])) { - return false; - } - if (!in_array($temp[1], $this->_supportedQops)) { - return false; - } else { - $data['qop'] = $temp[1]; - } - $temp = null; - - // Not optional in this implementation. The spec says this value - // shouldn't be a quoted string, but apparently some implementations - // quote it anyway. See ZF-1544. - $ret = preg_match('/nc="?([0-9A-Fa-f]{8})"?/', $header, $temp); - if (!$ret || empty($temp[1])) { - return false; - } - if (8 != strlen($temp[1]) || !ctype_xdigit($temp[1])) { - return false; - } else { - $data['nc'] = $temp[1]; - } - $temp = null; - - return $data; - } - - /** - * Securely compare two strings for equality while avoided C level memcmp() - * optimisations capable of leaking timing information useful to an attacker - * attempting to iteratively guess the unknown string (e.g. password) being - * compared against. - * - * @param string $a - * @param string $b - * @return bool - */ - protected function _secureStringCompare($a, $b) - { - if (strlen($a) !== strlen($b)) { - return false; - } - $result = 0; - for ($i = 0; $i < strlen($a); $i++) { - $result |= ord($a[$i]) ^ ord($b[$i]); - } - return $result == 0; - } -} diff --git a/library/vendor/Zend/Auth/Adapter/Http/Resolver/Exception.php b/library/vendor/Zend/Auth/Adapter/Http/Resolver/Exception.php deleted file mode 100644 index 76aa2506b..000000000 --- a/library/vendor/Zend/Auth/Adapter/Http/Resolver/Exception.php +++ /dev/null @@ -1,39 +0,0 @@ -setFile($path); - } - } - - /** - * Set the path to the credentials file - * - * @param string $path - * @throws Zend_Auth_Adapter_Http_Resolver_Exception - * @return Zend_Auth_Adapter_Http_Resolver_File Provides a fluent interface - */ - public function setFile($path) - { - if (empty($path) || !is_readable($path)) { - /** - * @see Zend_Auth_Adapter_Http_Resolver_Exception - */ - throw new Zend_Auth_Adapter_Http_Resolver_Exception('Path not readable: ' . $path); - } - $this->_file = $path; - - return $this; - } - - /** - * Returns the path to the credentials file - * - * @return string - */ - public function getFile() - { - return $this->_file; - } - - /** - * Resolve credentials - * - * Only the first matching username/realm combination in the file is - * returned. If the file contains credentials for Digest authentication, - * the returned string is the password hash, or h(a1) from RFC 2617. The - * returned string is the plain-text password for Basic authentication. - * - * The expected format of the file is: - * username:realm:sharedSecret - * - * That is, each line consists of the user's username, the applicable - * authentication realm, and the password or hash, each delimited by - * colons. - * - * @param string $username Username - * @param string $realm Authentication Realm - * @throws Zend_Auth_Adapter_Http_Resolver_Exception - * @return string|false User's shared secret, if the user is found in the - * realm, false otherwise. - */ - public function resolve($username, $realm) - { - if (empty($username)) { - /** - * @see Zend_Auth_Adapter_Http_Resolver_Exception - */ - throw new Zend_Auth_Adapter_Http_Resolver_Exception('Username is required'); - } else if (!ctype_print($username) || strpos($username, ':') !== false) { - /** - * @see Zend_Auth_Adapter_Http_Resolver_Exception - */ - throw new Zend_Auth_Adapter_Http_Resolver_Exception('Username must consist only of printable characters, ' - . 'excluding the colon'); - } - if (empty($realm)) { - /** - * @see Zend_Auth_Adapter_Http_Resolver_Exception - */ - throw new Zend_Auth_Adapter_Http_Resolver_Exception('Realm is required'); - } else if (!ctype_print($realm) || strpos($realm, ':') !== false) { - /** - * @see Zend_Auth_Adapter_Http_Resolver_Exception - */ - throw new Zend_Auth_Adapter_Http_Resolver_Exception('Realm must consist only of printable characters, ' - . 'excluding the colon.'); - } - - // Open file, read through looking for matching credentials - $fp = @fopen($this->_file, 'r'); - if (!$fp) { - /** - * @see Zend_Auth_Adapter_Http_Resolver_Exception - */ - throw new Zend_Auth_Adapter_Http_Resolver_Exception('Unable to open password file: ' . $this->_file); - } - - // No real validation is done on the contents of the password file. The - // assumption is that we trust the administrators to keep it secure. - while (($line = fgetcsv($fp, 512, ':')) !== false) { - if ($line[0] == $username && $line[1] == $realm) { - $password = $line[2]; - fclose($fp); - return $password; - } - } - - fclose($fp); - return false; - } -} diff --git a/library/vendor/Zend/Auth/Adapter/Http/Resolver/Interface.php b/library/vendor/Zend/Auth/Adapter/Http/Resolver/Interface.php deleted file mode 100644 index 4326ee820..000000000 --- a/library/vendor/Zend/Auth/Adapter/Http/Resolver/Interface.php +++ /dev/null @@ -1,47 +0,0 @@ -setOptions($options); - if ($username !== null) { - $this->setUsername($username); - } - if ($password !== null) { - $this->setPassword($password); - } - } - - /** - * Returns the array of arrays of Zend_Ldap options of this adapter. - * - * @return array|null - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Sets the array of arrays of Zend_Ldap options to be used by - * this adapter. - * - * @param array $options The array of arrays of Zend_Ldap options - * @return Zend_Auth_Adapter_Ldap Provides a fluent interface - */ - public function setOptions($options) - { - $this->_options = is_array($options) ? $options : array(); - return $this; - } - - /** - * Returns the username of the account being authenticated, or - * NULL if none is set. - * - * @return string|null - */ - public function getUsername() - { - return $this->_username; - } - - /** - * Sets the username for binding - * - * @param string $username The username for binding - * @return Zend_Auth_Adapter_Ldap Provides a fluent interface - */ - public function setUsername($username) - { - $this->_username = (string) $username; - return $this; - } - - /** - * Returns the password of the account being authenticated, or - * NULL if none is set. - * - * @return string|null - */ - public function getPassword() - { - return $this->_password; - } - - /** - * Sets the passwort for the account - * - * @param string $password The password of the account being authenticated - * @return Zend_Auth_Adapter_Ldap Provides a fluent interface - */ - public function setPassword($password) - { - $this->_password = (string) $password; - return $this; - } - - /** - * setIdentity() - set the identity (username) to be used - * - * Proxies to {@see setUsername()} - * - * Closes ZF-6813 - * - * @param string $identity - * @return Zend_Auth_Adapter_Ldap Provides a fluent interface - */ - public function setIdentity($identity) - { - return $this->setUsername($identity); - } - - /** - * setCredential() - set the credential (password) value to be used - * - * Proxies to {@see setPassword()} - * - * Closes ZF-6813 - * - * @param string $credential - * @return Zend_Auth_Adapter_Ldap Provides a fluent interface - */ - public function setCredential($credential) - { - return $this->setPassword($credential); - } - - /** - * Returns the LDAP Object - * - * @return Zend_Ldap The Zend_Ldap object used to authenticate the credentials - */ - public function getLdap() - { - if ($this->_ldap === null) { - /** - * @see Zend_Ldap - */ - $this->_ldap = new Zend_Ldap(); - } - - return $this->_ldap; - } - - /** - * Set an Ldap connection - * - * @param Zend_Ldap $ldap An existing Ldap object - * @return Zend_Auth_Adapter_Ldap Provides a fluent interface - */ - public function setLdap(Zend_Ldap $ldap) - { - $this->_ldap = $ldap; - - $this->setOptions(array($ldap->getOptions())); - - return $this; - } - - /** - * Returns a domain name for the current LDAP options. This is used - * for skipping redundant operations (e.g. authentications). - * - * @return string - */ - protected function _getAuthorityName() - { - $options = $this->getLdap()->getOptions(); - $name = $options['accountDomainName']; - if (!$name) - $name = $options['accountDomainNameShort']; - return $name ? $name : ''; - } - - /** - * Authenticate the user - * - * @throws Zend_Auth_Adapter_Exception - * @return Zend_Auth_Result - */ - public function authenticate() - { - /** - * @see Zend_Ldap_Exception - */ - - $messages = array(); - $messages[0] = ''; // reserved - $messages[1] = ''; // reserved - - $username = $this->_username; - $password = $this->_password; - - if (!$username) { - $code = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND; - $messages[0] = 'A username is required'; - return new Zend_Auth_Result($code, '', $messages); - } - if (!$password) { - /* A password is required because some servers will - * treat an empty password as an anonymous bind. - */ - $code = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID; - $messages[0] = 'A password is required'; - return new Zend_Auth_Result($code, '', $messages); - } - - $ldap = $this->getLdap(); - - $code = Zend_Auth_Result::FAILURE; - $messages[0] = "Authority not found: $username"; - $failedAuthorities = array(); - - /* Iterate through each server and try to authenticate the supplied - * credentials against it. - */ - foreach ($this->_options as $name => $options) { - - if (!is_array($options)) { - /** - * @see Zend_Auth_Adapter_Exception - */ - throw new Zend_Auth_Adapter_Exception('Adapter options array not an array'); - } - $adapterOptions = $this->_prepareOptions($ldap, $options); - $dname = ''; - - try { - if ($messages[1]) - $messages[] = $messages[1]; - $messages[1] = ''; - $messages[] = $this->_optionsToString($options); - - $dname = $this->_getAuthorityName(); - if (isset($failedAuthorities[$dname])) { - /* If multiple sets of server options for the same domain - * are supplied, we want to skip redundant authentications - * where the identity or credentials where found to be - * invalid with another server for the same domain. The - * $failedAuthorities array tracks this condition (and also - * serves to supply the original error message). - * This fixes issue ZF-4093. - */ - $messages[1] = $failedAuthorities[$dname]; - $messages[] = "Skipping previously failed authority: $dname"; - continue; - } - - $canonicalName = $ldap->getCanonicalAccountName($username); - $ldap->bind($canonicalName, $password); - /* - * Fixes problem when authenticated user is not allowed to retrieve - * group-membership information or own account. - * This requires that the user specified with "username" and optionally - * "password" in the Zend_Ldap options is able to retrieve the required - * information. - */ - $requireRebind = false; - if (isset($options['username'])) { - $ldap->bind(); - $requireRebind = true; - } - $dn = $ldap->getCanonicalAccountName($canonicalName, Zend_Ldap::ACCTNAME_FORM_DN); - - $groupResult = $this->_checkGroupMembership($ldap, $canonicalName, $dn, $adapterOptions); - if ($groupResult === true) { - $this->_authenticatedDn = $dn; - $messages[0] = ''; - $messages[1] = ''; - $messages[] = "$canonicalName authentication successful"; - if ($requireRebind === true) { - // rebinding with authenticated user - $ldap->bind($dn, $password); - } - return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $canonicalName, $messages); - } else { - $messages[0] = 'Account is not a member of the specified group'; - $messages[1] = $groupResult; - $failedAuthorities[$dname] = $groupResult; - } - } catch (Zend_Ldap_Exception $zle) { - - /* LDAP based authentication is notoriously difficult to diagnose. Therefore - * we bend over backwards to capture and record every possible bit of - * information when something goes wrong. - */ - - $err = $zle->getCode(); - - if ($err == Zend_Ldap_Exception::LDAP_X_DOMAIN_MISMATCH) { - /* This error indicates that the domain supplied in the - * username did not match the domains in the server options - * and therefore we should just skip to the next set of - * server options. - */ - continue; - } else if ($err == Zend_Ldap_Exception::LDAP_NO_SUCH_OBJECT) { - $code = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND; - $messages[0] = "Account not found: $username"; - $failedAuthorities[$dname] = $zle->getMessage(); - } else if ($err == Zend_Ldap_Exception::LDAP_INVALID_CREDENTIALS) { - $code = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID; - $messages[0] = 'Invalid credentials'; - $failedAuthorities[$dname] = $zle->getMessage(); - } else { - $line = $zle->getLine(); - $messages[] = $zle->getFile() . "($line): " . $zle->getMessage(); - $messages[] = preg_replace( - '/\b'.preg_quote(substr($password, 0, 15), '/').'\b/', - '*****', - $zle->getTraceAsString() - ); - $messages[0] = 'An unexpected failure occurred'; - } - $messages[1] = $zle->getMessage(); - } - } - - $msg = isset($messages[1]) ? $messages[1] : $messages[0]; - $messages[] = "$username authentication failed: $msg"; - - return new Zend_Auth_Result($code, $username, $messages); - } - - /** - * Sets the LDAP specific options on the Zend_Ldap instance - * - * @param Zend_Ldap $ldap - * @param array $options - * @return array of auth-adapter specific options - */ - protected function _prepareOptions(Zend_Ldap $ldap, array $options) - { - $adapterOptions = array( - 'group' => null, - 'groupDn' => $ldap->getBaseDn(), - 'groupScope' => Zend_Ldap::SEARCH_SCOPE_SUB, - 'groupAttr' => 'cn', - 'groupFilter' => 'objectClass=groupOfUniqueNames', - 'memberAttr' => 'uniqueMember', - 'memberIsDn' => true - ); - foreach ($adapterOptions as $key => $value) { - if (array_key_exists($key, $options)) { - $value = $options[$key]; - unset($options[$key]); - switch ($key) { - case 'groupScope': - $value = (int)$value; - if (in_array($value, array(Zend_Ldap::SEARCH_SCOPE_BASE, - Zend_Ldap::SEARCH_SCOPE_ONE, Zend_Ldap::SEARCH_SCOPE_SUB), true)) { - $adapterOptions[$key] = $value; - } - break; - case 'memberIsDn': - $adapterOptions[$key] = ($value === true || - $value === '1' || strcasecmp($value, 'true') == 0); - break; - default: - $adapterOptions[$key] = trim($value); - break; - } - } - } - $ldap->setOptions($options); - return $adapterOptions; - } - - /** - * Checks the group membership of the bound user - * - * @param Zend_Ldap $ldap - * @param string $canonicalName - * @param string $dn - * @param array $adapterOptions - * @return string|true - */ - protected function _checkGroupMembership(Zend_Ldap $ldap, $canonicalName, $dn, array $adapterOptions) - { - if ($adapterOptions['group'] === null) { - return true; - } - - if ($adapterOptions['memberIsDn'] === false) { - $user = $canonicalName; - } else { - $user = $dn; - } - - /** - * @see Zend_Ldap_Filter - */ - $groupName = Zend_Ldap_Filter::equals($adapterOptions['groupAttr'], $adapterOptions['group']); - $membership = Zend_Ldap_Filter::equals($adapterOptions['memberAttr'], $user); - $group = Zend_Ldap_Filter::andFilter($groupName, $membership); - $groupFilter = $adapterOptions['groupFilter']; - if (!empty($groupFilter)) { - $group = $group->addAnd($groupFilter); - } - - $result = $ldap->count($group, $adapterOptions['groupDn'], $adapterOptions['groupScope']); - - if ($result === 1) { - return true; - } else { - return 'Failed to verify group membership with ' . $group->toString(); - } - } - - /** - * getAccountObject() - Returns the result entry as a stdClass object - * - * This resembles the feature {@see Zend_Auth_Adapter_DbTable::getResultRowObject()}. - * Closes ZF-6813 - * - * @param array $returnAttribs - * @param array $omitAttribs - * @return stdClass|boolean - */ - public function getAccountObject(array $returnAttribs = array(), array $omitAttribs = array()) - { - if (!$this->_authenticatedDn) { - return false; - } - - $returnObject = new stdClass(); - - $returnAttribs = array_map('strtolower', $returnAttribs); - $omitAttribs = array_map('strtolower', $omitAttribs); - $returnAttribs = array_diff($returnAttribs, $omitAttribs); - - $entry = $this->getLdap()->getEntry($this->_authenticatedDn, $returnAttribs, true); - foreach ($entry as $attr => $value) { - if (in_array($attr, $omitAttribs)) { - // skip attributes marked to be omitted - continue; - } - if (is_array($value)) { - $returnObject->$attr = (count($value) > 1) ? $value : $value[0]; - } else { - $returnObject->$attr = $value; - } - } - return $returnObject; - } - - /** - * Converts options to string - * - * @param array $options - * @return string - */ - private function _optionsToString(array $options) - { - $str = ''; - foreach ($options as $key => $val) { - if ($key === 'password') - $val = '*****'; - if ($str) - $str .= ','; - $str .= $key . '=' . $val; - } - return $str; - } -} diff --git a/library/vendor/Zend/Auth/Adapter/OpenId.php b/library/vendor/Zend/Auth/Adapter/OpenId.php deleted file mode 100644 index c3fda57e0..000000000 --- a/library/vendor/Zend/Auth/Adapter/OpenId.php +++ /dev/null @@ -1,281 +0,0 @@ -_id = $id; - $this->_storage = $storage; - $this->_returnTo = $returnTo; - $this->_root = $root; - $this->_extensions = $extensions; - $this->_response = $response; - } - - /** - * Sets the value to be used as the identity - * - * @param string $id the identity value - * @return Zend_Auth_Adapter_OpenId Provides a fluent interface - */ - public function setIdentity($id) - { - $this->_id = $id; - return $this; - } - - /** - * Sets the storage implementation which will be use by OpenId - * - * @param Zend_OpenId_Consumer_Storage $storage - * @return Zend_Auth_Adapter_OpenId Provides a fluent interface - */ - public function setStorage(Zend_OpenId_Consumer_Storage $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * Sets the HTTP URL to redirect response from server to - * - * @param string $returnTo - * @return Zend_Auth_Adapter_OpenId Provides a fluent interface - */ - public function setReturnTo($returnTo) - { - $this->_returnTo = $returnTo; - return $this; - } - - /** - * Sets HTTP URL to identify consumer on server - * - * @param string $root - * @return Zend_Auth_Adapter_OpenId Provides a fluent interface - */ - public function setRoot($root) - { - $this->_root = $root; - return $this; - } - - /** - * Sets OpenID extension(s) - * - * @param mixed $extensions - * @return Zend_Auth_Adapter_OpenId Provides a fluent interface - */ - public function setExtensions($extensions) - { - $this->_extensions = $extensions; - return $this; - } - - /** - * Sets an optional response object to perform HTTP or HTML form redirection - * - * @param string $response - * @return Zend_Auth_Adapter_OpenId Provides a fluent interface - */ - public function setResponse($response) - { - $this->_response = $response; - return $this; - } - - /** - * Enables or disables interaction with user during authentication on - * OpenID provider. - * - * @param bool $check_immediate - * @return Zend_Auth_Adapter_OpenId Provides a fluent interface - */ - public function setCheckImmediate($check_immediate) - { - $this->_check_immediate = $check_immediate; - return $this; - } - - /** - * Sets HTTP client object to make HTTP requests - * - * @param Zend_Http_Client $client HTTP client object to be used - */ - public function setHttpClient($client) { - $this->_httpClient = $client; - } - - /** - * Authenticates the given OpenId identity. - * Defined by Zend_Auth_Adapter_Interface. - * - * @throws Zend_Auth_Adapter_Exception If answering the authentication query is impossible - * @return Zend_Auth_Result - */ - public function authenticate() { - $id = $this->_id; - if (!empty($id)) { - $consumer = new Zend_OpenId_Consumer($this->_storage); - $consumer->setHttpClient($this->_httpClient); - /* login() is never returns on success */ - if (!$this->_check_immediate) { - if (!$consumer->login($id, - $this->_returnTo, - $this->_root, - $this->_extensions, - $this->_response)) { - return new Zend_Auth_Result( - Zend_Auth_Result::FAILURE, - $id, - array("Authentication failed", $consumer->getError())); - } - } else { - if (!$consumer->check($id, - $this->_returnTo, - $this->_root, - $this->_extensions, - $this->_response)) { - return new Zend_Auth_Result( - Zend_Auth_Result::FAILURE, - $id, - array("Authentication failed", $consumer->getError())); - } - } - } else { - $params = (isset($_SERVER['REQUEST_METHOD']) && - $_SERVER['REQUEST_METHOD']=='POST') ? $_POST: $_GET; - $consumer = new Zend_OpenId_Consumer($this->_storage); - $consumer->setHttpClient($this->_httpClient); - if ($consumer->verify( - $params, - $id, - $this->_extensions)) { - return new Zend_Auth_Result( - Zend_Auth_Result::SUCCESS, - $id, - array("Authentication successful")); - } else { - return new Zend_Auth_Result( - Zend_Auth_Result::FAILURE, - $id, - array("Authentication failed", $consumer->getError())); - } - } - } - -} diff --git a/library/vendor/Zend/Auth/Exception.php b/library/vendor/Zend/Auth/Exception.php deleted file mode 100644 index c70033092..000000000 --- a/library/vendor/Zend/Auth/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ - self::SUCCESS ) { - $code = 1; - } - - $this->_code = $code; - $this->_identity = $identity; - $this->_messages = $messages; - } - - /** - * Returns whether the result represents a successful authentication attempt - * - * @return boolean - */ - public function isValid() - { - return ($this->_code > 0) ? true : false; - } - - /** - * getCode() - Get the result code for this authentication attempt - * - * @return int - */ - public function getCode() - { - return $this->_code; - } - - /** - * Returns the identity used in the authentication attempt - * - * @return mixed - */ - public function getIdentity() - { - return $this->_identity; - } - - /** - * Returns an array of string reasons why the authentication attempt was unsuccessful - * - * If authentication was successful, this method returns an empty array. - * - * @return array - */ - public function getMessages() - { - return $this->_messages; - } -} diff --git a/library/vendor/Zend/Auth/Storage/Exception.php b/library/vendor/Zend/Auth/Storage/Exception.php deleted file mode 100644 index c4365c626..000000000 --- a/library/vendor/Zend/Auth/Storage/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ -_data); - } - - /** - * Returns the contents of storage - * Behavior is undefined when storage is empty. - * - * @throws Zend_Auth_Storage_Exception If reading contents from storage is impossible - * @return mixed - */ - public function read() - { - return $this->_data; - } - - /** - * Writes $contents to storage - * - * @param mixed $contents - * @throws Zend_Auth_Storage_Exception If writing $contents to storage is impossible - * @return void - */ - public function write($contents) - { - $this->_data = $contents; - } - - /** - * Clears contents from storage - * - * @throws Zend_Auth_Storage_Exception If clearing contents from storage is impossible - * @return void - */ - public function clear() - { - $this->_data = null; - } -} diff --git a/library/vendor/Zend/Auth/Storage/Session.php b/library/vendor/Zend/Auth/Storage/Session.php deleted file mode 100644 index f0f5a5274..000000000 --- a/library/vendor/Zend/Auth/Storage/Session.php +++ /dev/null @@ -1,147 +0,0 @@ -_namespace = $namespace; - $this->_member = $member; - $this->_session = new Zend_Session_Namespace($this->_namespace); - } - - /** - * Returns the session namespace - * - * @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_Auth_Storage_Interface - * - * @return boolean - */ - public function isEmpty() - { - return !isset($this->_session->{$this->_member}); - } - - /** - * Defined by Zend_Auth_Storage_Interface - * - * @return mixed - */ - public function read() - { - return $this->_session->{$this->_member}; - } - - /** - * Defined by Zend_Auth_Storage_Interface - * - * @param mixed $contents - * @return void - */ - public function write($contents) - { - $this->_session->{$this->_member} = $contents; - } - - /** - * Defined by Zend_Auth_Storage_Interface - * - * @return void - */ - public function clear() - { - unset($this->_session->{$this->_member}); - } -} diff --git a/library/vendor/Zend/Barcode.php b/library/vendor/Zend/Barcode.php deleted file mode 100644 index d57c3d787..000000000 --- a/library/vendor/Zend/Barcode.php +++ /dev/null @@ -1,343 +0,0 @@ -rendererParams)) { - $rendererConfig = $barcode->rendererParams->toArray(); - } - if (isset($barcode->renderer)) { - $renderer = (string) $barcode->renderer; - } - if (isset($barcode->barcodeParams)) { - $barcodeConfig = $barcode->barcodeParams->toArray(); - } - if (isset($barcode->barcode)) { - $barcode = (string) $barcode->barcode; - } else { - $barcode = null; - } - } - - try { - $barcode = self::makeBarcode($barcode, $barcodeConfig); - $renderer = self::makeRenderer($renderer, $rendererConfig); - } catch (Zend_Exception $e) { - $renderable = ($e instanceof Zend_Barcode_Exception) ? $e->isRenderable() : false; - if ($automaticRenderError && $renderable) { - $barcode = self::makeBarcode('error', array( - 'text' => $e->getMessage() - )); - $renderer = self::makeRenderer($renderer, array()); - } else { - throw $e; - } - } - - $renderer->setAutomaticRenderError($automaticRenderError); - return $renderer->setBarcode($barcode); - } - - /** - * Barcode Constructor - * - * @param mixed $barcode String name of barcode class, or Zend_Config object. - * @param mixed $barcodeConfig OPTIONAL; an array or Zend_Config object with barcode parameters. - * @return Zend_Barcode_Object - */ - public static function makeBarcode($barcode, $barcodeConfig = array()) - { - if ($barcode instanceof Zend_Barcode_Object_ObjectAbstract) { - return $barcode; - } - - /* - * Convert Zend_Config argument to plain string - * barcode name and separate config object. - */ - if ($barcode instanceof Zend_Config) { - if (isset($barcode->barcodeParams) && $barcode->barcodeParams instanceof Zend_Config) { - $barcodeConfig = $barcode->barcodeParams->toArray(); - } - if (isset($barcode->barcode)) { - $barcode = (string) $barcode->barcode; - } else { - $barcode = null; - } - } - if ($barcodeConfig instanceof Zend_Config) { - $barcodeConfig = $barcodeConfig->toArray(); - } - - /* - * Verify that barcode parameters are in an array. - */ - if (!is_array($barcodeConfig)) { - /** - * @see Zend_Barcode_Exception - */ - throw new Zend_Barcode_Exception( - 'Barcode parameters must be in an array or a Zend_Config object' - ); - } - - /* - * Verify that an barcode name has been specified. - */ - if (!is_string($barcode) || empty($barcode)) { - /** - * @see Zend_Barcode_Exception - */ - throw new Zend_Barcode_Exception( - 'Barcode name must be specified in a string' - ); - } - /* - * Form full barcode class name - */ - $barcodeNamespace = 'Zend_Barcode_Object'; - if (isset($barcodeConfig['barcodeNamespace'])) { - $barcodeNamespace = $barcodeConfig['barcodeNamespace']; - } - - $barcodeName = strtolower($barcodeNamespace . '_' . $barcode); - $barcodeName = str_replace(' ', '_', ucwords( - str_replace( '_', ' ', $barcodeName) - )); - - /* - * Load the barcode class. This throws an exception - * if the specified class cannot be loaded. - */ - if (!class_exists($barcodeName)) { - Zend_Loader::loadClass($barcodeName); - } - - /* - * Create an instance of the barcode class. - * Pass the config to the barcode class constructor. - */ - $bcAdapter = new $barcodeName($barcodeConfig); - - /* - * Verify that the object created is a descendent of the abstract barcode type. - */ - if (!$bcAdapter instanceof Zend_Barcode_Object_ObjectAbstract) { - /** - * @see Zend_Barcode_Exception - */ - throw new Zend_Barcode_Exception( - "Barcode class '$barcodeName' does not extend Zend_Barcode_Object_ObjectAbstract" - ); - } - return $bcAdapter; - } - - /** - * Renderer Constructor - * - * @param mixed $renderer String name of renderer class, or Zend_Config object. - * @param mixed $rendererConfig OPTIONAL; an array or Zend_Config object with renderer parameters. - * @return Zend_Barcode_Renderer - */ - public static function makeRenderer($renderer = 'image', $rendererConfig = array()) - { - if ($renderer instanceof Zend_Barcode_Renderer_RendererAbstract) { - return $renderer; - } - - /* - * Convert Zend_Config argument to plain string - * barcode name and separate config object. - */ - if ($renderer instanceof Zend_Config) { - if (isset($renderer->rendererParams)) { - $rendererConfig = $renderer->rendererParams->toArray(); - } - if (isset($renderer->renderer)) { - $renderer = (string) $renderer->renderer; - } - } - if ($rendererConfig instanceof Zend_Config) { - $rendererConfig = $rendererConfig->toArray(); - } - - /* - * Verify that barcode parameters are in an array. - */ - if (!is_array($rendererConfig)) { - /** - * @see Zend_Barcode_Exception - */ - $e = new Zend_Barcode_Exception( - 'Barcode parameters must be in an array or a Zend_Config object' - ); - $e->setIsRenderable(false); - throw $e; - } - - /* - * Verify that an barcode name has been specified. - */ - if (!is_string($renderer) || empty($renderer)) { - /** - * @see Zend_Barcode_Exception - */ - $e = new Zend_Barcode_Exception( - 'Renderer name must be specified in a string' - ); - $e->setIsRenderable(false); - throw $e; - } - - /* - * Form full barcode class name - */ - $rendererNamespace = 'Zend_Barcode_Renderer'; - if (isset($rendererConfig['rendererNamespace'])) { - $rendererNamespace = $rendererConfig['rendererNamespace']; - } - - $rendererName = strtolower($rendererNamespace . '_' . $renderer); - $rendererName = str_replace(' ', '_', ucwords( - str_replace( '_', ' ', $rendererName) - )); - - /* - * Load the barcode class. This throws an exception - * if the specified class cannot be loaded. - */ - if (!class_exists($rendererName)) { - Zend_Loader::loadClass($rendererName); - } - - /* - * Create an instance of the barcode class. - * Pass the config to the barcode class constructor. - */ - $rdrAdapter = new $rendererName($rendererConfig); - - /* - * Verify that the object created is a descendent of the abstract barcode type. - */ - if (!$rdrAdapter instanceof Zend_Barcode_Renderer_RendererAbstract) { - /** - * @see Zend_Barcode_Exception - */ - $e = new Zend_Barcode_Exception( - "Renderer class '$rendererName' does not extend Zend_Barcode_Renderer_RendererAbstract" - ); - $e->setIsRenderable(false); - throw $e; - } - return $rdrAdapter; - } - - /** - * Proxy to renderer render() method - * - * @param string | Zend_Barcode_Object | array | Zend_Config $barcode - * @param string | Zend_Barcode_Renderer $renderer - * @param array | Zend_Config $barcodeConfig - * @param array | Zend_Config $rendererConfig - */ - public static function render( - $barcode, - $renderer, - $barcodeConfig = array(), - $rendererConfig = array() - ) { - self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->render(); - } - - /** - * Proxy to renderer draw() method - * - * @param string | Zend_Barcode_Object | array | Zend_Config $barcode - * @param string | Zend_Barcode_Renderer $renderer - * @param array | Zend_Config $barcodeConfig - * @param array | Zend_Config $rendererConfig - * @return mixed - */ - public static function draw( - $barcode, - $renderer, - $barcodeConfig = array(), - $rendererConfig = array() - ) { - return self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->draw(); - } - - /** - * Proxy for setBarcodeFont of Zend_Barcode_Object - * @param string $font - * @eturn void - */ - public static function setBarcodeFont($font) - { - Zend_Barcode_Object_ObjectAbstract::setBarcodeFont($font); - } -} diff --git a/library/vendor/Zend/Barcode/Exception.php b/library/vendor/Zend/Barcode/Exception.php deleted file mode 100644 index 82cba6869..000000000 --- a/library/vendor/Zend/Barcode/Exception.php +++ /dev/null @@ -1,62 +0,0 @@ -_isRenderable = (bool) $flag; - return $this; - } - - /** - * Retrieve renderable flag - * - * @return bool - */ - public function isRenderable() - { - return $this->_isRenderable; - } -} diff --git a/library/vendor/Zend/Barcode/Object/Code128.php b/library/vendor/Zend/Barcode/Object/Code128.php deleted file mode 100644 index 73863092a..000000000 --- a/library/vendor/Zend/Barcode/Object/Code128.php +++ /dev/null @@ -1,393 +0,0 @@ - "11011001100", 1 => "11001101100", 2 => "11001100110", - 3 => "10010011000", 4 => "10010001100", 5 => "10001001100", - 6 => "10011001000", 7 => "10011000100", 8 => "10001100100", - 9 => "11001001000", 10 => "11001000100", 11 => "11000100100", - 12 => "10110011100", 13 => "10011011100", 14 => "10011001110", - 15 => "10111001100", 16 => "10011101100", 17 => "10011100110", - 18 => "11001110010", 19 => "11001011100", 20 => "11001001110", - 21 => "11011100100", 22 => "11001110100", 23 => "11101101110", - 24 => "11101001100", 25 => "11100101100", 26 => "11100100110", - 27 => "11101100100", 28 => "11100110100", 29 => "11100110010", - 30 => "11011011000", 31 => "11011000110", 32 => "11000110110", - 33 => "10100011000", 34 => "10001011000", 35 => "10001000110", - 36 => "10110001000", 37 => "10001101000", 38 => "10001100010", - 39 => "11010001000", 40 => "11000101000", 41 => "11000100010", - 42 => "10110111000", 43 => "10110001110", 44 => "10001101110", - 45 => "10111011000", 46 => "10111000110", 47 => "10001110110", - 48 => "11101110110", 49 => "11010001110", 50 => "11000101110", - 51 => "11011101000", 52 => "11011100010", 53 => "11011101110", - 54 => "11101011000", 55 => "11101000110", 56 => "11100010110", - 57 => "11101101000", 58 => "11101100010", 59 => "11100011010", - 60 => "11101111010", 61 => "11001000010", 62 => "11110001010", - 63 => "10100110000", 64 => "10100001100", 65 => "10010110000", - 66 => "10010000110", 67 => "10000101100", 68 => "10000100110", - 69 => "10110010000", 70 => "10110000100", 71 => "10011010000", - 72 => "10011000010", 73 => "10000110100", 74 => "10000110010", - 75 => "11000010010", 76 => "11001010000", 77 => "11110111010", - 78 => "11000010100", 79 => "10001111010", 80 => "10100111100", - 81 => "10010111100", 82 => "10010011110", 83 => "10111100100", - 84 => "10011110100", 85 => "10011110010", 86 => "11110100100", - 87 => "11110010100", 88 => "11110010010", 89 => "11011011110", - 90 => "11011110110", 91 => "11110110110", 92 => "10101111000", - 93 => "10100011110", 94 => "10001011110", 95 => "10111101000", - 96 => "10111100010", 97 => "11110101000", 98 => "11110100010", - 99 => "10111011110", 100 => "10111101110", 101 => "11101011110", - 102 => "11110101110", - 103 => "11010000100", 104 => "11010010000", 105 => "11010011100", - 106 => "1100011101011"); - - /** - * Character sets ABC - * @var array - */ - protected $_charSets = array( - 'A' => array( - ' ', '!', '"', '#', '$', '%', '&', "'", - '(', ')', '*', '+', ',', '-', '.', '/', - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', ':', ';', '<', '=', '>', '?', - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, - 'FNC3', 'FNC2', 'SHIFT', 'Code C', 'Code B', 'FNC4', 'FNC1', - 'START A', 'START B', 'START C', 'STOP'), - 'B' => array( - ' ', '!', '"', '#', '$', '%', '&', "'", - '(', ')', '*', '+', ',', '-', '.', '/', - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', ':', ';', '<', '=', '>', '?', - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', - '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', - 'x', 'y', 'z', '{', '|', '}', '~', 0x7F, - 'FNC3', 'FNC2', 'SHIFT', 'Code C', 'FNC4', 'Code A', 'FNC1', - 'START A', 'START B', 'START C', 'STOP',), - 'C' => array( - '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', - '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', - '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', - '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', - '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', - '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', - '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', - '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', - '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', - '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', - 'Code B', 'Code A', 'FNC1', 'START A', 'START B', 'START C', 'STOP')); - /*'A' => array( - ' '=>0, '!'=>1, '"'=>2, '#'=>3, '$'=>4, '%'=>5, '&'=>6, "'"=>7, - '('=>8, ')'=>9, '*'=>10, '+'=>11, ','=>12, '-'=>13, '.'=>14, '/'=>15, - '0'=>16, '1'=>17, '2'=>18, '3'=>19, '4'=>20, '5'=>21, '6'=>22, '7'=>23, - '8'=>24, '9'=>25, ':'=>26, ';'=>27, '<'=>28, '='=>29, '>'=>30, '?'=>31, - '@'=>32, 'A'=>33, 'B'=>34, 'C'=>35, 'D'=>36, 'E'=>37, 'F'=>38, 'G'=>39, - 'H'=>40, 'I'=>41, 'J'=>42, 'K'=>43, 'L'=>44, 'M'=>45, 'N'=>46, 'O'=>47, - 'P'=>48, 'Q'=>49, 'R'=>50, 'S'=>51, 'T'=>52, 'U'=>53, 'V'=>54, 'W'=>55, - 'X'=>56, 'Y'=>57, 'Z'=>58, '['=>59, '\\'=>60, ']'=>61, '^'=>62, '_'=>63, - 0x00=>64, 0x01=>65, 0x02=>66, 0x03=>67, 0x04=>68, 0x05=>69, 0x06=>70, 0x07=>71, - 0x08=>72, 0x09=>73, 0x0A=>74, 0x0B=>75, 0x0C=>76, 0x0D=>77, 0x0E=>78, 0x0F=>79, - 0x10=>80, 0x11=>81, 0x12=>82, 0x13=>83, 0x14=>84, 0x15=>85, 0x16=>86, 0x17=>87, - 0x18=>88, 0x19=>89, 0x1A=>90, 0x1B=>91, 0x1C=>92, 0x1D=>93, 0x1E=>94, 0x1F=>95, - 'FNC3'=>96, 'FNC2'=>97, 'SHIFT'=>98, 'Code C'=>99, 'Code B'=>100, 'FNC4'=>101, 'FNC1'=>102, 'START A'=>103, - 'START B'=>104, 'START C'=>105, 'STOP'=>106), - 'B' => array( - ' '=>0, '!'=>1, '"'=>2, '#'=>3, '$'=>4, '%'=>5, '&'=>6, "'"=>7, - '('=>8, ')'=>9, '*'=>10, '+'=>11, ','=>12, '-'=>13, '.'=>14, '/'=>15, - '0'=>16, '1'=>17, '2'=>18, '3'=>19, '4'=>20, '5'=>21, '6'=>22, '7'=>23, - '8'=>24, '9'=>25, ':'=>26, ';'=>27, '<'=>28, '='=>29, '>'=>30, '?'=>31, - '@'=>32, 'A'=>33, 'B'=>34, 'C'=>35, 'D'=>36, 'E'=>37, 'F'=>38, 'G'=>39, - 'H'=>40, 'I'=>41, 'J'=>42, 'K'=>43, 'L'=>44, 'M'=>45, 'N'=>46, 'O'=>47, - 'P'=>48, 'Q'=>49, 'R'=>50, 'S'=>51, 'T'=>52, 'U'=>53, 'V'=>54, 'W'=>55, - 'X'=>56, 'Y'=>57, 'Z'=>58, '['=>59, '\\'=>60, ']'=>61, '^'=>62, '_'=>63, - '`' =>64, 'a'=>65, 'b'=>66, 'c'=>67, 'd'=>68, 'e'=>69, 'f'=>70, 'g'=>71, - 'h'=>72, 'i'=>73, 'j'=>74, 'k'=>75, 'l'=>76, 'm'=>77, 'n'=>78, 'o'=>79, - 'p'=>80, 'q'=>81, 'r'=>82, 's'=>83, 't'=>84, 'u'=>85, 'v'=>86, 'w'=>87, - 'x'=>88, 'y'=>89, 'z'=>90, '{'=>91, '|'=>92, '}'=>93, '~'=>94, 0x7F=>95, - 'FNC3'=>96, 'FNC2'=>97, 'SHIFT'=>98, 'Code C'=>99, 'FNC4'=>100, 'Code A'=>101, 'FNC1'=>102, 'START A'=>103, - 'START B'=>104, 'START C'=>105, 'STOP'=>106,), - 'C' => array( - '00'=>0, '01'=>1, '02'=>2, '03'=>3, '04'=>4, '05'=>5, '06'=>6, '07'=>7, '08'=>8, '09'=>9, - '10'=>10, '11'=>11, '12'=>12, '13'=>13, '14'=>14, '15'=>15, '16'=>16, '17'=>17, '18'=>18, '19'=>19, - '20'=>20, '21'=>21, '22'=>22, '23'=>23, '24'=>24, '25'=>25, '26'=>26, '27'=>27, '28'=>28, '29'=>29, - '30'=>30, '31'=>31, '32'=>32, '33'=>33, '34'=>34, '35'=>35, '36'=>36, '37'=>37, '38'=>38, '39'=>39, - '40'=>40, '41'=>41, '42'=>42, '43'=>43, '44'=>44, '45'=>45, '46'=>46, '47'=>47, '48'=>48, '49'=>49, - '50'=>50, '51'=>51, '52'=>52, '53'=>53, '54'=>54, '55'=>55, '56'=>56, '57'=>57, '58'=>58, '59'=>59, - '60'=>60, '61'=>61, '62'=>62, '63'=>63, '64'=>64, '65'=>65, '66'=>66, '67'=>67, '68'=>68, '69'=>69, - '70'=>70, '71'=>71, '72'=>72, '73'=>73, '74'=>74, '75'=>75, '76'=>76, '77'=>77, '78'=>78, '79'=>79, - '80'=>80, '81'=>81, '82'=>82, '83'=>83, '84'=>84, '85'=>85, '86'=>86, '87'=>87, '88'=>88, '89'=>89, - '90'=>90, '91'=>91, '92'=>92, '93'=>93, '94'=>94, '95'=>95, '96'=>96, '97'=>97, '98'=>98, '99'=>99, - 'Code B'=>100, 'Code A'=>101, 'FNC1'=>102, 'START A'=>103, 'START B'=>104, 'START C'=>105, 'STOP'=>106));*/ - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - // Each characters contain 11 bars... - $characterLength = 11 * $this->_barThinWidth * $this->_factor; - $convertedChars = count($this->_convertToBarcodeChars($this->getText())); - if ($this->_withChecksum) { - $convertedChars++; - } - $encodedData = $convertedChars * $characterLength; - // ...except the STOP character (13) - $encodedData += $characterLength + 2 * $this->_barThinWidth * $this->_factor; - $width = $quietZone + $encodedData + $quietZone; - return $width; - } - - /** - * Partial check of code128 barcode - * @return void - */ - protected function _checkParams() - { - } - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - - $convertedChars = $this->_convertToBarcodeChars($this->getText()); - - if ($this->_withChecksum) { - $convertedChars[] = $this->getChecksum($this->getText()); - } - - // STOP CHARACTER - $convertedChars[] = 106; - - foreach ($convertedChars as $barcodeChar) { - $barcodePattern = $this->_codingMap[$barcodeChar]; - foreach (str_split($barcodePattern) as $c) { - $barcodeTable[] = array($c, $this->_barThinWidth, 0, 1); - } - } - return $barcodeTable; - } - - /** - * Checks if the next $length chars of $string starting at $pos are numeric. - * Returns false if the end of the string is reached. - * @param string $string String to search - * @param int $pos Starting position - * @param int $length Length to search - * @return bool - */ - protected static function _isDigit($string, $pos, $length = 2) - { - if ($pos + $length > strlen($string)) { - return false; - } - - for ($i = $pos; $i < $pos + $length; $i++) { - if (!is_numeric($string[$i])) { - return false; - } - } - return true; - } - - /** - * Convert string to barcode string - * - * @param $string - * @return array - */ - protected function _convertToBarcodeChars($string) - { - $string = (string) $string; - if (!strlen($string)) { - return array(); - } - - if (isset($this->_convertedText[md5($string)])) { - return $this->_convertedText[md5($string)]; - } - - $currentCharset = null; - $sum = 0; - $fak = 0; - $result = array(); - - for ($pos = 0; $pos < strlen($string); $pos++) { - $char = $string[$pos]; - $code = null; - - if (self::_isDigit($string, $pos, 4) && $currentCharset != 'C' - || self::_isDigit($string, $pos, 2) && $currentCharset == 'C') { - /** - * Switch to C if the next 4 chars are numeric or stay C if the next 2 - * chars are numeric - */ - if ($currentCharset != 'C') { - if ($pos == 0) { - $code = array_search("START C", $this->_charSets['C']); - } else { - $code = array_search("Code C", $this->_charSets[$currentCharset]); - } - $result[] = $code; - $currentCharset = 'C'; - } - } else if (in_array($char, $this->_charSets['B']) && $currentCharset != 'B' - && !(in_array($char, $this->_charSets['A']) && $currentCharset == 'A')) { - /** - * Switch to B as B contains the char and B is not the current charset. - */ - if ($pos == 0) { - $code = array_search("START B", $this->_charSets['B']); - } else { - $code = array_search("Code B", $this->_charSets[$currentCharset]); - } - $result[] = $code; - $currentCharset = 'B'; - } else if (array_key_exists($char, $this->_charSets['A']) && $currentCharset != 'A' - && !(array_key_exists($char, $this->_charSets['B']) && $currentCharset == 'B')) { - /** - * Switch to C as C contains the char and C is not the current charset. - */ - if ($pos == 0) { - $code = array_search("START A", $this->_charSets['A']); - } else { - $code =array_search("Code A", $this->_charSets[$currentCharset]); - } - $result[] = $code; - $currentCharset = 'A'; - } - - if ($currentCharset == 'C') { - $code = array_search(substr($string, $pos, 2), $this->_charSets['C']); - $pos++; //Two chars from input - } else { - $code = array_search($string[$pos], $this->_charSets[$currentCharset]); - } - $result[] = $code; - } - - $this->_convertedText[md5($string)] = $result; - return $result; - } - - /** - * Set text to encode - * @param string $value - * @return Zend_Barcode_Object - */ - public function setText($value) - { - $this->_text = $value; - return $this; - } - - /** - * Retrieve text to encode - * @return string - */ - public function getText() - { - return $this->_text; - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $tableOfChars = $this->_convertToBarcodeChars($text); - - $sum = $tableOfChars[0]; - unset($tableOfChars[0]); - - $k = 1; - foreach ($tableOfChars as $char) { - $sum += ($k++) * $char; - } - - $checksum = $sum % 103; - - return $checksum; - } - - /** - * Standard validation for most of barcode objects - * - * @param string $value - * @param array $options - * @return bool - */ - protected function _validateText($value, $options = array()) - { - // @TODO: add code128 validator - return true; - } -} diff --git a/library/vendor/Zend/Barcode/Object/Code25.php b/library/vendor/Zend/Barcode/Object/Code25.php deleted file mode 100644 index f4b5b9496..000000000 --- a/library/vendor/Zend/Barcode/Object/Code25.php +++ /dev/null @@ -1,141 +0,0 @@ - '00110', - '1' => '10001', - '2' => '01001', - '3' => '11000', - '4' => '00101', - '5' => '10100', - '6' => '01100', - '7' => '00011', - '8' => '10010', - '9' => '01010', - ); - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (2 * $this->_barThickWidth + 4 * $this->_barThinWidth) * $this->_factor; - $characterLength = (3 * $this->_barThinWidth + 2 * $this->_barThickWidth + 5 * $this->_barThinWidth) - * $this->_factor; - $encodedData = strlen($this->getText()) * $characterLength; - $stopCharacter = (2 * $this->_barThickWidth + 4 * $this->_barThinWidth) * $this->_factor; - return $quietZone + $startCharacter + $encodedData + $stopCharacter + $quietZone; - } - - /** - * Partial check of interleaved 2 of 5 barcode - * @return void - */ - protected function _checkParams() - { - $this->_checkRatio(); - } - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - - // Start character (30301) - $barcodeTable[] = array(1 , $this->_barThickWidth , 0 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(1 , $this->_barThickWidth , 0 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth); - - $text = str_split($this->getText()); - foreach ($text as $char) { - $barcodeChar = str_split($this->_codingMap[$char]); - foreach ($barcodeChar as $c) { - /* visible, width, top, length */ - $width = $c ? $this->_barThickWidth : $this->_barThinWidth; - $barcodeTable[] = array(1 , $width , 0 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth); - } - } - - // Stop character (30103) - $barcodeTable[] = array(1 , $this->_barThickWidth , 0 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(1 , $this->_barThickWidth , 0 , 1); - return $barcodeTable; - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $this->_checkText($text); - $factor = 3; - $checksum = 0; - - for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * $factor; - $factor = 4 - $factor; - } - - $checksum = (10 - ($checksum % 10)) % 10; - - return $checksum; - } -} diff --git a/library/vendor/Zend/Barcode/Object/Code25interleaved.php b/library/vendor/Zend/Barcode/Object/Code25interleaved.php deleted file mode 100644 index 6c9459469..000000000 --- a/library/vendor/Zend/Barcode/Object/Code25interleaved.php +++ /dev/null @@ -1,177 +0,0 @@ -_barcodeLength = 'even'; - } - - /** - * Activate/deactivate drawing of bearer bars - * @param boolean $value - * @return Zend_Barcode_Object_Int25 - */ - public function setWithBearerBars($value) - { - $this->_withBearerBars = (bool) $value; - return $this; - } - - /** - * Retrieve if bearer bars are enabled - * @return boolean - */ - public function getWithBearerBars() - { - return $this->_withBearerBars; - } - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (4 * $this->_barThinWidth) * $this->_factor; - $characterLength = (3 * $this->_barThinWidth + 2 * $this->_barThickWidth) * $this->_factor; - $encodedData = strlen($this->getText()) * $characterLength; - $stopCharacter = ($this->_barThickWidth + 2 * $this->_barThinWidth) * $this->_factor; - return $quietZone + $startCharacter + $encodedData + $stopCharacter + $quietZone; - } - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - if ($this->_withBearerBars) { - $this->_withBorder = false; - } - - // Start character (0000) - $barcodeTable[] = array(1, $this->_barThinWidth, 0, 1); - $barcodeTable[] = array(0, $this->_barThinWidth, 0, 1); - $barcodeTable[] = array(1, $this->_barThinWidth, 0, 1); - $barcodeTable[] = array(0, $this->_barThinWidth, 0, 1); - - // Encoded $text - $text = $this->getText(); - for ($i = 0; $i < strlen($text); $i += 2) { // Draw 2 chars at a time - $char1 = substr($text, $i, 1); - $char2 = substr($text, $i + 1, 1); - - // Interleave - for ($ibar = 0; $ibar < 5; $ibar ++) { - // Draws char1 bar (fore color) - $barWidth = (substr($this->_codingMap[$char1], $ibar, 1)) - ? $this->_barThickWidth - : $this->_barThinWidth; - - $barcodeTable[] = array(1, $barWidth, 0, 1); - - // Left space corresponding to char2 (background color) - $barWidth = (substr($this->_codingMap[$char2], $ibar, 1)) - ? $this->_barThickWidth - : $this->_barThinWidth; - $barcodeTable[] = array(0, $barWidth, 0 , 1); - } - } - - // Stop character (100) - $barcodeTable[] = array(1 , $this->_barThickWidth, 0, 1); - $barcodeTable[] = array(0 , $this->_barThinWidth, 0, 1); - $barcodeTable[] = array(1 , $this->_barThinWidth, 0, 1); - return $barcodeTable; - } - - /** - * Drawing of bearer bars (if enabled) - * - * @return void - */ - protected function _postDrawBarcode() - { - if (!$this->_withBearerBars) { - return; - } - - $width = $this->_barThickWidth * $this->_factor; - $point1 = $this->_rotate(-1, -1); - $point2 = $this->_rotate($this->_calculateWidth() - 1, -1); - $point3 = $this->_rotate($this->_calculateWidth() - 1, $width - 1); - $point4 = $this->_rotate(-1, $width - 1); - $this->_addPolygon(array( - $point1, - $point2, - $point3, - $point4, - )); - $point1 = $this->_rotate( - 0, - 0 + $this->_barHeight * $this->_factor - 1 - ); - $point2 = $this->_rotate( - $this->_calculateWidth() - 1, - 0 + $this->_barHeight * $this->_factor - 1 - ); - $point3 = $this->_rotate( - $this->_calculateWidth() - 1, - 0 + $this->_barHeight * $this->_factor - $width - ); - $point4 = $this->_rotate( - 0, - 0 + $this->_barHeight * $this->_factor - $width - ); - $this->_addPolygon(array( - $point1, - $point2, - $point3, - $point4, - )); - } -} diff --git a/library/vendor/Zend/Barcode/Object/Code39.php b/library/vendor/Zend/Barcode/Object/Code39.php deleted file mode 100644 index 4c271399e..000000000 --- a/library/vendor/Zend/Barcode/Object/Code39.php +++ /dev/null @@ -1,186 +0,0 @@ - '000110100', - '1' => '100100001', - '2' => '001100001', - '3' => '101100000', - '4' => '000110001', - '5' => '100110000', - '6' => '001110000', - '7' => '000100101', - '8' => '100100100', - '9' => '001100100', - 'A' => '100001001', - 'B' => '001001001', - 'C' => '101001000', - 'D' => '000011001', - 'E' => '100011000', - 'F' => '001011000', - 'G' => '000001101', - 'H' => '100001100', - 'I' => '001001100', - 'J' => '000011100', - 'K' => '100000011', - 'L' => '001000011', - 'M' => '101000010', - 'N' => '000010011', - 'O' => '100010010', - 'P' => '001010010', - 'Q' => '000000111', - 'R' => '100000110', - 'S' => '001000110', - 'T' => '000010110', - 'U' => '110000001', - 'V' => '011000001', - 'W' => '111000000', - 'X' => '010010001', - 'Y' => '110010000', - 'Z' => '011010000', - '-' => '010000101', - '.' => '110000100', - ' ' => '011000100', - '$' => '010101000', - '/' => '010100010', - '+' => '010001010', - '%' => '000101010', - '*' => '010010100', - ); - - /** - * Partial check of Code39 barcode - * @return void - */ - protected function _checkParams() - { - $this->_checkRatio(); - } - - /** - * Width of the barcode (in pixels) - * @return int - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $characterLength = (6 * $this->_barThinWidth + 3 * $this->_barThickWidth + 1) * $this->_factor; - $encodedData = strlen($this->getText()) * $characterLength - $this->_factor; - return $quietZone + $encodedData + $quietZone; - } - - /** - * Set text to encode - * @param string $value - * @return Zend_Barcode_Object - */ - public function setText($value) - { - $this->_text = $value; - return $this; - } - - /** - * Retrieve text to display - * @return string - */ - public function getText() - { - return '*' . parent::getText() . '*'; - } - - /** - * Retrieve text to display - * @return string - */ - public function getTextToDisplay() - { - $text = parent::getTextToDisplay(); - if (substr($text, 0, 1) != '*' && substr($text, -1) != '*') { - return '*' . $text . '*'; - } else { - return $text; - } - } - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $text = str_split($this->getText()); - $barcodeTable = array(); - foreach ($text as $char) { - $barcodeChar = str_split($this->_codingMap[$char]); - $visible = true; - foreach ($barcodeChar as $c) { - /* visible, width, top, length */ - $width = $c ? $this->_barThickWidth : $this->_barThinWidth; - $barcodeTable[] = array((int) $visible, $width, 0, 1); - $visible = ! $visible; - } - $barcodeTable[] = array(0 , $this->_barThinWidth); - } - return $barcodeTable; - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $this->_checkText($text); - $text = str_split($text); - $charset = array_flip(array_keys($this->_codingMap)); - $checksum = 0; - foreach ($text as $character) { - $checksum += $charset[$character]; - } - return array_search(($checksum % 43), $charset); - } -} diff --git a/library/vendor/Zend/Barcode/Object/Ean13.php b/library/vendor/Zend/Barcode/Object/Ean13.php deleted file mode 100644 index 38d232838..000000000 --- a/library/vendor/Zend/Barcode/Object/Ean13.php +++ /dev/null @@ -1,223 +0,0 @@ - array( - 0 => "0001101", 1 => "0011001", 2 => "0010011", 3 => "0111101", 4 => "0100011", - 5 => "0110001", 6 => "0101111", 7 => "0111011", 8 => "0110111", 9 => "0001011" - ), - 'B' => array( - 0 => "0100111", 1 => "0110011", 2 => "0011011", 3 => "0100001", 4 => "0011101", - 5 => "0111001", 6 => "0000101", 7 => "0010001", 8 => "0001001", 9 => "0010111" - ), - 'C' => array( - 0 => "1110010", 1 => "1100110", 2 => "1101100", 3 => "1000010", 4 => "1011100", - 5 => "1001110", 6 => "1010000", 7 => "1000100", 8 => "1001000", 9 => "1110100" - )); - - protected $_parities = array( - 0 => array('A','A','A','A','A','A'), - 1 => array('A','A','B','A','B','B'), - 2 => array('A','A','B','B','A','B'), - 3 => array('A','A','B','B','B','A'), - 4 => array('A','B','A','A','B','B'), - 5 => array('A','B','B','A','A','B'), - 6 => array('A','B','B','B','A','A'), - 7 => array('A','B','A','B','A','B'), - 8 => array('A','B','A','B','B','A'), - 9 => array('A','B','B','A','B','A') - ); - - /** - * Default options for Postnet barcode - * @return void - */ - protected function _getDefaultOptions() - { - $this->_barcodeLength = 13; - $this->_mandatoryChecksum = true; - $this->_mandatoryQuietZones = true; - } - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (3 * $this->_barThinWidth) * $this->_factor; - $middleCharacter = (5 * $this->_barThinWidth) * $this->_factor; - $stopCharacter = (3 * $this->_barThinWidth) * $this->_factor; - $encodedData = (7 * $this->_barThinWidth) * $this->_factor * 12; - return $quietZone + $startCharacter + $middleCharacter + $encodedData + $stopCharacter + $quietZone; - } - - /** - * Partial check of interleaved EAN/UPC barcode - * @return void - */ - protected function _checkParams() - {} - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - $height = ($this->_drawText) ? 1.1 : 1; - - // Start character (101) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - - $textTable = str_split($this->getText()); - $parity = $this->_parities[$textTable[0]]; - - // First part - for ($i = 1; $i < 7; $i++) { - $bars = str_split($this->_codingMap[$parity[$i - 1]][$textTable[$i]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1); - } - } - - // Middle character (01010) - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - - // Second part - for ($i = 7; $i < 13; $i++) { - $bars = str_split($this->_codingMap['C'][$textTable[$i]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1); - } - } - - // Stop character (101) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - return $barcodeTable; - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $this->_checkText($text); - $factor = 3; - $checksum = 0; - - for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * $factor; - $factor = 4 - $factor; - } - - $checksum = (10 - ($checksum % 10)) % 10; - - return $checksum; - } - - /** - * Partial function to draw text - * @return void - */ - protected function _drawText() - { - if (get_class($this) == 'Zend_Barcode_Object_Ean13') { - $this->_drawEan13Text(); - } else { - parent::_drawText(); - } - } - - protected function _drawEan13Text() - { - if ($this->_drawText) { - $text = $this->getTextToDisplay(); - $characterWidth = (7 * $this->_barThinWidth) * $this->_factor; - $leftPosition = $this->getQuietZone() - $characterWidth; - for ($i = 0; $i < $this->_barcodeLength; $i ++) { - $this->_addText( - $text{$i}, - $this->_fontSize * $this->_factor, - $this->_rotate( - $leftPosition, - (int) $this->_withBorder * 2 - + $this->_factor * ($this->_barHeight + $this->_fontSize) + 1 - ), - $this->_font, - $this->_foreColor, - 'left', - - $this->_orientation - ); - switch ($i) { - case 0: - $factor = 3; - break; - case 6: - $factor = 4; - break; - default: - $factor = 0; - } - $leftPosition = $leftPosition + $characterWidth + ($factor * $this->_barThinWidth * $this->_factor); - } - } - } -} diff --git a/library/vendor/Zend/Barcode/Object/Ean2.php b/library/vendor/Zend/Barcode/Object/Ean2.php deleted file mode 100644 index 42f4a9165..000000000 --- a/library/vendor/Zend/Barcode/Object/Ean2.php +++ /dev/null @@ -1,63 +0,0 @@ - array('A','A'), - 1 => array('A','B'), - 2 => array('B','A'), - 3 => array('B','B') - ); - - /** - * Default options for Ean2 barcode - * @return void - */ - protected function _getDefaultOptions() - { - $this->_barcodeLength = 2; - } - - protected function _getParity($i) - { - $modulo = $this->getText() % 4; - return $this->_parities[$modulo][$i]; - } -} diff --git a/library/vendor/Zend/Barcode/Object/Ean5.php b/library/vendor/Zend/Barcode/Object/Ean5.php deleted file mode 100644 index e2d33332b..000000000 --- a/library/vendor/Zend/Barcode/Object/Ean5.php +++ /dev/null @@ -1,145 +0,0 @@ - array('B','B','A','A','A'), - 1 => array('B','A','B','A','A'), - 2 => array('B','A','A','B','A'), - 3 => array('B','A','A','A','B'), - 4 => array('A','B','B','A','A'), - 5 => array('A','A','B','B','A'), - 6 => array('A','A','A','B','B'), - 7 => array('A','B','A','B','A'), - 8 => array('A','B','A','A','B'), - 9 => array('A','A','B','A','B') - ); - - /** - * Default options for Ean5 barcode - * @return void - */ - protected function _getDefaultOptions() - { - $this->_barcodeLength = 5; - } - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (5 * $this->_barThinWidth) * $this->_factor; - $middleCharacter = (2 * $this->_barThinWidth) * $this->_factor; - $encodedData = (7 * $this->_barThinWidth) * $this->_factor; - return $quietZone + $startCharacter + ($this->_barcodeLength - 1) * $middleCharacter + $this->_barcodeLength * $encodedData + $quietZone; - } - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - - // Start character (01011) - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - - $firstCharacter = true; - $textTable = str_split($this->getText()); - - // Characters - for ($i = 0; $i < $this->_barcodeLength; $i++) { - if ($firstCharacter) { - $firstCharacter = false; - } else { - // Intermediate character (01) - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - } - $bars = str_split($this->_codingMap[$this->_getParity($i)][$textTable[$i]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1); - } - } - - return $barcodeTable; - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $this->_checkText($text); - $checksum = 0; - - for ($i = 0 ; $i < $this->_barcodeLength; $i ++) { - $checksum += intval($text{$i}) * ($i % 2 ? 9 : 3); - } - - return ($checksum % 10); - } - - protected function _getParity($i) - { - $checksum = $this->getChecksum($this->getText()); - return $this->_parities[$checksum][$i]; - } - - /** - * Retrieve text to encode - * @return string - */ - public function getText() - { - return $this->_addLeadingZeros($this->_text); - } -} diff --git a/library/vendor/Zend/Barcode/Object/Ean8.php b/library/vendor/Zend/Barcode/Object/Ean8.php deleted file mode 100644 index e09b431cd..000000000 --- a/library/vendor/Zend/Barcode/Object/Ean8.php +++ /dev/null @@ -1,174 +0,0 @@ -_barcodeLength = 8; - $this->_mandatoryChecksum = true; - } - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (3 * $this->_barThinWidth) * $this->_factor; - $middleCharacter = (5 * $this->_barThinWidth) * $this->_factor; - $stopCharacter = (3 * $this->_barThinWidth) * $this->_factor; - $encodedData = (7 * $this->_barThinWidth) * $this->_factor * 8; - return $quietZone + $startCharacter + $middleCharacter + $encodedData + $stopCharacter + $quietZone; - } - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - $height = ($this->_drawText) ? 1.1 : 1; - - // Start character (101) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - - $textTable = str_split($this->getText()); - - // First part - for ($i = 0; $i < 4; $i++) { - $bars = str_split($this->_codingMap['A'][$textTable[$i]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1); - } - } - - // Middle character (01010) - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - - // Second part - for ($i = 4; $i < 8; $i++) { - $bars = str_split($this->_codingMap['C'][$textTable[$i]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1); - } - } - - // Stop character (101) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - return $barcodeTable; - } - - /** - * Partial function to draw text - * @return void - */ - protected function _drawText() - { - if ($this->_drawText) { - $text = $this->getTextToDisplay(); - $characterWidth = (7 * $this->_barThinWidth) * $this->_factor; - $leftPosition = $this->getQuietZone() + (3 * $this->_barThinWidth) * $this->_factor; - for ($i = 0; $i < $this->_barcodeLength; $i ++) { - $this->_addText( - $text{$i}, - $this->_fontSize * $this->_factor, - $this->_rotate( - $leftPosition, - (int) $this->_withBorder * 2 - + $this->_factor * ($this->_barHeight + $this->_fontSize) + 1 - ), - $this->_font, - $this->_foreColor, - 'left', - - $this->_orientation - ); - switch ($i) { - case 3: - $factor = 4; - break; - default: - $factor = 0; - } - $leftPosition = $leftPosition + $characterWidth + ($factor * $this->_barThinWidth * $this->_factor); - } - } - } - - /** - * Particular validation for Ean8 barcode objects - * (to suppress checksum character substitution) - * - * @param string $value - * @param array $options - * @throws Zend_Barcode_Object_Exception - */ - protected function _validateText($value, $options = array()) - { - $validator = new Zend_Validate_Barcode(array( - 'adapter' => 'ean8', - 'checksum' => false, - )); - - $value = $this->_addLeadingZeros($value, true); - - if (!$validator->isValid($value)) { - $message = implode("\n", $validator->getMessages()); - - /** - * @see Zend_Barcode_Object_Exception - */ - throw new Zend_Barcode_Object_Exception($message); - } - } -} diff --git a/library/vendor/Zend/Barcode/Object/Error.php b/library/vendor/Zend/Barcode/Object/Error.php deleted file mode 100644 index 32d44bc9b..000000000 --- a/library/vendor/Zend/Barcode/Object/Error.php +++ /dev/null @@ -1,103 +0,0 @@ -_instructions = array(); - $this->_addText('ERROR:', 10, array(5 , 18), $this->_font, 0, 'left'); - $this->_addText($this->_text, 10, array(5 , 32), $this->_font, 0, 'left'); - return $this->_instructions; - } - - /** - * For compatibility reason - * @return void - */ - protected function _prepareBarcode() - { - } - - /** - * For compatibility reason - * @return void - */ - protected function _checkParams() - { - } - - /** - * For compatibility reason - * @return void - */ - protected function _calculateBarcodeWidth() - { - } -} diff --git a/library/vendor/Zend/Barcode/Object/Exception.php b/library/vendor/Zend/Barcode/Object/Exception.php deleted file mode 100644 index 727bea675..000000000 --- a/library/vendor/Zend/Barcode/Object/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ -_barcodeLength = 12; - $this->_mandatoryChecksum = true; - } - - /** - * Retrieve text to display - * @return string - */ - public function getTextToDisplay() - { - return preg_replace('/([0-9]{2})([0-9]{3})([0-9]{3})([0-9]{3})([0-9])/', - '$1.$2 $3.$4 $5', - $this->getText()); - } - - /** - * Check allowed characters - * @param string $value - * @return string - * @throws Zend_Barcode_Object_Exception - */ - public function validateText($value) - { - $this->_validateText($value, array('validator' => $this->getType())); - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $this->_checkText($text); - $checksum = 0; - - for ($i = strlen($text); $i > 0; $i --) { - $checksum += intval($text{$i - 1}) * (($i % 2) ? 4 : 9); - } - - $checksum = (10 - ($checksum % 10)) % 10; - - return $checksum; - } -} diff --git a/library/vendor/Zend/Barcode/Object/Itf14.php b/library/vendor/Zend/Barcode/Object/Itf14.php deleted file mode 100644 index b50fc38c4..000000000 --- a/library/vendor/Zend/Barcode/Object/Itf14.php +++ /dev/null @@ -1,47 +0,0 @@ -_barcodeLength = 14; - $this->_mandatoryChecksum = true; - } -} diff --git a/library/vendor/Zend/Barcode/Object/Leitcode.php b/library/vendor/Zend/Barcode/Object/Leitcode.php deleted file mode 100644 index e5386fa2b..000000000 --- a/library/vendor/Zend/Barcode/Object/Leitcode.php +++ /dev/null @@ -1,62 +0,0 @@ -_barcodeLength = 14; - $this->_mandatoryChecksum = true; - } - - /** - * Retrieve text to display - * @return string - */ - public function getTextToDisplay() - { - return preg_replace('/([0-9]{5})([0-9]{3})([0-9]{3})([0-9]{2})([0-9])/', - '$1.$2.$3.$4 $5', - $this->getText()); - } -} diff --git a/library/vendor/Zend/Barcode/Object/ObjectAbstract.php b/library/vendor/Zend/Barcode/Object/ObjectAbstract.php deleted file mode 100644 index 35babbdb1..000000000 --- a/library/vendor/Zend/Barcode/Object/ObjectAbstract.php +++ /dev/null @@ -1,1427 +0,0 @@ -_getDefaultOptions(); - if (self::$_staticFont !== null) { - $this->_font = self::$_staticFont; - } - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - if (is_array($options)) { - $this->setOptions($options); - } - $this->_type = strtolower( - substr(get_class($this), strlen($this->_barcodeNamespace) + 1) - ); - if ($this->_mandatoryChecksum) { - $this->_withChecksum = true; - $this->_withChecksumInText = true; - } - } - - /** - * Set default options for particular object - */ - protected function _getDefaultOptions() - { - } - - /** - * Set barcode state from options array - * - * @param array $options - * @return $this - */ - public function setOptions($options) - { - foreach ($options as $key => $value) { - $method = 'set' . $key; - if (method_exists($this, $method)) { - $this->$method($value); - } - } - return $this; - } - - /** - * Set barcode state from config object - * - * @param Zend_Config $config - * @return $this - */ - public function setConfig(Zend_Config $config) - { - return $this->setOptions($config->toArray()); - } - - /** - * Set barcode namespace for autoloading - * - * @param string $namespace - * @return $this - */ - public function setBarcodeNamespace($namespace) - { - $this->_barcodeNamespace = $namespace; - return $this; - } - - /** - * Retrieve barcode namespace - * - * @return string - */ - public function getBarcodeNamespace() - { - return $this->_barcodeNamespace; - } - - /** - * Retrieve type of barcode - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * Set height of the barcode bar - * - * @param integer $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setBarHeight($value) - { - if (intval($value) <= 0) { - throw new Zend_Barcode_Object_Exception( - 'Bar height must be greater than 0' - ); - } - $this->_barHeight = intval($value); - return $this; - } - - /** - * Get height of the barcode bar - * - * @return integer - */ - public function getBarHeight() - { - return $this->_barHeight; - } - - /** - * Set thickness of thin bar - * - * @param integer $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setBarThinWidth($value) - { - if (intval($value) <= 0) { - throw new Zend_Barcode_Object_Exception( - 'Bar width must be greater than 0' - ); - } - $this->_barThinWidth = intval($value); - return $this; - } - - /** - * Get thickness of thin bar - * - * @return integer - */ - public function getBarThinWidth() - { - return $this->_barThinWidth; - } - - /** - * Set thickness of thick bar - * - * @param integer $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setBarThickWidth($value) - { - if (intval($value) <= 0) { - throw new Zend_Barcode_Object_Exception( - 'Bar width must be greater than 0' - ); - } - $this->_barThickWidth = intval($value); - return $this; - } - - /** - * Get thickness of thick bar - * - * @return integer - */ - public function getBarThickWidth() - { - return $this->_barThickWidth; - } - - /** - * Set factor applying to - * thinBarWidth - thickBarWidth - barHeight - fontSize - * - * @param int|float|string|bool $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setFactor($value) - { - if (floatval($value) <= 0) { - throw new Zend_Barcode_Object_Exception( - 'Factor must be greater than 0' - ); - } - $this->_factor = floatval($value); - return $this; - } - - /** - * Get factor applying to - * thinBarWidth - thickBarWidth - barHeight - fontSize - * - * @return integer - */ - public function getFactor() - { - return $this->_factor; - } - - /** - * Set color of the barcode and text - * - * @param string $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setForeColor($value) - { - if (preg_match('`\#[0-9A-F]{6}`', $value)) { - $this->_foreColor = hexdec($value); - } elseif (is_numeric($value) && $value >= 0 && $value <= 16777125) { - $this->_foreColor = intval($value); - } else { - throw new Zend_Barcode_Object_Exception( - 'Text color must be set as #[0-9A-F]{6}' - ); - } - return $this; - } - - /** - * Retrieve color of the barcode and text - * - * @return unknown - */ - public function getForeColor() - { - return $this->_foreColor; - } - - /** - * Set the color of the background - * - * @param integer $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setBackgroundColor($value) - { - if (preg_match('`\#[0-9A-F]{6}`', $value)) { - $this->_backgroundColor = hexdec($value); - } elseif (is_numeric($value) && $value >= 0 && $value <= 16777125) { - $this->_backgroundColor = intval($value); - } else { - throw new Zend_Barcode_Object_Exception( - 'Background color must be set as #[0-9A-F]{6}' - ); - } - return $this; - } - - /** - * Retrieve background color of the image - * - * @return integer - */ - public function getBackgroundColor() - { - return $this->_backgroundColor; - } - - /** - * Activate/deactivate drawing of the bar - * - * @param boolean $value - * @return $this - */ - public function setWithBorder($value) - { - $this->_withBorder = (bool) $value; - return $this; - } - - /** - * Retrieve if border are draw or not - * - * @return boolean - */ - public function getWithBorder() - { - return $this->_withBorder; - } - - /** - * Activate/deactivate drawing of the quiet zones - * - * @param boolean $value - * @return $this - */ - public function setWithQuietZones($value) - { - $this->_withQuietZones = (bool) $value; - return $this; - } - - /** - * Retrieve if quiet zones are draw or not - * - * @return boolean - */ - public function getWithQuietZones() - { - return $this->_withQuietZones; - } - - /** - * Allow fast inversion of font/bars color and background color - * - * @return $this - */ - public function setReverseColor() - { - $tmp = $this->_foreColor; - $this->_foreColor = $this->_backgroundColor; - $this->_backgroundColor = $tmp; - - return $this; - } - - /** - * Set orientation of barcode and text - * - * @param int|float|string|bool $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setOrientation($value) - { - $value = floatval($value); - $this->_orientation = $value - floor($value / 360) * 360; - return $this; - } - - /** - * Retrieve orientation of barcode and text - * - * @return float - */ - public function getOrientation() - { - return $this->_orientation; - } - - /** - * Set text to encode - * - * @param string $value - * @return $this - */ - public function setText($value) - { - $this->_text = trim($value); - return $this; - } - - /** - * Retrieve text to encode - * - * @return string - */ - public function getText() - { - $text = $this->_text; - if ($this->_withChecksum) { - $text .= $this->getChecksum($this->_text); - } - return $this->_addLeadingZeros($text); - } - - /** - * Automatically add leading zeros if barcode length is fixed - * - * @param string $text - * @param boolean $withoutChecksum - * @return string - */ - protected function _addLeadingZeros($text, $withoutChecksum = false) - { - if ($this->_barcodeLength && $this->_addLeadingZeros) { - $omitChecksum = (int) ($this->_withChecksum && $withoutChecksum); - if (is_int($this->_barcodeLength)) { - $length = $this->_barcodeLength - $omitChecksum; - if (strlen($text) < $length) { - $text = str_repeat('0', $length - strlen($text)) . $text; - } - } else { - if ($this->_barcodeLength == 'even') { - $text = ((strlen($text) - $omitChecksum) % 2 ? '0' . $text : $text); - } - } - } - return $text; - } - - /** - * Retrieve text to encode - * - * @return string - */ - public function getRawText() - { - return $this->_text; - } - - /** - * Retrieve text to display - * - * @return string - */ - public function getTextToDisplay() - { - if ($this->_withChecksumInText) { - return $this->getText(); - } else { - return $this->_addLeadingZeros($this->_text, true); - } - } - - /** - * Activate/deactivate drawing of text to encode - * - * @param boolean $value - * @return $this - */ - public function setDrawText($value) - { - $this->_drawText = (bool) $value; - return $this; - } - - /** - * Retrieve if drawing of text to encode is enabled - * - * @return boolean - */ - public function getDrawText() - { - return $this->_drawText; - } - - /** - * Activate/deactivate the adjustment of the position - * of the characters to the position of the bars - * - * @param boolean $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setStretchText($value) - { - $this->_stretchText = (bool) $value; - return $this; - } - - /** - * Retrieve if the adjustment of the position of the characters - * to the position of the bars is enabled - * - * @return boolean - */ - public function getStretchText() - { - return $this->_stretchText; - } - - /** - * Activate/deactivate the automatic generation - * of the checksum character - * added to the barcode text - * - * @param boolean $value - * @return $this - */ - public function setWithChecksum($value) - { - if (!$this->_mandatoryChecksum) { - $this->_withChecksum = (bool) $value; - } - return $this; - } - - /** - * Retrieve if the checksum character is automatically - * added to the barcode text - * - * @return boolean - */ - public function getWithChecksum() - { - return $this->_withChecksum; - } - - /** - * Activate/deactivate the automatic generation - * of the checksum character - * added to the barcode text - * - * @param boolean $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setWithChecksumInText($value) - { - if (!$this->_mandatoryChecksum) { - $this->_withChecksumInText = (bool) $value; - } - - return $this; - } - - /** - * Retrieve if the checksum character is automatically - * added to the barcode text - * - * @return boolean - */ - public function getWithChecksumInText() - { - return $this->_withChecksumInText; - } - - /** - * Set the font for all instances of barcode - * - * @param string $font - */ - public static function setBarcodeFont($font) - { - if (is_string($font) || (is_int($font) && $font >= 1 && $font <= 5)) { - self::$_staticFont = $font; - } - } - - /** - * Set the font: - * - if integer between 1 and 5, use gd built-in fonts - * - if string, $value is assumed to be the path to a TTF font - * - * @param integer|string $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setFont($value) - { - if (is_int($value) && $value >= 1 && $value <= 5) { - if (!extension_loaded('gd')) { - throw new Zend_Barcode_Object_Exception( - 'GD extension is required to use numeric font' - ); - } - - // Case of numeric font with GD - $this->_font = $value; - - // In this case font size is given by: - $this->_fontSize = imagefontheight($value); - } elseif (is_string($value)) { - $this->_font = $value; - } else { - throw new Zend_Barcode_Object_Exception( - sprintf( - 'Invalid font "%s" provided to setFont()', - $value - ) - ); - } - return $this; - } - - /** - * Retrieve the font - * - * @return integer|string - */ - public function getFont() - { - return $this->_font; - } - - /** - * Set the size of the font in case of TTF - * - * @param float $value - * @return $this - * @throws Zend_Barcode_Object_Exception - */ - public function setFontSize($value) - { - if (is_numeric($this->_font)) { - // Case of numeric font with GD - return $this; - } - - if (!is_numeric($value)) { - throw new Zend_Barcode_Object_Exception( - 'Font size must be a numeric value' - ); - } - - $this->_fontSize = $value; - return $this; - } - - /** - * Retrieve the size of the font in case of TTF - * - * @return float - */ - public function getFontSize() - { - return $this->_fontSize; - } - - /** - * Quiet zone before first bar - * and after the last bar - * - * @return integer - */ - public function getQuietZone() - { - if ($this->_withQuietZones || $this->_mandatoryQuietZones) { - return 10 * $this->_barThinWidth * $this->_factor; - } else { - return 0; - } - } - - /** - * Add an instruction in the array of instructions - * - * @param array $instruction - */ - protected function _addInstruction(array $instruction) - { - $this->_instructions[] = $instruction; - } - - /** - * Retrieve the set of drawing instructions - * - * @return array - */ - public function getInstructions() - { - return $this->_instructions; - } - - /** - * Add a polygon drawing instruction in the set of instructions - * - * @param array $points - * @param integer $color - * @param boolean $filled - */ - protected function _addPolygon(array $points, $color = null, $filled = true) - { - if ($color === null) { - $color = $this->_foreColor; - } - $this->_addInstruction( - array( - 'type' => 'polygon', - 'points' => $points, - 'color' => $color, - 'filled' => $filled, - ) - ); - } - - /** - * Add a text drawing instruction in the set of instructions - * - * @param string $text - * @param float $size - * @param array $position - * @param string $font - * @param integer $color - * @param string $alignment - * @param float|int $orientation - */ - protected function _addText( - $text, - $size, - $position, - $font, - $color, - $alignment = 'center', - $orientation = 0 - ) { - if ($color === null) { - $color = $this->_foreColor; - } - $this->_addInstruction( - array( - 'type' => 'text', - 'text' => $text, - 'size' => $size, - 'position' => $position, - 'font' => $font, - 'color' => $color, - 'alignment' => $alignment, - 'orientation' => $orientation, - ) - ); - } - - /** - * Checking of parameters after all settings - * - * @return bool - */ - public function checkParams() - { - $this->_checkText(); - $this->_checkFontAndOrientation(); - $this->_checkParams(); - return true; - } - - /** - * Check if a text is really provided to barcode - * - * @param string|null $value - * @throws Zend_Barcode_Object_Exception - */ - protected function _checkText($value = null) - { - if ($value === null) { - $value = $this->_text; - } - if (!strlen($value)) { - throw new Zend_Barcode_Object_Exception( - 'A text must be provide to Barcode before drawing' - ); - } - $this->validateText($value); - } - - /** - * Check the ratio between the thick and the thin bar - * - * @param int $min - * @param int $max - * @throws Zend_Barcode_Object_Exception - */ - protected function _checkRatio($min = 2, $max = 3) - { - $ratio = $this->_barThickWidth / $this->_barThinWidth; - if (!($ratio >= $min && $ratio <= $max)) { - throw new Zend_Barcode_Object_Exception( - sprintf( - 'Ratio thick/thin bar must be between %0.1f and %0.1f (actual %0.3f)', - $min, - $max, - $ratio - ) - ); - } - } - - /** - * Drawing with an angle is just allow TTF font - * - * @throws Zend_Barcode_Object_Exception - */ - protected function _checkFontAndOrientation() - { - if (is_numeric($this->_font) && $this->_orientation != 0) { - throw new Zend_Barcode_Object_Exception( - 'Only drawing with TTF font allow orientation of the barcode.' - ); - } - } - - /** - * Width of the result image (before any rotation) - * - * @return integer - */ - protected function _calculateWidth() - { - return (int) $this->_withBorder - + $this->_calculateBarcodeWidth() - + (int) $this->_withBorder; - } - - /** - * Calculate the width of the barcode - * - * @return integer - */ - abstract protected function _calculateBarcodeWidth(); - - /** - * Height of the result object - * - * @return int - */ - protected function _calculateHeight() - { - return (int) $this->_withBorder * 2 - + $this->_calculateBarcodeHeight() - + (int) $this->_withBorder * 2; - } - - /** - * Height of the barcode - * - * @return int - */ - protected function _calculateBarcodeHeight() - { - $textHeight = 0; - $extraHeight = 0; - if ($this->_drawText) { - $textHeight += $this->_fontSize; - $extraHeight = 2; - } - - return ($this->_barHeight + $textHeight) * $this->_factor - + $extraHeight; - } - - /** - * Get height of the result object - * - * @param bool $recalculate - * @return int - */ - public function getHeight($recalculate = false) - { - if ($this->_height === null || $recalculate) { - $this->_height = - abs( - $this->_calculateHeight() * cos( - $this->_orientation / 180 * pi() - ) - ) - + abs( - $this->_calculateWidth() * sin( - $this->_orientation / 180 * pi() - ) - ); - } - return $this->_height; - } - - /** - * Get width of the result object - * - * @param bool $recalculate - * @return int - */ - public function getWidth($recalculate = false) - { - if ($this->_width === null || $recalculate) { - $this->_width = - abs( - $this->_calculateWidth() * cos( - $this->_orientation / 180 * pi() - ) - ) - + abs( - $this->_calculateHeight() * sin( - $this->_orientation / 180 * pi() - ) - ); - } - return $this->_width; - } - - /** - * Calculate the offset from the left of the object - * if an orientation is activated - * - * @param bool $recalculate - * @return float - */ - public function getOffsetLeft($recalculate = false) - { - if ($this->_offsetLeft === null || $recalculate) { - $this->_offsetLeft = - min(array( - 0 * cos( - $this->_orientation / 180 * pi()) - 0 * sin( - $this->_orientation / 180 * pi()), - 0 * cos( - $this->_orientation / 180 * pi()) - $this->_calculateBarcodeHeight() * sin( - $this->_orientation / 180 * pi()), - $this->_calculateBarcodeWidth() * cos( - $this->_orientation / 180 * pi()) - $this->_calculateBarcodeHeight() * sin( - $this->_orientation / 180 * pi()), - $this->_calculateBarcodeWidth() * cos( - $this->_orientation / 180 * pi()) - 0 * sin( - $this->_orientation / 180 * pi()), - )); - } - return $this->_offsetLeft; - } - - /** - * Calculate the offset from the top of the object - * if an orientation is activated - * - * @param bool $recalculate - * @return float - */ - public function getOffsetTop($recalculate = false) - { - if ($this->_offsetTop === null || $recalculate) { - $this->_offsetTop = - min(array( - 0 * cos( - $this->_orientation / 180 * pi()) + 0 * sin( - $this->_orientation / 180 * pi()), - $this->_calculateBarcodeHeight() * cos( - $this->_orientation / 180 * pi()) + 0 * sin( - $this->_orientation / 180 * pi()), - $this->_calculateBarcodeHeight() * cos( - $this->_orientation / 180 * pi()) + $this->_calculateBarcodeWidth() * sin( - $this->_orientation / 180 * pi()), - 0 * cos( - $this->_orientation / 180 * pi()) + $this->_calculateBarcodeWidth() * sin( - $this->_orientation / 180 * pi()), - )); - } - return $this->_offsetTop; - } - - /** - * Apply rotation on a point in X/Y dimensions - * - * @param float $x1 x-position before rotation - * @param float $y1 y-position before rotation - * @return array Array of two elements corresponding to the new XY point - */ - protected function _rotate($x1, $y1) - { - $x2 = $x1 * cos($this->_orientation / 180 * pi()) - - $y1 * sin($this->_orientation / 180 * pi()) - + $this->getOffsetLeft(); - $y2 = $y1 * cos($this->_orientation / 180 * pi()) - + $x1 * sin($this->_orientation / 180 * pi()) - + $this->getOffsetTop(); - - return array( - intval($x2), - intval($y2) - ); - } - - /** - * Complete drawing of the barcode - * - * @return array Table of instructions - */ - public function draw() - { - $this->checkParams(); - $this->_drawBarcode(); - $this->_drawBorder(); - $this->_drawText(); - return $this->getInstructions(); - } - - /** - * Draw the barcode - */ - protected function _drawBarcode() - { - $barcodeTable = $this->_prepareBarcode(); - - $this->_preDrawBarcode(); - - $xpos = (int) $this->_withBorder; - $ypos = (int) $this->_withBorder; - - $point1 = $this->_rotate(0, 0); - $point2 = $this->_rotate(0, $this->_calculateHeight() - 1); - $point3 = $this->_rotate( - $this->_calculateWidth() - 1, - $this->_calculateHeight() - 1 - ); - $point4 = $this->_rotate($this->_calculateWidth() - 1, 0); - - $this->_addPolygon( - array( - $point1, - $point2, - $point3, - $point4 - ), $this->_backgroundColor - ); - - $xpos += $this->getQuietZone(); - $barLength = $this->_barHeight * $this->_factor; - - foreach ($barcodeTable as $bar) { - $width = $bar[1] * $this->_factor; - if ($bar[0]) { - $point1 = $this->_rotate($xpos, $ypos + $bar[2] * $barLength); - $point2 = $this->_rotate($xpos, $ypos + $bar[3] * $barLength); - $point3 = $this->_rotate( - $xpos + $width - 1, - $ypos + $bar[3] * $barLength - ); - $point4 = $this->_rotate( - $xpos + $width - 1, - $ypos + $bar[2] * $barLength - ); - $this->_addPolygon( - array( - $point1, - $point2, - $point3, - $point4, - ) - ); - } - $xpos += $width; - } - - $this->_postDrawBarcode(); - } - - /** - * Partial function to draw border - */ - protected function _drawBorder() - { - if ($this->_withBorder) { - $point1 = $this->_rotate(0, 0); - $point2 = $this->_rotate($this->_calculateWidth() - 1, 0); - $point3 = $this->_rotate( - $this->_calculateWidth() - 1, - $this->_calculateHeight() - 1 - ); - $point4 = $this->_rotate(0, $this->_calculateHeight() - 1); - $this->_addPolygon( - array( - $point1, - $point2, - $point3, - $point4, - $point1, - ), $this->_foreColor, false - ); - } - } - - /** - * Partial function to draw text - */ - protected function _drawText() - { - if ($this->_drawText) { - $text = $this->getTextToDisplay(); - if ($this->_stretchText) { - $textLength = strlen($text); - $space = ($this->_calculateWidth() - 2 * $this->getQuietZone()) / $textLength; - for ($i = 0; $i < $textLength; $i ++) { - $leftPosition = $this->getQuietZone() + $space * ($i + 0.5); - $this->_addText( - $text{$i}, - $this->_fontSize * $this->_factor, - $this->_rotate( - $leftPosition, - (int) $this->_withBorder * 2 - + $this->_factor * ($this->_barHeight + $this->_fontSize) + 1 - ), - $this->_font, - $this->_foreColor, - 'center', - - $this->_orientation - ); - } - } else { - $this->_addText( - $text, - $this->_fontSize * $this->_factor, - $this->_rotate( - $this->_calculateWidth() / 2, - (int) $this->_withBorder * 2 - + $this->_factor * ($this->_barHeight + $this->_fontSize) + 1 - ), - $this->_font, - $this->_foreColor, - 'center', - - $this->_orientation - ); - } - } - } - - /** - * Check for invalid characters - * - * @param string $value Text to be ckecked - */ - public function validateText($value) - { - $this->_validateText($value); - } - - /** - * Standard validation for most of barcode objects - * - * @param string $value - * @param array $options - * @throws Zend_Barcode_Object_Exception - */ - protected function _validateText($value, $options = array()) - { - $validatorName = (isset($options['validator'])) ? $options['validator'] : $this->getType(); - - $validator = new Zend_Validate_Barcode( - array( - 'adapter' => $validatorName, - 'checksum' => false, - ) - ); - - $checksumCharacter = ''; - $withChecksum = false; - if ($this->_mandatoryChecksum) { - $checksumCharacter = $this->_substituteChecksumCharacter; - $withChecksum = true; - } - - $value = $this->_addLeadingZeros($value, $withChecksum) - . $checksumCharacter; - - if (!$validator->isValid($value)) { - $message = implode("\n", $validator->getMessages()); - - /** - * @see Zend_Barcode_Object_Exception - */ - throw new Zend_Barcode_Object_Exception($message); - } - } - - /** - * Each child must prepare the barcode and return - * a table like array( - * 0 => array( - * 0 => int (visible(black) or not(white)) - * 1 => int (width of the bar) - * 2 => float (0->1 position from the top of the beginning of the bar in %) - * 3 => float (0->1 position from the top of the end of the bar in %) - * ), - * 1 => ... - * ) - * - * @return array - */ - abstract protected function _prepareBarcode(); - - /** - * Checking of parameters after all settings - */ - abstract protected function _checkParams(); - - /** - * Allow each child to draw something else - */ - protected function _preDrawBarcode() - { - } - - /** - * Allow each child to draw something else - * (ex: bearer bars in interleaved 2 of 5 code) - */ - protected function _postDrawBarcode() - { - } -} diff --git a/library/vendor/Zend/Barcode/Object/Planet.php b/library/vendor/Zend/Barcode/Object/Planet.php deleted file mode 100644 index 07af1c30d..000000000 --- a/library/vendor/Zend/Barcode/Object/Planet.php +++ /dev/null @@ -1,60 +0,0 @@ - "00111", - 1 => "11100", - 2 => "11010", - 3 => "11001", - 4 => "10110", - 5 => "10101", - 6 => "10011", - 7 => "01110", - 8 => "01101", - 9 => "01011" - ); -} diff --git a/library/vendor/Zend/Barcode/Object/Postnet.php b/library/vendor/Zend/Barcode/Object/Postnet.php deleted file mode 100644 index a00cfea57..000000000 --- a/library/vendor/Zend/Barcode/Object/Postnet.php +++ /dev/null @@ -1,134 +0,0 @@ - "11000", - 1 => "00011", - 2 => "00101", - 3 => "00110", - 4 => "01001", - 5 => "01010", - 6 => "01100", - 7 => "10001", - 8 => "10010", - 9 => "10100" - ); - - /** - * Default options for Postnet barcode - * @return void - */ - protected function _getDefaultOptions() - { - $this->_barThinWidth = 2; - $this->_barHeight = 20; - $this->_drawText = false; - $this->_stretchText = true; - $this->_mandatoryChecksum = true; - } - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (2 * $this->_barThinWidth) * $this->_factor; - $stopCharacter = (1 * $this->_barThinWidth) * $this->_factor; - $encodedData = (10 * $this->_barThinWidth) * $this->_factor * strlen($this->getText()); - return $quietZone + $startCharacter + $encodedData + $stopCharacter + $quietZone; - } - - /** - * Partial check of interleaved Postnet barcode - * @return void - */ - protected function _checkParams() - {} - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - - // Start character (1) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - - // Text to encode - $textTable = str_split($this->getText()); - foreach ($textTable as $char) { - $bars = str_split($this->_codingMap[$char]); - foreach ($bars as $b) { - $barcodeTable[] = array(1 , $this->_barThinWidth , 0.5 - $b * 0.5 , 1); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - } - } - - // Stop character (1) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - return $barcodeTable; - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $this->_checkText($text); - $sum = array_sum(str_split($text)); - $checksum = (10 - ($sum % 10)) % 10; - return $checksum; - } -} diff --git a/library/vendor/Zend/Barcode/Object/Royalmail.php b/library/vendor/Zend/Barcode/Object/Royalmail.php deleted file mode 100644 index 987e7d638..000000000 --- a/library/vendor/Zend/Barcode/Object/Royalmail.php +++ /dev/null @@ -1,161 +0,0 @@ - '3300', '1' => '3210', '2' => '3201', '3' => '2310', '4' => '2301', '5' => '2211', - '6' => '3120', '7' => '3030', '8' => '3021', '9' => '2130', 'A' => '2121', 'B' => '2031', - 'C' => '3102', 'D' => '3012', 'E' => '3003', 'F' => '2112', 'G' => '2103', 'H' => '2013', - 'I' => '1320', 'J' => '1230', 'K' => '1221', 'L' => '0330', 'M' => '0321', 'N' => '0231', - 'O' => '1302', 'P' => '1212', 'Q' => '1203', 'R' => '0312', 'S' => '0303', 'T' => '0213', - 'U' => '1122', 'V' => '1032', 'W' => '1023', 'X' => '0132', 'Y' => '0123', 'Z' => '0033' - ); - - protected $_rows = array( - '0' => 1, '1' => 1, '2' => 1, '3' => 1, '4' => 1, '5' => 1, - '6' => 2, '7' => 2, '8' => 2, '9' => 2, 'A' => 2, 'B' => 2, - 'C' => 3, 'D' => 3, 'E' => 3, 'F' => 3, 'G' => 3, 'H' => 3, - 'I' => 4, 'J' => 4, 'K' => 4, 'L' => 4, 'M' => 4, 'N' => 4, - 'O' => 5, 'P' => 5, 'Q' => 5, 'R' => 5, 'S' => 5, 'T' => 5, - 'U' => 0, 'V' => 0, 'W' => 0, 'X' => 0, 'Y' => 0, 'Z' => 0, - ); - - protected $_columns = array( - '0' => 1, '1' => 2, '2' => 3, '3' => 4, '4' => 5, '5' => 0, - '6' => 1, '7' => 2, '8' => 3, '9' => 4, 'A' => 5, 'B' => 0, - 'C' => 1, 'D' => 2, 'E' => 3, 'F' => 4, 'G' => 5, 'H' => 0, - 'I' => 1, 'J' => 2, 'K' => 3, 'L' => 4, 'M' => 5, 'N' => 0, - 'O' => 1, 'P' => 2, 'Q' => 3, 'R' => 4, 'S' => 5, 'T' => 0, - 'U' => 1, 'V' => 2, 'W' => 3, 'X' => 4, 'Y' => 5, 'Z' => 0, - ); - - /** - * Default options for Postnet barcode - * @return void - */ - protected function _getDefaultOptions() - { - $this->_barThinWidth = 2; - $this->_barHeight = 20; - $this->_drawText = false; - $this->_stretchText = true; - $this->_mandatoryChecksum = true; - } - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (2 * $this->_barThinWidth) * $this->_factor; - $stopCharacter = (1 * $this->_barThinWidth) * $this->_factor; - $encodedData = (8 * $this->_barThinWidth) * $this->_factor * strlen($this->getText()); - return $quietZone + $startCharacter + $encodedData + $stopCharacter + $quietZone; - } - - /** - * Partial check of interleaved Postnet barcode - * @return void - */ - protected function _checkParams() - {} - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - - // Start character (1) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 5/8); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - - // Text to encode - $textTable = str_split($this->getText()); - foreach ($textTable as $char) { - $bars = str_split($this->_codingMap[$char]); - foreach ($bars as $b) { - $barcodeTable[] = array(1 , $this->_barThinWidth , ($b > 1 ? 3/8 : 0) , ($b % 2 ? 5/8 : 1)); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , 1); - } - } - - // Stop character (1) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , 1); - return $barcodeTable; - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $this->_checkText($text); - $values = str_split($text); - $rowvalue = 0; - $colvalue = 0; - foreach($values as $row) { - $rowvalue += $this->_rows[$row]; - $colvalue += $this->_columns[$row]; - } - - $rowvalue %= 6; - $colvalue %= 6; - - $rowchkvalue = array_keys($this->_rows, $rowvalue); - $colchkvalue = array_keys($this->_columns, $colvalue); - return current(array_intersect($rowchkvalue, $colchkvalue)); - } -} diff --git a/library/vendor/Zend/Barcode/Object/Upca.php b/library/vendor/Zend/Barcode/Object/Upca.php deleted file mode 100644 index 4f3eaa395..000000000 --- a/library/vendor/Zend/Barcode/Object/Upca.php +++ /dev/null @@ -1,170 +0,0 @@ -_barcodeLength = 12; - $this->_mandatoryChecksum = true; - $this->_mandatoryQuietZones = true; - } - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (3 * $this->_barThinWidth) * $this->_factor; - $middleCharacter = (5 * $this->_barThinWidth) * $this->_factor; - $stopCharacter = (3 * $this->_barThinWidth) * $this->_factor; - $encodedData = (7 * $this->_barThinWidth) * $this->_factor * 12; - return $quietZone + $startCharacter + $middleCharacter + $encodedData + $stopCharacter + $quietZone; - } - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - $height = ($this->_drawText) ? 1.1 : 1; - - // Start character (101) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - - $textTable = str_split($this->getText()); - - // First character - $bars = str_split($this->_codingMap['A'][$textTable[0]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , $height); - } - - // First part - for ($i = 1; $i < 6; $i++) { - $bars = str_split($this->_codingMap['A'][$textTable[$i]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1); - } - } - - // Middle character (01010) - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - - // Second part - for ($i = 6; $i < 11; $i++) { - $bars = str_split($this->_codingMap['C'][$textTable[$i]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1); - } - } - - // Last character - $bars = str_split($this->_codingMap['C'][$textTable[11]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , $height); - } - - // Stop character (101) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - return $barcodeTable; - } - - /** - * Partial function to draw text - * @return void - */ - protected function _drawText() - { - if ($this->_drawText) { - $text = $this->getTextToDisplay(); - $characterWidth = (7 * $this->_barThinWidth) * $this->_factor; - $leftPosition = $this->getQuietZone() - $characterWidth; - for ($i = 0; $i < $this->_barcodeLength; $i ++) { - $fontSize = $this->_fontSize; - if ($i == 0 || $i == 11) { - $fontSize *= 0.8; - } - $this->_addText( - $text{$i}, - $fontSize * $this->_factor, - $this->_rotate( - $leftPosition, - (int) $this->_withBorder * 2 - + $this->_factor * ($this->_barHeight + $fontSize) + 1 - ), - $this->_font, - $this->_foreColor, - 'left', - - $this->_orientation - ); - switch ($i) { - case 0: - $factor = 10; - break; - case 5: - $factor = 4; - break; - case 10: - $factor = 11; - break; - default: - $factor = 0; - } - $leftPosition = $leftPosition + $characterWidth + ($factor * $this->_barThinWidth * $this->_factor); - } - } - } -} diff --git a/library/vendor/Zend/Barcode/Object/Upce.php b/library/vendor/Zend/Barcode/Object/Upce.php deleted file mode 100644 index 7ee12083d..000000000 --- a/library/vendor/Zend/Barcode/Object/Upce.php +++ /dev/null @@ -1,227 +0,0 @@ - array( - 0 => array('B','B','B','A','A','A'), - 1 => array('B','B','A','B','A','A'), - 2 => array('B','B','A','A','B','A'), - 3 => array('B','B','A','A','A','B'), - 4 => array('B','A','B','B','A','A'), - 5 => array('B','A','A','B','B','A'), - 6 => array('B','A','A','A','B','B'), - 7 => array('B','A','B','A','B','A'), - 8 => array('B','A','B','A','A','B'), - 9 => array('B','A','A','B','A','B')), - 1 => array( - 0 => array('A','A','A','B','B','B'), - 1 => array('A','A','B','A','B','B'), - 2 => array('A','A','B','B','A','B'), - 3 => array('A','A','B','B','B','A'), - 4 => array('A','B','A','A','B','B'), - 5 => array('A','B','B','A','A','B'), - 6 => array('A','B','B','B','A','A'), - 7 => array('A','B','A','B','A','B'), - 8 => array('A','B','A','B','B','A'), - 9 => array('A','B','B','A','B','A')) - ); - - /** - * Default options for Postnet barcode - * @return void - */ - protected function _getDefaultOptions() - { - $this->_barcodeLength = 8; - $this->_mandatoryChecksum = true; - $this->_mandatoryQuietZones = true; - } - - /** - * Retrieve text to encode - * @return string - */ - public function getText() - { - $text = parent::getText(); - if ($text{0} != 1) { - $text{0} = 0; - } - return $text; - } - - /** - * Width of the barcode (in pixels) - * @return integer - */ - protected function _calculateBarcodeWidth() - { - $quietZone = $this->getQuietZone(); - $startCharacter = (3 * $this->_barThinWidth) * $this->_factor; - $stopCharacter = (6 * $this->_barThinWidth) * $this->_factor; - $encodedData = (7 * $this->_barThinWidth) * $this->_factor * 6; - return $quietZone + $startCharacter + $encodedData + $stopCharacter + $quietZone; - } - - /** - * Prepare array to draw barcode - * @return array - */ - protected function _prepareBarcode() - { - $barcodeTable = array(); - $height = ($this->_drawText) ? 1.1 : 1; - - // Start character (101) - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - - $textTable = str_split($this->getText()); - $system = 0; - if ($textTable[0] == 1) { - $system = 1; - } - $checksum = $textTable[7]; - $parity = $this->_parities[$system][$checksum]; - - for ($i = 1; $i < 7; $i++) { - $bars = str_split($this->_codingMap[$parity[$i - 1]][$textTable[$i]]); - foreach ($bars as $b) { - $barcodeTable[] = array($b , $this->_barThinWidth , 0 , 1); - } - } - - // Stop character (10101) - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(0 , $this->_barThinWidth , 0 , $height); - $barcodeTable[] = array(1 , $this->_barThinWidth , 0 , $height); - return $barcodeTable; - } - - /** - * Partial function to draw text - * @return void - */ - protected function _drawText() - { - if ($this->_drawText) { - $text = $this->getTextToDisplay(); - $characterWidth = (7 * $this->_barThinWidth) * $this->_factor; - $leftPosition = $this->getQuietZone() - $characterWidth; - for ($i = 0; $i < $this->_barcodeLength; $i ++) { - $fontSize = $this->_fontSize; - if ($i == 0 || $i == 7) { - $fontSize *= 0.8; - } - $this->_addText( - $text{$i}, - $fontSize * $this->_factor, - $this->_rotate( - $leftPosition, - (int) $this->_withBorder * 2 - + $this->_factor * ($this->_barHeight + $fontSize) + 1 - ), - $this->_font, - $this->_foreColor, - 'left', - - $this->_orientation - ); - switch ($i) { - case 0: - $factor = 3; - break; - case 6: - $factor = 5; - break; - default: - $factor = 0; - } - $leftPosition = $leftPosition + $characterWidth + ($factor * $this->_barThinWidth * $this->_factor); - } - } - } - - /** - * Particular validation for Upce barcode objects - * (to suppress checksum character substitution) - * - * @param string $value - * @param array $options - * @throws Zend_Barcode_Object_Exception - */ - protected function _validateText($value, $options = array()) - { - $validator = new Zend_Validate_Barcode(array( - 'adapter' => 'upce', - 'checksum' => false, - )); - - $value = $this->_addLeadingZeros($value, true); - - if (!$validator->isValid($value)) { - $message = implode("\n", $validator->getMessages()); - - /** - * @see Zend_Barcode_Object_Exception - */ - throw new Zend_Barcode_Object_Exception($message); - } - } - - /** - * Get barcode checksum - * - * @param string $text - * @return int - */ - public function getChecksum($text) - { - $text = $this->_addLeadingZeros($text, true); - if ($text{0} != 1) { - $text{0} = 0; - } - return parent::getChecksum($text); - } -} diff --git a/library/vendor/Zend/Barcode/Renderer/Exception.php b/library/vendor/Zend/Barcode/Renderer/Exception.php deleted file mode 100644 index f89d21c31..000000000 --- a/library/vendor/Zend/Barcode/Renderer/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ -_userHeight = intval($value); - return $this; - } - - /** - * Get barcode height - * - * @return int - */ - public function getHeight() - { - return $this->_userHeight; - } - - /** - * Set barcode width - * - * @param mixed $value - * @return self - * @throws Zend_Barcode_Renderer_Exception - */ - public function setWidth($value) - { - if (!is_numeric($value) || intval($value) < 0) { - throw new Zend_Barcode_Renderer_Exception( - 'Image width must be greater than or equals 0' - ); - } - $this->_userWidth = intval($value); - return $this; - } - - /** - * Get barcode width - * - * @return int - */ - public function getWidth() - { - return $this->_userWidth; - } - - /** - * Set an image resource to draw the barcode inside - * - * @param $image - * @return Zend_Barcode_Renderer - * @throws Zend_Barcode_Renderer_Exception - */ - public function setResource($image) - { - if (gettype($image) != 'resource' || get_resource_type($image) != 'gd') { - throw new Zend_Barcode_Renderer_Exception( - 'Invalid image resource provided to setResource()' - ); - } - $this->_resource = $image; - return $this; - } - - /** - * Set the image type to produce (png, jpeg, gif) - * - * @param string $value - * @return Zend_Barcode_RendererAbstract - * @throws Zend_Barcode_Renderer_Exception - */ - public function setImageType($value) - { - if ($value == 'jpg') { - $value = 'jpeg'; - } - - if (!in_array($value, $this->_allowedImageType)) { - throw new Zend_Barcode_Renderer_Exception(sprintf( - 'Invalid type "%s" provided to setImageType()', - $value - )); - } - - $this->_imageType = $value; - return $this; - } - - /** - * Retrieve the image type to produce - * - * @return string - */ - public function getImageType() - { - return $this->_imageType; - } - - /** - * Initialize the image resource - * - * @return void - * @throws Zend_Barcode_Exception - */ - protected function _initRenderer() - { - if (!extension_loaded('gd')) { - $e = new Zend_Barcode_Exception( - 'Gd extension must be loaded to render barcode as image' - ); - $e->setIsRenderable(false); - throw $e; - } - - $barcodeWidth = $this->_barcode->getWidth(true); - $barcodeHeight = $this->_barcode->getHeight(true); - - if ($this->_resource !== null) { - $foreColor = $this->_barcode->getForeColor(); - $backgroundColor = $this->_barcode->getBackgroundColor(); - $this->_imageBackgroundColor = imagecolorallocate( - $this->_resource, - ($backgroundColor & 0xFF0000) >> 16, - ($backgroundColor & 0x00FF00) >> 8, - $backgroundColor & 0x0000FF - ); - $this->_imageForeColor = imagecolorallocate( - $this->_resource, - ($foreColor & 0xFF0000) >> 16, - ($foreColor & 0x00FF00) >> 8, - $foreColor & 0x0000FF - ); - } else { - $width = $barcodeWidth; - $height = $barcodeHeight; - if ($this->_userWidth && $this->_barcode->getType() != 'error') { - $width = $this->_userWidth; - } - if ($this->_userHeight && $this->_barcode->getType() != 'error') { - $height = $this->_userHeight; - } - - $foreColor = $this->_barcode->getForeColor(); - $backgroundColor = $this->_barcode->getBackgroundColor(); - $this->_resource = imagecreatetruecolor($width, $height); - - $this->_imageBackgroundColor = imagecolorallocate( - $this->_resource, - ($backgroundColor & 0xFF0000) >> 16, - ($backgroundColor & 0x00FF00) >> 8, - $backgroundColor & 0x0000FF - ); - $this->_imageForeColor = imagecolorallocate( - $this->_resource, - ($foreColor & 0xFF0000) >> 16, - ($foreColor & 0x00FF00) >> 8, - $foreColor & 0x0000FF - ); - $white = imagecolorallocate($this->_resource, 255, 255, 255); - imagefilledrectangle($this->_resource, 0, 0, $width - 1, $height - 1, $white); - } - $this->_adjustPosition(imagesy($this->_resource), imagesx($this->_resource)); - imagefilledrectangle( - $this->_resource, - $this->_leftOffset, - $this->_topOffset, - $this->_leftOffset + $barcodeWidth - 1, - $this->_topOffset + $barcodeHeight - 1, - $this->_imageBackgroundColor - ); - } - - /** - * Check barcode parameters - * - * @return void - */ - protected function _checkParams() - { - $this->_checkDimensions(); - } - - /** - * Check barcode dimensions - * - * @return void - * @throws Zend_Barcode_Renderer_Exception - */ - protected function _checkDimensions() - { - if ($this->_resource !== null) { - if (imagesy($this->_resource) < $this->_barcode->getHeight(true)) { - throw new Zend_Barcode_Renderer_Exception( - 'Barcode is define outside the image (height)' - ); - } - } else { - if ($this->_userHeight) { - $height = $this->_barcode->getHeight(true); - if ($this->_userHeight < $height) { - throw new Zend_Barcode_Renderer_Exception(sprintf( - "Barcode is define outside the image (calculated: '%d', provided: '%d')", - $height, - $this->_userHeight - )); - } - } - } - if ($this->_resource !== null) { - if (imagesx($this->_resource) < $this->_barcode->getWidth(true)) { - throw new Zend_Barcode_Renderer_Exception( - 'Barcode is define outside the image (width)' - ); - } - } else { - if ($this->_userWidth) { - $width = $this->_barcode->getWidth(true); - if ($this->_userWidth < $width) { - throw new Zend_Barcode_Renderer_Exception(sprintf( - "Barcode is define outside the image (calculated: '%d', provided: '%d')", - $width, - $this->_userWidth - )); - } - } - } - } - - /** - * Draw and render the barcode with correct headers - * - * @return mixed - */ - public function render() - { - $this->draw(); - header("Content-Type: image/" . $this->_imageType); - $functionName = 'image' . $this->_imageType; - call_user_func($functionName, $this->_resource); - @imagedestroy($this->_resource); - } - - /** - * Draw a polygon in the image resource - * - * @param array $points - * @param integer $color - * @param boolean $filled - */ - protected function _drawPolygon($points, $color, $filled = true) - { - $newPoints = array( - $points[0][0] + $this->_leftOffset, - $points[0][1] + $this->_topOffset, - $points[1][0] + $this->_leftOffset, - $points[1][1] + $this->_topOffset, - $points[2][0] + $this->_leftOffset, - $points[2][1] + $this->_topOffset, - $points[3][0] + $this->_leftOffset, - $points[3][1] + $this->_topOffset, - ); - - $allocatedColor = imagecolorallocate( - $this->_resource, - ($color & 0xFF0000) >> 16, - ($color & 0x00FF00) >> 8, - $color & 0x0000FF - ); - - if ($filled) { - imagefilledpolygon($this->_resource, $newPoints, 4, $allocatedColor); - } else { - imagepolygon($this->_resource, $newPoints, 4, $allocatedColor); - } - } - - /** - * Draw a polygon in the image resource - * - * @param string $text - * @param float $size - * @param array $position - * @param string $font - * @param integer $color - * @param string $alignment - * @param float|int $orientation - * @throws Zend_Barcode_Renderer_Exception - */ - protected function _drawText($text, $size, $position, $font, $color, $alignment = 'center', $orientation = 0) - { - $allocatedColor = imagecolorallocate( - $this->_resource, - ($color & 0xFF0000) >> 16, - ($color & 0x00FF00) >> 8, - $color & 0x0000FF - ); - - if ($font == null) { - $font = 3; - } - $position[0] += $this->_leftOffset; - $position[1] += $this->_topOffset; - - if (is_numeric($font)) { - if ($orientation) { - /** - * imagestring() doesn't allow orientation, if orientation - * needed: a TTF font is required. - * Throwing an exception here, allow to use automaticRenderError - * to informe user of the problem instead of simply not drawing - * the text - */ - throw new Zend_Barcode_Renderer_Exception( - 'No orientation possible with GD internal font' - ); - } - $fontWidth = imagefontwidth($font); - $positionY = $position[1] - imagefontheight($font) + 1; - switch ($alignment) { - case 'left': - $positionX = $position[0]; - break; - case 'center': - $positionX = $position[0] - ceil(($fontWidth * strlen($text)) / 2); - break; - case 'right': - $positionX = $position[0] - ($fontWidth * strlen($text)); - break; - } - imagestring($this->_resource, $font, $positionX, $positionY, $text, $color); - } else { - - if (!function_exists('imagettfbbox')) { - throw new Zend_Barcode_Renderer_Exception( - 'A font was provided, but this instance of PHP does not have TTF (FreeType) support' - ); - } - - $box = imagettfbbox($size, 0, $font, $text); - switch ($alignment) { - case 'left': - $width = 0; - break; - case 'center': - $width = ($box[2] - $box[0]) / 2; - break; - case 'right': - $width = ($box[2] - $box[0]); - break; - } - imagettftext( - $this->_resource, - $size, - $orientation, - $position[0] - ($width * cos(pi() * $orientation / 180)), - $position[1] + ($width * sin(pi() * $orientation / 180)), - $allocatedColor, - $font, - $text - ); - } - } -} diff --git a/library/vendor/Zend/Barcode/Renderer/Pdf.php b/library/vendor/Zend/Barcode/Renderer/Pdf.php deleted file mode 100644 index cb70e0f9f..000000000 --- a/library/vendor/Zend/Barcode/Renderer/Pdf.php +++ /dev/null @@ -1,240 +0,0 @@ -_resource = $pdf; - $this->_page = intval($page); - - if (!count($this->_resource->pages)) { - $this->_page = 0; - $this->_resource->pages[] = new Zend_Pdf_Page( - Zend_Pdf_Page::SIZE_A4 - ); - } - return $this; - } - - /** - * Check renderer parameters - * - * @return void - */ - protected function _checkParams() - { - } - - /** - * Draw the barcode in the PDF, send headers and the PDF - * @return mixed - */ - public function render() - { - $this->draw(); - header("Content-Type: application/pdf"); - echo $this->_resource->render(); - } - - /** - * Initialize the PDF resource - * @return void - */ - protected function _initRenderer() - { - if ($this->_resource === null) { - $this->_resource = new Zend_Pdf(); - $this->_resource->pages[] = new Zend_Pdf_Page( - Zend_Pdf_Page::SIZE_A4 - ); - } - - $pdfPage = $this->_resource->pages[$this->_page]; - $this->_adjustPosition($pdfPage->getHeight(), $pdfPage->getWidth()); - } - - /** - * Draw a polygon in the rendering resource - * @param array $points - * @param integer $color - * @param boolean $filled - */ - protected function _drawPolygon($points, $color, $filled = true) - { - $page = $this->_resource->pages[$this->_page]; - foreach ($points as $point) { - $x[] = $point[0] * $this->_moduleSize + $this->_leftOffset; - $y[] = $page->getHeight() - $point[1] * $this->_moduleSize - $this->_topOffset; - } - if (count($y) == 4) { - if ($x[0] != $x[3] && $y[0] == $y[3]) { - $y[0] -= ($this->_moduleSize / 2); - $y[3] -= ($this->_moduleSize / 2); - } - if ($x[1] != $x[2] && $y[1] == $y[2]) { - $y[1] += ($this->_moduleSize / 2); - $y[2] += ($this->_moduleSize / 2); - } - } - - $color = new Zend_Pdf_Color_Rgb( - (($color & 0xFF0000) >> 16) / 255.0, - (($color & 0x00FF00) >> 8) / 255.0, - ($color & 0x0000FF) / 255.0 - ); - - $page->setLineColor($color); - $page->setFillColor($color); - $page->setLineWidth($this->_moduleSize); - - $fillType = ($filled) - ? Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE - : Zend_Pdf_Page::SHAPE_DRAW_STROKE; - - $page->drawPolygon($x, $y, $fillType); - } - - /** - * Draw a text in the rendering resource - * - * @param string $text - * @param float $size - * @param array $position - * @param string $font - * @param integer $color - * @param string $alignment - * @param float|int $orientation - */ - protected function _drawText( - $text, - $size, - $position, - $font, - $color, - $alignment = 'center', - $orientation = 0 - ) { - $page = $this->_resource->pages[$this->_page]; - $color = new Zend_Pdf_Color_Rgb( - (($color & 0xFF0000) >> 16) / 255.0, - (($color & 0x00FF00) >> 8) / 255.0, - ($color & 0x0000FF) / 255.0 - ); - - $page->setLineColor($color); - $page->setFillColor($color); - $page->setFont(Zend_Pdf_Font::fontWithPath($font), $size * $this->_moduleSize * 1.2); - - $width = $this->widthForStringUsingFontSize( - $text, - Zend_Pdf_Font::fontWithPath($font), - $size * $this->_moduleSize - ); - - $angle = pi() * $orientation / 180; - $left = $position[0] * $this->_moduleSize + $this->_leftOffset; - $top = $page->getHeight() - $position[1] * $this->_moduleSize - $this->_topOffset; - - switch ($alignment) { - case 'center': - $left -= ($width / 2) * cos($angle); - $top -= ($width / 2) * sin($angle); - break; - case 'right': - $left -= $width; - break; - } - $page->rotate($left, $top, $angle); - $page->drawText($text, $left, $top); - $page->rotate($left, $top, - $angle); - } - - /** - * Calculate the width of a string: - * in case of using alignment parameter in drawText - * @param string $text - * @param Zend_Pdf_Font $font - * @param float $fontSize - * @return float - */ - public function widthForStringUsingFontSize($text, $font, $fontSize) - { - $drawingString = iconv('UTF-8', 'UTF-16BE//IGNORE', $text); - $characters = array(); - for ($i = 0; $i < strlen($drawingString); $i ++) { - $characters[] = (ord($drawingString[$i ++]) << 8) | ord($drawingString[$i]); - } - $glyphs = $font->glyphNumbersForCharacters($characters); - $widths = $font->widthsForGlyphs($glyphs); - $stringWidth = (array_sum($widths) / $font->getUnitsPerEm()) * $fontSize; - return $stringWidth; - } -} diff --git a/library/vendor/Zend/Barcode/Renderer/RendererAbstract.php b/library/vendor/Zend/Barcode/Renderer/RendererAbstract.php deleted file mode 100644 index df0763efa..000000000 --- a/library/vendor/Zend/Barcode/Renderer/RendererAbstract.php +++ /dev/null @@ -1,543 +0,0 @@ -toArray(); - } - if (is_array($options)) { - $this->setOptions($options); - } - $this->_type = strtolower(substr( - get_class($this), - strlen($this->_rendererNamespace) + 1 - )); - } - - /** - * Set renderer state from options array - * @param array $options - * @return Zend_Renderer_Object - */ - public function setOptions($options) - { - foreach ($options as $key => $value) { - $method = 'set' . $key; - if (method_exists($this, $method)) { - $this->$method($value); - } - } - return $this; - } - - /** - * Set renderer state from config object - * @param Zend_Config $config - * @return Zend_Renderer_Object - */ - public function setConfig(Zend_Config $config) - { - return $this->setOptions($config->toArray()); - } - - /** - * Set renderer namespace for autoloading - * - * @param string $namespace - * @return Zend_Renderer_Object - */ - public function setRendererNamespace($namespace) - { - $this->_rendererNamespace = $namespace; - return $this; - } - - /** - * Retrieve renderer namespace - * - * @return string - */ - public function getRendererNamespace() - { - return $this->_rendererNamespace; - } - - /** - * Retrieve renderer type - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * Manually adjust top position - * @param integer $value - * @return Zend_Barcode_Renderer - * @throws Zend_Barcode_Renderer_Exception - */ - public function setTopOffset($value) - { - if (!is_numeric($value) || intval($value) < 0) { - throw new Zend_Barcode_Renderer_Exception( - 'Vertical position must be greater than or equals 0' - ); - } - $this->_topOffset = intval($value); - return $this; - } - - /** - * Retrieve vertical adjustment - * @return integer - */ - public function getTopOffset() - { - return $this->_topOffset; - } - - /** - * Manually adjust left position - * @param integer $value - * @return Zend_Barcode_Renderer - * @throws Zend_Barcode_Renderer_Exception - */ - public function setLeftOffset($value) - { - if (!is_numeric($value) || intval($value) < 0) { - throw new Zend_Barcode_Renderer_Exception( - 'Horizontal position must be greater than or equals 0' - ); - } - $this->_leftOffset = intval($value); - return $this; - } - - /** - * Retrieve vertical adjustment - * @return integer - */ - public function getLeftOffset() - { - return $this->_leftOffset; - } - - /** - * Activate/Deactivate the automatic rendering of exception - * - * @param boolean $value - * @return $this - */ - public function setAutomaticRenderError($value) - { - $this->_automaticRenderError = (bool) $value; - return $this; - } - - /** - * Horizontal position of the barcode in the rendering resource - * - * @param string $value - * @return Zend_Barcode_Renderer - * @throws Zend_Barcode_Renderer_Exception - */ - public function setHorizontalPosition($value) - { - if (!in_array($value, array('left' , 'center' , 'right'))) { - throw new Zend_Barcode_Renderer_Exception( - "Invalid barcode position provided must be 'left', 'center' or 'right'" - ); - } - $this->_horizontalPosition = $value; - return $this; - } - - /** - * Horizontal position of the barcode in the rendering resource - * @return string - */ - public function getHorizontalPosition() - { - return $this->_horizontalPosition; - } - - /** - * Vertical position of the barcode in the rendering resource - * - * @param string $value - * @return self - * @throws Zend_Barcode_Renderer_Exception - */ - public function setVerticalPosition($value) - { - if (!in_array($value, array('top' , 'middle' , 'bottom'))) { - throw new Zend_Barcode_Renderer_Exception( - "Invalid barcode position provided must be 'top', 'middle' or 'bottom'" - ); - } - $this->_verticalPosition = $value; - return $this; - } - - /** - * Vertical position of the barcode in the rendering resource - * @return string - */ - public function getVerticalPosition() - { - return $this->_verticalPosition; - } - - /** - * Set the size of a module - * @param float $value - * @return Zend_Barcode_Renderer - * @throws Zend_Barcode_Renderer_Exception - */ - public function setModuleSize($value) - { - if (!is_numeric($value) || floatval($value) <= 0) { - throw new Zend_Barcode_Renderer_Exception( - 'Float size must be greater than 0' - ); - } - $this->_moduleSize = floatval($value); - return $this; - } - - - /** - * Set the size of a module - * @return float - */ - public function getModuleSize() - { - return $this->_moduleSize; - } - - /** - * Retrieve the automatic rendering of exception - * @return boolean - */ - public function getAutomaticRenderError() - { - return $this->_automaticRenderError; - } - - /** - * Set the barcode object - * - * @param Zend_Barcode_Object $barcode - * @return Zend_Barcode_Renderer - * @throws Zend_Barcode_Renderer_Exception - */ - public function setBarcode($barcode) - { - if (!$barcode instanceof Zend_Barcode_Object_ObjectAbstract) { - throw new Zend_Barcode_Renderer_Exception( - 'Invalid barcode object provided to setBarcode()' - ); - } - $this->_barcode = $barcode; - return $this; - } - - /** - * Retrieve the barcode object - * @return Zend_Barcode_Object - */ - public function getBarcode() - { - return $this->_barcode; - } - - /** - * Checking of parameters after all settings - * @return boolean - */ - public function checkParams() - { - $this->_checkBarcodeObject(); - $this->_checkParams(); - return true; - } - - /** - * Check if a barcode object is correctly provided - * @return void - * @throws Zend_Barcode_Renderer_Exception - */ - protected function _checkBarcodeObject() - { - if ($this->_barcode === null) { - /** - * @see Zend_Barcode_Renderer_Exception - */ - throw new Zend_Barcode_Renderer_Exception( - 'No barcode object provided' - ); - } - } - - /** - * Calculate the left and top offset of the barcode in the - * rendering support - * - * @param float $supportHeight - * @param float $supportWidth - * @return void - */ - protected function _adjustPosition($supportHeight, $supportWidth) - { - $barcodeHeight = $this->_barcode->getHeight(true) * $this->_moduleSize; - if ($barcodeHeight != $supportHeight && $this->_topOffset == 0) { - switch ($this->_verticalPosition) { - case 'middle': - $this->_topOffset = floor( - ($supportHeight - $barcodeHeight) / 2); - break; - case 'bottom': - $this->_topOffset = $supportHeight - $barcodeHeight; - break; - case 'top': - default: - $this->_topOffset = 0; - break; - } - } - $barcodeWidth = $this->_barcode->getWidth(true) * $this->_moduleSize; - if ($barcodeWidth != $supportWidth && $this->_leftOffset == 0) { - switch ($this->_horizontalPosition) { - case 'center': - $this->_leftOffset = floor( - ($supportWidth - $barcodeWidth) / 2); - break; - case 'right': - $this->_leftOffset = $supportWidth - $barcodeWidth; - break; - case 'left': - default: - $this->_leftOffset = 0; - break; - } - } - } - - /** - * Draw the barcode in the rendering resource - * - * @return mixed - * @throws Zend_Exception - * @throws Zend_Barcode_Exception - */ - public function draw() - { - try { - $this->checkParams(); - $this->_initRenderer(); - $this->_drawInstructionList(); - } catch (Zend_Exception $e) { - $renderable = false; - if ($e instanceof Zend_Barcode_Exception) { - $renderable = $e->isRenderable(); - } - if ($this->_automaticRenderError && $renderable) { - $barcode = Zend_Barcode::makeBarcode( - 'error', - array('text' => $e->getMessage()) - ); - $this->setBarcode($barcode); - $this->_resource = null; - $this->_initRenderer(); - $this->_drawInstructionList(); - } else { - if ($e instanceof Zend_Barcode_Exception) { - $e->setIsRenderable(false); - } - throw $e; - } - } - return $this->_resource; - } - - /** - * Sub process to draw the barcode instructions - * Needed by the automatic error rendering - */ - private function _drawInstructionList() - { - $instructionList = $this->_barcode->draw(); - foreach ($instructionList as $instruction) { - switch ($instruction['type']) { - case 'polygon': - $this->_drawPolygon( - $instruction['points'], - $instruction['color'], - $instruction['filled'] - ); - break; - case 'text': //$text, $size, $position, $font, $color, $alignment = 'center', $orientation = 0) - $this->_drawText( - $instruction['text'], - $instruction['size'], - $instruction['position'], - $instruction['font'], - $instruction['color'], - $instruction['alignment'], - $instruction['orientation'] - ); - break; - default: - /** - * @see Zend_Barcode_Renderer_Exception - */ - throw new Zend_Barcode_Renderer_Exception( - 'Unknown drawing command' - ); - } - } - } - - /** - * Checking of parameters after all settings - * @return void - */ - abstract protected function _checkParams(); - - /** - * Render the resource by sending headers and drawed resource - * @return mixed - */ - abstract public function render(); - - /** - * Initialize the rendering resource - * @return void - */ - abstract protected function _initRenderer(); - - /** - * Draw a polygon in the rendering resource - * @param array $points - * @param integer $color - * @param boolean $filled - */ - abstract protected function _drawPolygon($points, $color, $filled = true); - - /** - * Draw a polygon in the rendering resource - * - * @param string $text - * @param float $size - * @param array $position - * @param string $font - * @param integer $color - * @param string $alignment - * @param float|int $orientation - */ - abstract protected function _drawText( - $text, - $size, - $position, - $font, - $color, - $alignment = 'center', - $orientation = 0 - ); -} diff --git a/library/vendor/Zend/Barcode/Renderer/Svg.php b/library/vendor/Zend/Barcode/Renderer/Svg.php deleted file mode 100644 index 58791a15f..000000000 --- a/library/vendor/Zend/Barcode/Renderer/Svg.php +++ /dev/null @@ -1,377 +0,0 @@ -_userHeight = intval($value); - return $this; - } - - /** - * Get barcode height - * - * @return int - */ - public function getHeight() - { - return $this->_userHeight; - } - - /** - * Set barcode width - * - * @param mixed $value - * @return self - * @throws Zend_Barcode_Renderer_Exception - */ - public function setWidth($value) - { - if (!is_numeric($value) || intval($value) < 0) { - throw new Zend_Barcode_Renderer_Exception( - 'Svg width must be greater than or equals 0' - ); - } - $this->_userWidth = intval($value); - return $this; - } - - /** - * Get barcode width - * - * @return int - */ - public function getWidth() - { - return $this->_userWidth; - } - - /** - * Set an image resource to draw the barcode inside - * - * @param $svg - * @return Zend_Barcode_Renderer - * @throws Zend_Barcode_Renderer_Exception - */ - public function setResource($svg) - { - if (!$svg instanceof DOMDocument) { - throw new Zend_Barcode_Renderer_Exception( - 'Invalid DOMDocument resource provided to setResource()' - ); - } - $this->_resource = $svg; - return $this; - } - - /** - * Initialize the image resource - * - * @return void - */ - protected function _initRenderer() - { - $barcodeWidth = $this->_barcode->getWidth(true); - $barcodeHeight = $this->_barcode->getHeight(true); - - $backgroundColor = $this->_barcode->getBackgroundColor(); - $imageBackgroundColor = 'rgb(' . implode(', ', array(($backgroundColor & 0xFF0000) >> 16, - ($backgroundColor & 0x00FF00) >> 8, - ($backgroundColor & 0x0000FF))) . ')'; - - $width = $barcodeWidth; - $height = $barcodeHeight; - if ($this->_userWidth && $this->_barcode->getType() != 'error') { - $width = $this->_userWidth; - } - if ($this->_userHeight && $this->_barcode->getType() != 'error') { - $height = $this->_userHeight; - } - if ($this->_resource === null) { - $this->_resource = new DOMDocument('1.0', 'utf-8'); - $this->_resource->formatOutput = true; - $this->_rootElement = $this->_resource->createElement('svg'); - $this->_rootElement->setAttribute('xmlns', "http://www.w3.org/2000/svg"); - $this->_rootElement->setAttribute('version', '1.1'); - $this->_rootElement->setAttribute('width', $width); - $this->_rootElement->setAttribute('height', $height); - - $this->_appendRootElement('title', - array(), - "Barcode " . strtoupper($this->_barcode->getType()) . " " . $this->_barcode->getText()); - } else { - $this->_readRootElement(); - $width = $this->_rootElement->getAttribute('width'); - $height = $this->_rootElement->getAttribute('height'); - } - $this->_adjustPosition($height, $width); - - $this->_appendRootElement('rect', - array('x' => $this->_leftOffset, - 'y' => $this->_topOffset, - 'width' => ($this->_leftOffset + $barcodeWidth - 1), - 'height' => ($this->_topOffset + $barcodeHeight - 1), - 'fill' => $imageBackgroundColor)); - } - - protected function _readRootElement() - { - if ($this->_resource !== null) { - $this->_rootElement = $this->_resource->documentElement; - } - } - - /** - * Append a new DOMElement to the root element - * - * @param string $tagName - * @param array $attributes - * @param string $textContent - */ - protected function _appendRootElement($tagName, $attributes = array(), $textContent = null) - { - $newElement = $this->_createElement($tagName, $attributes, $textContent); - $this->_rootElement->appendChild($newElement); - } - - /** - * Create DOMElement - * - * @param string $tagName - * @param array $attributes - * @param string $textContent - * @return DOMElement - */ - protected function _createElement($tagName, $attributes = array(), $textContent = null) - { - $element = $this->_resource->createElement($tagName); - foreach ($attributes as $k =>$v) { - $element->setAttribute($k, $v); - } - if ($textContent !== null) { - $element->appendChild(new DOMText((string) $textContent)); - } - return $element; - } - - /** - * Check barcode parameters - * - * @return void - */ - protected function _checkParams() - { - $this->_checkDimensions(); - } - - /** - * Check barcode dimensions - * - * @return void - * @throws Zend_Barcode_Renderer_Exception - */ - protected function _checkDimensions() - { - if ($this->_resource !== null) { - $this->_readRootElement(); - $height = (float) $this->_rootElement->getAttribute('height'); - if ($height < $this->_barcode->getHeight(true)) { - throw new Zend_Barcode_Renderer_Exception( - 'Barcode is define outside the image (height)' - ); - } - } else { - if ($this->_userHeight) { - $height = $this->_barcode->getHeight(true); - if ($this->_userHeight < $height) { - throw new Zend_Barcode_Renderer_Exception(sprintf( - "Barcode is define outside the image (calculated: '%d', provided: '%d')", - $height, - $this->_userHeight - )); - } - } - } - if ($this->_resource !== null) { - $this->_readRootElement(); - $width = $this->_rootElement->getAttribute('width'); - if ($width < $this->_barcode->getWidth(true)) { - throw new Zend_Barcode_Renderer_Exception( - 'Barcode is define outside the image (width)' - ); - } - } else { - if ($this->_userWidth) { - $width = (float) $this->_barcode->getWidth(true); - if ($this->_userWidth < $width) { - throw new Zend_Barcode_Renderer_Exception(sprintf( - "Barcode is define outside the image (calculated: '%d', provided: '%d')", - $width, - $this->_userWidth - )); - } - } - } - } - - /** - * Draw the barcode in the rendering resource - * @return mixed - */ - public function draw() - { - parent::draw(); - $this->_resource->appendChild($this->_rootElement); - return $this->_resource; - } - - /** - * Draw and render the barcode with correct headers - * - * @return mixed - */ - public function render() - { - $this->draw(); - header("Content-Type: image/svg+xml"); - echo $this->_resource->saveXML(); - } - - /** - * Draw a polygon in the svg resource - * - * @param array $points - * @param integer $color - * @param boolean $filled - */ - protected function _drawPolygon($points, $color, $filled = true) - { - $color = 'rgb(' . implode(', ', array(($color & 0xFF0000) >> 16, - ($color & 0x00FF00) >> 8, - ($color & 0x0000FF))) . ')'; - $orientation = $this->getBarcode()->getOrientation(); - $newPoints = array( - $points[0][0] + $this->_leftOffset, - $points[0][1] + $this->_topOffset, - $points[1][0] + $this->_leftOffset, - $points[1][1] + $this->_topOffset, - $points[2][0] + $this->_leftOffset + cos(-$orientation), - $points[2][1] + $this->_topOffset - sin($orientation), - $points[3][0] + $this->_leftOffset + cos(-$orientation), - $points[3][1] + $this->_topOffset - sin($orientation), - ); - $newPoints = implode(' ', $newPoints); - $attributes['points'] = $newPoints; - $attributes['fill'] = $color; - $this->_appendRootElement('polygon', $attributes); - } - - /** - * Draw a polygon in the svg resource - * - * @param string $text - * @param float $size - * @param array $position - * @param string $font - * @param integer $color - * @param string $alignment - * @param float|int $orientation - */ - protected function _drawText($text, $size, $position, $font, $color, $alignment = 'center', $orientation = 0) - { - $color = 'rgb(' . implode(', ', array(($color & 0xFF0000) >> 16, - ($color & 0x00FF00) >> 8, - ($color & 0x0000FF))) . ')'; - $attributes['x'] = $position[0] + $this->_leftOffset; - $attributes['y'] = $position[1] + $this->_topOffset; - //$attributes['font-family'] = $font; - $attributes['color'] = $color; - $attributes['font-size'] = $size * 1.2; - switch ($alignment) { - case 'left': - $textAnchor = 'start'; - break; - case 'right': - $textAnchor = 'end'; - break; - case 'center': - default: - $textAnchor = 'middle'; - } - $attributes['style'] = 'text-anchor: ' . $textAnchor; - $attributes['transform'] = 'rotate(' - . (- $orientation) - . ', ' - . ($position[0] + $this->_leftOffset) - . ', ' . ($position[1] + $this->_topOffset) - . ')'; - $this->_appendRootElement('text', $attributes, $text); - } -} diff --git a/library/vendor/Zend/Cache.php b/library/vendor/Zend/Cache.php index 9ed41ddfc..272cd0b9d 100644 --- a/library/vendor/Zend/Cache.php +++ b/library/vendor/Zend/Cache.php @@ -84,6 +84,7 @@ abstract class Zend_Cache * @param array $backendOptions associative array of options for the corresponding backend constructor * @param boolean $customFrontendNaming if true, the frontend argument is used as a complete class name ; if false, the frontend argument is used as the end of "Zend_Cache_Frontend_[...]" class name * @param boolean $customBackendNaming if true, the backend argument is used as a complete class name ; if false, the backend argument is used as the end of "Zend_Cache_Backend_[...]" class name + * @param boolean $autoload if true, there will no require_once for backend and frontend (useful only for custom backends/frontends) * @throws Zend_Cache_Exception * @return Zend_Cache_Core|Zend_Cache_Frontend */ diff --git a/library/vendor/Zend/Cache/Backend/ZendServer.php b/library/vendor/Zend/Cache/Backend/ZendServer.php old mode 100644 new mode 100755 diff --git a/library/vendor/Zend/Cache/Backend/ZendServer/Disk.php b/library/vendor/Zend/Cache/Backend/ZendServer/Disk.php old mode 100644 new mode 100755 diff --git a/library/vendor/Zend/Cache/Backend/ZendServer/ShMem.php b/library/vendor/Zend/Cache/Backend/ZendServer/ShMem.php old mode 100644 new mode 100755 diff --git a/library/vendor/Zend/Captcha/Adapter.php b/library/vendor/Zend/Captcha/Adapter.php deleted file mode 100644 index e3a451d05..000000000 --- a/library/vendor/Zend/Captcha/Adapter.php +++ /dev/null @@ -1,75 +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); - } else if ($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 - * - * @param Zend_Config $config - * @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. - * - * @return null - */ - public function getDecorator() - { - return null; - } -} diff --git a/library/vendor/Zend/Captcha/Dumb.php b/library/vendor/Zend/Captcha/Dumb.php deleted file mode 100644 index 413f0e467..000000000 --- a/library/vendor/Zend/Captcha/Dumb.php +++ /dev/null @@ -1,74 +0,0 @@ -_label = $label; - } - - /** - * Retrieve the label for the CAPTCHA - * @return string - */ - public function getLabel() - { - return $this->_label; - } - /** - * Render the captcha - * - * @param Zend_View_Interface $view - * @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/vendor/Zend/Captcha/Exception.php b/library/vendor/Zend/Captcha/Exception.php deleted file mode 100644 index 449cd5146..000000000 --- a/library/vendor/Zend/Captcha/Exception.php +++ /dev/null @@ -1,36 +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 Zend_View_Interface $view - * @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/vendor/Zend/Captcha/Image.php b/library/vendor/Zend/Captcha/Image.php deleted file mode 100644 index c8c85fbbb..000000000 --- a/library/vendor/Zend/Captcha/Image.php +++ /dev/null @@ -1,619 +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 mt_rand(700000, 1000000) / 15000000; - } - - /** - * Generate random phase - * - * @return float - */ - protected function _randomPhase() - { - // random phase from 0 to pi - return mt_rand(0, 3141592) / 1000000; - } - - /** - * Generate random character size - * - * @return int - */ - protected function _randomSize() - { - return mt_rand(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 (mt_rand(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 - * @throws Zend_Captcha_Exception - */ - 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, $x, $y, $text_color, $font, $word); - - // generate noise - for ($i=0; $i<$this->_dotNoiseLevel; $i++) { - imagefilledellipse($img, mt_rand(0,$w), mt_rand(0,$h), 2, 2, $text_color); - } - for($i=0; $i<$this->_lineNoiseLevel; $i++) { - imageline($img, mt_rand(0,$w), mt_rand(0,$h), mt_rand(0,$w), mt_rand(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; - } else { - $color = (imagecolorat($img, $sx, $sy) >> 16) & 0xFF; - $color_x = (imagecolorat($img, $sx + 1, $sy) >> 16) & 0xFF; - $color_y = (imagecolorat($img, $sx, $sy + 1) >> 16) & 0xFF; - $color_xy = (imagecolorat($img, $sx + 1, $sy + 1) >> 16) & 0xFF; - } - if ($color == 255 && $color_x == 255 && $color_y == 255 && $color_xy == 255) { - // ignore background - continue; - } elseif ($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, $newcolor, $newcolor, $newcolor)); - } - } - - // generate noise - for ($i=0; $i<$this->_dotNoiseLevel; $i++) { - imagefilledellipse($img2, mt_rand(0,$w), mt_rand(0,$h), 2, 2, $text_color); - } - for ($i=0; $i<$this->_lineNoiseLevel; $i++) { - imageline($img2, mt_rand(0,$w), mt_rand(0,$h), mt_rand(0,$w), mt_rand(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 Zend_View_Interface $view - * @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()
-             . ' 'Missing captcha fields', - self::ERR_CAPTCHA => 'Failed to validate captcha', - self::BAD_CAPTCHA => 'Captcha value is wrong: %value%', - ); - - /** - * Retrieve ReCaptcha Private key - * - * @return string - */ - public function getPrivkey() - { - return $this->getService()->getPrivateKey(); - } - - /** - * Retrieve ReCaptcha Public key - * - * @return string - */ - public function getPubkey() - { - return $this->getService()->getPublicKey(); - } - - /** - * Set ReCaptcha Private key - * - * @param string $privkey - * @return Zend_Captcha_ReCaptcha - */ - public function setPrivkey($privkey) - { - $this->getService()->setPrivateKey($privkey); - return $this; - } - - /** - * Set ReCaptcha public key - * - * @param string $pubkey - * @return Zend_Captcha_ReCaptcha - */ - public function setPubkey($pubkey) - { - $this->getService()->setPublicKey($pubkey); - return $this; - } - - /** - * Constructor - * - * @param array|Zend_Config $options - */ - public function __construct($options = null) - { - $this->setService(new Zend_Service_ReCaptcha()); - $this->_serviceParams = $this->getService()->getParams(); - $this->_serviceOptions = $this->getService()->getOptions(); - - parent::__construct($options); - - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - if (!empty($options)) { - $this->setOptions($options); - } - } - - /** - * Set service object - * - * @param Zend_Service_ReCaptcha $service - * @return Zend_Captcha_ReCaptcha - */ - public function setService(Zend_Service_ReCaptcha $service) - { - $this->_service = $service; - return $this; - } - - /** - * Retrieve ReCaptcha service object - * - * @return Zend_Service_ReCaptcha - */ - public function getService() - { - return $this->_service; - } - - /** - * Set option - * - * If option is a service parameter, proxies to the service. The same - * goes for any service options (distinct from service params) - * - * @param string $key - * @param mixed $value - * @return Zend_Captcha_ReCaptcha - */ - public function setOption($key, $value) - { - $service = $this->getService(); - if (isset($this->_serviceParams[$key])) { - $service->setParam($key, $value); - return $this; - } - if (isset($this->_serviceOptions[$key])) { - $service->setOption($key, $value); - return $this; - } - return parent::setOption($key, $value); - } - - /** - * Generate captcha - * - * @see Zend_Form_Captcha_Adapter::generate() - * @return string - */ - public function generate() - { - return ""; - } - - /** - * Validate captcha - * - * @see Zend_Validate_Interface::isValid() - * @param mixed $value - * @param array|null $context - * @return boolean - */ - 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; - } - - if (empty($value[$this->_CHALLENGE]) || empty($value[$this->_RESPONSE])) { - $this->_error(self::MISSING_VALUE); - return false; - } - - $service = $this->getService(); - - $res = $service->verify($value[$this->_CHALLENGE], $value[$this->_RESPONSE]); - - if (!$res) { - $this->_error(self::ERR_CAPTCHA); - return false; - } - - if (!$res->isValid()) { - $this->_error(self::BAD_CAPTCHA, $res->getErrorCode()); - $service->setParam('error', $res->getErrorCode()); - return false; - } - - return true; - } - - /** - * Render captcha - * - * @param Zend_View_Interface $view - * @param mixed $element - * @return string - */ - public function render(Zend_View_Interface $view = null, $element = null) - { - $name = null; - if ($element instanceof Zend_Form_Element) { - $name = $element->getBelongsTo(); - } - return $this->getService()->getHTML($name); - } - - /** - * Get captcha decorator - * - * @return string - */ - public function getDecorator() - { - return "Captcha_ReCaptcha"; - } -} diff --git a/library/vendor/Zend/Captcha/Word.php b/library/vendor/Zend/Captcha/Word.php deleted file mode 100644 index e392ba1f1..000000000 --- a/library/vendor/Zend/Captcha/Word.php +++ /dev/null @@ -1,417 +0,0 @@ - '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 integer - */ - 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 integer - */ - public function getWordlen() - { - return $this->_wordlen; - } - - /** - * Set word length of captcha - * - * @param integer $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 - * - * @param Zend_Session_Namespace $session - * @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; - - for ($i=0; $i < $wordLen; $i = $i + 2) { - // generate word with mix of vowels and consonants - $consonant = $consonants[array_rand($consonants)]; - $vowel = $vowels[array_rand($vowels)]; - $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(mt_rand(0, 1000) . microtime(true)); - } - - /** - * Validate the word - * - * @see Zend_Validate_Interface::isValid() - * @param mixed $value - * @param array|null $context - * @return boolean - */ - 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/vendor/Zend/Config/Json.php b/library/vendor/Zend/Config/Json.php deleted file mode 100644 index cd9533917..000000000 --- a/library/vendor/Zend/Config/Json.php +++ /dev/null @@ -1,233 +0,0 @@ - $value) { - switch (strtolower($key)) { - case 'allow_modifications': - case 'allowmodifications': - $allowModifications = (bool) $value; - break; - case 'skip_extends': - case 'skipextends': - $this->_skipExtends = (bool) $value; - break; - case 'ignore_constants': - case 'ignoreconstants': - $this->_ignoreConstants = (bool) $value; - break; - default: - break; - } - } - } - - set_error_handler(array($this, '_loadFileErrorHandler')); // Warnings and errors are suppressed - if ($json[0] != '{') { - $json = file_get_contents($json); - } - restore_error_handler(); - - // Check if there was a error while loading file - if ($this->_loadFileErrorStr !== null) { - throw new Zend_Config_Exception($this->_loadFileErrorStr); - } - - // Replace constants - if (!$this->_ignoreConstants) { - $json = $this->_replaceConstants($json); - } - - // Parse/decode - try { - $config = Zend_Json::decode($json); - } catch (Zend_Json_Exception $e) { - // decode failed - throw new Zend_Config_Exception("Error parsing JSON data"); - } - - if ($section === null) { - $dataArray = array(); - foreach ($config as $sectionName => $sectionData) { - $dataArray[$sectionName] = $this->_processExtends($config, $sectionName); - } - - parent::__construct($dataArray, $allowModifications); - } elseif (is_array($section)) { - $dataArray = array(); - foreach ($section as $sectionName) { - if (!isset($config[$sectionName])) { - throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $sectionName)); - } - - $dataArray = array_merge($this->_processExtends($config, $sectionName), $dataArray); - } - - parent::__construct($dataArray, $allowModifications); - } else { - if (!isset($config[$section])) { - throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section)); - } - - $dataArray = $this->_processExtends($config, $section); - if (!is_array($dataArray)) { - // Section in the JSON data contains just one top level string - $dataArray = array($section => $dataArray); - } - - parent::__construct($dataArray, $allowModifications); - } - - $this->_loadedSection = $section; - } - - /** - * Helper function to process each element in the section and handle - * the "_extends" inheritance attribute. - * - * @param array $data Data array to process - * @param string $section Section to process - * @param array $config Configuration which was parsed yet - * @throws Zend_Config_Exception When $section cannot be found - * @return array - */ - protected function _processExtends(array $data, $section, array $config = array()) - { - if (!isset($data[$section])) { - throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section)); - } - - $thisSection = $data[$section]; - - if (is_array($thisSection) && isset($thisSection[self::EXTENDS_NAME])) { - if (is_array($thisSection[self::EXTENDS_NAME])) { - throw new Zend_Config_Exception('Invalid extends clause: must be a string; array received'); - } - $this->_assertValidExtend($section, $thisSection[self::EXTENDS_NAME]); - - if (!$this->_skipExtends) { - $config = $this->_processExtends($data, $thisSection[self::EXTENDS_NAME], $config); - } - unset($thisSection[self::EXTENDS_NAME]); - } - - $config = $this->_arrayMergeRecursive($config, $thisSection); - - return $config; - } - - /** - * Replace any constants referenced in a string with their values - * - * @param string $value - * @return string - */ - protected function _replaceConstants($value) - { - foreach ($this->_getConstants() as $constant) { - if (strstr($value, $constant)) { - // handle backslashes that may represent windows path names for instance - $replacement = str_replace('\\', '\\\\', constant($constant)); - $value = str_replace($constant, $replacement, $value); - } - } - return $value; - } - - /** - * Get (reverse) sorted list of defined constant names - * - * @return array - */ - protected function _getConstants() - { - $constants = array_keys(get_defined_constants()); - rsort($constants, SORT_STRING); - return $constants; - } -} diff --git a/library/vendor/Zend/Config/Writer/Json.php b/library/vendor/Zend/Config/Writer/Json.php deleted file mode 100644 index ec5dedb25..000000000 --- a/library/vendor/Zend/Config/Writer/Json.php +++ /dev/null @@ -1,104 +0,0 @@ -_prettyPrint; - } - - /** - * Set prettyPrint flag - * - * @param bool $prettyPrint PrettyPrint flag - * @return Zend_Config_Writer_Json - */ - public function setPrettyPrint($flag) - { - $this->_prettyPrint = (bool) $flag; - return $this; - } - - /** - * Render a Zend_Config into a JSON config string. - * - * @since 1.10 - * @return string - */ - public function render() - { - $data = $this->_config->toArray(); - $sectionName = $this->_config->getSectionName(); - $extends = $this->_config->getExtends(); - - if (is_string($sectionName)) { - $data = array($sectionName => $data); - } - - foreach ($extends as $section => $parentSection) { - $data[$section][Zend_Config_Json::EXTENDS_NAME] = $parentSection; - } - - // Ensure that each "extends" section actually exists - foreach ($data as $section => $sectionData) { - if (is_array($sectionData) && isset($sectionData[Zend_Config_Json::EXTENDS_NAME])) { - $sectionExtends = $sectionData[Zend_Config_Json::EXTENDS_NAME]; - if (!isset($data[$sectionExtends])) { - // Remove "extends" declaration if section does not exist - unset($data[$section][Zend_Config_Json::EXTENDS_NAME]); - } - } - } - - $out = Zend_Json::encode($data); - if ($this->prettyPrint()) { - $out = Zend_Json::prettyPrint($out); - } - return $out; - } -} diff --git a/library/vendor/Zend/Config/Writer/Xml.php b/library/vendor/Zend/Config/Writer/Xml.php deleted file mode 100644 index b128f25ae..000000000 --- a/library/vendor/Zend/Config/Writer/Xml.php +++ /dev/null @@ -1,124 +0,0 @@ -'); - $extends = $this->_config->getExtends(); - $sectionName = $this->_config->getSectionName(); - - if (is_string($sectionName)) { - $child = $xml->addChild($sectionName); - - $this->_addBranch($this->_config, $child, $xml); - } else { - foreach ($this->_config as $sectionName => $data) { - if (!($data instanceof Zend_Config)) { - $xml->addChild($sectionName, (string) $data); - } else { - $child = $xml->addChild($sectionName); - - if (isset($extends[$sectionName])) { - $child->addAttribute('zf:extends', $extends[$sectionName], Zend_Config_Xml::XML_NAMESPACE); - } - - $this->_addBranch($data, $child, $xml); - } - } - } - - $dom = dom_import_simplexml($xml)->ownerDocument; - $dom->formatOutput = true; - - $xmlString = $dom->saveXML(); - - return $xmlString; - } - - /** - * Add a branch to an XML object recursively - * - * @param Zend_Config $config - * @param SimpleXMLElement $xml - * @param SimpleXMLElement $parent - * @return void - */ - protected function _addBranch(Zend_Config $config, SimpleXMLElement $xml, SimpleXMLElement $parent) - { - $branchType = null; - - foreach ($config as $key => $value) { - if ($branchType === null) { - if (is_numeric($key)) { - $branchType = 'numeric'; - $branchName = $xml->getName(); - $xml = $parent; - - unset($parent->{$branchName}); - } else { - $branchType = 'string'; - } - } else if ($branchType !== (is_numeric($key) ? 'numeric' : 'string')) { - throw new Zend_Config_Exception('Mixing of string and numeric keys is not allowed'); - } - - if ($branchType === 'numeric') { - if ($value instanceof Zend_Config) { - $child = $parent->addChild($branchName); - - $this->_addBranch($value, $child, $parent); - } else { - $parent->addChild($branchName, (string) $value); - } - } else { - if ($value instanceof Zend_Config) { - $child = $xml->addChild($key); - - $this->_addBranch($value, $child, $xml); - } else { - $xml->addChild($key, (string) $value); - } - } - } - } -} diff --git a/library/vendor/Zend/Config/Writer/Yaml.php b/library/vendor/Zend/Config/Writer/Yaml.php deleted file mode 100644 index 197bfbfeb..000000000 --- a/library/vendor/Zend/Config/Writer/Yaml.php +++ /dev/null @@ -1,141 +0,0 @@ -_yamlEncoder; - } - - /** - * Set callback for decoding YAML - * - * @param callable $yamlEncoder the decoder to set - * @return Zend_Config_Yaml - */ - public function setYamlEncoder($yamlEncoder) - { - if (!is_callable($yamlEncoder)) { - throw new Zend_Config_Exception('Invalid parameter to setYamlEncoder - must be callable'); - } - - $this->_yamlEncoder = $yamlEncoder; - return $this; - } - - /** - * Render a Zend_Config into a YAML config string. - * - * @since 1.10 - * @return string - */ - public function render() - { - $data = $this->_config->toArray(); - $sectionName = $this->_config->getSectionName(); - $extends = $this->_config->getExtends(); - - if (is_string($sectionName)) { - $data = array($sectionName => $data); - } - - foreach ($extends as $section => $parentSection) { - $data[$section][Zend_Config_Yaml::EXTENDS_NAME] = $parentSection; - } - - // Ensure that each "extends" section actually exists - foreach ($data as $section => $sectionData) { - if (is_array($sectionData) && isset($sectionData[Zend_Config_Yaml::EXTENDS_NAME])) { - $sectionExtends = $sectionData[Zend_Config_Yaml::EXTENDS_NAME]; - if (!isset($data[$sectionExtends])) { - // Remove "extends" declaration if section does not exist - unset($data[$section][Zend_Config_Yaml::EXTENDS_NAME]); - } - } - } - - return call_user_func($this->getYamlEncoder(), $data); - } - - /** - * Very dumb YAML encoder - * - * Until we have Zend_Yaml... - * - * @param array $data YAML data - * @return string - */ - public static function encode($data) - { - return self::_encodeYaml(0, $data); - } - - /** - * Service function for encoding YAML - * - * @param int $indent Current indent level - * @param array $data Data to encode - * @return string - */ - protected static function _encodeYaml($indent, $data) - { - reset($data); - $result = ""; - $numeric = is_numeric(key($data)); - - foreach($data as $key => $value) { - if(is_array($value)) { - $encoded = "\n".self::_encodeYaml($indent+1, $value); - } else { - $encoded = (string)$value."\n"; - } - $result .= str_repeat(" ", $indent).($numeric?"- ":"$key: ").$encoded; - } - return $result; - } -} diff --git a/library/vendor/Zend/Config/Xml.php b/library/vendor/Zend/Config/Xml.php deleted file mode 100644 index 845eafc70..000000000 --- a/library/vendor/Zend/Config/Xml.php +++ /dev/null @@ -1,300 +0,0 @@ - false, - * 'skipExtends' => false - * ); - * - * @param string $xml XML file or string to process - * @param mixed $section Section to process - * @param array|boolean $options - * @throws Zend_Config_Exception When xml is not set or cannot be loaded - * @throws Zend_Config_Exception When section $sectionName cannot be found in $xml - */ - public function __construct($xml, $section = null, $options = false) - { - if (empty($xml)) { - throw new Zend_Config_Exception('Filename is not set'); - } - - $allowModifications = false; - if (is_bool($options)) { - $allowModifications = $options; - } elseif (is_array($options)) { - if (isset($options['allowModifications'])) { - $allowModifications = (bool) $options['allowModifications']; - } - if (isset($options['skipExtends'])) { - $this->_skipExtends = (bool) $options['skipExtends']; - } - } - - set_error_handler(array($this, '_loadFileErrorHandler')); // Warnings and errors are suppressed - if (strstr($xml, 'getMessage() - ); - } - } - - restore_error_handler(); - // Check if there was a error while loading file - if ($this->_loadFileErrorStr !== null) { - throw new Zend_Config_Exception($this->_loadFileErrorStr); - } - - if ($section === null) { - $dataArray = array(); - foreach ($config as $sectionName => $sectionData) { - $dataArray[$sectionName] = $this->_processExtends($config, $sectionName); - } - - parent::__construct($dataArray, $allowModifications); - } else if (is_array($section)) { - $dataArray = array(); - foreach ($section as $sectionName) { - if (!isset($config->$sectionName)) { - throw new Zend_Config_Exception("Section '$sectionName' cannot be found in $xml"); - } - - $dataArray = array_merge($this->_processExtends($config, $sectionName), $dataArray); - } - - parent::__construct($dataArray, $allowModifications); - } else { - if (!isset($config->$section)) { - throw new Zend_Config_Exception("Section '$section' cannot be found in $xml"); - } - - $dataArray = $this->_processExtends($config, $section); - if (!is_array($dataArray)) { - // Section in the XML file contains just one top level string - $dataArray = array($section => $dataArray); - } - - parent::__construct($dataArray, $allowModifications); - } - - $this->_loadedSection = $section; - } - - /** - * Helper function to process each element in the section and handle - * the "extends" inheritance attribute. - * - * @param SimpleXMLElement $element XML Element to process - * @param string $section Section to process - * @param array $config Configuration which was parsed yet - * @throws Zend_Config_Exception When $section cannot be found - * @return array - */ - protected function _processExtends(SimpleXMLElement $element, $section, array $config = array()) - { - if (!isset($element->$section)) { - throw new Zend_Config_Exception("Section '$section' cannot be found"); - } - - $thisSection = $element->$section; - $nsAttributes = $thisSection->attributes(self::XML_NAMESPACE); - - if (isset($thisSection['extends']) || isset($nsAttributes['extends'])) { - $extendedSection = (string) (isset($nsAttributes['extends']) ? $nsAttributes['extends'] : $thisSection['extends']); - $this->_assertValidExtend($section, $extendedSection); - - if (!$this->_skipExtends) { - $config = $this->_processExtends($element, $extendedSection, $config); - } - } - - $config = $this->_arrayMergeRecursive($config, $this->_toArray($thisSection)); - - return $config; - } - - /** - * Returns a string or an associative and possibly multidimensional array from - * a SimpleXMLElement. - * - * @param SimpleXMLElement $xmlObject Convert a SimpleXMLElement into an array - * @return array|string - */ - protected function _toArray(SimpleXMLElement $xmlObject) - { - $config = array(); - $nsAttributes = $xmlObject->attributes(self::XML_NAMESPACE); - - // Search for parent node values - if (count($xmlObject->attributes()) > 0) { - foreach ($xmlObject->attributes() as $key => $value) { - if ($key === 'extends') { - continue; - } - - $value = (string) $value; - - if (array_key_exists($key, $config)) { - if (!is_array($config[$key])) { - $config[$key] = array($config[$key]); - } - - $config[$key][] = $value; - } else { - $config[$key] = $value; - } - } - } - - // Search for local 'const' nodes and replace them - if (count($xmlObject->children(self::XML_NAMESPACE)) > 0) { - if (count($xmlObject->children()) > 0) { - throw new Zend_Config_Exception("A node with a 'const' childnode may not have any other children"); - } - - $dom = dom_import_simplexml($xmlObject); - $namespaceChildNodes = array(); - - // We have to store them in an array, as replacing nodes will - // confuse the DOMNodeList later - foreach ($dom->childNodes as $node) { - if ($node instanceof DOMElement && $node->namespaceURI === self::XML_NAMESPACE) { - $namespaceChildNodes[] = $node; - } - } - - foreach ($namespaceChildNodes as $node) { - switch ($node->localName) { - case 'const': - if (!$node->hasAttributeNS(self::XML_NAMESPACE, 'name')) { - throw new Zend_Config_Exception("Misssing 'name' attribute in 'const' node"); - } - - $constantName = $node->getAttributeNS(self::XML_NAMESPACE, 'name'); - - if (!defined($constantName)) { - throw new Zend_Config_Exception("Constant with name '$constantName' was not defined"); - } - - $constantValue = constant($constantName); - - $dom->replaceChild($dom->ownerDocument->createTextNode($constantValue), $node); - break; - - default: - throw new Zend_Config_Exception("Unknown node with name '$node->localName' found"); - } - } - - return (string) simplexml_import_dom($dom); - } - - // Search for children - if (count($xmlObject->children()) > 0) { - foreach ($xmlObject->children() as $key => $value) { - if (count($value->children()) > 0 || count($value->children(self::XML_NAMESPACE)) > 0) { - $value = $this->_toArray($value); - } else if (count($value->attributes()) > 0) { - $attributes = $value->attributes(); - if (isset($attributes['value'])) { - $value = (string) $attributes['value']; - } else { - $value = $this->_toArray($value); - } - } else { - $value = (string) $value; - } - - if (array_key_exists($key, $config)) { - if (!is_array($config[$key]) || !array_key_exists(0, $config[$key])) { - $config[$key] = array($config[$key]); - } - - $config[$key][] = $value; - } else { - $config[$key] = $value; - } - } - } else if (!isset($xmlObject['extends']) && !isset($nsAttributes['extends']) && (count($config) === 0)) { - // Object has no children nor attributes and doesn't use the extends - // attribute: it's a string - $config = (string) $xmlObject; - } - - return $config; - } -} diff --git a/library/vendor/Zend/Config/Yaml.php b/library/vendor/Zend/Config/Yaml.php deleted file mode 100644 index 7ea0218dd..000000000 --- a/library/vendor/Zend/Config/Yaml.php +++ /dev/null @@ -1,406 +0,0 @@ -_yamlDecoder; - } - - /** - * Set callback for decoding YAML - * - * @param callable $yamlDecoder the decoder to set - * @return Zend_Config_Yaml - */ - public function setYamlDecoder($yamlDecoder) - { - if (!is_callable($yamlDecoder)) { - throw new Zend_Config_Exception('Invalid parameter to setYamlDecoder() - must be callable'); - } - - $this->_yamlDecoder = $yamlDecoder; - return $this; - } - - /** - * Loads the section $section from the config file encoded as YAML - * - * Sections are defined as properties of the main object - * - * In order to extend another section, a section defines the "_extends" - * property having a value of the section name from which the extending - * section inherits values. - * - * Note that the keys in $section will override any keys of the same - * name in the sections that have been included via "_extends". - * - * Options may include: - * - allow_modifications: whether or not the config object is mutable - * - skip_extends: whether or not to skip processing of parent configuration - * - yaml_decoder: a callback to use to decode the Yaml source - * - * @param string $yaml YAML file to process - * @param mixed $section Section to process - * @param array|boolean $options - */ - public function __construct($yaml, $section = null, $options = false) - { - if (empty($yaml)) { - throw new Zend_Config_Exception('Filename is not set'); - } - - $ignoreConstants = $staticIgnoreConstants = self::ignoreConstants(); - $allowModifications = false; - if (is_bool($options)) { - $allowModifications = $options; - } elseif (is_array($options)) { - foreach ($options as $key => $value) { - switch (strtolower($key)) { - case 'allow_modifications': - case 'allowmodifications': - $allowModifications = (bool) $value; - break; - case 'skip_extends': - case 'skipextends': - $this->_skipExtends = (bool) $value; - break; - case 'ignore_constants': - case 'ignoreconstants': - $ignoreConstants = (bool) $value; - break; - case 'yaml_decoder': - case 'yamldecoder': - $this->setYamlDecoder($value); - break; - default: - break; - } - } - } - - // Suppress warnings and errors while loading file - set_error_handler(array($this, '_loadFileErrorHandler')); - $yaml = file_get_contents($yaml); - restore_error_handler(); - - // Check if there was a error while loading file - if ($this->_loadFileErrorStr !== null) { - throw new Zend_Config_Exception($this->_loadFileErrorStr); - } - - // Override static value for ignore_constants if provided in $options - self::setIgnoreConstants($ignoreConstants); - - // Parse YAML - $config = call_user_func($this->getYamlDecoder(), $yaml); - - // Reset original static state of ignore_constants - self::setIgnoreConstants($staticIgnoreConstants); - - if (null === $config) { - // decode failed - throw new Zend_Config_Exception("Error parsing YAML data"); - } - - if (null === $section) { - $dataArray = array(); - foreach ($config as $sectionName => $sectionData) { - $dataArray[$sectionName] = $this->_processExtends($config, $sectionName); - } - parent::__construct($dataArray, $allowModifications); - } elseif (is_array($section)) { - $dataArray = array(); - foreach ($section as $sectionName) { - if (!isset($config[$sectionName])) { - throw new Zend_Config_Exception(sprintf( - 'Section "%s" cannot be found', - implode(' ', (array)$section) - )); - } - - $dataArray = array_merge($this->_processExtends($config, $sectionName), $dataArray); - } - parent::__construct($dataArray, $allowModifications); - } else { - if (!isset($config[$section])) { - throw new Zend_Config_Exception(sprintf( - 'Section "%s" cannot be found', - implode(' ', (array)$section) - )); - } - - $dataArray = $this->_processExtends($config, $section); - if (!is_array($dataArray)) { - // Section in the yaml data contains just one top level string - $dataArray = array($section => $dataArray); - } - parent::__construct($dataArray, $allowModifications); - } - - $this->_loadedSection = $section; - } - - /** - * Helper function to process each element in the section and handle - * the "_extends" inheritance attribute. - * - * @param array $data Data array to process - * @param string $section Section to process - * @param array $config Configuration which was parsed yet - * @return array - * @throws Zend_Config_Exception When $section cannot be found - */ - protected function _processExtends(array $data, $section, array $config = array()) - { - if (!isset($data[$section])) { - throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section)); - } - - $thisSection = $data[$section]; - - if (is_array($thisSection) && isset($thisSection[self::EXTENDS_NAME])) { - $this->_assertValidExtend($section, $thisSection[self::EXTENDS_NAME]); - - if (!$this->_skipExtends) { - $config = $this->_processExtends($data, $thisSection[self::EXTENDS_NAME], $config); - } - unset($thisSection[self::EXTENDS_NAME]); - } - - $config = $this->_arrayMergeRecursive($config, $thisSection); - - return $config; - } - - /** - * Very dumb YAML parser - * - * Until we have Zend_Yaml... - * - * @param string $yaml YAML source - * @return array Decoded data - */ - public static function decode($yaml) - { - $lines = explode("\n", $yaml); - reset($lines); - return self::_decodeYaml(0, $lines); - } - - /** - * Service function to decode YAML - * - * @param int $currentIndent Current indent level - * @param array $lines YAML lines - * @return array|string - */ - protected static function _decodeYaml($currentIndent, &$lines) - { - $config = array(); - $inIndent = false; - while (list($n, $line) = each($lines)) { - $lineno = $n + 1; - - $line = rtrim(preg_replace("/#.*$/", "", $line)); - if (strlen($line) == 0) { - continue; - } - - $indent = strspn($line, " "); - - // line without the spaces - $line = trim($line); - if (strlen($line) == 0) { - continue; - } - - if ($indent < $currentIndent) { - // this level is done - prev($lines); - return $config; - } - - if (!$inIndent) { - $currentIndent = $indent; - $inIndent = true; - } - - if (preg_match("/(?!-)([\w\-]+):\s*(.*)/", $line, $m)) { - // key: value - if (strlen($m[2])) { - // simple key: value - $value = preg_replace("/#.*$/", "", $m[2]); - $value = self::_parseValue($value); - } else { - // key: and then values on new lines - $value = self::_decodeYaml($currentIndent + 1, $lines); - if (is_array($value) && !count($value)) { - $value = ""; - } - } - $config[$m[1]] = $value; - } elseif ($line[0] == "-") { - // item in the list: - // - FOO - if (strlen($line) > 2) { - $value = substr($line, 2); - - $config[] = self::_parseValue($value); - } else { - $config[] = self::_decodeYaml($currentIndent + 1, $lines); - } - } else { - throw new Zend_Config_Exception(sprintf( - 'Error parsing YAML at line %d - unsupported syntax: "%s"', - $lineno, $line - )); - } - } - return $config; - } - - /** - * Parse values - * - * @param string $value - * @return string - */ - protected static function _parseValue($value) - { - $value = trim($value); - - // remove quotes from string. - if ('"' == $value['0']) { - if ('"' == $value[count($value) -1]) { - $value = substr($value, 1, -1); - } - } elseif ('\'' == $value['0'] && '\'' == $value[count($value) -1]) { - $value = strtr($value, array("''" => "'", "'" => '')); - } - - // Check for booleans and constants - if (preg_match('/^(t(rue)?|on|y(es)?)$/i', $value)) { - $value = true; - } elseif (preg_match('/^(f(alse)?|off|n(o)?)$/i', $value)) { - $value = false; - } elseif (strcasecmp($value, 'null') === 0) { - $value = null; - } elseif (!self::$_ignoreConstants) { - // test for constants - $value = self::_replaceConstants($value); - } - - return $value; - } - - /** - * Replace any constants referenced in a string with their values - * - * @param string $value - * @return string - */ - protected static function _replaceConstants($value) - { - foreach (self::_getConstants() as $constant) { - if (strstr($value, $constant)) { - $value = str_replace($constant, constant($constant), $value); - } - } - return $value; - } - - /** - * Get (reverse) sorted list of defined constant names - * - * @return array - */ - protected static function _getConstants() - { - $constants = array_keys(get_defined_constants()); - rsort($constants, SORT_STRING); - return $constants; - } -} diff --git a/library/vendor/Zend/Console/Getopt.php b/library/vendor/Zend/Console/Getopt.php deleted file mode 100644 index 7d10e642f..000000000 --- a/library/vendor/Zend/Console/Getopt.php +++ /dev/null @@ -1,979 +0,0 @@ - self::MODE_ZEND, - self::CONFIG_DASHDASH => true, - self::CONFIG_IGNORECASE => false, - self::CONFIG_PARSEALL => true, - ); - - /** - * Stores the command-line arguments for the calling applicaion. - * - * @var array - */ - protected $_argv = array(); - - /** - * Stores the name of the calling applicaion. - * - * @var string - */ - protected $_progname = ''; - - /** - * Stores the list of legal options for this application. - * - * @var array - */ - protected $_rules = array(); - - /** - * Stores alternate spellings of legal options. - * - * @var array - */ - protected $_ruleMap = array(); - - /** - * Stores options given by the user in the current invocation - * of the application, as well as parameters given in options. - * - * @var array - */ - protected $_options = array(); - - /** - * Stores the command-line arguments other than options. - * - * @var array - */ - protected $_remainingArgs = array(); - - /** - * State of the options: parsed or not yet parsed? - * - * @var boolean - */ - protected $_parsed = false; - - /** - * The constructor takes one to three parameters. - * - * The first parameter is $rules, which may be a string for - * gnu-style format, or a structured array for Zend-style format. - * - * The second parameter is $argv, and it is optional. If not - * specified, $argv is inferred from the global argv. - * - * The third parameter is an array of configuration parameters - * to control the behavior of this instance of Getopt; it is optional. - * - * @param array $rules - * @param array $argv - * @param array $getoptConfig - * @return void - */ - public function __construct($rules, $argv = null, $getoptConfig = array()) - { - if (!isset($_SERVER['argv'])) { - 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" - ); - } else { - throw new Zend_Console_Getopt_Exception( - '$_SERVER["argv"] is not set, but Zend_Console_Getopt cannot work without this information.' - ); - } - } - - $this->_progname = $_SERVER['argv'][0]; - $this->setOptions($getoptConfig); - $this->addRules($rules); - if (!is_array($argv)) { - $argv = array_slice($_SERVER['argv'], 1); - } - if (isset($argv)) { - $this->addArguments((array)$argv); - } - } - - /** - * Return the state of the option seen on the command line of the - * current application invocation. This function returns true, or the - * parameter to the option, if any. If the option was not given, - * this function returns null. - * - * The magic __get method works in the context of naming the option - * as a virtual member of this class. - * - * @param string $key - * @return string - */ - public function __get($key) - { - return $this->getOption($key); - } - - /** - * Test whether a given option has been seen. - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - $this->parse(); - if (isset($this->_ruleMap[$key])) { - $key = $this->_ruleMap[$key]; - return isset($this->_options[$key]); - } - return false; - } - - /** - * Set the value for a given option. - * - * @param string $key - * @param string $value - * @return void - */ - public function __set($key, $value) - { - $this->parse(); - if (isset($this->_ruleMap[$key])) { - $key = $this->_ruleMap[$key]; - $this->_options[$key] = $value; - } - } - - /** - * Return the current set of options and parameters seen as a string. - * - * @return string - */ - public function __toString() - { - return $this->toString(); - } - - /** - * Unset an option. - * - * @param string $key - * @return void - */ - public function __unset($key) - { - $this->parse(); - if (isset($this->_ruleMap[$key])) { - $key = $this->_ruleMap[$key]; - unset($this->_options[$key]); - } - } - - /** - * Define additional command-line arguments. - * These are appended to those defined when the constructor was called. - * - * @param array $argv - * @throws Zend_Console_Getopt_Exception When not given an array as parameter - * @return Zend_Console_Getopt Provides a fluent interface - */ - public function addArguments($argv) - { - if(!is_array($argv)) { - throw new Zend_Console_Getopt_Exception( - "Parameter #1 to addArguments should be an array"); - } - $this->_argv = array_merge($this->_argv, $argv); - $this->_parsed = false; - return $this; - } - - /** - * Define full set of command-line arguments. - * These replace any currently defined. - * - * @param array $argv - * @throws Zend_Console_Getopt_Exception When not given an array as parameter - * @return Zend_Console_Getopt Provides a fluent interface - */ - public function setArguments($argv) - { - if(!is_array($argv)) { - throw new Zend_Console_Getopt_Exception( - "Parameter #1 to setArguments should be an array"); - } - $this->_argv = $argv; - $this->_parsed = false; - return $this; - } - - /** - * Define multiple configuration options from an associative array. - * These are not program options, but properties to configure - * the behavior of Zend_Console_Getopt. - * - * @param array $getoptConfig - * @return Zend_Console_Getopt Provides a fluent interface - */ - public function setOptions($getoptConfig) - { - if (isset($getoptConfig)) { - foreach ($getoptConfig as $key => $value) { - $this->setOption($key, $value); - } - } - return $this; - } - - /** - * Define one configuration option as a key/value pair. - * These are not program options, but properties to configure - * the behavior of Zend_Console_Getopt. - * - * @param string $configKey - * @param string $configValue - * @return Zend_Console_Getopt Provides a fluent interface - */ - public function setOption($configKey, $configValue) - { - if ($configKey !== null) { - $this->_getoptConfig[$configKey] = $configValue; - } - return $this; - } - - /** - * Define additional option rules. - * These are appended to the rules defined when the constructor was called. - * - * @param array $rules - * @return Zend_Console_Getopt Provides a fluent interface - */ - public function addRules($rules) - { - $ruleMode = $this->_getoptConfig['ruleMode']; - switch ($this->_getoptConfig['ruleMode']) { - case self::MODE_ZEND: - if (is_array($rules)) { - $this->_addRulesModeZend($rules); - break; - } - // intentional fallthrough - case self::MODE_GNU: - $this->_addRulesModeGnu($rules); - break; - default: - /** - * Call addRulesModeFoo() for ruleMode 'foo'. - * The developer should subclass Getopt and - * provide this method. - */ - $method = '_addRulesMode' . ucfirst($ruleMode); - $this->$method($rules); - } - $this->_parsed = false; - return $this; - } - - /** - * Return the current set of options and parameters seen as a string. - * - * @return string - */ - public function toString() - { - $this->parse(); - $s = array(); - foreach ($this->_options as $flag => $value) { - $s[] = $flag . '=' . ($value === true ? 'true' : $value); - } - return implode(' ', $s); - } - - /** - * Return the current set of options and parameters seen - * as an array of canonical options and parameters. - * - * Clusters have been expanded, and option aliases - * have been mapped to their primary option names. - * - * @return array - */ - public function toArray() - { - $this->parse(); - $s = array(); - foreach ($this->_options as $flag => $value) { - $s[] = $flag; - if ($value !== true) { - $s[] = $value; - } - } - return $s; - } - - /** - * Return the current set of options and parameters seen in Json format. - * - * @return string - */ - public function toJson() - { - $this->parse(); - $j = array(); - foreach ($this->_options as $flag => $value) { - $j['options'][] = array( - 'option' => array( - 'flag' => $flag, - 'parameter' => $value - ) - ); - } - - /** - * @see Zend_Json - */ - $json = Zend_Json::encode($j); - - return $json; - } - - /** - * Return the current set of options and parameters seen in XML format. - * - * @return string - */ - public function toXml() - { - $this->parse(); - $doc = new DomDocument('1.0', 'utf-8'); - $optionsNode = $doc->createElement('options'); - $doc->appendChild($optionsNode); - foreach ($this->_options as $flag => $value) { - $optionNode = $doc->createElement('option'); - $optionNode->setAttribute('flag', utf8_encode($flag)); - if ($value !== true) { - $optionNode->setAttribute('parameter', utf8_encode($value)); - } - $optionsNode->appendChild($optionNode); - } - $xml = $doc->saveXML(); - return $xml; - } - - /** - * Return a list of options that have been seen in the current argv. - * - * @return array - */ - public function getOptions() - { - $this->parse(); - return array_keys($this->_options); - } - - /** - * Return the state of the option seen on the command line of the - * current application invocation. - * - * This function returns true, or the parameter value to the option, if any. - * If the option was not given, this function returns false. - * - * @param string $flag - * @return mixed - */ - public function getOption($flag) - { - $this->parse(); - if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { - $flag = strtolower($flag); - } - if (isset($this->_ruleMap[$flag])) { - $flag = $this->_ruleMap[$flag]; - if (isset($this->_options[$flag])) { - return $this->_options[$flag]; - } - } - return null; - } - - /** - * Return the arguments from the command-line following all options found. - * - * @return array - */ - public function getRemainingArgs() - { - $this->parse(); - return $this->_remainingArgs; - } - - /** - * Return a useful option reference, formatted for display in an - * error message. - * - * Note that this usage information is provided in most Exceptions - * generated by this class. - * - * @return string - */ - public function getUsageMessage() - { - $usage = "Usage: {$this->_progname} [ options ]\n"; - $maxLen = 20; - $lines = array(); - foreach ($this->_rules as $rule) { - $flags = array(); - if (is_array($rule['alias'])) { - foreach ($rule['alias'] as $flag) { - $flags[] = (strlen($flag) == 1 ? '-' : '--') . $flag; - } - } - $linepart['name'] = implode('|', $flags); - if (isset($rule['param']) && $rule['param'] != 'none') { - $linepart['name'] .= ' '; - switch ($rule['param']) { - case 'optional': - $linepart['name'] .= "[ <{$rule['paramType']}> ]"; - break; - case 'required': - $linepart['name'] .= "<{$rule['paramType']}>"; - break; - } - } - if (strlen($linepart['name']) > $maxLen) { - $maxLen = strlen($linepart['name']); - } - $linepart['help'] = ''; - if (isset($rule['help'])) { - $linepart['help'] .= $rule['help']; - } - $lines[] = $linepart; - } - foreach ($lines as $linepart) { - $usage .= sprintf("%s %s\n", - str_pad($linepart['name'], $maxLen), - $linepart['help']); - } - return $usage; - } - - /** - * Define aliases for options. - * - * The parameter $aliasMap is an associative array - * mapping option name (short or long) to an alias. - * - * @param array $aliasMap - * @throws Zend_Console_Getopt_Exception - * @return Zend_Console_Getopt Provides a fluent interface - */ - public function setAliases($aliasMap) - { - foreach ($aliasMap as $flag => $alias) - { - if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { - $flag = strtolower($flag); - $alias = strtolower($alias); - } - if (!isset($this->_ruleMap[$flag])) { - continue; - } - $flag = $this->_ruleMap[$flag]; - if (isset($this->_rules[$alias]) || isset($this->_ruleMap[$alias])) { - $o = (strlen($alias) == 1 ? '-' : '--') . $alias; - throw new Zend_Console_Getopt_Exception( - "Option \"$o\" is being defined more than once."); - } - $this->_rules[$flag]['alias'][] = $alias; - $this->_ruleMap[$alias] = $flag; - } - return $this; - } - - /** - * Define help messages for options. - * - * The parameter $help_map is an associative array - * mapping option name (short or long) to the help string. - * - * @param array $helpMap - * @return Zend_Console_Getopt Provides a fluent interface - */ - public function setHelp($helpMap) - { - foreach ($helpMap as $flag => $help) - { - if (!isset($this->_ruleMap[$flag])) { - continue; - } - $flag = $this->_ruleMap[$flag]; - $this->_rules[$flag]['help'] = $help; - } - return $this; - } - - /** - * Parse command-line arguments and find both long and short - * options. - * - * Also find option parameters, and remaining arguments after - * all options have been parsed. - * - * @return Zend_Console_Getopt|null Provides a fluent interface - */ - public function parse() - { - if ($this->_parsed === true) { - return; - } - $argv = $this->_argv; - $this->_options = array(); - $this->_remainingArgs = array(); - while (count($argv) > 0) { - if ($argv[0] == '--') { - array_shift($argv); - if ($this->_getoptConfig[self::CONFIG_DASHDASH]) { - $this->_remainingArgs = array_merge($this->_remainingArgs, $argv); - break; - } - } - if (substr($argv[0], 0, 2) == '--') { - $this->_parseLongOption($argv); - } else if (substr($argv[0], 0, 1) == '-' && ('-' != $argv[0] || count($argv) >1)) { - $this->_parseShortOptionCluster($argv); - } else if($this->_getoptConfig[self::CONFIG_PARSEALL]) { - $this->_remainingArgs[] = array_shift($argv); - } else { - /* - * We should put all other arguments in _remainingArgs and stop parsing - * since CONFIG_PARSEALL is false. - */ - $this->_remainingArgs = array_merge($this->_remainingArgs, $argv); - break; - } - } - $this->_parsed = true; - return $this; - } - - /** - * @throws Zend_Console_Getopt_Exception - */ - public function checkRequiredArguments() - { - foreach ($this->_rules as $name => $rule) { - if ($rule['param'] === 'required') { - $defined = false; - foreach ($rule['alias'] as $alias) { - $defined = $defined === true ? true : array_key_exists($alias, $this->_options); - } - if ($defined === false) { - throw new Zend_Console_Getopt_Exception( - 'Option "$alias" requires a parameter.', - $this->getUsageMessage() - ); - } - } - } - } - - /** - * Parse command-line arguments for a single long option. - * A long option is preceded by a double '--' character. - * Long options may not be clustered. - * - * @param mixed &$argv - * @return void - */ - protected function _parseLongOption(&$argv) - { - $optionWithParam = ltrim(array_shift($argv), '-'); - $l = explode('=', $optionWithParam, 2); - $flag = array_shift($l); - $param = array_shift($l); - if (isset($param)) { - array_unshift($argv, $param); - } - $this->_parseSingleOption($flag, $argv); - } - - /** - * Parse command-line arguments for short options. - * Short options are those preceded by a single '-' character. - * Short options may be clustered. - * - * @param mixed &$argv - * @return void - */ - protected function _parseShortOptionCluster(&$argv) - { - $flagCluster = ltrim(array_shift($argv), '-'); - foreach (str_split($flagCluster) as $flag) { - $this->_parseSingleOption($flag, $argv); - } - } - - /** - * Parse command-line arguments for a single option. - * - * @param string $flag - * @param mixed $argv - * @throws Zend_Console_Getopt_Exception - * @return void - */ - protected function _parseSingleOption($flag, &$argv) - { - if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { - $flag = strtolower($flag); - } - if (!isset($this->_ruleMap[$flag])) { - throw new Zend_Console_Getopt_Exception( - "Option \"$flag\" is not recognized.", - $this->getUsageMessage()); - } - $realFlag = $this->_ruleMap[$flag]; - switch ($this->_rules[$realFlag]['param']) { - case 'required': - if (count($argv) > 0 && substr($argv[0], 0, 1) != '-') { - $param = array_shift($argv); - $this->_checkParameterType($realFlag, $param); - } else { - throw new Zend_Console_Getopt_Exception( - "Option \"$flag\" requires a parameter.", - $this->getUsageMessage()); - } - break; - case 'optional': - if (count($argv) > 0 && substr($argv[0], 0, 1) != '-') { - $param = array_shift($argv); - $this->_checkParameterType($realFlag, $param); - } else { - $param = true; - } - break; - default: - $param = true; - } - $this->_options[$realFlag] = $param; - } - - /** - * Return true if the parameter is in a valid format for - * the option $flag. - * Throw an exception in most other cases. - * - * @param string $flag - * @param string $param - * @throws Zend_Console_Getopt_Exception - * @return bool - */ - protected function _checkParameterType($flag, $param) - { - $type = 'string'; - if (isset($this->_rules[$flag]['paramType'])) { - $type = $this->_rules[$flag]['paramType']; - } - switch ($type) { - case 'word': - if (preg_match('/\W/', $param)) { - throw new Zend_Console_Getopt_Exception( - "Option \"$flag\" requires a single-word parameter, but was given \"$param\".", - $this->getUsageMessage()); - } - break; - case 'integer': - if (preg_match('/\D/', $param)) { - throw new Zend_Console_Getopt_Exception( - "Option \"$flag\" requires an integer parameter, but was given \"$param\".", - $this->getUsageMessage()); - } - break; - case 'string': - default: - break; - } - return true; - } - - /** - * Define legal options using the gnu-style format. - * - * @param string $rules - * @return void - */ - protected function _addRulesModeGnu($rules) - { - $ruleArray = array(); - - /** - * Options may be single alphanumeric characters. - * Options may have a ':' which indicates a required string parameter. - * No long options or option aliases are supported in GNU style. - */ - preg_match_all('/([a-zA-Z0-9]:?)/', $rules, $ruleArray); - foreach ($ruleArray[1] as $rule) { - $r = array(); - $flag = substr($rule, 0, 1); - if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { - $flag = strtolower($flag); - } - $r['alias'][] = $flag; - if (substr($rule, 1, 1) == ':') { - $r['param'] = 'required'; - $r['paramType'] = 'string'; - } else { - $r['param'] = 'none'; - } - $this->_rules[$flag] = $r; - $this->_ruleMap[$flag] = $flag; - } - } - - /** - * Define legal options using the Zend-style format. - * - * @param array $rules - * @throws Zend_Console_Getopt_Exception - * @return void - */ - protected function _addRulesModeZend($rules) - { - foreach ($rules as $ruleCode => $helpMessage) - { - // this may have to translate the long parm type if there - // are any complaints that =string will not work (even though that use - // case is not documented) - if (in_array(substr($ruleCode, -2, 1), array('-', '='))) { - $flagList = substr($ruleCode, 0, -2); - $delimiter = substr($ruleCode, -2, 1); - $paramType = substr($ruleCode, -1); - } else { - $flagList = $ruleCode; - $delimiter = $paramType = null; - } - if ($this->_getoptConfig[self::CONFIG_IGNORECASE]) { - $flagList = strtolower($flagList); - } - $flags = explode('|', $flagList); - $rule = array(); - $mainFlag = $flags[0]; - foreach ($flags as $flag) { - if (empty($flag)) { - throw new Zend_Console_Getopt_Exception( - "Blank flag not allowed in rule \"$ruleCode\"."); - } - if (strlen($flag) == 1) { - if (isset($this->_ruleMap[$flag])) { - throw new Zend_Console_Getopt_Exception( - "Option \"-$flag\" is being defined more than once."); - } - $this->_ruleMap[$flag] = $mainFlag; - $rule['alias'][] = $flag; - } else { - if (isset($this->_rules[$flag]) || isset($this->_ruleMap[$flag])) { - throw new Zend_Console_Getopt_Exception( - "Option \"--$flag\" is being defined more than once."); - } - $this->_ruleMap[$flag] = $mainFlag; - $rule['alias'][] = $flag; - } - } - if (isset($delimiter)) { - switch ($delimiter) { - case self::PARAM_REQUIRED: - $rule['param'] = 'required'; - break; - case self::PARAM_OPTIONAL: - default: - $rule['param'] = 'optional'; - } - switch (substr($paramType, 0, 1)) { - case self::TYPE_WORD: - $rule['paramType'] = 'word'; - break; - case self::TYPE_INTEGER: - $rule['paramType'] = 'integer'; - break; - case self::TYPE_STRING: - default: - $rule['paramType'] = 'string'; - } - } else { - $rule['param'] = 'none'; - } - $rule['help'] = $helpMessage; - $this->_rules[$mainFlag] = $rule; - } - } - -} diff --git a/library/vendor/Zend/Console/Getopt/Exception.php b/library/vendor/Zend/Console/Getopt/Exception.php deleted file mode 100644 index cb3ebf2be..000000000 --- a/library/vendor/Zend/Console/Getopt/Exception.php +++ /dev/null @@ -1,65 +0,0 @@ -usage = $usage; - parent::__construct($message); - } - - /** - * Returns the usage - * - * @return string - */ - public function getUsageMessage() - { - return $this->usage; - } -} diff --git a/library/vendor/Zend/Controller/Action/Helper/AutoCompleteDojo.php b/library/vendor/Zend/Controller/Action/Helper/AutoCompleteDojo.php deleted file mode 100644 index 31fd33d6a..000000000 --- a/library/vendor/Zend/Controller/Action/Helper/AutoCompleteDojo.php +++ /dev/null @@ -1,83 +0,0 @@ - $value) { - $items[] = array('label' => $value, 'name' => $value); - } - $data = new Zend_Dojo_Data('name', $items); - } - - if (!$keepLayouts) { - Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNoRender(true); - - $layout = Zend_Layout::getMvcInstance(); - if ($layout instanceof Zend_Layout) { - $layout->disableLayout(); - } - } - - $response = Zend_Controller_Front::getInstance()->getResponse(); - $response->setHeader('Content-Type', 'application/json'); - - return $data->toJson(); - } -} diff --git a/library/vendor/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php b/library/vendor/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php deleted file mode 100644 index fe443e20b..000000000 --- a/library/vendor/Zend/Controller/Action/Helper/AutoCompleteScriptaculous.php +++ /dev/null @@ -1,80 +0,0 @@ -validateData($data)) { - /** - * @see Zend_Controller_Action_Exception - */ - throw new Zend_Controller_Action_Exception('Invalid data passed for autocompletion'); - } - - $data = (array) $data; - $data = '
  • ' . implode('
  • ', $data) . '
'; - - if (!$keepLayouts) { - $this->disableLayouts(); - } - - return $data; - } -} diff --git a/library/vendor/Zend/Controller/Action/Helper/FlashMessenger.php b/library/vendor/Zend/Controller/Action/Helper/FlashMessenger.php deleted file mode 100644 index 07414c9c6..000000000 --- a/library/vendor/Zend/Controller/Action/Helper/FlashMessenger.php +++ /dev/null @@ -1,311 +0,0 @@ -getName()); - foreach (self::$_session as $namespace => $messages) { - self::$_messages[$namespace] = $messages; - unset(self::$_session->{$namespace}); - } - } - } - - /** - * postDispatch() - runs after action is dispatched, in this - * case, it is resetting the namespace in case we have forwarded to a different - * action, Flashmessage will be 'clean' (default namespace) - * - * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface - */ - public function postDispatch() - { - $this->resetNamespace(); - return $this; - } - - /** - * setNamespace() - change the namespace messages are added to, useful for - * per action controller messaging between requests - * - * @param string $namespace - * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface - */ - public function setNamespace($namespace = 'default') - { - $this->_namespace = $namespace; - return $this; - } - - /** - * getNamespace() - return the current namepsace - * - * @return string - */ - public function getNamespace() - { - return $this->_namespace; - } - - /** - * resetNamespace() - reset the namespace to the default - * - * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface - */ - public function resetNamespace() - { - $this->setNamespace(); - return $this; - } - - /** - * addMessage() - Add a message to flash message - * - * @param string $message - * @return Zend_Controller_Action_Helper_FlashMessenger Provides a fluent interface - */ - public function addMessage($message, $namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - if (self::$_messageAdded === false) { - self::$_session->setExpirationHops(1, null, true); - } - - if (!is_array(self::$_session->{$namespace})) { - self::$_session->{$namespace} = array(); - } - - self::$_session->{$namespace}[] = $message; - self::$_messageAdded = true; - - return $this; - } - - /** - * hasMessages() - Wether a specific namespace has messages - * - * @return boolean - */ - public function hasMessages($namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - return isset(self::$_messages[$namespace]); - } - - /** - * getMessages() - Get messages from a specific namespace - * - * @return array - */ - public function getMessages($namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - if ($this->hasMessages($namespace)) { - return self::$_messages[$namespace]; - } - - return array(); - } - - /** - * Clear all messages from the previous request & current namespace - * - * @return boolean True if messages were cleared, false if none existed - */ - public function clearMessages($namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - if ($this->hasMessages($namespace)) { - unset(self::$_messages[$namespace]); - return true; - } - - return false; - } - - /** - * hasCurrentMessages() - check to see if messages have been added to current - * namespace within this request - * - * @return boolean - */ - public function hasCurrentMessages($namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - return isset(self::$_session->{$namespace}); - } - - /** - * getCurrentMessages() - get messages that have been added to the current - * namespace within this request - * - * @return array - */ - public function getCurrentMessages($namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - if ($this->hasCurrentMessages($namespace)) { - return self::$_session->{$namespace}; - } - - return array(); - } - - /** - * clear messages from the current request & current namespace - * - * @return boolean - */ - public function clearCurrentMessages($namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - if ($this->hasCurrentMessages($namespace)) { - unset(self::$_session->{$namespace}); - return true; - } - - return false; - } - - /** - * getIterator() - complete the IteratorAggregate interface, for iterating - * - * @return ArrayObject - */ - public function getIterator($namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - if ($this->hasMessages($namespace)) { - return new ArrayObject($this->getMessages($namespace)); - } - - return new ArrayObject(); - } - - /** - * count() - Complete the countable interface - * - * @return int - */ - public function count($namespace = null) - { - if (!is_string($namespace) || $namespace == '') { - $namespace = $this->getNamespace(); - } - - if ($this->hasMessages($namespace)) { - return count($this->getMessages($namespace)); - } - - return 0; - } - - /** - * Strategy pattern: proxy to addMessage() - * - * @param string $message - * @return void - */ - public function direct($message, $namespace=NULL) - { - return $this->addMessage($message, $namespace); - } -} diff --git a/library/vendor/Zend/Crypt/Math.php b/library/vendor/Zend/Crypt/Math.php index 3632ce07d..f39ac16b0 100644 --- a/library/vendor/Zend/Crypt/Math.php +++ b/library/vendor/Zend/Crypt/Math.php @@ -56,13 +56,97 @@ class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger } $rand = ''; $i2 = strlen($maximum) - 1; - for ($i = 1;$i < $i2;$i++) { - $rand .= mt_rand(0,9); + for ($i = 1; $i < $i2; $i++) { + $rand .= mt_rand(0, 9); } - $rand .= mt_rand(0,9); + $rand .= mt_rand(0, 9); return $rand; } + /** + * Return a random strings of $length bytes + * + * @param integer $length + * @param boolean $strong + * @return string + */ + public static function randBytes($length, $strong = false) + { + $length = (int) $length; + if ($length <= 0) { + return false; + } + if (function_exists('random_bytes')) { // available in PHP 7 + return random_bytes($length); + } + if (function_exists('mcrypt_create_iv')) { + $bytes = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM); + if ($bytes !== false && strlen($bytes) === $length) { + return $bytes; + } + } + if (file_exists('/dev/urandom') && is_readable('/dev/urandom')) { + $frandom = fopen('/dev/urandom', 'r'); + if ($frandom !== false) { + return fread($frandom, $length); + } + } + if (true === $strong) { + throw new Zend_Crypt_Exception( + 'This PHP environment doesn\'t support secure random number generation. ' . + 'Please consider installing the OpenSSL and/or Mcrypt extensions' + ); + } + $rand = ''; + for ($i = 0; $i < $length; $i++) { + $rand .= chr(mt_rand(0, 255)); + } + return $rand; + } + + /** + * Return a random integer between $min and $max + * + * @param integer $min + * @param integer $max + * @param boolean $strong + * @return integer + */ + public static function randInteger($min, $max, $strong = false) + { + if ($min > $max) { + throw new Zend_Crypt_Exception( + 'The min parameter must be lower than max parameter' + ); + } + $range = $max - $min; + if ($range == 0) { + return $max; + } elseif ($range > PHP_INT_MAX || is_float($range)) { + throw new Zend_Crypt_Exception( + 'The supplied range is too great to generate' + ); + } + if (function_exists('random_int')) { // available in PHP 7 + return random_int($min, $max); + } + // calculate number of bits required to store range on this machine + $r = $range; + $bits = 0; + while ($r) { + $bits++; + $r >>= 1; + } + $bits = (int) max($bits, 1); + $bytes = (int) max(ceil($bits / 8), 1); + $filter = (int) ((1 << $bits) - 1); + do { + $rnd = hexdec(bin2hex(self::randBytes($bytes, $strong))); + $rnd &= $filter; + } while ($rnd > $range); + return ($min + $rnd); + } + /** * Get the big endian two's complement of a given big integer in * binary notation @@ -70,7 +154,8 @@ class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger * @param string $long * @return string */ - public function btwoc($long) { + public function btwoc($long) + { if (ord($long[0]) > 127) { return "\x00" . $long; } @@ -83,7 +168,8 @@ class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger * @param string $binary * @return string */ - public function fromBinary($binary) { + public function fromBinary($binary) + { return $this->_math->binaryToInteger($binary); } @@ -97,5 +183,4 @@ class Zend_Crypt_Math extends Zend_Crypt_Math_BigInteger { return $this->_math->integerToBinary($integer); } - } diff --git a/library/vendor/Zend/Crypt/Math/BigInteger.php b/library/vendor/Zend/Crypt/Math/BigInteger.php index 1117df765..0b98cec21 100644 --- a/library/vendor/Zend/Crypt/Math/BigInteger.php +++ b/library/vendor/Zend/Crypt/Math/BigInteger.php @@ -101,6 +101,7 @@ class Zend_Crypt_Math_BigInteger if($extension == 'gmp' && extension_loaded('gmp')) { $this->_math = new Zend_Crypt_Math_BigInteger_Gmp(); //} elseif($extension == 'bigint' && extension_loaded('big_int')) { + // require_once 'Zend/Crypt_Math/BigInteger/Bigint.php'; // $this->_math = new Zend_Crypt_Math_BigInteger_Bigint(); } elseif ($extension == 'bcmath' && extension_loaded('bcmath')) { $this->_math = new Zend_Crypt_Math_BigInteger_Bcmath(); diff --git a/library/vendor/Zend/Currency.php b/library/vendor/Zend/Currency.php deleted file mode 100644 index 25d12dce1..000000000 --- a/library/vendor/Zend/Currency.php +++ /dev/null @@ -1,884 +0,0 @@ - Position for the currency sign - * 'script' => Script for the output - * 'format' => Locale for numeric output - * 'display' => Currency detail to show - * 'precision' => Precision for the currency - * 'name' => Name for this currency - * 'currency' => 3 lettered international abbreviation - * 'symbol' => Currency symbol - * 'locale' => Locale for this currency - * 'value' => Money value - * 'service' => Exchange service to use - * - * @var array - * @see Zend_Locale - */ - protected $_options = array( - 'position' => self::STANDARD, - 'script' => null, - 'format' => null, - 'display' => self::NO_SYMBOL, - 'precision' => 2, - 'name' => null, - 'currency' => null, - 'symbol' => null, - 'locale' => null, - 'value' => 0, - 'service' => null, - 'tag' => 'Zend_Locale' - ); - - /** - * Creates a currency instance. Every supressed parameter is used from the actual or the given locale. - * - * @param string|array $options OPTIONAL Options array or currency short name - * when string is given - * @param string|Zend_Locale $locale OPTIONAL locale name - * @throws Zend_Currency_Exception When currency is invalid - */ - public function __construct($options = null, $locale = null) - { - $calloptions = $options; - if (is_array($options) && isset($options['display'])) { - $this->_options['display'] = $options['display']; - } - - if (is_array($options)) { - $this->setLocale($locale); - $this->setFormat($options); - } else if (Zend_Locale::isLocale($options, false, false)) { - $this->setLocale($options); - $options = $locale; - } else { - $this->setLocale($locale); - } - - // Get currency details - if (!isset($this->_options['currency']) || !is_array($options)) { - $this->_options['currency'] = self::getShortName($options, $this->_options['locale']); - } - - if (!isset($this->_options['name']) || !is_array($options)) { - $this->_options['name'] = self::getName($options, $this->_options['locale']); - } - - if (!isset($this->_options['symbol']) || !is_array($options)) { - $this->_options['symbol'] = self::getSymbol($options, $this->_options['locale']); - } - - if (($this->_options['currency'] === null) and ($this->_options['name'] === null)) { - throw new Zend_Currency_Exception("Currency '$options' not found"); - } - - // Get the format - if ((is_array($calloptions) && !isset($calloptions['display'])) - || (!is_array($calloptions) && $this->_options['display'] == self::NO_SYMBOL)) { - if (!empty($this->_options['symbol'])) { - $this->_options['display'] = self::USE_SYMBOL; - } else if (!empty($this->_options['currency'])) { - $this->_options['display'] = self::USE_SHORTNAME; - } - } - } - - /** - * Returns a localized currency string - * - * @param integer|float $value OPTIONAL Currency value - * @param array $options OPTIONAL options to set temporary - * @throws Zend_Currency_Exception When the value is not a number - * @return string - */ - public function toCurrency($value = null, array $options = array()) - { - if ($value === null) { - if (is_array($options) && isset($options['value'])) { - $value = $options['value']; - } else { - $value = $this->_options['value']; - } - } - - if (is_array($value)) { - $options += $value; - if (isset($options['value'])) { - $value = $options['value']; - } - } - - // Validate the passed number - if (!(isset($value)) or (is_numeric($value) === false)) { - throw new Zend_Currency_Exception("Value '$value' has to be numeric"); - } - - if (isset($options['currency'])) { - if (!isset($options['locale'])) { - $options['locale'] = $this->_options['locale']; - } - - $options['currency'] = self::getShortName($options['currency'], $options['locale']); - $options['name'] = self::getName($options['currency'], $options['locale']); - $options['symbol'] = self::getSymbol($options['currency'], $options['locale']); - } - - $options = $this->_checkOptions($options) + $this->_options; - - // Format the number - $format = $options['format']; - $locale = $options['locale']; - if (empty($format)) { - $format = Zend_Locale_Data::getContent($locale, 'currencynumber'); - } else if (Zend_Locale::isLocale($format, true, false)) { - $locale = $format; - $format = Zend_Locale_Data::getContent($format, 'currencynumber'); - } - - $original = $value; - $value = Zend_Locale_Format::toNumber($value, array('locale' => $locale, - 'number_format' => $format, - 'precision' => $options['precision'])); - - if ($options['position'] !== self::STANDARD) { - $value = str_replace('¤', '', $value); - $space = ''; - if (iconv_strpos($value, ' ') !== false) { - $value = str_replace(' ', '', $value); - $space = ' '; - } - - if ($options['position'] == self::LEFT) { - $value = '¤' . $space . $value; - } else { - $value = $value . $space . '¤'; - } - } - - // Localize the number digits - if (empty($options['script']) === false) { - $value = Zend_Locale_Format::convertNumerals($value, 'Latn', $options['script']); - } - - // Get the sign to be placed next to the number - if (is_numeric($options['display']) === false) { - $sign = $options['display']; - } else { - switch($options['display']) { - case self::USE_SYMBOL: - $sign = $this->_extractPattern($options['symbol'], $original); - break; - - case self::USE_SHORTNAME: - $sign = $options['currency']; - break; - - case self::USE_NAME: - $sign = $options['name']; - break; - - default: - $sign = ''; - $value = str_replace(' ', '', $value); - break; - } - } - - $value = str_replace('¤', $sign, $value); - return $value; - } - - /** - * Internal method to extract the currency pattern - * when a choice is given based on the given value - * - * @param string $pattern - * @param float|integer $value - * @return string - */ - private function _extractPattern($pattern, $value) - { - if (strpos($pattern, '|') === false) { - return $pattern; - } - - $patterns = explode('|', $pattern); - $token = $pattern; - $value = trim(str_replace('¤', '', $value)); - krsort($patterns); - foreach($patterns as $content) { - if (strpos($content, '<') !== false) { - $check = iconv_substr($content, 0, iconv_strpos($content, '<')); - $token = iconv_substr($content, iconv_strpos($content, '<') + 1); - if ($check < $value) { - return $token; - } - } else { - $check = iconv_substr($content, 0, iconv_strpos($content, '≤')); - $token = iconv_substr($content, iconv_strpos($content, '≤') + 1); - if ($check <= $value) { - return $token; - } - } - - } - - return $token; - } - - /** - * Sets the formating options of the localized currency string - * If no parameter is passed, the standard setting of the - * actual set locale will be used - * - * @param array $options (Optional) Options to set - * @return Zend_Currency - */ - public function setFormat(array $options = array()) - { - $this->_options = $this->_checkOptions($options) + $this->_options; - return $this; - } - - /** - * Internal function for checking static given locale parameter - * - * @param string $currency (Optional) Currency name - * @param string|Zend_Locale $locale (Optional) Locale to display informations - * @throws Zend_Currency_Exception When locale contains no region - * @return string The extracted locale representation as string - */ - private function _checkParams($currency = null, $locale = null) - { - // Manage the params - if ((empty($locale)) and (!empty($currency)) and - (Zend_Locale::isLocale($currency, true, false))) { - $locale = $currency; - $currency = null; - } - - // Validate the locale and get the country short name - $country = null; - if ((Zend_Locale::isLocale($locale, true, false)) and (strlen($locale) > 4)) { - $country = substr($locale, (strpos($locale, '_') + 1)); - } else { - throw new Zend_Currency_Exception("No region found within the locale '" . (string) $locale . "'"); - } - - // Get the available currencies for this country - $data = Zend_Locale_Data::getContent($locale, 'currencytoregion', $country); - if ((empty($currency) === false) and (empty($data) === false)) { - $abbreviation = $currency; - } else { - $abbreviation = $data; - } - - return array('locale' => $locale, 'currency' => $currency, 'name' => $abbreviation, 'country' => $country); - } - - /** - * Returns the actual or details of other currency symbols, - * when no symbol is available it returns the currency shortname (f.e. FIM for Finnian Mark) - * - * @param string $currency (Optional) Currency name - * @param string|Zend_Locale $locale (Optional) Locale to display informations - * @return string - */ - public function getSymbol($currency = null, $locale = null) - { - if (($currency === null) and ($locale === null)) { - return $this->_options['symbol']; - } - - $params = self::_checkParams($currency, $locale); - - // Get the symbol - $symbol = Zend_Locale_Data::getContent($params['locale'], 'currencysymbol', $params['currency']); - if (empty($symbol) === true) { - $symbol = Zend_Locale_Data::getContent($params['locale'], 'currencysymbol', $params['name']); - } - - if (empty($symbol) === true) { - return null; - } - - return $symbol; - } - - /** - * Returns the actual or details of other currency shortnames - * - * @param string $currency OPTIONAL Currency's name - * @param string|Zend_Locale $locale OPTIONAL The locale - * @return string - */ - public function getShortName($currency = null, $locale = null) - { - if (($currency === null) and ($locale === null)) { - return $this->_options['currency']; - } - - $params = self::_checkParams($currency, $locale); - - // Get the shortname - if (empty($params['currency']) === true) { - return $params['name']; - } - - $list = Zend_Locale_Data::getContent($params['locale'], 'currencytoname', $params['currency']); - if (empty($list) === true) { - $list = Zend_Locale_Data::getContent($params['locale'], 'nametocurrency', $params['currency']); - if (empty($list) === false) { - $list = $params['currency']; - } - } - - if (empty($list) === true) { - return null; - } - - return $list; - } - - /** - * Returns the actual or details of other currency names - * - * @param string $currency (Optional) Currency's short name - * @param string|Zend_Locale $locale (Optional) The locale - * @return string - */ - public function getName($currency = null, $locale = null) - { - if (($currency === null) and ($locale === null)) { - return $this->_options['name']; - } - - $params = self::_checkParams($currency, $locale); - - // Get the name - $name = Zend_Locale_Data::getContent($params['locale'], 'nametocurrency', $params['currency']); - if (empty($name) === true) { - $name = Zend_Locale_Data::getContent($params['locale'], 'nametocurrency', $params['name']); - } - - if (empty($name) === true) { - return null; - } - - return $name; - } - - /** - * Returns a list of regions where this currency is or was known - * - * @param string $currency OPTIONAL Currency's short name - * @throws Zend_Currency_Exception When no currency was defined - * @return array List of regions - */ - public function getRegionList($currency = null) - { - if ($currency === null) { - $currency = $this->_options['currency']; - } - - if (empty($currency) === true) { - throw new Zend_Currency_Exception('No currency defined'); - } - - $data = Zend_Locale_Data::getContent($this->_options['locale'], 'regiontocurrency', $currency); - - $result = explode(' ', $data); - return $result; - } - - /** - * Returns a list of currencies which are used in this region - * a region name should be 2 charachters only (f.e. EG, DE, US) - * If no region is given, the actual region is used - * - * @param string $region OPTIONAL Region to return the currencies for - * @return array List of currencies - */ - public function getCurrencyList($region = null) - { - if (empty($region) === true) { - if (strlen($this->_options['locale']) > 4) { - $region = substr($this->_options['locale'], (strpos($this->_options['locale'], '_') + 1)); - } - } - - $data = Zend_Locale_Data::getContent($this->_options['locale'], 'currencytoregion', $region); - - $result = explode(' ', $data); - return $result; - } - - /** - * Returns the actual currency name - * - * @return string - */ - public function toString() - { - return $this->toCurrency(); - } - - /** - * Returns the currency name - * - * @return string - */ - public function __toString() - { - return $this->toString(); - } - - /** - * Returns the set cache - * - * @return Zend_Cache_Core The set cache - */ - public static function getCache() - { - return Zend_Locale_Data::getCache(); - } - - /** - * Sets a cache for Zend_Currency - * - * @param Zend_Cache_Core $cache Cache to set - * @return void - */ - public static function setCache(Zend_Cache_Core $cache) - { - Zend_Locale_Data::setCache($cache); - } - - /** - * Returns true when a cache is set - * - * @return boolean - */ - public static function hasCache() - { - return Zend_Locale_Data::hasCache(); - } - - /** - * Removes any set cache - * - * @return void - */ - public static function removeCache() - { - Zend_Locale_Data::removeCache(); - } - - /** - * Clears all set cache data - * - * @param string $tag Tag to clear when the default tag name is not used - * @return void - */ - public static function clearCache($tag = null) - { - Zend_Locale_Data::clearCache($tag); - } - - /** - * Sets a new locale for data retreivement - * 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 - * @throws Zend_Currency_Exception When the given locale does not exist - * @return Zend_Currency Provides fluent interface - */ - public function setLocale($locale = null) - { - try { - $locale = Zend_Locale::findLocale($locale); - if (strlen($locale) > 4) { - $this->_options['locale'] = $locale; - } else { - throw new Zend_Currency_Exception("No region found within the locale '" . (string) $locale . "'"); - } - } catch (Zend_Locale_Exception $e) { - throw new Zend_Currency_Exception($e->getMessage()); - } - - // Get currency details - $this->_options['currency'] = $this->getShortName(null, $this->_options['locale']); - $this->_options['name'] = $this->getName(null, $this->_options['locale']); - $this->_options['symbol'] = $this->getSymbol(null, $this->_options['locale']); - - return $this; - } - - /** - * Returns the actual set locale - * - * @return string - */ - public function getLocale() - { - return $this->_options['locale']; - } - - /** - * Returns the value - * - * @return float - */ - public function getValue() - { - return $this->_options['value']; - } - - /** - * Adds a currency - * - * @param float|integer|Zend_Currency $value Add this value to currency - * @param string|Zend_Currency $currency The currency to add - * @return Zend_Currency - */ - public function setValue($value, $currency = null) - { - $this->_options['value'] = $this->_exchangeCurrency($value, $currency); - return $this; - } - - /** - * Adds a currency - * - * @param float|integer|Zend_Currency $value Add this value to currency - * @param string|Zend_Currency $currency The currency to add - * @return Zend_Currency - */ - public function add($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - $this->_options['value'] += (float) $value; - return $this; - } - - /** - * Substracts a currency - * - * @param float|integer|Zend_Currency $value Substracts this value from currency - * @param string|Zend_Currency $currency The currency to substract - * @return Zend_Currency - */ - public function sub($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - $this->_options['value'] -= (float) $value; - return $this; - } - - /** - * Divides a currency - * - * @param float|integer|Zend_Currency $value Divides this value from currency - * @param string|Zend_Currency $currency The currency to divide - * @return Zend_Currency - */ - public function div($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - $this->_options['value'] /= (float) $value; - return $this; - } - - /** - * Multiplies a currency - * - * @param float|integer|Zend_Currency $value Multiplies this value from currency - * @param string|Zend_Currency $currency The currency to multiply - * @return Zend_Currency - */ - public function mul($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - $this->_options['value'] *= (float) $value; - return $this; - } - - /** - * Calculates the modulo from a currency - * - * @param float|integer|Zend_Currency $value Calculate modulo from this value - * @param string|Zend_Currency $currency The currency to calculate the modulo - * @return Zend_Currency - */ - public function mod($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - $this->_options['value'] %= (float) $value; - return $this; - } - - /** - * Compares two currencies - * - * @param float|integer|Zend_Currency $value Compares the currency with this value - * @param string|Zend_Currency $currency The currency to compare this value from - * @return Zend_Currency - */ - public function compare($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - $value = $this->_options['value'] - $value; - if ($value < 0) { - return -1; - } else if ($value > 0) { - return 1; - } - - return 0; - } - - /** - * Returns true when the two currencies are equal - * - * @param float|integer|Zend_Currency $value Compares the currency with this value - * @param string|Zend_Currency $currency The currency to compare this value from - * @return boolean - */ - public function equals($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - if ($this->_options['value'] == $value) { - return true; - } - - return false; - } - - /** - * Returns true when the currency is more than the given value - * - * @param float|integer|Zend_Currency $value Compares the currency with this value - * @param string|Zend_Currency $currency The currency to compare this value from - * @return boolean - */ - public function isMore($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - if ($this->_options['value'] > $value) { - return true; - } - - return false; - } - - /** - * Returns true when the currency is less than the given value - * - * @param float|integer|Zend_Currency $value Compares the currency with this value - * @param string|Zend_Currency $currency The currency to compare this value from - * @return boolean - */ - public function isLess($value, $currency = null) - { - $value = $this->_exchangeCurrency($value, $currency); - if ($this->_options['value'] < $value) { - return true; - } - - return false; - - } - - /** - * Internal method which calculates the exchanges currency - * - * @param float|integer|Zend_Currency $value Compares the currency with this value - * @param string|Zend_Currency $currency The currency to compare this value from - * @return unknown - */ - protected function _exchangeCurrency($value, $currency) - { - if ($value instanceof Zend_Currency) { - $currency = $value->getShortName(); - $value = $value->getValue(); - } else { - $currency = $this->getShortName($currency, $this->getLocale()); - } - - $rate = 1; - if ($currency !== $this->getShortName()) { - $service = $this->getService(); - if (!($service instanceof Zend_Currency_CurrencyInterface)) { - throw new Zend_Currency_Exception('No exchange service applied'); - } - - $rate = $service->getRate($currency, $this->getShortName()); - } - - $value *= $rate; - return $value; - } - - /** - * Returns the set service class - * - * @return Zend_Service - */ - public function getService() - { - return $this->_options['service']; - } - - /** - * Sets a new exchange service - * - * @param string|Zend_Currency_CurrencyInterface $service Service class - * @return Zend_Currency - */ - public function setService($service) - { - if (is_string($service)) { - if (!class_exists($service)) { - $file = str_replace('_', DIRECTORY_SEPARATOR, $service) . '.php'; - if (Zend_Loader::isReadable($file)) { - Zend_Loader::loadClass($service); - } - } - - $service = new $service; - } - - if (!($service instanceof Zend_Currency_CurrencyInterface)) { - throw new Zend_Currency_Exception('A currency service must implement Zend_Currency_CurrencyInterface'); - } - - $this->_options['service'] = $service; - return $this; - } - - /** - * Internal method for checking the options array - * - * @param array $options Options to check - * @throws Zend_Currency_Exception On unknown position - * @throws Zend_Currency_Exception On unknown locale - * @throws Zend_Currency_Exception On unknown display - * @throws Zend_Currency_Exception On precision not between -1 and 30 - * @throws Zend_Currency_Exception On problem with script conversion - * @throws Zend_Currency_Exception On unknown options - * @return array - */ - protected function _checkOptions(array $options = array()) - { - if (count($options) === 0) { - return $this->_options; - } - - foreach ($options as $name => $value) { - $name = strtolower($name); - if ($name !== 'format') { - if (gettype($value) === 'string') { - $value = strtolower($value); - } - } - - switch($name) { - case 'position': - if (($value !== self::STANDARD) and ($value !== self::RIGHT) and ($value !== self::LEFT)) { - throw new Zend_Currency_Exception("Unknown position '" . $value . "'"); - } - - break; - - case 'format': - if ((empty($value) === false) and (Zend_Locale::isLocale($value, null, false) === false)) { - if (!is_string($value) || (strpos($value, '0') === false)) { - throw new Zend_Currency_Exception("'" . - ((gettype($value) === 'object') ? get_class($value) : $value) - . "' is no format token"); - } - } - break; - - case 'display': - if (is_numeric($value) and ($value !== self::NO_SYMBOL) and ($value !== self::USE_SYMBOL) and - ($value !== self::USE_SHORTNAME) and ($value !== self::USE_NAME)) { - throw new Zend_Currency_Exception("Unknown display '$value'"); - } - break; - - case 'precision': - if ($value === null) { - $value = -1; - } - - if (($value < -1) or ($value > 30)) { - throw new Zend_Currency_Exception("'$value' precision has to be between -1 and 30."); - } - break; - - case 'script': - try { - Zend_Locale_Format::convertNumerals(0, $options['script']); - } catch (Zend_Locale_Exception $e) { - throw new Zend_Currency_Exception($e->getMessage()); - } - break; - - default: - break; - } - } - - return $options; - } -} diff --git a/library/vendor/Zend/Currency/CurrencyInterface.php b/library/vendor/Zend/Currency/CurrencyInterface.php deleted file mode 100644 index 8e828864b..000000000 --- a/library/vendor/Zend/Currency/CurrencyInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -query("SELECT SERVERPROPERTY('productversion')"); + $stmt = $this->query("SELECT CAST(SERVERPROPERTY('productversion') AS VARCHAR)"); $result = $stmt->fetchAll(Zend_Db::FETCH_NUM); if (count($result)) { return $result[0][0]; @@ -417,4 +417,19 @@ class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract return null; } } + + /** + * Quote a raw string. + * + * @param string $value Raw string + * @return string Quoted string + */ + protected function _quote($value) + { + if (!is_int($value) && !is_float($value)) { + // Fix for null-byte injection + $value = addcslashes($value, "\000\032"); + } + return parent::_quote($value); + } } diff --git a/library/vendor/Zend/Db/Adapter/Pdo/Sqlite.php b/library/vendor/Zend/Db/Adapter/Pdo/Sqlite.php index 22169b983..645333948 100644 --- a/library/vendor/Zend/Db/Adapter/Pdo/Sqlite.php +++ b/library/vendor/Zend/Db/Adapter/Pdo/Sqlite.php @@ -288,4 +288,18 @@ class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract return $sql; } + /** + * Quote a raw string. + * + * @param string $value Raw string + * @return string Quoted string + */ + protected function _quote($value) + { + if (!is_int($value) && !is_float($value)) { + // Fix for null-byte injection + $value = addcslashes($value, "\000\032"); + } + return parent::_quote($value); + } } diff --git a/library/vendor/Zend/Db/Profiler/Firebug.php b/library/vendor/Zend/Db/Profiler/Firebug.php deleted file mode 100644 index 248654d83..000000000 --- a/library/vendor/Zend/Db/Profiler/Firebug.php +++ /dev/null @@ -1,158 +0,0 @@ -_label = $label; - if(!$this->_label) { - $this->_label = 'Zend_Db_Profiler_Firebug'; - } - } - - /** - * Enable or disable the profiler. If $enable is false, the profiler - * is disabled and will not log any queries sent to it. - * - * @param boolean $enable - * @return Zend_Db_Profiler Provides a fluent interface - */ - public function setEnabled($enable) - { - parent::setEnabled($enable); - - if ($this->getEnabled()) { - - if (!$this->_message) { - $this->_message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_label); - $this->_message->setBuffered(true); - $this->_message->setHeader(array('Time','Event','Parameters')); - $this->_message->setDestroy(true); - $this->_message->setOption('includeLineNumbers', false); - Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message); - } - - } else { - - if ($this->_message) { - $this->_message->setDestroy(true); - $this->_message = null; - } - - } - - return $this; - } - - /** - * Intercept the query end and log the profiling data. - * - * @param integer $queryId - * @throws Zend_Db_Profiler_Exception - * @return void - */ - public function queryEnd($queryId) - { - $state = parent::queryEnd($queryId); - - if (!$this->getEnabled() || $state == self::IGNORED) { - return; - } - - $this->_message->setDestroy(false); - - $profile = $this->getQueryProfile($queryId); - - $this->_totalElapsedTime += $profile->getElapsedSecs(); - - $this->_message->addRow(array((string)round($profile->getElapsedSecs(),5), - $profile->getQuery(), - ($params=$profile->getQueryParams())?$params:null)); - - $this->updateMessageLabel(); - } - - /** - * Update the label of the message holding the profile info. - * - * @return void - */ - protected function updateMessageLabel() - { - if (!$this->_message) { - return; - } - $this->_message->setLabel(str_replace(array('%label%', - '%totalCount%', - '%totalDuration%'), - array($this->_label, - $this->getTotalNumQueries(), - (string)round($this->_totalElapsedTime,5)), - $this->_label_template)); - } -} diff --git a/library/vendor/Zend/Db/Select.php b/library/vendor/Zend/Db/Select.php index 5e3bcda74..64908e3f6 100644 --- a/library/vendor/Zend/Db/Select.php +++ b/library/vendor/Zend/Db/Select.php @@ -79,7 +79,26 @@ class Zend_Db_Select const SQL_ASC = 'ASC'; const SQL_DESC = 'DESC'; - const REGEX_COLUMN_EXPR = '/^([\w]*\(([^\(\)]|(?1))*\))$/'; + const REGEX_COLUMN_EXPR = '/^([\w]*\s*\(([^\(\)]|(?1))*\))$/'; + const REGEX_COLUMN_EXPR_ORDER = '/^([\w]+\s*\(([^\(\)]|(?1))*\))$/'; + const REGEX_COLUMN_EXPR_GROUP = '/^([\w]+\s*\(([^\(\)]|(?1))*\))$/'; + + // @see http://stackoverflow.com/a/13823184/2028814 + const REGEX_SQL_COMMENTS = '@ + (([\'"]).*?[^\\\]\2) # $1 : Skip single & double quoted expressions + |( # $3 : Match comments + (?:\#|--).*?$ # - Single line comments + | # - Multi line (nested) comments + /\* # . comment open marker + (?: [^/*] # . non comment-marker characters + |/(?!\*) # . ! not a comment open + |\*(?!/) # . ! not a comment close + |(?R) # . recursive case + )* # . repeat eventually + \*\/ # . comment close marker + )\s* # Trim after comments + |(?<=;)\s+ # Trim after semi-colon + @msx'; /** * Bind variables for query @@ -506,7 +525,9 @@ class Zend_Db_Select } foreach ($spec as $val) { - if (preg_match(self::REGEX_COLUMN_EXPR, (string) $val)) { + // Remove comments from SQL statement + $noComments = preg_replace(self::REGEX_SQL_COMMENTS, '$1', (string) $val); + if (preg_match(self::REGEX_COLUMN_EXPR_GROUP, $noComments)) { $val = new Zend_Db_Expr($val); } $this->_parts[self::GROUP][] = $val; @@ -598,7 +619,9 @@ class Zend_Db_Select $val = trim($matches[1]); $direction = $matches[2]; } - if (preg_match(self::REGEX_COLUMN_EXPR, (string) $val)) { + // Remove comments from SQL statement + $noComments = preg_replace(self::REGEX_SQL_COMMENTS, '$1', (string) $val); + if (preg_match(self::REGEX_COLUMN_EXPR_ORDER, $noComments)) { $val = new Zend_Db_Expr($val); } $this->_parts[self::ORDER][] = array($val, $direction); @@ -930,6 +953,7 @@ class Zend_Db_Select $currentCorrelationName = $correlationName; if (is_string($col)) { // Check for a column matching " AS " and extract the alias name + $col = trim(str_replace("\n", ' ', $col)); if (preg_match('/^(.+)\s+' . self::SQL_AS . '\s+(.+)$/i', $col, $m)) { $col = $m[1]; $alias = $m[2]; diff --git a/library/vendor/Zend/Debug.php b/library/vendor/Zend/Debug.php deleted file mode 100644 index 00196269e..000000000 --- a/library/vendor/Zend/Debug.php +++ /dev/null @@ -1,113 +0,0 @@ - tags, cleans up newlines and indents, and runs - * htmlentities() before output. - * - * @param mixed $var The variable to dump. - * @param string $label OPTIONAL Label to prepend to output. - * @param bool $echo OPTIONAL Echo output if true. - * @return string - */ - public static function dump($var, $label=null, $echo=true) - { - // format the label - $label = ($label===null) ? '' : rtrim($label) . ' '; - - // var_dump the variable into a buffer and keep the output - ob_start(); - var_dump($var); - $output = ob_get_clean(); - - // neaten the newlines and indents - $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output); - if (self::getSapi() == 'cli') { - $output = PHP_EOL . $label - . PHP_EOL . $output - . PHP_EOL; - } else { - if(!extension_loaded('xdebug')) { - $flags = ENT_QUOTES; - // PHP 5.4.0+ - if (defined('ENT_SUBSTITUTE')) { - $flags = ENT_QUOTES | ENT_SUBSTITUTE; - } - $output = htmlspecialchars($output, $flags); - } - - $output = '
'
-                    . $label
-                    . $output
-                    . '
'; - } - - if ($echo) { - echo($output); - } - return $output; - } - -} diff --git a/library/vendor/Zend/Dom/Exception.php b/library/vendor/Zend/Dom/Exception.php deleted file mode 100644 index bd0331558..000000000 --- a/library/vendor/Zend/Dom/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ -setEncoding($encoding); - $this->setDocument($document); - } - - /** - * Set document encoding - * - * @param string $encoding - * @return Zend_Dom_Query - */ - public function setEncoding($encoding) - { - $this->_encoding = (null === $encoding) ? null : (string) $encoding; - return $this; - } - - /** - * Get document encoding - * - * @return null|string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set document to query - * - * @param string $document - * @param null|string $encoding Document encoding - * @return Zend_Dom_Query - */ - public function setDocument($document, $encoding = null) - { - if (0 === strlen($document)) { - return $this; - } - // breaking XML declaration to make syntax highlighting work - if ('<' . '?xml' == substr(trim($document), 0, 5)) { - if (preg_match('/]*xmlns="([^"]+)"[^>]*>/i', $document, $matches)) { - $this->_xpathNamespaces[] = $matches[1]; - return $this->setDocumentXhtml($document, $encoding); - } - return $this->setDocumentXml($document, $encoding); - } - if (strstr($document, 'DTD XHTML')) { - return $this->setDocumentXhtml($document, $encoding); - } - return $this->setDocumentHtml($document, $encoding); - } - - /** - * Register HTML document - * - * @param string $document - * @param null|string $encoding Document encoding - * @return Zend_Dom_Query - */ - public function setDocumentHtml($document, $encoding = null) - { - $this->_document = (string) $document; - $this->_docType = self::DOC_HTML; - if (null !== $encoding) { - $this->setEncoding($encoding); - } - return $this; - } - - /** - * Register XHTML document - * - * @param string $document - * @param null|string $encoding Document encoding - * @return Zend_Dom_Query - */ - public function setDocumentXhtml($document, $encoding = null) - { - $this->_document = (string) $document; - $this->_docType = self::DOC_XHTML; - if (null !== $encoding) { - $this->setEncoding($encoding); - } - return $this; - } - - /** - * Register XML document - * - * @param string $document - * @param null|string $encoding Document encoding - * @return Zend_Dom_Query - */ - public function setDocumentXml($document, $encoding = null) - { - $this->_document = (string) $document; - $this->_docType = self::DOC_XML; - if (null !== $encoding) { - $this->setEncoding($encoding); - } - return $this; - } - - /** - * Retrieve current document - * - * @return string - */ - public function getDocument() - { - return $this->_document; - } - - /** - * Get document type - * - * @return string - */ - public function getDocumentType() - { - return $this->_docType; - } - - /** - * Get any DOMDocument errors found - * - * @return false|array - */ - public function getDocumentErrors() - { - return $this->_documentErrors; - } - - /** - * Perform a CSS selector query - * - * @param string $query - * @return Zend_Dom_Query_Result - */ - public function query($query) - { - $xpathQuery = Zend_Dom_Query_Css2Xpath::transform($query); - return $this->queryXpath($xpathQuery, $query); - } - - /** - * Perform an XPath query - * - * @param string|array $xpathQuery - * @param string $query CSS selector query - * @throws Zend_Dom_Exception - * @return Zend_Dom_Query_Result - */ - public function queryXpath($xpathQuery, $query = null) - { - if (null === ($document = $this->getDocument())) { - throw new Zend_Dom_Exception('Cannot query; no document registered'); - } - - $encoding = $this->getEncoding(); - libxml_use_internal_errors(true); - if (null === $encoding) { - $domDoc = new DOMDocument('1.0'); - } else { - $domDoc = new DOMDocument('1.0', $encoding); - } - $type = $this->getDocumentType(); - switch ($type) { - case self::DOC_XML: - try { - $domDoc = Zend_Xml_Security::scan($document, $domDoc); - $success = ($domDoc !== false); - } catch (Zend_Xml_Exception $e) { - throw new Zend_Dom_Exception( - $e->getMessage() - ); - } - break; - case self::DOC_HTML: - case self::DOC_XHTML: - default: - $success = $domDoc->loadHTML($document); - break; - } - $errors = libxml_get_errors(); - if (!empty($errors)) { - $this->_documentErrors = $errors; - libxml_clear_errors(); - } - libxml_use_internal_errors(false); - - if (!$success) { - throw new Zend_Dom_Exception(sprintf('Error parsing document (type == %s)', $type)); - } - - $nodeList = $this->_getNodeList($domDoc, $xpathQuery); - return new Zend_Dom_Query_Result($query, $xpathQuery, $domDoc, $nodeList); - } - - /** - * Register XPath namespaces - * - * @param array $xpathNamespaces - * @return void - */ - public function registerXpathNamespaces($xpathNamespaces) - { - $this->_xpathNamespaces = $xpathNamespaces; - } - - /** - * Prepare node list - * - * @param DOMDocument $document - * @param string|array $xpathQuery - * @return array - */ - protected function _getNodeList($document, $xpathQuery) - { - $xpath = new DOMXPath($document); - foreach ($this->_xpathNamespaces as $prefix => $namespaceUri) { - $xpath->registerNamespace($prefix, $namespaceUri); - } - $xpathQuery = (string) $xpathQuery; - if (preg_match_all('|\[contains\((@[a-z0-9_-]+),\s?\' |i', $xpathQuery, $matches)) { - foreach ($matches[1] as $attribute) { - $queryString = '//*[' . $attribute . ']'; - $attributeName = substr($attribute, 1); - $nodes = $xpath->query($queryString); - foreach ($nodes as $node) { - $attr = $node->attributes->getNamedItem($attributeName); - $attr->value = ' ' . $attr->value . ' '; - } - } - } - return $xpath->query($xpathQuery); - } -} diff --git a/library/vendor/Zend/Dom/Query/Css2Xpath.php b/library/vendor/Zend/Dom/Query/Css2Xpath.php deleted file mode 100644 index 5612ad7ab..000000000 --- a/library/vendor/Zend/Dom/Query/Css2Xpath.php +++ /dev/null @@ -1,169 +0,0 @@ -\s+|', '>', $path); - $segments = preg_split('/\s+/', $path); - foreach ($segments as $key => $segment) { - $pathSegment = self::_tokenize($segment); - if (0 == $key) { - if (0 === strpos($pathSegment, '[contains(')) { - $paths[0] .= '*' . ltrim($pathSegment, '*'); - } else { - $paths[0] .= $pathSegment; - } - continue; - } - if (0 === strpos($pathSegment, '[contains(')) { - foreach ($paths as $key => $xpath) { - $paths[$key] .= '//*' . ltrim($pathSegment, '*'); - $paths[] = $xpath . $pathSegment; - } - } else { - foreach ($paths as $key => $xpath) { - $paths[$key] .= '//' . $pathSegment; - } - } - } - - if (1 == count($paths)) { - return $paths[0]; - } - return implode('|', $paths); - } - - /** - * Tokenize CSS expressions to XPath - * - * @param string $expression - * @return string - */ - protected static function _tokenize($expression) - { - // Child selectors - $expression = str_replace('>', '/', $expression); - - // IDs - $expression = preg_replace('|#([a-z][a-z0-9_-]*)|i', '[@id=\'$1\']', $expression); - $expression = preg_replace('|(?_cssQuery = $cssQuery; - $this->_xpathQuery = $xpathQuery; - $this->_document = $document; - $this->_nodeList = $nodeList; - } - - /** - * Retrieve CSS Query - * - * @return string - */ - public function getCssQuery() - { - return $this->_cssQuery; - } - - /** - * Retrieve XPath query - * - * @return string - */ - public function getXpathQuery() - { - return $this->_xpathQuery; - } - - /** - * Retrieve DOMDocument - * - * @return DOMDocument - */ - public function getDocument() - { - return $this->_document; - } - - /** - * Iterator: rewind to first element - * - * @return DOMNode|null - */ - public function rewind() - { - $this->_position = 0; - return $this->_nodeList->item(0); - } - - /** - * Iterator: is current position valid? - * - * @return bool - */ - public function valid() - { - if (in_array($this->_position, range(0, $this->_nodeList->length - 1)) && $this->_nodeList->length > 0) { - return true; - } - return false; - } - - /** - * Iterator: return current element - * - * @return DOMElement - */ - public function current() - { - return $this->_nodeList->item($this->_position); - } - - /** - * Iterator: return key of current element - * - * @return int - */ - public function key() - { - return $this->_position; - } - - /** - * Iterator: move to next element - * - * @return DOMNode|null - */ - public function next() - { - ++$this->_position; - return $this->_nodeList->item($this->_position); - } - - /** - * Countable: get count - * - * @return int - */ - public function count() - { - return $this->_nodeList->length; - } -} diff --git a/library/vendor/Zend/EventManager/Event.php b/library/vendor/Zend/EventManager/Event.php deleted file mode 100644 index 0c56f921d..000000000 --- a/library/vendor/Zend/EventManager/Event.php +++ /dev/null @@ -1,223 +0,0 @@ -setName($name); - } - - if (null !== $target) { - $this->setTarget($target); - } - - if (null !== $params) { - $this->setParams($params); - } - } - - /** - * Get event name - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Get the event target - * - * This may be either an object, or the name of a static method. - * - * @return string|object - */ - public function getTarget() - { - return $this->target; - } - - /** - * Set parameters - * - * Overwrites parameters - * - * @param array|ArrayAccess|object $params - * @return Event - */ - public function setParams($params) - { - if (!is_array($params) && !is_object($params)) { - throw new Zend_EventManager_Exception_InvalidArgumentException(sprintf( - 'Event parameters must be an array or object; received "%s"', - (is_object($params) ? get_class($params) : gettype($params)) - )); - } - - $this->params = $params; - return $this; - } - - /** - * Get all parameters - * - * @return array|object|ArrayAccess - */ - public function getParams() - { - return $this->params; - } - - /** - * Get an individual parameter - * - * If the parameter does not exist, the $default value will be returned. - * - * @param string|int $name - * @param mixed $default - * @return mixed - */ - public function getParam($name, $default = null) - { - // Check in params that are arrays or implement array access - if (is_array($this->params) || $this->params instanceof ArrayAccess) { - if (!isset($this->params[$name])) { - return $default; - } - - return $this->params[$name]; - } - - // Check in normal objects - if (!isset($this->params->{$name})) { - return $default; - } - return $this->params->{$name}; - } - - /** - * Set the event name - * - * @param string $name - * @return Zend_EventManager_Event - */ - public function setName($name) - { - $this->name = (string) $name; - return $this; - } - - /** - * Set the event target/context - * - * @param null|string|object $target - * @return Zend_EventManager_Event - */ - public function setTarget($target) - { - $this->target = $target; - return $this; - } - - /** - * Set an individual parameter to a value - * - * @param string|int $name - * @param mixed $value - * @return Zend_EventManager_Event - */ - public function setParam($name, $value) - { - if (is_array($this->params) || $this->params instanceof ArrayAccess) { - // Arrays or objects implementing array access - $this->params[$name] = $value; - } else { - // Objects - $this->params->{$name} = $value; - } - return $this; - } - - /** - * Stop further event propagation - * - * @param bool $flag - * @return void - */ - public function stopPropagation($flag = true) - { - $this->stopPropagation = (bool) $flag; - } - - /** - * Is propagation stopped? - * - * @return bool - */ - public function propagationIsStopped() - { - return $this->stopPropagation; - } -} diff --git a/library/vendor/Zend/EventManager/EventCollection.php b/library/vendor/Zend/EventManager/EventCollection.php deleted file mode 100644 index 36fbca892..000000000 --- a/library/vendor/Zend/EventManager/EventCollection.php +++ /dev/null @@ -1,108 +0,0 @@ -setIdentifiers($identifiers); - } - - /** - * Set the event class to utilize - * - * @param string $class - * @return Zend_EventManager_EventManager - */ - public function setEventClass($class) - { - $this->eventClass = $class; - return $this; - } - - /** - * Set static collections container - * - * @param Zend_EventManager_SharedEventCollection $collections - * @return $this - */ - public function setSharedCollections(Zend_EventManager_SharedEventCollection $collections) - { - $this->sharedCollections = $collections; - return $this; - } - - /** - * Remove any shared collections - * - * Sets {@link $sharedCollections} to boolean false to disable ability - * to lazy-load static event manager instance. - * - * @return void - */ - public function unsetSharedCollections() - { - $this->sharedCollections = false; - } - - /** - * Get static collections container - * - * @return false|Zend_EventManager_SharedEventCollection - */ - public function getSharedCollections() - { - if (null === $this->sharedCollections) { - $this->setSharedCollections(Zend_EventManager_StaticEventManager::getInstance()); - } - return $this->sharedCollections; - } - - /** - * Get the identifier(s) for this Zend_EventManager_EventManager - * - * @return array - */ - public function getIdentifiers() - { - return $this->identifiers; - } - - /** - * Set the identifiers (overrides any currently set identifiers) - * - * @param string|int|array|Traversable $identifiers - * @return Zend_EventManager_EventManager - */ - public function setIdentifiers($identifiers) - { - if (is_array($identifiers) || $identifiers instanceof Traversable) { - $this->identifiers = array_unique((array) $identifiers); - } elseif ($identifiers !== null) { - $this->identifiers = array($identifiers); - } - return $this; - } - - /** - * Add some identifier(s) (appends to any currently set identifiers) - * - * @param string|int|array|Traversable $identifiers - * @return Zend_EventManager_EventManager - */ - public function addIdentifiers($identifiers) - { - if (is_array($identifiers) || $identifiers instanceof Traversable) { - $this->identifiers = array_unique($this->identifiers + (array) $identifiers); - } elseif ($identifiers !== null) { - $this->identifiers = array_unique(array_merge($this->identifiers, array($identifiers))); - } - return $this; - } - - /** - * Trigger all listeners for a given event - * - * Can emulate triggerUntil() if the last argument provided is a callback. - * - * @param string $event - * @param string|object $target Object calling emit, or symbol describing target (such as static method name) - * @param array|ArrayAccess $argv Array of arguments; typically, should be associative - * @param null|callback $callback - * @return Zend_EventManager_ResponseCollection All listener return values - */ - public function trigger($event, $target = null, $argv = array(), $callback = null) - { - if ($event instanceof Zend_EventManager_EventDescription) { - $e = $event; - $event = $e->getName(); - $callback = $target; - } elseif ($target instanceof Zend_EventManager_EventDescription) { - $e = $target; - $e->setName($event); - $callback = $argv; - } elseif ($argv instanceof Zend_EventManager_EventDescription) { - $e = $argv; - $e->setName($event); - $e->setTarget($target); - } else { - $e = new $this->eventClass(); - $e->setName($event); - $e->setTarget($target); - $e->setParams($argv); - } - - if ($callback && !is_callable($callback)) { - throw new Zend_Stdlib_Exception_InvalidCallbackException('Invalid callback provided'); - } - - return $this->triggerListeners($event, $e, $callback); - } - - /** - * Trigger listeners until return value of one causes a callback to - * evaluate to true - * - * Triggers listeners until the provided callback evaluates the return - * value of one as true, or until all listeners have been executed. - * - * @param string $event - * @param string|object $target Object calling emit, or symbol describing target (such as static method name) - * @param array|ArrayAccess $argv Array of arguments; typically, should be associative - * @param Callable $callback - * @throws Zend_Stdlib_Exception_InvalidCallbackException if invalid callback provided - */ - public function triggerUntil($event, $target, $argv = null, $callback = null) - { - if ($event instanceof Zend_EventManager_EventDescription) { - $e = $event; - $event = $e->getName(); - $callback = $target; - } elseif ($target instanceof Zend_EventManager_EventDescription) { - $e = $target; - $e->setName($event); - $callback = $argv; - } elseif ($argv instanceof Zend_EventManager_EventDescription) { - $e = $argv; - $e->setName($event); - $e->setTarget($target); - } else { - $e = new $this->eventClass(); - $e->setName($event); - $e->setTarget($target); - $e->setParams($argv); - } - - if (!is_callable($callback)) { - throw new Zend_Stdlib_Exception_InvalidCallbackException('Invalid callback provided'); - } - - return $this->triggerListeners($event, $e, $callback); - } - - /** - * Attach a listener to an event - * - * The first argument is the event, and the next argument describes a - * callback that will respond to that event. A CallbackHandler instance - * describing the event listener combination will be returned. - * - * The last argument indicates a priority at which the event should be - * executed. By default, this value is 1; however, you may set it for any - * integer value. Higher values have higher priority (i.e., execute first). - * - * You can specify "*" for the event name. In such cases, the listener will - * be triggered for every event. - * - * @param string|array|Zend_EventManager_ListenerAggregate $event An event or array of event names. If a ListenerAggregate, proxies to {@link attachAggregate()}. - * @param callback|int $callback If string $event provided, expects PHP callback; for a ListenerAggregate $event, this will be the priority - * @param int $priority If provided, the priority at which to register the callback - * @return Zend_Stdlib_CallbackHandler|mixed CallbackHandler if attaching callback (to allow later unsubscribe); mixed if attaching aggregate - */ - public function attach($event, $callback = null, $priority = 1) - { - // Proxy ListenerAggregate arguments to attachAggregate() - if ($event instanceof Zend_EventManager_ListenerAggregate) { - return $this->attachAggregate($event, $callback); - } - - // Null callback is invalid - if (null === $callback) { - throw new Zend_EventManager_Exception_InvalidArgumentException(sprintf( - '%s: expects a callback; none provided', - __METHOD__ - )); - } - - // Array of events should be registered individually, and return an array of all listeners - if (is_array($event)) { - $listeners = array(); - foreach ($event as $name) { - $listeners[] = $this->attach($name, $callback, $priority); - } - return $listeners; - } - - // If we don't have a priority queue for the event yet, create one - if (empty($this->events[$event])) { - $this->events[$event] = new Zend_Stdlib_PriorityQueue(); - } - - // Create a callback handler, setting the event and priority in its metadata - $listener = new Zend_Stdlib_CallbackHandler($callback, array('event' => $event, 'priority' => $priority)); - - // Inject the callback handler into the queue - $this->events[$event]->insert($listener, $priority); - return $listener; - } - - /** - * Attach a listener aggregate - * - * Listener aggregates accept an EventCollection instance, and call attach() - * one or more times, typically to attach to multiple events using local - * methods. - * - * @param Zend_EventManager_ListenerAggregate $aggregate - * @param int $priority If provided, a suggested priority for the aggregate to use - * @return mixed return value of {@link Zend_EventManager_ListenerAggregate::attach()} - */ - public function attachAggregate(Zend_EventManager_ListenerAggregate $aggregate, $priority = 1) - { - return $aggregate->attach($this, $priority); - } - - /** - * Unsubscribe a listener from an event - * - * @param Zend_Stdlib_CallbackHandler|Zend_EventManager_ListenerAggregate $listener - * @return bool Returns true if event and listener found, and unsubscribed; returns false if either event or listener not found - * @throws Zend_EventManager_Exception_InvalidArgumentException if invalid listener provided - */ - public function detach($listener) - { - if ($listener instanceof Zend_EventManager_ListenerAggregate) { - return $this->detachAggregate($listener); - } - - if (!$listener instanceof Zend_Stdlib_CallbackHandler) { - throw new Zend_EventManager_Exception_InvalidArgumentException(sprintf( - '%s: expected a Zend_EventManager_ListenerAggregate or Zend_Stdlib_CallbackHandler; received "%s"', - __METHOD__, - (is_object($listener) ? get_class($listener) : gettype($listener)) - )); - } - - $event = $listener->getMetadatum('event'); - if (!$event || empty($this->events[$event])) { - return false; - } - $return = $this->events[$event]->remove($listener); - if (!$return) { - return false; - } - if (!count($this->events[$event])) { - unset($this->events[$event]); - } - return true; - } - - /** - * Detach a listener aggregate - * - * Listener aggregates accept an EventCollection instance, and call detach() - * of all previously attached listeners. - * - * @param Zend_EventManager_ListenerAggregate $aggregate - * @return mixed return value of {@link Zend_EventManager_ListenerAggregate::detach()} - */ - public function detachAggregate(Zend_EventManager_ListenerAggregate $aggregate) - { - return $aggregate->detach($this); - } - - /** - * Retrieve all registered events - * - * @return array - */ - public function getEvents() - { - return array_keys($this->events); - } - - /** - * Retrieve all listeners for a given event - * - * @param string $event - * @return Zend_Stdlib_PriorityQueue - */ - public function getListeners($event) - { - if (!array_key_exists($event, $this->events)) { - return new Zend_Stdlib_PriorityQueue(); - } - return $this->events[$event]; - } - - /** - * Clear all listeners for a given event - * - * @param string $event - * @return void - */ - public function clearListeners($event) - { - if (!empty($this->events[$event])) { - unset($this->events[$event]); - } - } - - /** - * Prepare arguments - * - * Use this method if you want to be able to modify arguments from within a - * listener. It returns an ArrayObject of the arguments, which may then be - * passed to trigger() or triggerUntil(). - * - * @param array $args - * @return ArrayObject - */ - public function prepareArgs(array $args) - { - return new ArrayObject($args); - } - - /** - * Trigger listeners - * - * Actual functionality for triggering listeners, to which both trigger() and triggerUntil() - * delegate. - * - * @param string $event Event name - * @param EventDescription $e - * @param null|callback $callback - * @return ResponseCollection - */ - protected function triggerListeners($event, Zend_EventManager_EventDescription $e, $callback = null) - { - $responses = new Zend_EventManager_ResponseCollection; - $listeners = $this->getListeners($event); - - // Add shared/wildcard listeners to the list of listeners, - // but don't modify the listeners object - $sharedListeners = $this->getSharedListeners($event); - $sharedWildcardListeners = $this->getSharedListeners('*'); - $wildcardListeners = $this->getListeners('*'); - if (count($sharedListeners) || count($sharedWildcardListeners) || count($wildcardListeners)) { - $listeners = clone $listeners; - } - - // Shared listeners on this specific event - $this->insertListeners($listeners, $sharedListeners); - - // Shared wildcard listeners - $this->insertListeners($listeners, $sharedWildcardListeners); - - // Add wildcard listeners - $this->insertListeners($listeners, $wildcardListeners); - - if ($listeners->isEmpty()) { - return $responses; - } - - foreach ($listeners as $listener) { - // Trigger the listener's callback, and push its result onto the - // response collection - $responses->push(call_user_func($listener->getCallback(), $e)); - - // If the event was asked to stop propagating, do so - if ($e->propagationIsStopped()) { - $responses->setStopped(true); - break; - } - - // If the result causes our validation callback to return true, - // stop propagation - if ($callback && call_user_func($callback, $responses->last())) { - $responses->setStopped(true); - break; - } - } - - return $responses; - } - - /** - * Get list of all listeners attached to the shared collection for - * identifiers registered by this instance - * - * @param string $event - * @return array - */ - protected function getSharedListeners($event) - { - if (!$sharedCollections = $this->getSharedCollections()) { - return array(); - } - - $identifiers = $this->getIdentifiers(); - $sharedListeners = array(); - - foreach ($identifiers as $id) { - if (!$listeners = $sharedCollections->getListeners($id, $event)) { - continue; - } - - if (!is_array($listeners) && !($listeners instanceof Traversable)) { - continue; - } - - foreach ($listeners as $listener) { - if (!$listener instanceof Zend_Stdlib_CallbackHandler) { - continue; - } - $sharedListeners[] = $listener; - } - } - - return $sharedListeners; - } - - /** - * Add listeners to the master queue of listeners - * - * Used to inject shared listeners and wildcard listeners. - * - * @param Zend_Stdlib_PriorityQueue $masterListeners - * @param Zend_Stdlib_PriorityQueue $listeners - * @return void - */ - protected function insertListeners($masterListeners, $listeners) - { - if (!count($listeners)) { - return; - } - - foreach ($listeners as $listener) { - $priority = $listener->getMetadatum('priority'); - if (null === $priority) { - $priority = 1; - } elseif (is_array($priority)) { - // If we have an array, likely using PriorityQueue. Grab first - // element of the array, as that's the actual priority. - $priority = array_shift($priority); - } - $masterListeners->insert($listener, $priority); - } - } -} diff --git a/library/vendor/Zend/EventManager/EventManagerAware.php b/library/vendor/Zend/EventManager/EventManagerAware.php deleted file mode 100644 index e1a9b33f8..000000000 --- a/library/vendor/Zend/EventManager/EventManagerAware.php +++ /dev/null @@ -1,40 +0,0 @@ -setExtractFlags(self::EXTR_BOTH); - - // Iterate and remove any matches - $removed = false; - $items = array(); - $this->rewind(); - while (!$this->isEmpty()) { - $item = $this->extract(); - if ($item['data'] === $datum) { - $removed = true; - continue; - } - $items[] = $item; - } - - // Repopulate - foreach ($items as $item) { - $this->insert($item['data'], $item['priority']); - } - - $this->setExtractFlags(self::EXTR_DATA); - return $removed; - } - - /** - * Iterate the next filter in the chain - * - * Iterates and calls the next filter in the chain. - * - * @param mixed $context - * @param array $params - * @param Zend_EventManager_Filter_FilterIterator $chain - * @return mixed - */ - public function next($context = null, array $params = array(), $chain = null) - { - if (empty($context) || $chain->isEmpty()) { - return; - } - - $next = $this->extract(); - if (!$next instanceof Zend_Stdlib_CallbackHandler) { - return; - } - - $return = call_user_func($next->getCallback(), $context, $params, $chain); - return $return; - } -} diff --git a/library/vendor/Zend/EventManager/FilterChain.php b/library/vendor/Zend/EventManager/FilterChain.php deleted file mode 100644 index 656cd0936..000000000 --- a/library/vendor/Zend/EventManager/FilterChain.php +++ /dev/null @@ -1,135 +0,0 @@ -filters = new Zend_EventManager_Filter_FilterIterator(); - } - - /** - * Apply the filters - * - * Begins iteration of the filters. - * - * @param mixed $context Object under observation - * @param mixed $argv Associative array of arguments - * @return mixed - */ - public function run($context, array $argv = array()) - { - $chain = clone $this->getFilters(); - - if ($chain->isEmpty()) { - return; - } - - $next = $chain->extract(); - if (!$next instanceof Zend_Stdlib_CallbackHandler) { - return; - } - - return call_user_func($next->getCallback(), $context, $argv, $chain); - } - - /** - * Connect a filter to the chain - * - * @param callback $callback PHP Callback - * @param int $priority Priority in the queue at which to execute; defaults to 1 (higher numbers == higher priority) - * @throws Zend_Stdlib_Exception_InvalidCallbackException - * @return Zend_Stdlib_CallbackHandler (to allow later unsubscribe) - */ - public function attach($callback, $priority = 1) - { - if (empty($callback)) { - throw new Zend_Stdlib_Exception_InvalidCallbackException('No callback provided'); - } - $filter = new Zend_Stdlib_CallbackHandler($callback, array('priority' => $priority)); - $this->filters->insert($filter, $priority); - return $filter; - } - - /** - * Detach a filter from the chain - * - * @param Zend_Stdlib_CallbackHandler $filter - * @return bool Returns true if filter found and unsubscribed; returns false otherwise - */ - public function detach(Zend_Stdlib_CallbackHandler $filter) - { - return $this->filters->remove($filter); - } - - /** - * Retrieve all filters - * - * @return Zend_EventManager_Filter_FilterIterator - */ - public function getFilters() - { - return $this->filters; - } - - /** - * Clear all filters - * - * @return void - */ - public function clearFilters() - { - $this->filters = new Zend_EventManager_Filter_FilterIterator(); - } - - /** - * Return current responses - * - * Only available while the chain is still being iterated. Returns the - * current ResponseCollection. - * - * @return null|Zend_EventManager_ResponseCollection - */ - public function getResponses() - { - return $this->responses; - } -} diff --git a/library/vendor/Zend/EventManager/GlobalEventManager.php b/library/vendor/Zend/EventManager/GlobalEventManager.php deleted file mode 100644 index 542854547..000000000 --- a/library/vendor/Zend/EventManager/GlobalEventManager.php +++ /dev/null @@ -1,147 +0,0 @@ -trigger($event, $context, $argv); - } - - /** - * Trigger listeenrs until return value of one causes a callback to evaluate - * to true. - * - * @param string $event - * @param string|object $context - * @param array|object $argv - * @param callback $callback - * @return Zend_EventManager_ResponseCollection - */ - public static function triggerUntil($event, $context, $argv, $callback) - { - return self::getEventCollection()->triggerUntil($event, $context, $argv, $callback); - } - - /** - * Attach a listener to an event - * - * @param string $event - * @param callback $callback - * @param int $priority - * @return Zend_Stdlib_CallbackHandler - */ - public static function attach($event, $callback, $priority = 1) - { - return self::getEventCollection()->attach($event, $callback, $priority); - } - - /** - * Detach a callback from a listener - * - * @param Zend_Stdlib_CallbackHandler $listener - * @return bool - */ - public static function detach(Zend_Stdlib_CallbackHandler $listener) - { - return self::getEventCollection()->detach($listener); - } - - /** - * Retrieve list of events this object manages - * - * @return array - */ - public static function getEvents() - { - return self::getEventCollection()->getEvents(); - } - - /** - * Retrieve all listeners for a given event - * - * @param string $event - * @return Zend_Stdlib_PriorityQueue|array - */ - public static function getListeners($event) - { - return self::getEventCollection()->getListeners($event); - } - - /** - * Clear all listeners for a given event - * - * @param string $event - * @return void - */ - public static function clearListeners($event) - { - return self::getEventCollection()->clearListeners($event); - } -} diff --git a/library/vendor/Zend/EventManager/ListenerAggregate.php b/library/vendor/Zend/EventManager/ListenerAggregate.php deleted file mode 100644 index c360252a5..000000000 --- a/library/vendor/Zend/EventManager/ListenerAggregate.php +++ /dev/null @@ -1,53 +0,0 @@ - true, - self::IT_MODE_KEEP => true, - ); - - if (!isset($expected[$mode])) { - throw new InvalidArgumentException(sprintf('Invalid iterator mode specified ("%s")', $mode)); - } - - $this->mode = $mode; - } - - /** - * Return last element in the stack - * - * @return mixed - */ - public function bottom() - { - $this->rewind(); - $value = array_pop($this->stack); - array_push($this->stack, $value); - return $value; - } - - /** - * Countable: return count of items in the stack - * - * @return int - */ - public function count() - { - return $this->count; - } - - /** - * Iterator: return current item in the stack - * - * @return mixed - */ - public function current() - { - if (!$this->stack) { - $this->rewind(); - } - return current($this->stack); - } - - /** - * Get iteration mode - * - * @return int - */ - public function getIteratorMode() - { - return $this->mode; - } - - /** - * Is the stack empty? - * - * @return bool - */ - public function isEmpty() - { - return ($this->count === 0); - } - - /** - * Iterator: return key of current item in the stack - * - * @return mixed - */ - public function key() - { - if (!$this->stack) { - $this->rewind(); - } - return key($this->stack); - } - - /** - * Iterator: advance pointer to next item in the stack - * - * @return void - */ - public function next() - { - if (!$this->stack) { - $this->rewind(); - } - return next($this->stack); - } - - /** - * ArrayAccess: does an item exist at the specified offset? - * - * @param mixed $index - * @return bool - */ - public function offsetExists($index) - { - return array_key_exists($index, $this->data); - } - - /** - * ArrayAccess: get the item at the specified offset - * - * @param mixed $index - * @return mixed - * @throws OutOfRangeException - */ - public function offsetGet($index) - { - if (!$this->offsetExists($index)) { - throw OutOfRangeException(sprintf('Invalid index ("%s") specified', $index)); - } - return $this->data[$index]; - } - - /** - * ArrayAccess: add an item at the specified offset - * - * @param mixed $index - * @param mixed $newval - * @return void - */ - public function offsetSet($index, $newval) - { - $this->data[$index] = $newval; - $this->stack = false; - $this->count++; - } - - /** - * ArrayAccess: unset the item at the specified offset - * - * @param mixed $index - * @return void - * @throws OutOfRangeException - */ - public function offsetUnset($index) - { - if (!$this->offsetExists($index)) { - throw OutOfRangeException(sprintf('Invalid index ("%s") specified', $index)); - } - unset($this->data[$index]); - $this->stack = false; - $this->count--; - } - - /** - * Pop a node from the end of the stack - * - * @return mixed - * @throws RuntimeException - */ - public function pop() - { - $val = array_pop($this->data); - $this->stack = false; - $this->count--; - return $val; - } - - /** - * Move the iterator to the previous node - * - * @todo Does this need to be implemented? - * @return void - */ - public function prev() - { - } - - /** - * Push an element to the list - * - * @param mixed $value - * @return void - */ - public function push($value) - { - array_push($this->data, $value); - $this->count++; - $this->stack = false; - } - - /** - * Iterator: rewind to beginning of stack - * - * @return void - */ - public function rewind() - { - if (is_array($this->stack)) { - return reset($this->stack); - } - $this->stack = array_reverse($this->data, true); - } - - /** - * Serialize the storage - * - * @return string - */ - public function serialize() - { - return serialize($this->data); - } - - /** - * Shifts a node from the beginning of the list - * - * @return mixed - * @throws RuntimeException - */ - public function shift() - { - $val = array_shift($this->data); - $this->stack = false; - $this->count--; - return $val; - } - - /** - * Peek at the top node of the stack - * - * @return mixed - */ - public function top() - { - $this->rewind(); - $value = array_shift($this->stack); - array_unshift($this->stack, $value); - return $value; - } - - /** - * Unserialize the storage - * - * @param string - * @return void - */ - public function unserialize($serialized) - { - $this->data = unserialize($serialized); - $this->stack = false; - } - - /** - * Unshift a node onto the beginning of the list - * - * @param mixed $value - * @return void - */ - public function unshift($value) - { - array_unshift($this->data, $value); - $this->count++; - $this->stack = false; - } - - /** - * Iterator: is the current pointer valid? - * - * @return bool - */ - public function valid() - { - $key = key($this->stack); - $var = ($key !== null && $key !== false); - return $var; - } - } -} - -/** - * Collection of signal handler return values - * - * @category Zend - * @package Zend_EventManager - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_EventManager_ResponseCollection extends SplStack -{ - protected $stopped = false; - - /** - * Did the last response provided trigger a short circuit of the stack? - * - * @return bool - */ - public function stopped() - { - return $this->stopped; - } - - /** - * Mark the collection as stopped (or its opposite) - * - * @param bool $flag - * @return Zend_EventManager_ResponseCollection - */ - public function setStopped($flag) - { - $this->stopped = (bool) $flag; - return $this; - } - - /** - * Convenient access to the first handler return value. - * - * @return mixed The first handler return value - */ - public function first() - { - return parent::bottom(); - } - - /** - * Convenient access to the last handler return value. - * - * If the collection is empty, returns null. Otherwise, returns value - * returned by last handler. - * - * @return mixed The last handler return value - */ - public function last() - { - if (count($this) === 0) { - return null; - } - return parent::top(); - } - - /** - * Check if any of the responses match the given value. - * - * @param mixed $value The value to look for among responses - */ - public function contains($value) - { - foreach ($this as $response) { - if ($response === $value) { - return true; - } - } - return false; - } -} diff --git a/library/vendor/Zend/EventManager/SharedEventCollection.php b/library/vendor/Zend/EventManager/SharedEventCollection.php deleted file mode 100644 index 0050c6137..000000000 --- a/library/vendor/Zend/EventManager/SharedEventCollection.php +++ /dev/null @@ -1,32 +0,0 @@ - - * SharedEventManager::getInstance()->connect( - * array('My\Resource\AbstractResource', 'My\Resource\EntityResource'), - * 'getOne', - * function ($e) use ($cache) { - * if (!$id = $e->getParam('id', false)) { - * return; - * } - * if (!$data = $cache->load(get_class($resource) . '::getOne::' . $id )) { - * return; - * } - * return $data; - * } - * ); - * - * - * @param string|array $id Identifier(s) for event emitting component(s) - * @param string $event - * @param callback $callback PHP Callback - * @param int $priority Priority at which listener should execute - * @return void - */ - public function attach($id, $event, $callback, $priority = 1) - { - $ids = (array) $id; - foreach ($ids as $id) { - if (!array_key_exists($id, $this->identifiers)) { - $this->identifiers[$id] = new Zend_EventManager_EventManager(); - } - $this->identifiers[$id]->attach($event, $callback, $priority); - } - } - - /** - * Detach a listener from an event offered by a given resource - * - * @param string|int $id - * @param Zend_Stdlib_CallbackHandler $listener - * @return bool Returns true if event and listener found, and unsubscribed; returns false if either event or listener not found - */ - public function detach($id, Zend_Stdlib_CallbackHandler $listener) - { - if (!array_key_exists($id, $this->identifiers)) { - return false; - } - return $this->identifiers[$id]->detach($listener); - } - - /** - * Retrieve all registered events for a given resource - * - * @param string|int $id - * @return array - */ - public function getEvents($id) - { - if (!array_key_exists($id, $this->identifiers)) { - return false; - } - return $this->identifiers[$id]->getEvents(); - } - - /** - * Retrieve all listeners for a given identifier and event - * - * @param string|int $id - * @param string|int $event - * @return false|Zend_Stdlib_PriorityQueue - */ - public function getListeners($id, $event) - { - if (!array_key_exists($id, $this->identifiers)) { - return false; - } - return $this->identifiers[$id]->getListeners($event); - } - - /** - * Clear all listeners for a given identifier, optionally for a specific event - * - * @param string|int $id - * @param null|string $event - * @return bool - */ - public function clearListeners($id, $event = null) - { - if (!array_key_exists($id, $this->identifiers)) { - return false; - } - - if (null === $event) { - unset($this->identifiers[$id]); - return true; - } - - return $this->identifiers[$id]->clearListeners($event); - } -} diff --git a/library/vendor/Zend/EventManager/StaticEventManager.php b/library/vendor/Zend/EventManager/StaticEventManager.php deleted file mode 100644 index 355efc7bf..000000000 --- a/library/vendor/Zend/EventManager/StaticEventManager.php +++ /dev/null @@ -1,77 +0,0 @@ - 'http://a9.com/-/spec/opensearchrss/1.0/', - 'atom' => 'http://www.w3.org/2005/Atom', - 'rss' => 'http://blogs.law.harvard.edu/tech/rss', - ); - - - /** - * Set the HTTP client instance - * - * Sets the HTTP client object to use for retrieving the feeds. - * - * @param Zend_Http_Client $httpClient - * @return void - */ - public static function setHttpClient(Zend_Http_Client $httpClient) - { - self::$_httpClient = $httpClient; - } - - - /** - * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used. - * - * @return Zend_Http_Client_Abstract - */ - public static function getHttpClient() - { - if (!self::$_httpClient instanceof Zend_Http_Client) { - /** - * @see Zend_Http_Client - */ - self::$_httpClient = new Zend_Http_Client(); - } - - return self::$_httpClient; - } - - - /** - * Toggle using POST instead of PUT and DELETE HTTP methods - * - * Some feed implementations do not accept PUT and DELETE HTTP - * methods, or they can't be used because of proxies or other - * measures. This allows turning on using POST where PUT and - * DELETE would normally be used; in addition, an - * X-Method-Override header will be sent with a value of PUT or - * DELETE as appropriate. - * - * @param boolean $override Whether to override PUT and DELETE. - * @return void - */ - public static function setHttpMethodOverride($override = true) - { - self::$_httpMethodOverride = $override; - } - - - /** - * Get the HTTP override state - * - * @return boolean - */ - public static function getHttpMethodOverride() - { - return self::$_httpMethodOverride; - } - - - /** - * Get the full version of a namespace prefix - * - * Looks up a prefix (atom:, etc.) in the list of registered - * namespaces and returns the full namespace URI if - * available. Returns the prefix, unmodified, if it's not - * registered. - * - * @return string - */ - public static function lookupNamespace($prefix) - { - return isset(self::$_namespaces[$prefix]) ? - self::$_namespaces[$prefix] : - $prefix; - } - - - /** - * Add a namespace and prefix to the registered list - * - * Takes a prefix and a full namespace URI and adds them to the - * list of registered namespaces for use by - * Zend_Feed::lookupNamespace(). - * - * @param string $prefix The namespace prefix - * @param string $namespaceURI The full namespace URI - * @return void - */ - public static function registerNamespace($prefix, $namespaceURI) - { - self::$_namespaces[$prefix] = $namespaceURI; - } - - - /** - * Imports a feed located at $uri. - * - * @param string $uri - * @throws Zend_Feed_Exception - * @return Zend_Feed_Abstract - */ - public static function import($uri) - { - $client = self::getHttpClient(); - $client->setUri($uri); - $response = $client->request('GET'); - if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); - } - $feed = $response->getBody(); - return self::importString($feed); - } - - - /** - * Imports a feed represented by $string. - * - * @param string $string - * @throws Zend_Feed_Exception - * @return Zend_Feed_Abstract - */ - public static function importString($string) - { - if (trim($string) == '') { - throw new Zend_Feed_Exception('Document/string being imported' - . ' is an Empty string or comes from an empty HTTP response'); - } - $doc = new DOMDocument; - $doc = Zend_Xml_Security::scan($string, $doc); - - if (!$doc) { - // prevent the class to generate an undefined variable notice (ZF-2590) - // Build error message - $error = libxml_get_last_error(); - if ($error && $error->message) { - $errormsg = "DOMDocument cannot parse XML: {$error->message}"; - } else { - $errormsg = "DOMDocument cannot parse XML"; - } - - - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception($errormsg); - } - - // Try to find the base feed element or a single of an Atom feed - if ($doc->getElementsByTagName('feed')->item(0) || - $doc->getElementsByTagName('entry')->item(0)) { - /** - * @see Zend_Feed_Atom - */ - // return a newly created Zend_Feed_Atom object - return new Zend_Feed_Atom(null, $string); - } - - // Try to find the base feed element of an RSS feed - if ($doc->getElementsByTagName('channel')->item(0)) { - /** - * @see Zend_Feed_Rss - */ - // return a newly created Zend_Feed_Rss object - return new Zend_Feed_Rss(null, $string); - } - - // $string does not appear to be a valid feed of the supported types - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Invalid or unsupported feed format'); - } - - - /** - * Imports a feed from a file located at $filename. - * - * @param string $filename - * @throws Zend_Feed_Exception - * @return Zend_Feed_Abstract - */ - public static function importFile($filename) - { - @ini_set('track_errors', 1); - $feed = @file_get_contents($filename); - @ini_restore('track_errors'); - if ($feed === false) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); - } - return self::importString($feed); - } - - - /** - * Attempts to find feeds at $uri referenced by tags. Returns an - * array of the feeds referenced at $uri. - * - * @todo Allow findFeeds() to follow one, but only one, code 302. - * - * @param string $uri - * @throws Zend_Feed_Exception - * @return array - */ - public static function findFeeds($uri) - { - // Get the HTTP response from $uri and save the contents - $client = self::getHttpClient(); - $client->setUri($uri); - $response = $client->request(); - if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus()); - } - $contents = $response->getBody(); - - // Parse the contents for appropriate tags - @ini_set('track_errors', 1); - $pattern = '~(]+)/?>~i'; - $result = @preg_match_all($pattern, $contents, $matches); - @ini_restore('track_errors'); - if ($result === false) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception("Internal error: $php_errormsg"); - } - - // Try to fetch a feed for each link tag that appears to refer to a feed - $feeds = array(); - if (isset($matches[1]) && count($matches[1]) > 0) { - foreach ($matches[1] as $link) { - // force string to be an utf-8 one - if (!mb_check_encoding($link, 'UTF-8')) { - $link = mb_convert_encoding($link, 'UTF-8'); - } - $xml = @Zend_Xml_Security::scan(rtrim($link, ' /') . ' />'); - if ($xml === false) { - continue; - } - $attributes = $xml->attributes(); - if (!isset($attributes['rel']) || !@preg_match('~^(?:alternate|service\.feed)~i', $attributes['rel'])) { - continue; - } - if (!isset($attributes['type']) || - !@preg_match('~^application/(?:atom|rss|rdf)\+xml~', $attributes['type'])) { - continue; - } - if (!isset($attributes['href'])) { - continue; - } - try { - // checks if we need to canonize the given uri - try { - $uri = Zend_Uri::factory((string) $attributes['href']); - } catch (Zend_Uri_Exception $e) { - // canonize the uri - $path = (string) $attributes['href']; - $query = $fragment = ''; - if (substr($path, 0, 1) != '/') { - // add the current root path to this one - $path = rtrim($client->getUri()->getPath(), '/') . '/' . $path; - } - if (strpos($path, '?') !== false) { - list($path, $query) = explode('?', $path, 2); - } - if (strpos($query, '#') !== false) { - list($query, $fragment) = explode('#', $query, 2); - } - $uri = Zend_Uri::factory($client->getUri(true)); - $uri->setPath($path); - $uri->setQuery($query); - $uri->setFragment($fragment); - } - - $feed = self::import($uri); - } catch (Exception $e) { - continue; - } - $feeds[$uri->getUri()] = $feed; - } - } - - // Return the fetched feeds - return $feeds; - } - - /** - * Construct a new Zend_Feed_Abstract object from a custom array - * - * @param array $data - * @param string $format (rss|atom) the requested output format - * @return Zend_Feed_Abstract - */ - public static function importArray(array $data, $format = 'atom') - { - $obj = 'Zend_Feed_' . ucfirst(strtolower($format)); - if (!class_exists($obj)) { - Zend_Loader::loadClass($obj); - } - - /** - * @see Zend_Feed_Builder - */ - return new $obj(null, null, new Zend_Feed_Builder($data)); - } - - /** - * Construct a new Zend_Feed_Abstract object from a Zend_Feed_Builder_Interface data source - * - * @param Zend_Feed_Builder_Interface $builder this object will be used to extract the data of the feed - * @param string $format (rss|atom) the requested output format - * @return Zend_Feed_Abstract - */ - public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom') - { - $obj = 'Zend_Feed_' . ucfirst(strtolower($format)); - if (!class_exists($obj)) { - Zend_Loader::loadClass($obj); - } - return new $obj(null, null, $builder); - } -} diff --git a/library/vendor/Zend/Feed/Abstract.php b/library/vendor/Zend/Feed/Abstract.php deleted file mode 100644 index 6e8db21c0..000000000 --- a/library/vendor/Zend/Feed/Abstract.php +++ /dev/null @@ -1,295 +0,0 @@ -setUri($uri); - $response = $client->request('GET'); - if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus() . '; request: ' . $client->getLastRequest() . "\nresponse: " . $response->asString()); - } - $this->_element = $this->_importFeedFromString($response->getBody()); - $this->__wakeup(); - } elseif ($string !== null) { - // Retrieve the feed from $string - $this->_element = $string; - $this->__wakeup(); - } else { - // Generate the feed from the array - $header = $builder->getHeader(); - $this->_element = new DOMDocument('1.0', $header['charset']); - $root = $this->_mapFeedHeaders($header); - $this->_mapFeedEntries($root, $builder->getEntries()); - $this->_element = $root; - $this->_buildEntryCache(); - } - } - - - /** - * Load the feed as an XML DOMDocument object - * - * @return void - * @throws Zend_Feed_Exception - */ - public function __wakeup() - { - @ini_set('track_errors', 1); - $doc = new DOMDocument; - $doc = @Zend_Xml_Security::scan($this->_element, $doc); - @ini_restore('track_errors'); - - if (!$doc) { - // prevent the class to generate an undefined variable notice (ZF-2590) - if (!isset($php_errormsg)) { - if (function_exists('xdebug_is_enabled')) { - $php_errormsg = '(error message not available, when XDebug is running)'; - } else { - $php_errormsg = '(error message not available)'; - } - } - - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); - } - - $this->_element = $doc; - } - - - /** - * Prepare for serialiation - * - * @return array - */ - public function __sleep() - { - $this->_element = $this->saveXML(); - - return array('_element'); - } - - - /** - * Cache the individual feed elements so they don't need to be - * searched for on every operation. - * - * @return void - */ - protected function _buildEntryCache() - { - $this->_entries = array(); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $this->_entryElementName) { - $this->_entries[] = $child; - } - } - } - - - /** - * Get the number of entries in this feed object. - * - * @return integer Entry count. - */ - public function count() - { - return count($this->_entries); - } - - - /** - * Required by the Iterator interface. - * - * @return void - */ - public function rewind() - { - $this->_entryIndex = 0; - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The current row, or null if no rows. - */ - public function current() - { - return new $this->_entryClassName( - null, - $this->_entries[$this->_entryIndex]); - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The current row number (starts at 0), or NULL if no rows - */ - public function key() - { - return $this->_entryIndex; - } - - - /** - * Required by the Iterator interface. - * - * @return mixed The next row, or null if no more rows. - */ - public function next() - { - ++$this->_entryIndex; - } - - - /** - * Required by the Iterator interface. - * - * @return boolean Whether the iteration is valid - */ - public function valid() - { - return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count(); - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - abstract protected function _mapFeedHeaders($array); - - /** - * Generate the entries of the feed when working in write mode - * - * @param DOMElement $root the root node to use - * @param array $array the data to use - * @return DOMElement root node - */ - abstract protected function _mapFeedEntries(DOMElement $root, $array); - - /** - * Send feed to a http client with the correct header - * - * @throws Zend_Feed_Exception if headers have already been sent - * @return void - */ - abstract public function send(); - - /** - * Import a feed from a string - * - * Protects against XXE attack vectors. - * - * @param string $feed - * @return string - * @throws Zend_Feed_Exception on detection of an XXE vector - */ - protected function _importFeedFromString($feed) - { - if (trim($feed) == '') { - throw new Zend_Feed_Exception('Remote feed being imported' - . ' is an Empty string or comes from an empty HTTP response'); - } - $doc = new DOMDocument; - $doc = Zend_Xml_Security::scan($feed, $doc); - - if (!$doc) { - // prevent the class to generate an undefined variable notice (ZF-2590) - // Build error message - $error = libxml_get_last_error(); - if ($error && $error->message) { - $errormsg = "DOMDocument cannot parse XML: {$error->message}"; - } else { - $errormsg = "DOMDocument cannot parse XML"; - } - - - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception($errormsg); - } - - return $doc->saveXML($doc->documentElement); - } -} diff --git a/library/vendor/Zend/Feed/Atom.php b/library/vendor/Zend/Feed/Atom.php deleted file mode 100644 index 14009e5e8..000000000 --- a/library/vendor/Zend/Feed/Atom.php +++ /dev/null @@ -1,386 +0,0 @@ - - * elements). - * - * @var string - */ - protected $_entryElementName = 'entry'; - - /** - * The default namespace for Atom feeds. - * - * @var string - */ - protected $_defaultNamespace = 'atom'; - - - /** - * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. - * - * @return void - * @throws Zend_Feed_Exception - */ - public function __wakeup() - { - parent::__wakeup(); - - // Find the base feed element and create an alias to it. - $element = $this->_element->getElementsByTagName('feed')->item(0); - if (!$element) { - // Try to find a single instead. - $element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0); - if (!$element) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('No root or <' . $this->_entryElementName - . '> element found, cannot parse feed.'); - } - - $doc = new DOMDocument($this->_element->version, - $this->_element->actualEncoding); - $feed = $doc->appendChild($doc->createElement('feed')); - $feed->appendChild($doc->importNode($element, true)); - $element = $feed; - } - - $this->_element = $element; - - // Find the entries and save a pointer to them for speed and - // simplicity. - $this->_buildEntryCache(); - } - - - /** - * Easy access to tags keyed by "rel" attributes. - * - * If $elt->link() is called with no arguments, we will attempt to - * return the value of the tag(s) like all other - * method-syntax attribute access. If an argument is passed to - * link(), however, then we will return the "href" value of the - * first tag that has a "rel" attribute matching $rel: - * - * $elt->link(): returns the value of the link tag. - * $elt->link('self'): returns the href from the first in the entry. - * - * @param string $rel The "rel" attribute to look for. - * @return mixed - */ - public function link($rel = null) - { - if ($rel === null) { - return parent::__call('link', null); - } - - // index link tags by their "rel" attribute. - $links = parent::__get('link'); - if (!is_array($links)) { - if ($links instanceof Zend_Feed_Element) { - $links = array($links); - } else { - return $links; - } - } - - foreach ($links as $link) { - if (empty($link['rel'])) { - continue; - } - if ($rel == $link['rel']) { - return $link['href']; - } - } - - return null; - } - - - /** - * Make accessing some individual elements of the feed easier. - * - * Special accessors 'entry' and 'entries' are provided so that if - * you wish to iterate over an Atom feed's entries, you can do so - * using foreach ($feed->entries as $entry) or foreach - * ($feed->entry as $entry). - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - switch ($var) { - case 'entry': - // fall through to the next case - case 'entries': - return $this; - - default: - return parent::__get($var); - } - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - protected function _mapFeedHeaders($array) - { - $feed = $this->_element->createElement('feed'); - $feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom'); - - $id = $this->_element->createElement('id', $array->link); - $feed->appendChild($id); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($array->title)); - $feed->appendChild($title); - - if (isset($array->author)) { - $author = $this->_element->createElement('author'); - $name = $this->_element->createElement('name', $array->author); - $author->appendChild($name); - if (isset($array->email)) { - $email = $this->_element->createElement('email', $array->email); - $author->appendChild($email); - } - $feed->appendChild($author); - } - - $updated = isset($array->lastUpdate) ? $array->lastUpdate : time(); - $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated)); - $feed->appendChild($updated); - - if (isset($array->published)) { - $published = $this->_element->createElement('published', date(DATE_ATOM, $array->published)); - $feed->appendChild($published); - } - - $link = $this->_element->createElement('link'); - $link->setAttribute('rel', 'self'); - $link->setAttribute('href', $array->link); - if (isset($array->language)) { - $link->setAttribute('hreflang', $array->language); - } - $feed->appendChild($link); - - if (isset($array->description)) { - $subtitle = $this->_element->createElement('subtitle'); - $subtitle->appendChild($this->_element->createCDATASection($array->description)); - $feed->appendChild($subtitle); - } - - if (isset($array->copyright)) { - $copyright = $this->_element->createElement('rights', $array->copyright); - $feed->appendChild($copyright); - } - - if (isset($array->image)) { - $image = $this->_element->createElement('logo', $array->image); - $feed->appendChild($image); - } - - $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; - $generator = $this->_element->createElement('generator', $generator); - $feed->appendChild($generator); - - return $feed; - } - - /** - * Generate the entries of the feed when working in write mode - * - * The following nodes are constructed for each feed entry - * - * url to feed entry - * entry title - * last update - * - * short text - * long version, can contain html - * - * - * @param array $array the data to use - * @param DOMElement $root the root node to use - * @return void - */ - protected function _mapFeedEntries(DOMElement $root, $array) - { - foreach ($array as $dataentry) { - $entry = $this->_element->createElement('entry'); - - $id = $this->_element->createElement('id', isset($dataentry->guid) ? $dataentry->guid : $dataentry->link); - $entry->appendChild($id); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($dataentry->title)); - $entry->appendChild($title); - - $updated = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); - $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated)); - $entry->appendChild($updated); - - $link = $this->_element->createElement('link'); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('href', $dataentry->link); - $entry->appendChild($link); - - $summary = $this->_element->createElement('summary'); - $summary->appendChild($this->_element->createCDATASection($dataentry->description)); - $entry->appendChild($summary); - - if (isset($dataentry->content)) { - $content = $this->_element->createElement('content'); - $content->setAttribute('type', 'html'); - $content->appendChild($this->_element->createCDATASection($dataentry->content)); - $entry->appendChild($content); - } - - if (isset($dataentry->category)) { - foreach ($dataentry->category as $category) { - $node = $this->_element->createElement('category'); - $node->setAttribute('term', $category['term']); - if (isset($category['scheme'])) { - $node->setAttribute('scheme', $category['scheme']); - } - $entry->appendChild($node); - } - } - - if (isset($dataentry->source)) { - $source = $this->_element->createElement('source'); - $title = $this->_element->createElement('title', $dataentry->source['title']); - $source->appendChild($title); - $link = $this->_element->createElement('link', $dataentry->source['title']); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('href', $dataentry->source['url']); - $source->appendChild($link); - } - - if (isset($dataentry->enclosure)) { - foreach ($dataentry->enclosure as $enclosure) { - $node = $this->_element->createElement('link'); - $node->setAttribute('rel', 'enclosure'); - $node->setAttribute('href', $enclosure['url']); - if (isset($enclosure['type'])) { - $node->setAttribute('type', $enclosure['type']); - } - if (isset($enclosure['length'])) { - $node->setAttribute('length', $enclosure['length']); - } - $entry->appendChild($node); - } - } - - if (isset($dataentry->comments)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:comment', - $dataentry->comments); - $entry->appendChild($comments); - } - if (isset($dataentry->commentRss)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:commentRss', - $dataentry->commentRss); - $entry->appendChild($comments); - } - - $root->appendChild($entry); - } - } - - /** - * Override Zend_Feed_Element to allow formated feeds - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $doc->appendChild($doc->importNode($this->_element, true)); - $doc->formatOutput = true; - - return $doc->saveXML(); - } - - /** - * Send feed to a http client with the correct header - * - * @return void - * @throws Zend_Feed_Exception if headers have already been sent - */ - public function send() - { - if (headers_sent()) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Cannot send ATOM because headers have already been sent.'); - } - - header('Content-Type: application/atom+xml; charset=' . $this->_element->ownerDocument->actualEncoding); - - echo $this->saveXML(); - } -} diff --git a/library/vendor/Zend/Feed/Builder.php b/library/vendor/Zend/Feed/Builder.php deleted file mode 100644 index eed8b8146..000000000 --- a/library/vendor/Zend/Feed/Builder.php +++ /dev/null @@ -1,390 +0,0 @@ - - * array( - * 'title' => 'title of the feed', //required - * 'link' => 'canonical url to the feed', //required - * 'lastUpdate' => 'timestamp of the update date', // optional - * 'published' => 'timestamp of the publication date', //optional - * 'charset' => 'charset', // required - * 'description' => 'short description of the feed', //optional - * 'author' => 'author/publisher of the feed', //optional - * 'email' => 'email of the author', //optional - * 'webmaster' => 'email address for person responsible for technical issues' // optional, ignored if atom is used - * 'copyright' => 'copyright notice', //optional - * 'image' => 'url to image', //optional - * 'generator' => 'generator', // optional - * 'language' => 'language the feed is written in', // optional - * 'ttl' => 'how long in minutes a feed can be cached before refreshing', // optional, ignored if atom is used - * 'rating' => 'The PICS rating for the channel.', // optional, ignored if atom is used - * 'cloud' => array( - * 'domain' => 'domain of the cloud, e.g. rpc.sys.com' // required - * 'port' => 'port to connect to' // optional, default to 80 - * 'path' => 'path of the cloud, e.g. /RPC2 //required - * 'registerProcedure' => 'procedure to call, e.g. myCloud.rssPleaseNotify' // required - * 'protocol' => 'protocol to use, e.g. soap or xml-rpc' // required - * ), a cloud to be notified of updates // optional, ignored if atom is used - * 'textInput' => array( - * 'title' => 'the label of the Submit button in the text input area' // required, - * 'description' => 'explains the text input area' // required - * 'name' => 'the name of the text object in the text input area' // required - * 'link' => 'the URL of the CGI script that processes text input requests' // required - * ) // a text input box that can be displayed with the feed // optional, ignored if atom is used - * 'skipHours' => array( - * 'hour in 24 format', // e.g 13 (1pm) - * // up to 24 rows whose value is a number between 0 and 23 - * ) // Hint telling aggregators which hours they can skip // optional, ignored if atom is used - * 'skipDays ' => array( - * 'a day to skip', // e.g Monday - * // up to 7 rows whose value is a Monday, Tuesday, Wednesday, Thursday, Friday, Saturday or Sunday - * ) // Hint telling aggregators which days they can skip // optional, ignored if atom is used - * 'itunes' => array( - * 'author' => 'Artist column' // optional, default to the main author value - * 'owner' => array( - * 'name' => 'name of the owner' // optional, default to main author value - * 'email' => 'email of the owner' // optional, default to main email value - * ) // Owner of the podcast // optional - * 'image' => 'album/podcast art' // optional, default to the main image value - * 'subtitle' => 'short description' // optional, default to the main description value - * 'summary' => 'longer description' // optional, default to the main description value - * 'block' => 'Prevent an episode from appearing (yes|no)' // optional - * 'category' => array( - * array('main' => 'main category', // required - * 'sub' => 'sub category' // optional - * ), - * // up to 3 rows - * ) // 'Category column and in iTunes Music Store Browse' // required - * 'explicit' => 'parental advisory graphic (yes|no|clean)' // optional - * 'keywords' => 'a comma separated list of 12 keywords maximum' // optional - * 'new-feed-url' => 'used to inform iTunes of new feed URL location' // optional - * ) // Itunes extension data // optional, ignored if atom is used - * 'entries' => array( - * array( - * 'title' => 'title of the feed entry', //required - * 'link' => 'url to a feed entry', //required - * 'description' => 'short version of a feed entry', // only text, no html, required - * 'guid' => 'id of the article, if not given link value will used', //optional - * 'content' => 'long version', // can contain html, optional - * 'lastUpdate' => 'timestamp of the publication date', // optional - * 'comments' => 'comments page of the feed entry', // optional - * 'commentRss' => 'the feed url of the associated comments', // optional - * 'source' => array( - * 'title' => 'title of the original source' // required, - * 'url' => 'url of the original source' // required - * ) // original source of the feed entry // optional - * 'category' => array( - * array( - * 'term' => 'first category label' // required, - * 'scheme' => 'url that identifies a categorization scheme' // optional - * ), - * array( - * //data for the second category and so on - * ) - * ) // list of the attached categories // optional - * 'enclosure' => array( - * array( - * 'url' => 'url of the linked enclosure' // required - * 'type' => 'mime type of the enclosure' // optional - * 'length' => 'length of the linked content in octets' // optional - * ), - * array( - * //data for the second enclosure and so on - * ) - * ) // list of the enclosures of the feed entry // optional - * ), - * array( - * //data for the second entry and so on - * ) - * ) - * ); - * - * - * @param array $data - * @return void - */ - public function __construct(array $data) - { - $this->_data = $data; - $this->_createHeader($data); - if (isset($data['entries'])) { - $this->_createEntries($data['entries']); - } - } - - /** - * Returns an instance of Zend_Feed_Builder_Header - * describing the header of the feed - * - * @return Zend_Feed_Builder_Header - */ - public function getHeader() - { - return $this->_header; - } - - /** - * Returns an array of Zend_Feed_Builder_Entry instances - * describing the entries of the feed - * - * @return array of Zend_Feed_Builder_Entry - */ - public function getEntries() - { - return $this->_entries; - } - - /** - * Create the Zend_Feed_Builder_Header instance - * - * @param array $data - * @throws Zend_Feed_Builder_Exception - * @return void - */ - protected function _createHeader(array $data) - { - $mandatories = array('title', 'link', 'charset'); - foreach ($mandatories as $mandatory) { - if (!isset($data[$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("$mandatory key is missing"); - } - } - $this->_header = new Zend_Feed_Builder_Header($data['title'], $data['link'], $data['charset']); - if (isset($data['lastUpdate'])) { - $this->_header->setLastUpdate($data['lastUpdate']); - } - if (isset($data['published'])) { - $this->_header->setPublishedDate($data['published']); - } - if (isset($data['description'])) { - $this->_header->setDescription($data['description']); - } - if (isset($data['author'])) { - $this->_header->setAuthor($data['author']); - } - if (isset($data['email'])) { - $this->_header->setEmail($data['email']); - } - if (isset($data['webmaster'])) { - $this->_header->setWebmaster($data['webmaster']); - } - if (isset($data['copyright'])) { - $this->_header->setCopyright($data['copyright']); - } - if (isset($data['image'])) { - $this->_header->setImage($data['image']); - } - if (isset($data['generator'])) { - $this->_header->setGenerator($data['generator']); - } - if (isset($data['language'])) { - $this->_header->setLanguage($data['language']); - } - if (isset($data['ttl'])) { - $this->_header->setTtl($data['ttl']); - } - if (isset($data['rating'])) { - $this->_header->setRating($data['rating']); - } - if (isset($data['cloud'])) { - $mandatories = array('domain', 'path', 'registerProcedure', 'protocol'); - foreach ($mandatories as $mandatory) { - if (!isset($data['cloud'][$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your cloud"); - } - } - $uri_str = 'http://' . $data['cloud']['domain'] . $data['cloud']['path']; - $this->_header->setCloud($uri_str, $data['cloud']['registerProcedure'], $data['cloud']['protocol']); - } - if (isset($data['textInput'])) { - $mandatories = array('title', 'description', 'name', 'link'); - foreach ($mandatories as $mandatory) { - if (!isset($data['textInput'][$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your textInput"); - } - } - $this->_header->setTextInput($data['textInput']['title'], - $data['textInput']['description'], - $data['textInput']['name'], - $data['textInput']['link']); - } - if (isset($data['skipHours'])) { - $this->_header->setSkipHours($data['skipHours']); - } - if (isset($data['skipDays'])) { - $this->_header->setSkipDays($data['skipDays']); - } - if (isset($data['itunes'])) { - $itunes = new Zend_Feed_Builder_Header_Itunes($data['itunes']['category']); - if (isset($data['itunes']['author'])) { - $itunes->setAuthor($data['itunes']['author']); - } - if (isset($data['itunes']['owner'])) { - $name = isset($data['itunes']['owner']['name']) ? $data['itunes']['owner']['name'] : ''; - $email = isset($data['itunes']['owner']['email']) ? $data['itunes']['owner']['email'] : ''; - $itunes->setOwner($name, $email); - } - if (isset($data['itunes']['image'])) { - $itunes->setImage($data['itunes']['image']); - } - if (isset($data['itunes']['subtitle'])) { - $itunes->setSubtitle($data['itunes']['subtitle']); - } - if (isset($data['itunes']['summary'])) { - $itunes->setSummary($data['itunes']['summary']); - } - if (isset($data['itunes']['block'])) { - $itunes->setBlock($data['itunes']['block']); - } - if (isset($data['itunes']['explicit'])) { - $itunes->setExplicit($data['itunes']['explicit']); - } - if (isset($data['itunes']['keywords'])) { - $itunes->setKeywords($data['itunes']['keywords']); - } - if (isset($data['itunes']['new-feed-url'])) { - $itunes->setNewFeedUrl($data['itunes']['new-feed-url']); - } - - $this->_header->setITunes($itunes); - } - } - - /** - * Create the array of article entries - * - * @param array $data - * @throws Zend_Feed_Builder_Exception - * @return void - */ - protected function _createEntries(array $data) - { - foreach ($data as $row) { - $mandatories = array('title', 'link', 'description'); - foreach ($mandatories as $mandatory) { - if (!isset($row[$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("$mandatory key is missing"); - } - } - $entry = new Zend_Feed_Builder_Entry($row['title'], $row['link'], $row['description']); - if (isset($row['author'])) { - $entry->setAuthor($row['author']); - } - if (isset($row['guid'])) { - $entry->setId($row['guid']); - } - if (isset($row['content'])) { - $entry->setContent($row['content']); - } - if (isset($row['lastUpdate'])) { - $entry->setLastUpdate($row['lastUpdate']); - } - if (isset($row['comments'])) { - $entry->setCommentsUrl($row['comments']); - } - if (isset($row['commentRss'])) { - $entry->setCommentsRssUrl($row['commentRss']); - } - if (isset($row['source'])) { - $mandatories = array('title', 'url'); - foreach ($mandatories as $mandatory) { - if (!isset($row['source'][$mandatory])) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("$mandatory key of source property is missing"); - } - } - $entry->setSource($row['source']['title'], $row['source']['url']); - } - if (isset($row['category'])) { - $entry->setCategories($row['category']); - } - if (isset($row['enclosure'])) { - $entry->setEnclosures($row['enclosure']); - } - - $this->_entries[] = $entry; - } - } -} diff --git a/library/vendor/Zend/Feed/Builder/Entry.php b/library/vendor/Zend/Feed/Builder/Entry.php deleted file mode 100644 index dad54abf5..000000000 --- a/library/vendor/Zend/Feed/Builder/Entry.php +++ /dev/null @@ -1,295 +0,0 @@ -offsetSet('title', $title); - $this->offsetSet('link', $link); - $this->offsetSet('description', $description); - $this->setLastUpdate(time()); - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - - /** - * Sets the author of the entry - * - * @param string $author - * @return Zend_Feed_Builder_Entry - */ - public function setAuthor($author) - { - $this->offsetSet('author', $author); - return $this; - } - - /** - * Sets the id/guid of the entry - * - * @param string $id - * @return Zend_Feed_Builder_Entry - */ - public function setId($id) - { - $this->offsetSet('guid', $id); - return $this; - } - - /** - * Sets the full html content of the entry - * - * @param string $content - * @return Zend_Feed_Builder_Entry - */ - public function setContent($content) - { - $this->offsetSet('content', $content); - return $this; - } - - /** - * Timestamp of the update date - * - * @param int $lastUpdate - * @return Zend_Feed_Builder_Entry - */ - public function setLastUpdate($lastUpdate) - { - $this->offsetSet('lastUpdate', $lastUpdate); - return $this; - } - - /** - * Sets the url of the commented page associated to the entry - * - * @param string $comments - * @return Zend_Feed_Builder_Entry - */ - public function setCommentsUrl($comments) - { - $this->offsetSet('comments', $comments); - return $this; - } - - /** - * Sets the url of the comments feed link - * - * @param string $commentRss - * @return Zend_Feed_Builder_Entry - */ - public function setCommentsRssUrl($commentRss) - { - $this->offsetSet('commentRss', $commentRss); - return $this; - } - - /** - * Defines a reference to the original source - * - * @param string $title - * @param string $url - * @return Zend_Feed_Builder_Entry - */ - public function setSource($title, $url) - { - $this->offsetSet('source', array('title' => $title, - 'url' => $url)); - return $this; - } - - /** - * Sets the categories of the entry - * Format of the array: - * - * array( - * array( - * 'term' => 'first category label', - * 'scheme' => 'url that identifies a categorization scheme' // optional - * ), - * // second category and so one - * ) - * - * - * @param array $categories - * @return Zend_Feed_Builder_Entry - */ - public function setCategories(array $categories) - { - foreach ($categories as $category) { - $this->addCategory($category); - } - return $this; - } - - /** - * Add a category to the entry - * - * @param array $category see Zend_Feed_Builder_Entry::setCategories() for format - * @return Zend_Feed_Builder_Entry - * @throws Zend_Feed_Builder_Exception - */ - public function addCategory(array $category) - { - if (empty($category['term'])) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to define the name of the category"); - } - - if (!$this->offsetExists('category')) { - $categories = array($category); - } else { - $categories = $this->offsetGet('category'); - $categories[] = $category; - } - $this->offsetSet('category', $categories); - return $this; - } - - /** - * Sets the enclosures of the entry - * Format of the array: - * - * array( - * array( - * 'url' => 'url of the linked enclosure', - * 'type' => 'mime type of the enclosure' // optional - * 'length' => 'length of the linked content in octets' // optional - * ), - * // second enclosure and so one - * ) - * - * - * @param array $enclosures - * @return Zend_Feed_Builder_Entry - * @throws Zend_Feed_Builder_Exception - */ - public function setEnclosures(array $enclosures) - { - foreach ($enclosures as $enclosure) { - if (empty($enclosure['url'])) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to supply an url for your enclosure"); - } - $type = isset($enclosure['type']) ? $enclosure['type'] : ''; - $length = isset($enclosure['length']) ? $enclosure['length'] : ''; - $this->addEnclosure($enclosure['url'], $type, $length); - } - return $this; - } - - /** - * Add an enclosure to the entry - * - * @param string $url - * @param string $type - * @param string $length - * @return Zend_Feed_Builder_Entry - */ - public function addEnclosure($url, $type = '', $length = '') - { - if (!$this->offsetExists('enclosure')) { - $enclosure = array(); - } else { - $enclosure = $this->offsetGet('enclosure'); - } - $enclosure[] = array('url' => $url, - 'type' => $type, - 'length' => $length); - $this->offsetSet('enclosure', $enclosure); - return $this; - } -} diff --git a/library/vendor/Zend/Feed/Builder/Exception.php b/library/vendor/Zend/Feed/Builder/Exception.php deleted file mode 100644 index 9fc6ec6a5..000000000 --- a/library/vendor/Zend/Feed/Builder/Exception.php +++ /dev/null @@ -1,39 +0,0 @@ -offsetSet('title', $title); - $this->offsetSet('link', $link); - $this->offsetSet('charset', $charset); - $this->setLastUpdate(time()) - ->setGenerator('Zend_Feed'); - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - - /** - * Timestamp of the update date - * - * @param int $lastUpdate - * @return Zend_Feed_Builder_Header - */ - public function setLastUpdate($lastUpdate) - { - $this->offsetSet('lastUpdate', $lastUpdate); - return $this; - } - - /** - * Timestamp of the publication date - * - * @param int $published - * @return Zend_Feed_Builder_Header - */ - public function setPublishedDate($published) - { - $this->offsetSet('published', $published); - return $this; - } - - /** - * Short description of the feed - * - * @param string $description - * @return Zend_Feed_Builder_Header - */ - public function setDescription($description) - { - $this->offsetSet('description', $description); - return $this; - } - - /** - * Sets the author of the feed - * - * @param string $author - * @return Zend_Feed_Builder_Header - */ - public function setAuthor($author) - { - $this->offsetSet('author', $author); - return $this; - } - - /** - * Sets the author's email - * - * @param string $email - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception - */ - public function setEmail($email) - { - /** - * @see Zend_Validate_EmailAddress - */ - $validate = new Zend_Validate_EmailAddress(); - if (!$validate->isValid($email)) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the email property"); - } - $this->offsetSet('email', $email); - return $this; - } - - /** - * Sets the copyright notice - * - * @param string $copyright - * @return Zend_Feed_Builder_Header - */ - public function setCopyright($copyright) - { - $this->offsetSet('copyright', $copyright); - return $this; - } - - /** - * Sets the image of the feed - * - * @param string $image - * @return Zend_Feed_Builder_Header - */ - public function setImage($image) - { - $this->offsetSet('image', $image); - return $this; - } - - /** - * Sets the generator of the feed - * - * @param string $generator - * @return Zend_Feed_Builder_Header - */ - public function setGenerator($generator) - { - $this->offsetSet('generator', $generator); - return $this; - } - - /** - * Sets the language of the feed - * - * @param string $language - * @return Zend_Feed_Builder_Header - */ - public function setLanguage($language) - { - $this->offsetSet('language', $language); - return $this; - } - - /** - * Email address for person responsible for technical issues - * Ignored if atom is used - * - * @param string $webmaster - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception - */ - public function setWebmaster($webmaster) - { - /** - * @see Zend_Validate_EmailAddress - */ - $validate = new Zend_Validate_EmailAddress(); - if (!$validate->isValid($webmaster)) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the webmaster property"); - } - $this->offsetSet('webmaster', $webmaster); - return $this; - } - - /** - * How long in minutes a feed can be cached before refreshing - * Ignored if atom is used - * - * @param int $ttl - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception - */ - public function setTtl($ttl) - { - /** - * @see Zend_Validate_Int - */ - $validate = new Zend_Validate_Int(); - if (!$validate->isValid($ttl)) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set an integer value to the ttl property"); - } - $this->offsetSet('ttl', $ttl); - return $this; - } - - /** - * PICS rating for the feed - * Ignored if atom is used - * - * @param string $rating - * @return Zend_Feed_Builder_Header - */ - public function setRating($rating) - { - $this->offsetSet('rating', $rating); - return $this; - } - - /** - * Cloud to be notified of updates of the feed - * Ignored if atom is used - * - * @param string|Zend_Uri_Http $uri - * @param string $procedure procedure to call, e.g. myCloud.rssPleaseNotify - * @param string $protocol protocol to use, e.g. soap or xml-rpc - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception - */ - public function setCloud($uri, $procedure, $protocol) - { - if (is_string($uri) && Zend_Uri_Http::check($uri)) { - $uri = Zend_Uri::factory($uri); - } - if (!$uri instanceof Zend_Uri_Http) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception('Passed parameter is not a valid HTTP URI'); - } - if (!$uri->getPort()) { - $uri->setPort(80); - } - $this->offsetSet('cloud', array('uri' => $uri, - 'procedure' => $procedure, - 'protocol' => $protocol)); - return $this; - } - - /** - * A text input box that can be displayed with the feed - * Ignored if atom is used - * - * @param string $title the label of the Submit button in the text input area - * @param string $description explains the text input area - * @param string $name the name of the text object in the text input area - * @param string $link the URL of the CGI script that processes text input requests - * @return Zend_Feed_Builder_Header - */ - public function setTextInput($title, $description, $name, $link) - { - $this->offsetSet('textInput', array('title' => $title, - 'description' => $description, - 'name' => $name, - 'link' => $link)); - return $this; - } - - /** - * Hint telling aggregators which hours they can skip - * Ignored if atom is used - * - * @param array $hours list of hours in 24 format - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception - */ - public function setSkipHours(array $hours) - { - if (count($hours) > 24) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you can not have more than 24 rows in the skipHours property"); - } - foreach ($hours as $hour) { - if ($hour < 0 || $hour > 23) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("$hour has te be between 0 and 23"); - } - } - $this->offsetSet('skipHours', $hours); - return $this; - } - - /** - * Hint telling aggregators which days they can skip - * Ignored if atom is used - * - * @param array $days list of days to skip, e.g. Monday - * @return Zend_Feed_Builder_Header - * @throws Zend_Feed_Builder_Exception - */ - public function setSkipDays(array $days) - { - if (count($days) > 7) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you can not have more than 7 days in the skipDays property"); - } - $valid = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); - foreach ($days as $day) { - if (!in_array(strtolower($day), $valid)) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("$day is not a valid day"); - } - } - $this->offsetSet('skipDays', $days); - return $this; - } - - /** - * Sets the iTunes rss extension - * - * @param Zend_Feed_Builder_Header_Itunes $itunes - * @return Zend_Feed_Builder_Header - */ - public function setITunes(Zend_Feed_Builder_Header_Itunes $itunes) - { - $this->offsetSet('itunes', $itunes); - return $this; - } -} diff --git a/library/vendor/Zend/Feed/Builder/Header/Itunes.php b/library/vendor/Zend/Feed/Builder/Header/Itunes.php deleted file mode 100644 index de7d50db8..000000000 --- a/library/vendor/Zend/Feed/Builder/Header/Itunes.php +++ /dev/null @@ -1,281 +0,0 @@ -setCategories($categories); - } - - /** - * Sets the categories column and in iTunes Music Store Browse - * $categories must conform to the following format: - * - * array(array('main' => 'main category', - * 'sub' => 'sub category' // optionnal - * ), - * // up to 3 rows - * ) - * - * - * @param array $categories - * @return Zend_Feed_Builder_Header_Itunes - * @throws Zend_Feed_Builder_Exception - */ - public function setCategories(array $categories) - { - $nb = count($categories); - if (0 === $nb) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set at least one itunes category"); - } - if ($nb > 3) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set at most three itunes categories"); - } - foreach ($categories as $i => $category) { - if (empty($category['main'])) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set the main category (category #$i)"); - } - } - $this->offsetSet('category', $categories); - return $this; - } - - /** - * Sets the artist value, default to the feed's author value - * - * @param string $author - * @return Zend_Feed_Builder_Header_Itunes - */ - public function setAuthor($author) - { - $this->offsetSet('author', $author); - return $this; - } - - /** - * Sets the owner of the postcast - * - * @param string $name default to the feed's author value - * @param string $email default to the feed's email value - * @return Zend_Feed_Builder_Header_Itunes - * @throws Zend_Feed_Builder_Exception - */ - public function setOwner($name = '', $email = '') - { - if (!empty($email)) { - /** - * @see Zend_Validate_EmailAddress - */ - $validate = new Zend_Validate_EmailAddress(); - if (!$validate->isValid($email)) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property"); - } - } - $this->offsetSet('owner', array('name' => $name, 'email' => $email)); - return $this; - } - - /** - * Sets the album/podcast art picture - * Default to the feed's image value - * - * @param string $image - * @return Zend_Feed_Builder_Header_Itunes - */ - public function setImage($image) - { - $this->offsetSet('image', $image); - return $this; - } - - /** - * Sets the short description of the podcast - * Default to the feed's description - * - * @param string $subtitle - * @return Zend_Feed_Builder_Header_Itunes - */ - public function setSubtitle($subtitle) - { - $this->offsetSet('subtitle', $subtitle); - return $this; - } - - /** - * Sets the longer description of the podcast - * Default to the feed's description - * - * @param string $summary - * @return Zend_Feed_Builder_Header_Itunes - */ - public function setSummary($summary) - { - $this->offsetSet('summary', $summary); - return $this; - } - - /** - * Prevent a feed from appearing - * - * @param string $block can be 'yes' or 'no' - * @return Zend_Feed_Builder_Header_Itunes - * @throws Zend_Feed_Builder_Exception - */ - public function setBlock($block) - { - $block = strtolower($block); - if (!in_array($block, array('yes', 'no'))) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set yes or no to the itunes block property"); - } - $this->offsetSet('block', $block); - return $this; - } - - /** - * Configuration of the parental advisory graphic - * - * @param string $explicit can be 'yes', 'no' or 'clean' - * @return Zend_Feed_Builder_Header_Itunes - * @throws Zend_Feed_Builder_Exception - */ - public function setExplicit($explicit) - { - $explicit = strtolower($explicit); - if (!in_array($explicit, array('yes', 'no', 'clean'))) { - /** - * @see Zend_Feed_Builder_Exception - */ - throw new Zend_Feed_Builder_Exception("you have to set yes, no or clean to the itunes explicit property"); - } - $this->offsetSet('explicit', $explicit); - return $this; - } - - /** - * Sets a comma separated list of 12 keywords maximum - * - * @param string $keywords - * @return Zend_Feed_Builder_Header_Itunes - */ - public function setKeywords($keywords) - { - $this->offsetSet('keywords', $keywords); - return $this; - } - - /** - * Sets the new feed URL location - * - * @param string $url - * @return Zend_Feed_Builder_Header_Itunes - */ - public function setNewFeedUrl($url) - { - $this->offsetSet('new_feed_url', $url); - return $this; - } - - /** - * Read only properties accessor - * - * @param string $name property to read - * @return mixed - */ - public function __get($name) - { - if (!$this->offsetExists($name)) { - return NULL; - } - - return $this->offsetGet($name); - } - - /** - * Write properties accessor - * - * @param string $name name of the property to set - * @param mixed $value value to set - * @return void - */ - public function __set($name, $value) - { - $this->offsetSet($name, $value); - } - - /** - * Isset accessor - * - * @param string $key - * @return boolean - */ - public function __isset($key) - { - return $this->offsetExists($key); - } - - /** - * Unset accessor - * - * @param string $key - * @return void - */ - public function __unset($key) - { - if ($this->offsetExists($key)) { - $this->offsetUnset($key); - } - } - -} diff --git a/library/vendor/Zend/Feed/Builder/Interface.php b/library/vendor/Zend/Feed/Builder/Interface.php deleted file mode 100644 index 8e2615694..000000000 --- a/library/vendor/Zend/Feed/Builder/Interface.php +++ /dev/null @@ -1,52 +0,0 @@ -_element = $element; - } - - - /** - * Get a DOM representation of the element - * - * Returns the underlying DOM object, which can then be - * manipulated with full DOM methods. - * - * @return DOMDocument - */ - public function getDOM() - { - return $this->_element; - } - - - /** - * Update the object from a DOM element - * - * Take a DOMElement object, which may be originally from a call - * to getDOM() or may be custom created, and use it as the - * DOM tree for this Zend_Feed_Element. - * - * @param DOMElement $element - * @return void - */ - public function setDOM(DOMElement $element) - { - $this->_element = $this->_element->ownerDocument->importNode($element, true); - } - - /** - * Set the parent element of this object to another - * Zend_Feed_Element. - * - * @param Zend_Feed_Element $element - * @return void - */ - public function setParent(Zend_Feed_Element $element) - { - $this->_parentElement = $element; - $this->_appended = false; - } - - - /** - * Appends this element to its parent if necessary. - * - * @return void - */ - protected function ensureAppended() - { - if (!$this->_appended) { - $this->_parentElement->getDOM()->appendChild($this->_element); - $this->_appended = true; - $this->_parentElement->ensureAppended(); - } - } - - - /** - * Get an XML string representation of this element - * - * Returns a string of this element's XML, including the XML - * prologue. - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $doc->appendChild($doc->importNode($this->_element, true)); - return $doc->saveXML(); - } - - - /** - * Get the XML for only this element - * - * Returns a string of this element's XML without prologue. - * - * @return string - */ - public function saveXmlFragment() - { - return $this->_element->ownerDocument->saveXML($this->_element); - } - - /** - * Get encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set encoding - * - * @param string $value Encoding to use - * @return Zend_Feed_Element - */ - public function setEncoding($value) - { - $this->_encoding = (string) $value; - return $this; - } - - /** - * Map variable access onto the underlying entry representation. - * - * Get-style access returns a Zend_Feed_Element representing the - * child element accessed. To get string values, use method syntax - * with the __call() overriding. - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - $nodes = $this->_children($var); - $length = count($nodes); - - if ($length == 1) { - return new Zend_Feed_Element($nodes[0]); - } elseif ($length > 1) { - return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes); - } else { - // When creating anonymous nodes for __set chaining, don't - // call appendChild() on them. Instead we pass the current - // element to them as an extra reference; the child is - // then responsible for appending itself when it is - // actually set. This way "if ($foo->bar)" doesn't create - // a phantom "bar" element in our tree. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $elt); - } else { - $node = $this->_element->ownerDocument->createElement($var); - } - $node = new self($node); - $node->setParent($this); - return $node; - } - } - - - /** - * Map variable sets onto the underlying entry representation. - * - * @param string $var The property to change. - * @param string $val The property's new value. - * @return void - * @throws Zend_Feed_Exception - */ - public function __set($var, $val) - { - $this->ensureAppended(); - - $nodes = $this->_children($var); - if (!$nodes) { - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), - $var, htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); - $this->_element->appendChild($node); - } else { - $node = $this->_element->ownerDocument->createElement($var, - htmlspecialchars($val, ENT_NOQUOTES, $this->getEncoding())); - $this->_element->appendChild($node); - } - } elseif (count($nodes) > 1) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Cannot set the value of multiple tags simultaneously.'); - } else { - $nodes[0]->nodeValue = $val; - } - } - - - /** - * Map isset calls onto the underlying entry representation. - * - * @param string $var - * @return boolean - */ - public function __isset($var) - { - // Look for access of the form {ns:var}. We don't use - // _children() here because we can break out of the loop - // immediately once we find something. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $elt && $child->prefix == $ns) { - return true; - } - } - } else { - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $var) { - return true; - } - } - } - } - - - /** - * Get the value of an element with method syntax. - * - * Map method calls to get the string value of the requested - * element. If there are multiple elements that match, this will - * return an array of those objects. - * - * @param string $var The element to get the string value of. - * @param mixed $unused This parameter is not used. - * @return mixed The node's value, null, or an array of nodes. - */ - public function __call($var, $unused) - { - $nodes = $this->_children($var); - - if (!$nodes) { - return null; - } elseif (count($nodes) > 1) { - return $nodes; - } else { - return $nodes[0]->nodeValue; - } - } - - - /** - * Remove all children matching $var. - * - * @param string $var - * @return void - */ - public function __unset($var) - { - $nodes = $this->_children($var); - foreach ($nodes as $node) { - $parent = $node->parentNode; - $parent->removeChild($node); - } - } - - - /** - * Returns the nodeValue of this element when this object is used - * in a string context. - * - * @return string - */ - public function __toString() - { - return $this->_element->nodeValue; - } - - - /** - * Finds children with tagnames matching $var - * - * Similar to SimpleXML's children() method. - * - * @param string $var Tagname to match, can be either namespace:tagName or just tagName. - * @return array - */ - protected function _children($var) - { - $found = array(); - - // Look for access of the form {ns:var}. - if (strpos($var, ':') !== false) { - list($ns, $elt) = explode(':', $var, 2); - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $elt && $child->prefix == $ns) { - $found[] = $child; - } - } - } else { - foreach ($this->_element->childNodes as $child) { - if ($child->localName == $var) { - $found[] = $child; - } - } - } - - return $found; - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return boolean - */ - public function offsetExists($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->hasAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->hasAttribute($offset); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return string - */ - public function offsetGet($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->getAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->getAttribute($offset); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @param string $value - * @return string - */ - public function offsetSet($offset, $value) - { - $this->ensureAppended(); - - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - // DOMElement::setAttributeNS() requires $qualifiedName to have a prefix - return $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $offset, $value); - } else { - return $this->_element->setAttribute($offset, $value); - } - } - - - /** - * Required by the ArrayAccess interface. - * - * @param string $offset - * @return boolean - */ - public function offsetUnset($offset) - { - if (strpos($offset, ':') !== false) { - list($ns, $attr) = explode(':', $offset, 2); - return $this->_element->removeAttributeNS(Zend_Feed::lookupNamespace($ns), $attr); - } else { - return $this->_element->removeAttribute($offset); - } - } - -} diff --git a/library/vendor/Zend/Feed/Entry/Abstract.php b/library/vendor/Zend/Feed/Entry/Abstract.php deleted file mode 100644 index 9ae213ae1..000000000 --- a/library/vendor/Zend/Feed/Entry/Abstract.php +++ /dev/null @@ -1,121 +0,0 @@ -getElementsByTagName($this->_rootElement)->item(0); - if (!$element) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.'); - } - } else { - $doc = new DOMDocument('1.0', 'utf-8'); - if ($this->_rootNamespace !== null) { - $element = $doc->createElementNS(Zend_Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement); - } else { - $element = $doc->createElement($this->_rootElement); - } - } - } - - parent::__construct($element); - } - -} diff --git a/library/vendor/Zend/Feed/Entry/Atom.php b/library/vendor/Zend/Feed/Entry/Atom.php deleted file mode 100644 index f2edffa1c..000000000 --- a/library/vendor/Zend/Feed/Entry/Atom.php +++ /dev/null @@ -1,272 +0,0 @@ -link('edit'); - if (!$deleteUri) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Cannot delete entry; no link rel="edit" is present.'); - } - - // DELETE - $client = Zend_Feed::getHttpClient(); - do { - $client->setUri($deleteUri); - if (Zend_Feed::getHttpMethodOverride()) { - $client->setHeader('X-HTTP-Method-Override', 'DELETE'); - $response = $client->request('POST'); - } else { - $response = $client->request('DELETE'); - } - $httpStatus = $response->getStatus(); - switch ((int) $httpStatus / 100) { - // Success - case 2: - return true; - // Redirect - case 3: - $deleteUri = $response->getHeader('Location'); - continue; - // Error - default: - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception("Expected response code 2xx, got $httpStatus"); - } - } while (true); - } - - - /** - * Save a new or updated Atom entry. - * - * Save is used to either create new entries or to save changes to - * existing ones. If we have a link rel="edit", we are changing - * an existing entry. In this case we re-serialize the entry and - * PUT it to the edit URI, checking for a 200 OK result. - * - * For posting new entries, you must specify the $postUri - * parameter to save() to tell the object where to post itself. - * We use $postUri and POST the serialized entry there, checking - * for a 201 Created response. If the insert is successful, we - * then parse the response from the POST to get any values that - * the server has generated: an id, an updated time, and its new - * link rel="edit". - * - * @param string $postUri Location to POST for creating new entries. - * @return void - * @throws Zend_Feed_Exception - */ - public function save($postUri = null) - { - if ($this->id()) { - // If id is set, look for link rel="edit" in the - // entry object and PUT. - $editUri = $this->link('edit'); - if (!$editUri) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Cannot edit entry; no link rel="edit" is present.'); - } - - $client = Zend_Feed::getHttpClient(); - $client->setUri($editUri); - if (Zend_Feed::getHttpMethodOverride()) { - $client->setHeaders(array('X-HTTP-Method-Override: PUT', - 'Content-Type: ' . self::CONTENT_TYPE)); - $client->setRawData($this->saveXML()); - $response = $client->request('POST'); - } else { - $client->setHeaders('Content-Type', self::CONTENT_TYPE); - $client->setRawData($this->saveXML()); - $response = $client->request('PUT'); - } - if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Expected response code 200, got ' . $response->getStatus()); - } - } else { - if ($postUri === null) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('PostURI must be specified to save new entries.'); - } - $client = Zend_Feed::getHttpClient(); - $client->setUri($postUri); - $client->setHeaders('Content-Type', self::CONTENT_TYPE); - $client->setRawData($this->saveXML()); - $response = $client->request('POST'); - - if ($response->getStatus() !== 201) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Expected response code 201, got ' - . $response->getStatus()); - } - } - - // Update internal properties using $client->responseBody; - @ini_set('track_errors', 1); - $newEntry = new DOMDocument; - $newEntry = @Zend_Xml_Security::scan($response->getBody(), $newEntry); - @ini_restore('track_errors'); - - if (!$newEntry) { - // prevent the class to generate an undefined variable notice (ZF-2590) - if (!isset($php_errormsg)) { - if (function_exists('xdebug_is_enabled')) { - $php_errormsg = '(error message not available, when XDebug is running)'; - } else { - $php_errormsg = '(error message not available)'; - } - } - - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('XML cannot be parsed: ' . $php_errormsg); - } - - $newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0); - if (!$newEntry) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('No root element found in server response:' - . "\n\n" . $client->responseBody); - } - - if ($this->_element->parentNode) { - $oldElement = $this->_element; - $this->_element = $oldElement->ownerDocument->importNode($newEntry, true); - $oldElement->parentNode->replaceChild($this->_element, $oldElement); - } else { - $this->_element = $newEntry; - } - } - - - /** - * Easy access to tags keyed by "rel" attributes. - * - * If $elt->link() is called with no arguments, we will attempt to - * return the value of the tag(s) like all other - * method-syntax attribute access. If an argument is passed to - * link(), however, then we will return the "href" value of the - * first tag that has a "rel" attribute matching $rel: - * - * $elt->link(): returns the value of the link tag. - * $elt->link('self'): returns the href from the first in the entry. - * - * @param string $rel The "rel" attribute to look for. - * @return mixed - */ - public function link($rel = null) - { - if ($rel === null) { - return parent::__call('link', null); - } - - // index link tags by their "rel" attribute. - $links = parent::__get('link'); - if (!is_array($links)) { - if ($links instanceof Zend_Feed_Element) { - $links = array($links); - } else { - return $links; - } - } - - foreach ($links as $link) { - if (empty($link['rel'])) { - $link['rel'] = 'alternate'; // see Atom 1.0 spec - } - if ($rel == $link['rel']) { - return $link['href']; - } - } - - return null; - } - -} diff --git a/library/vendor/Zend/Feed/Entry/Rss.php b/library/vendor/Zend/Feed/Entry/Rss.php deleted file mode 100644 index 782f6aa8b..000000000 --- a/library/vendor/Zend/Feed/Entry/Rss.php +++ /dev/null @@ -1,121 +0,0 @@ -_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); - return parent::__get("$prefix:encoded"); - default: - return parent::__get($var); - } - } - - /** - * Overwrites parent::_set method to enable write access - * to content:encoded element. - * - * @param string $var The property to change. - * @param string $val The property's new value. - * @return void - */ - public function __set($var, $value) - { - switch ($var) { - case 'content': - parent::__set('content:encoded', $value); - break; - default: - parent::__set($var, $value); - } - } - - /** - * Overwrites parent::_isset method to enable access - * to content:encoded element. - * - * @param string $var - * @return boolean - */ - public function __isset($var) - { - switch ($var) { - case 'content': - // don't use other callback to prevent invalid returned value - return $this->content() !== null; - default: - return parent::__isset($var); - } - } - - /** - * Overwrites parent::_call method to enable read access - * to content:encoded element. - * Please note that method-style write access is not currently supported - * by parent method, consequently this method doesn't as well. - * - * @param string $var The element to get the string value of. - * @param mixed $unused This parameter is not used. - * @return mixed The node's value, null, or an array of nodes. - */ - public function __call($var, $unused) - { - switch ($var) { - case 'content': - $prefix = $this->_element->lookupPrefix('http://purl.org/rss/1.0/modules/content/'); - return parent::__call("$prefix:encoded", $unused); - default: - return parent::__call($var, $unused); - } - } -} diff --git a/library/vendor/Zend/Feed/Exception.php b/library/vendor/Zend/Feed/Exception.php deleted file mode 100644 index 70d84f2c3..000000000 --- a/library/vendor/Zend/Feed/Exception.php +++ /dev/null @@ -1,41 +0,0 @@ -getHubs(); - } - - /** - * Allows the external environment to make Zend_Oauth use a specific - * Client instance. - * - * @param Zend_Http_Client $httpClient - * @return void - */ - public static function setHttpClient(Zend_Http_Client $httpClient) - { - self::$httpClient = $httpClient; - } - - /** - * Return the singleton instance of the HTTP Client. Note that - * the instance is reset and cleared of previous parameters GET/POST. - * Headers are NOT reset but handled by this component if applicable. - * - * @return Zend_Http_Client - */ - public static function getHttpClient() - { - if (!isset(self::$httpClient)): - self::$httpClient = new Zend_Http_Client; - else: - self::$httpClient->resetParameters(); - endif; - return self::$httpClient; - } - - /** - * Simple mechanism to delete the entire singleton HTTP Client instance - * which forces an new instantiation for subsequent requests. - * - * @return void - */ - public static function clearHttpClient() - { - self::$httpClient = null; - } - - /** - * RFC 3986 safe url encoding method - * - * @param string $string - * @return string - */ - public static function urlencode($string) - { - $rawencoded = rawurlencode($string); - $rfcencoded = str_replace('%7E', '~', $rawencoded); - return $rfcencoded; - } -} diff --git a/library/vendor/Zend/Feed/Pubsubhubbub/CallbackAbstract.php b/library/vendor/Zend/Feed/Pubsubhubbub/CallbackAbstract.php deleted file mode 100644 index 87e7a98b0..000000000 --- a/library/vendor/Zend/Feed/Pubsubhubbub/CallbackAbstract.php +++ /dev/null @@ -1,309 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|Zend_Config $config Options array or Zend_Config instance - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract - */ - public function setConfig($config) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); - } - if (array_key_exists('storage', $config)) { - $this->setStorage($config['storage']); - } - return $this; - } - - /** - * Send the response, including all headers. - * If you wish to handle this via Zend_Controller, use the getter methods - * to retrieve any data needed to be set on your HTTP Response object, or - * simply give this object the HTTP Response instance to work with for you! - * - * @return void - */ - public function sendResponse() - { - $this->getHttpResponse()->sendResponse(); - } - - /** - * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used - * to background save any verification tokens associated with a subscription - * or other. - * - * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract - */ - public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * Gets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used - * to background save any verification tokens associated with a subscription - * or other. - * - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface - */ - public function getStorage() - { - if ($this->_storage === null) { - throw new Zend_Feed_Pubsubhubbub_Exception('No storage object has been' - . ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface'); - } - return $this->_storage; - } - - /** - * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. - * - * @param Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http $httpResponse - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract - */ - public function setHttpResponse($httpResponse) - { - if (!is_object($httpResponse) - || (!$httpResponse instanceof Zend_Feed_Pubsubhubbub_HttpResponse - && !$httpResponse instanceof Zend_Controller_Response_Http) - ) { - throw new Zend_Feed_Pubsubhubbub_Exception('HTTP Response object must' - . ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or' - . ' Zend_Controller_Response_Http'); - } - $this->_httpResponse = $httpResponse; - return $this; - } - - /** - * An instance of a class handling Http Responses. This is implemented in - * Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with - * (i.e. not inherited from) Zend_Controller_Response_Http. - * - * @return Zend_Feed_Pubsubhubbub_HttpResponse|Zend_Controller_Response_Http - */ - public function getHttpResponse() - { - if ($this->_httpResponse === null) { - $this->_httpResponse = new Zend_Feed_Pubsubhubbub_HttpResponse; - } - return $this->_httpResponse; - } - - /** - * Sets the number of Subscribers for which any updates are on behalf of. - * In other words, is this class serving one or more subscribers? How many? - * Defaults to 1 if left unchanged. - * - * @param string|int $count - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_CallbackAbstract - */ - public function setSubscriberCount($count) - { - $count = intval($count); - if ($count <= 0) { - throw new Zend_Feed_Pubsubhubbub_Exception('Subscriber count must be' - . ' greater than zero'); - } - $this->_subscriberCount = $count; - return $this; - } - - /** - * Gets the number of Subscribers for which any updates are on behalf of. - * In other words, is this class serving one or more subscribers? How many? - * - * @return int - */ - public function getSubscriberCount() - { - return $this->_subscriberCount; - } - - /** - * Attempt to detect the callback URL (specifically the path forward) - */ - protected function _detectCallbackUrl() - { - $callbackUrl = ''; - if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { - $callbackUrl = $_SERVER['HTTP_X_ORIGINAL_URL']; - } elseif (isset($_SERVER['HTTP_X_REWRITE_URL'])) { - $callbackUrl = $_SERVER['HTTP_X_REWRITE_URL']; - } elseif (isset($_SERVER['REQUEST_URI'])) { - $callbackUrl = $_SERVER['REQUEST_URI']; - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $schemeAndHttpHost = $scheme . '://' . $this->_getHttpHost(); - if (strpos($callbackUrl, $schemeAndHttpHost) === 0) { - $callbackUrl = substr($callbackUrl, strlen($schemeAndHttpHost)); - } - } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { - $callbackUrl= $_SERVER['ORIG_PATH_INFO']; - if (!empty($_SERVER['QUERY_STRING'])) { - $callbackUrl .= '?' . $_SERVER['QUERY_STRING']; - } - } - return $callbackUrl; - } - - /** - * Get the HTTP host - * - * @return string - */ - protected function _getHttpHost() - { - if (!empty($_SERVER['HTTP_HOST'])) { - return $_SERVER['HTTP_HOST']; - } - $scheme = 'http'; - if ($_SERVER['HTTPS'] == 'on') { - $scheme = 'https'; - } - $name = $_SERVER['SERVER_NAME']; - $port = $_SERVER['SERVER_PORT']; - if (($scheme == 'http' && $port == 80) - || ($scheme == 'https' && $port == 443) - ) { - return $name; - } else { - return $name . ':' . $port; - } - } - - /** - * Retrieve a Header value from either $_SERVER or Apache - * - * @param string $header - * @return bool - */ - protected function _getHeader($header) - { - $temp = strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { - return $_SERVER[$temp]; - } - $temp = 'HTTP_' . strtoupper(str_replace('-', '_', $header)); - if (!empty($_SERVER[$temp])) { - return $_SERVER[$temp]; - } - if (function_exists('apache_request_headers')) { - $headers = apache_request_headers(); - if (!empty($headers[$header])) { - return $headers[$header]; - } - } - return false; - } - - /** - * Return the raw body of the request - * - * @return string|false Raw body, or false if not present - */ - protected function _getRawBody() - { - $body = file_get_contents('php://input'); - if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) { - $body = $GLOBALS['HTTP_RAW_POST_DATA']; - } - if (strlen(trim($body)) > 0) { - return $body; - } - return false; - } -} diff --git a/library/vendor/Zend/Feed/Pubsubhubbub/CallbackInterface.php b/library/vendor/Zend/Feed/Pubsubhubbub/CallbackInterface.php deleted file mode 100644 index d655c1bb4..000000000 --- a/library/vendor/Zend/Feed/Pubsubhubbub/CallbackInterface.php +++ /dev/null @@ -1,69 +0,0 @@ -sendHeaders(); - echo $this->getBody(); - } - - /** - * Send all headers - * - * Sends any headers specified. If an {@link setHttpResponseCode() HTTP response code} - * has been specified, it is sent with the first header. - * - * @return void - */ - public function sendHeaders() - { - if (count($this->_headers) || (200 != $this->_httpResponseCode)) { - $this->canSendHeaders(true); - } elseif (200 == $this->_httpResponseCode) { - return; - } - $httpCodeSent = false; - foreach ($this->_headers as $header) { - if (!$httpCodeSent && $this->_httpResponseCode) { - header($header['name'] . ': ' . $header['value'], $header['replace'], $this->_httpResponseCode); - $httpCodeSent = true; - } else { - header($header['name'] . ': ' . $header['value'], $header['replace']); - } - } - if (!$httpCodeSent) { - header('HTTP/1.1 ' . $this->_httpResponseCode); - $httpCodeSent = true; - } - } - - /** - * Set a header - * - * If $replace is true, replaces any headers already defined with that - * $name. - * - * @param string $name - * @param string $value - * @param boolean $replace - * @return Zend_Feed_Pubsubhubbub_HttpResponse - */ - public function setHeader($name, $value, $replace = false) - { - $name = $this->_normalizeHeader($name); - $value = (string) $value; - if ($replace) { - foreach ($this->_headers as $key => $header) { - if ($name == $header['name']) { - unset($this->_headers[$key]); - } - } - } - $this->_headers[] = array( - 'name' => $name, - 'value' => $value, - 'replace' => $replace, - ); - - return $this; - } - - /** - * Check if a specific Header is set and return its value - * - * @param string $name - * @return string|null - */ - public function getHeader($name) - { - $name = $this->_normalizeHeader($name); - foreach ($this->_headers as $header) { - if ($header['name'] == $name) { - return $header['value']; - } - } - } - - /** - * Return array of headers; see {@link $_headers} for format - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * Can we send headers? - * - * @param boolean $throw Whether or not to throw an exception if headers have been sent; defaults to false - * @return boolean - * @throws Zend_Feed_Pubsubhubbub_Exception - */ - public function canSendHeaders($throw = false) - { - $ok = headers_sent($file, $line); - if ($ok && $throw) { - throw new Zend_Feed_Pubsubhubbub_Exception('Cannot send headers; headers already sent in ' . $file . ', line ' . $line); - } - return !$ok; - } - - /** - * Set HTTP response code to use with headers - * - * @param int $code - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_HttpResponse - */ - public function setHttpResponseCode($code) - { - if (!is_int($code) || (100 > $code) || (599 < $code)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid HTTP response' - . ' code:' . $code); - } - $this->_httpResponseCode = $code; - return $this; - } - - /** - * Retrieve HTTP response code - * - * @return int - */ - public function getHttpResponseCode() - { - return $this->_httpResponseCode; - } - - /** - * Set body content - * - * @param string $content - * @return Zend_Feed_Pubsubhubbub_HttpResponse - */ - public function setBody($content) - { - $this->_body = (string) $content; - $this->setHeader('content-length', strlen($content)); - return $this; - } - - /** - * Return the body content - * - * @return string - */ - public function getBody() - { - return $this->_body; - } - - /** - * Normalizes a header name to X-Capitalized-Names - * - * @param string $name - * @return string - */ - protected function _normalizeHeader($name) - { - $filtered = str_replace(array('-', '_'), ' ', (string) $name); - $filtered = ucwords(strtolower($filtered)); - $filtered = str_replace(' ', '-', $filtered); - return $filtered; - } -} diff --git a/library/vendor/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php b/library/vendor/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php deleted file mode 100644 index ad0807b36..000000000 --- a/library/vendor/Zend/Feed/Pubsubhubbub/Model/ModelAbstract.php +++ /dev/null @@ -1,61 +0,0 @@ -_db = new Zend_Db_Table($table); - } else { - $this->_db = $tableGateway; - } - } - -} diff --git a/library/vendor/Zend/Feed/Pubsubhubbub/Model/Subscription.php b/library/vendor/Zend/Feed/Pubsubhubbub/Model/Subscription.php deleted file mode 100644 index 0917d778d..000000000 --- a/library/vendor/Zend/Feed/Pubsubhubbub/Model/Subscription.php +++ /dev/null @@ -1,135 +0,0 @@ -_db->find($data['id']); - if (count($result)) { - $data['created_time'] = $result->current()->created_time; - $now = new Zend_Date; - if (isset($data['lease_seconds'])) { - $data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'); - } - $this->_db->update( - $data, - $this->_db->getAdapter()->quoteInto('id = ?', $data['id']) - ); - return false; - } - - $this->_db->insert($data); - return true; - } - - /** - * Get subscription by ID/key - * - * @param string $key - * @throws Zend_Db_Table_Exception - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return array - */ - public function getSubscription($key) - { - if (empty($key) || !is_string($key)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' - .' of "' . $key . '" must be a non-empty string'); - } - $result = $this->_db->find($key); - if (count($result)) { - return $result->current()->toArray(); - } - return false; - } - - /** - * Determine if a subscription matching the key exists - * - * @param string $key - * @throws Zend_Db_Table_Exception - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return bool - */ - public function hasSubscription($key) - { - if (empty($key) || !is_string($key)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "key"' - .' of "' . $key . '" must be a non-empty string'); - } - $result = $this->_db->find($key); - if (count($result)) { - return true; - } - return false; - } - - /** - * Delete a subscription - * - * @param string $key - * @return bool - */ - public function deleteSubscription($key) - { - $result = $this->_db->find($key); - if (count($result)) { - $this->_db->delete( - $this->_db->getAdapter()->quoteInto('id = ?', $key) - ); - return true; - } - return false; - } - -} diff --git a/library/vendor/Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php b/library/vendor/Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php deleted file mode 100644 index c604ff1fc..000000000 --- a/library/vendor/Zend/Feed/Pubsubhubbub/Model/SubscriptionInterface.php +++ /dev/null @@ -1,65 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|Zend_Config $config Options array or Zend_Config instance - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function setConfig($config) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' - . 'expected, got ' . gettype($config)); - } - if (array_key_exists('hubUrls', $config)) { - $this->addHubUrls($config['hubUrls']); - } - if (array_key_exists('updatedTopicUrls', $config)) { - $this->addUpdatedTopicUrls($config['updatedTopicUrls']); - } - if (array_key_exists('parameters', $config)) { - $this->setParameters($config['parameters']); - } - return $this; - } - - /** - * Add a Hub Server URL supported by Publisher - * - * @param string $url - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function addHubUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $this->_hubUrls[] = $url; - return $this; - } - - /** - * Add an array of Hub Server URLs supported by Publisher - * - * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function addHubUrls(array $urls) - { - foreach ($urls as $url) { - $this->addHubUrl($url); - } - return $this; - } - - /** - * Remove a Hub Server URL - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function removeHubUrl($url) - { - if (!in_array($url, $this->getHubUrls())) { - return $this; - } - $key = array_search($url, $this->_hubUrls); - unset($this->_hubUrls[$key]); - return $this; - } - - /** - * Return an array of unique Hub Server URLs currently available - * - * @return array - */ - public function getHubUrls() - { - $this->_hubUrls = array_unique($this->_hubUrls); - return $this->_hubUrls; - } - - /** - * Add a URL to a topic (Atom or RSS feed) which has been updated - * - * @param string $url - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function addUpdatedTopicUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $this->_updatedTopicUrls[] = $url; - return $this; - } - - /** - * Add an array of Topic URLs which have been updated - * - * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function addUpdatedTopicUrls(array $urls) - { - foreach ($urls as $url) { - $this->addUpdatedTopicUrl($url); - } - return $this; - } - - /** - * Remove an updated topic URL - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function removeUpdatedTopicUrl($url) - { - if (!in_array($url, $this->getUpdatedTopicUrls())) { - return $this; - } - $key = array_search($url, $this->_updatedTopicUrls); - unset($this->_updatedTopicUrls[$key]); - return $this; - } - - /** - * Return an array of unique updated topic URLs currently available - * - * @return array - */ - public function getUpdatedTopicUrls() - { - $this->_updatedTopicUrls = array_unique($this->_updatedTopicUrls); - return $this->_updatedTopicUrls; - } - - /** - * Notifies a single Hub Server URL of changes - * - * @param string $url The Hub Server's URL - * @return void - * @throws Zend_Feed_Pubsubhubbub_Exception Thrown on failure - */ - public function notifyHub($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .'URL'); - } - $client = $this->_getHttpClient(); - $client->setUri($url); - $response = $client->request(); - if ($response->getStatus() !== 204) { - throw new Zend_Feed_Pubsubhubbub_Exception('Notification to Hub Server ' - . 'at "' . $url . '" appears to have failed with a status code of "' - . $response->getStatus() . '" and message "' - . $response->getMessage() . '"'); - } - } - - /** - * Notifies all Hub Server URLs of changes - * - * If a Hub notification fails, certain data will be retained in an - * an array retrieved using getErrors(), if a failure occurs for any Hubs - * the isSuccess() check will return FALSE. This method is designed not - * to needlessly fail with an Exception/Error unless from Zend_Http_Client. - * - * @return void - * @throws Zend_Feed_Pubsubhubbub_Exception Thrown if no hubs attached - */ - public function notifyAll() - { - $client = $this->_getHttpClient(); - $hubs = $this->getHubUrls(); - if (empty($hubs)) { - throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' - . ' have been set so no notifcations can be sent'); - } - $this->_errors = array(); - foreach ($hubs as $url) { - $client->setUri($url); - $response = $client->request(); - if ($response->getStatus() !== 204) { - $this->_errors[] = array( - 'response' => $response, - 'hubUrl' => $url - ); - } - } - } - - /** - * Add an optional parameter to the update notification requests - * - * @param string $name - * @param string|null $value - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function setParameter($name, $value = null) - { - if (is_array($name)) { - $this->setParameters($name); - return $this; - } - if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' - .' of "' . $name . '" must be a non-empty string'); - } - if ($value === null) { - $this->removeParameter($name); - return $this; - } - if (empty($value) || (!is_string($value) && $value !== null)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' - .' of "' . $value . '" must be a non-empty string'); - } - $this->_parameters[$name] = $value; - return $this; - } - - /** - * Add an optional parameter to the update notification requests - * - * @param array $parameters - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function setParameters(array $parameters) - { - foreach ($parameters as $name => $value) { - $this->setParameter($name, $value); - } - return $this; - } - - /** - * Remove an optional parameter for the notification requests - * - * @param string $name - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Publisher - */ - public function removeParameter($name) - { - if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' - .' of "' . $name . '" must be a non-empty string'); - } - if (array_key_exists($name, $this->_parameters)) { - unset($this->_parameters[$name]); - } - return $this; - } - - /** - * Return an array of optional parameters for notification requests - * - * @return array - */ - public function getParameters() - { - return $this->_parameters; - } - - /** - * Returns a boolean indicator of whether the notifications to Hub - * Servers were ALL successful. If even one failed, FALSE is returned. - * - * @return bool - */ - public function isSuccess() - { - if (count($this->_errors) > 0) { - return false; - } - return true; - } - - /** - * Return an array of errors met from any failures, including keys: - * 'response' => the Zend_Http_Response object from the failure - * 'hubUrl' => the URL of the Hub Server whose notification failed - * - * @return array - */ - public function getErrors() - { - return $this->_errors; - } - - /** - * Get a basic prepared HTTP client for use - * - * @throws Zend_Feed_Pubsubhubbub_Exception - * @throws Zend_Http_Client_Exception - * @return Zend_Http_Client - */ - protected function _getHttpClient() - { - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $client->setMethod(Zend_Http_Client::POST); - $client->setConfig(array( - 'useragent' => 'Zend_Feed_Pubsubhubbub_Publisher/' . Zend_Version::VERSION, - )); - $params = array(); - $params[] = 'hub.mode=publish'; - $topics = $this->getUpdatedTopicUrls(); - if (empty($topics)) { - throw new Zend_Feed_Pubsubhubbub_Exception('No updated topic URLs' - . ' have been set'); - } - foreach ($topics as $topicUrl) { - $params[] = 'hub.url=' . urlencode($topicUrl); - } - $optParams = $this->getParameters(); - foreach ($optParams as $name => $value) { - $params[] = urlencode($name) . '=' . urlencode($value); - } - $paramString = implode('&', $params); - $client->setRawData($paramString, 'application/x-www-form-urlencoded'); - return $client; - } -} diff --git a/library/vendor/Zend/Feed/Pubsubhubbub/Subscriber.php b/library/vendor/Zend/Feed/Pubsubhubbub/Subscriber.php deleted file mode 100644 index 5e3faca59..000000000 --- a/library/vendor/Zend/Feed/Pubsubhubbub/Subscriber.php +++ /dev/null @@ -1,852 +0,0 @@ -setConfig($config); - } - } - - /** - * Process any injected configuration options - * - * @param array|Zend_Config $config Options array or Zend_Config instance - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setConfig($config) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - } elseif (!is_array($config)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Array or Zend_Config object' - . ' expected, got ' . gettype($config)); - } - if (array_key_exists('hubUrls', $config)) { - $this->addHubUrls($config['hubUrls']); - } - if (array_key_exists('callbackUrl', $config)) { - $this->setCallbackUrl($config['callbackUrl']); - } - if (array_key_exists('topicUrl', $config)) { - $this->setTopicUrl($config['topicUrl']); - } - if (array_key_exists('storage', $config)) { - $this->setStorage($config['storage']); - } - if (array_key_exists('leaseSeconds', $config)) { - $this->setLeaseSeconds($config['leaseSeconds']); - } - if (array_key_exists('parameters', $config)) { - $this->setParameters($config['parameters']); - } - if (array_key_exists('authentications', $config)) { - $this->addAuthentications($config['authentications']); - } - if (array_key_exists('usePathParameter', $config)) { - $this->usePathParameter($config['usePathParameter']); - } - if (array_key_exists('preferredVerificationMode', $config)) { - $this->setPreferredVerificationMode( - $config['preferredVerificationMode'] - ); - } - return $this; - } - - /** - * Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe - * event will relate - * - * @param string $url - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setTopicUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - .' of "' . $url . '" must be a non-empty string and a valid' - .' URL'); - } - $this->_topicUrl = $url; - return $this; - } - - /** - * Set the topic URL (RSS or Atom feed) to which the intended (un)subscribe - * event will relate - * - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return string - */ - public function getTopicUrl() - { - if (empty($this->_topicUrl)) { - throw new Zend_Feed_Pubsubhubbub_Exception('A valid Topic (RSS or Atom' - . ' feed) URL MUST be set before attempting any operation'); - } - return $this->_topicUrl; - } - - /** - * Set the number of seconds for which any subscription will remain valid - * - * @param int $seconds - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setLeaseSeconds($seconds) - { - $seconds = intval($seconds); - if ($seconds <= 0) { - throw new Zend_Feed_Pubsubhubbub_Exception('Expected lease seconds' - . ' must be an integer greater than zero'); - } - $this->_leaseSeconds = $seconds; - return $this; - } - - /** - * Get the number of lease seconds on subscriptions - * - * @return int - */ - public function getLeaseSeconds() - { - return $this->_leaseSeconds; - } - - /** - * Set the callback URL to be used by Hub Servers when communicating with - * this Subscriber - * - * @param string $url - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setCallbackUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - . ' of "' . $url . '" must be a non-empty string and a valid' - . ' URL'); - } - $this->_callbackUrl = $url; - return $this; - } - - /** - * Get the callback URL to be used by Hub Servers when communicating with - * this Subscriber - * - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return string - */ - public function getCallbackUrl() - { - if (empty($this->_callbackUrl)) { - throw new Zend_Feed_Pubsubhubbub_Exception('A valid Callback URL MUST be' - . ' set before attempting any operation'); - } - return $this->_callbackUrl; - } - - /** - * Set preferred verification mode (sync or async). By default, this - * Subscriber prefers synchronous verification, but does support - * asynchronous if that's the Hub Server's utilised mode. - * - * Zend_Feed_Pubsubhubbub_Subscriber will always send both modes, whose - * order of occurance in the parameter list determines this preference. - * - * @param string $mode Should be 'sync' or 'async' - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setPreferredVerificationMode($mode) - { - if ($mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC - && $mode !== Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid preferred' - . ' mode specified: "' . $mode . '" but should be one of' - . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC or' - . ' Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC'); - } - $this->_preferredVerificationMode = $mode; - return $this; - } - - /** - * Get preferred verification mode (sync or async). - * - * @return string - */ - public function getPreferredVerificationMode() - { - return $this->_preferredVerificationMode; - } - - /** - * Add a Hub Server URL supported by Publisher - * - * @param string $url - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function addHubUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - . ' of "' . $url . '" must be a non-empty string and a valid' - . ' URL'); - } - $this->_hubUrls[] = $url; - return $this; - } - - /** - * Add an array of Hub Server URLs supported by Publisher - * - * @param array $urls - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function addHubUrls(array $urls) - { - foreach ($urls as $url) { - $this->addHubUrl($url); - } - return $this; - } - - /** - * Remove a Hub Server URL - * - * @param string $url - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function removeHubUrl($url) - { - if (!in_array($url, $this->getHubUrls())) { - return $this; - } - $key = array_search($url, $this->_hubUrls); - unset($this->_hubUrls[$key]); - return $this; - } - - /** - * Return an array of unique Hub Server URLs currently available - * - * @return array - */ - public function getHubUrls() - { - $this->_hubUrls = array_unique($this->_hubUrls); - return $this->_hubUrls; - } - - /** - * Add authentication credentials for a given URL - * - * @param string $url - * @param array $authentication - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function addAuthentication($url, array $authentication) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "url"' - . ' of "' . $url . '" must be a non-empty string and a valid' - . ' URL'); - } - $this->_authentications[$url] = $authentication; - return $this; - } - - /** - * Add authentication credentials for hub URLs - * - * @param array $authentications - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function addAuthentications(array $authentications) - { - foreach ($authentications as $url => $authentication) { - $this->addAuthentication($url, $authentication); - } - return $this; - } - - /** - * Get all hub URL authentication credentials - * - * @return array - */ - public function getAuthentications() - { - return $this->_authentications; - } - - /** - * Set flag indicating whether or not to use a path parameter - * - * @param bool $bool - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function usePathParameter($bool = true) - { - $this->_usePathParameter = $bool; - return $this; - } - - /** - * Add an optional parameter to the (un)subscribe requests - * - * @param string $name - * @param string|null $value - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setParameter($name, $value = null) - { - if (is_array($name)) { - $this->setParameters($name); - return $this; - } - if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' - . ' of "' . $name . '" must be a non-empty string'); - } - if ($value === null) { - $this->removeParameter($name); - return $this; - } - if (empty($value) || (!is_string($value) && $value !== null)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "value"' - . ' of "' . $value . '" must be a non-empty string'); - } - $this->_parameters[$name] = $value; - return $this; - } - - /** - * Add an optional parameter to the (un)subscribe requests - * - * @param array $parameters - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setParameters(array $parameters) - { - foreach ($parameters as $name => $value) { - $this->setParameter($name, $value); - } - return $this; - } - - /** - * Remove an optional parameter for the (un)subscribe requests - * - * @param string $name - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function removeParameter($name) - { - if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid parameter "name"' - . ' of "' . $name . '" must be a non-empty string'); - } - if (array_key_exists($name, $this->_parameters)) { - unset($this->_parameters[$name]); - } - return $this; - } - - /** - * Return an array of optional parameters for (un)subscribe requests - * - * @return array - */ - public function getParameters() - { - return $this->_parameters; - } - - /** - * Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used to background - * save any verification tokens associated with a subscription or other. - * - * @param Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage - * @return Zend_Feed_Pubsubhubbub_Subscriber - */ - public function setStorage(Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * Gets an instance of Zend_Feed_Pubsubhubbub_Storage_StorageInterface used - * to background save any verification tokens associated with a subscription - * or other. - * - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface - */ - public function getStorage() - { - if ($this->_storage === null) { - throw new Zend_Feed_Pubsubhubbub_Exception('No storage vehicle ' - . 'has been set.'); - } - return $this->_storage; - } - - /** - * Subscribe to one or more Hub Servers using the stored Hub URLs - * for the given Topic URL (RSS or Atom feed) - */ - public function subscribeAll() - { - return $this->_doRequest('subscribe'); - } - - /** - * Unsubscribe from one or more Hub Servers using the stored Hub URLs - * for the given Topic URL (RSS or Atom feed) - */ - public function unsubscribeAll() - { - return $this->_doRequest('unsubscribe'); - } - - /** - * Returns a boolean indicator of whether the notifications to Hub - * Servers were ALL successful. If even one failed, FALSE is returned. - * - * @return bool - */ - public function isSuccess() - { - if (count($this->_errors) > 0) { - return false; - } - return true; - } - - /** - * Return an array of errors met from any failures, including keys: - * 'response' => the Zend_Http_Response object from the failure - * 'hubUrl' => the URL of the Hub Server whose notification failed - * - * @return array - */ - public function getErrors() - { - return $this->_errors; - } - - /** - * Return an array of Hub Server URLs who returned a response indicating - * operation in Asynchronous Verification Mode, i.e. they will not confirm - * any (un)subscription immediately but at a later time (Hubs may be - * doing this as a batch process when load balancing) - * - * @return array - */ - public function getAsyncHubs() - { - return $this->_asyncHubs; - } - - /** - * Executes an (un)subscribe request - * - * @param string $mode - * @throws Zend_Feed_Pubsubhubbub_Exception - * @throws Zend_Http_Client_Exception - */ - protected function _doRequest($mode) - { - $client = $this->_getHttpClient(); - $hubs = $this->getHubUrls(); - if (empty($hubs)) { - throw new Zend_Feed_Pubsubhubbub_Exception('No Hub Server URLs' - . ' have been set so no subscriptions can be attempted'); - } - $this->_errors = array(); - $this->_asyncHubs = array(); - foreach ($hubs as $url) { - if (array_key_exists($url, $this->_authentications)) { - $auth = $this->_authentications[$url]; - $client->setAuth($auth[0], $auth[1]); - } - $client->setUri($url); - $client->setRawData( - $this->_getRequestParameters($url, $mode), - 'application/x-www-form-urlencoded' - ); - $response = $client->request(); - if ($response->getStatus() !== 204 - && $response->getStatus() !== 202 - ) { - $this->_errors[] = array( - 'response' => $response, - 'hubUrl' => $url, - ); - /** - * At first I thought it was needed, but the backend storage will - * allow tracking async without any user interference. It's left - * here in case the user is interested in knowing what Hubs - * are using async verification modes so they may update Models and - * move these to asynchronous processes. - */ - } elseif ($response->getStatus() == 202) { - $this->_asyncHubs[] = array( - 'response' => $response, - 'hubUrl' => $url, - ); - } - } - } - - /** - * Get a basic prepared HTTP client for use - * - * @return Zend_Http_Client - */ - protected function _getHttpClient() - { - $client = Zend_Feed_Pubsubhubbub::getHttpClient(); - $client->setMethod(Zend_Http_Client::POST); - $client->setConfig(array('useragent' => 'Zend_Feed_Pubsubhubbub_Subscriber/' - . Zend_Version::VERSION)); - return $client; - } - - /** - * Return a list of standard protocol/optional parameters for addition to - * client's POST body that are specific to the current Hub Server URL - * - * @param string $hubUrl - * @param string $mode - * @throws Zend_Feed_Pubsubhubbub_Exception - * @return string - */ - protected function _getRequestParameters($hubUrl, $mode) - { - if (!in_array($mode, array('subscribe', 'unsubscribe'))) { - throw new Zend_Feed_Pubsubhubbub_Exception('Invalid mode specified: "' - . $mode . '" which should have been "subscribe" or "unsubscribe"'); - } - - $params = array( - 'hub.mode' => $mode, - 'hub.topic' => $this->getTopicUrl(), - ); - - if ($this->getPreferredVerificationMode() - == Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC - ) { - $vmodes = array( - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, - ); - } else { - $vmodes = array( - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_ASYNC, - Zend_Feed_Pubsubhubbub::VERIFICATION_MODE_SYNC, - ); - } - $params['hub.verify'] = array(); - foreach($vmodes as $vmode) { - $params['hub.verify'][] = $vmode; - } - - /** - * Establish a persistent verify_token and attach key to callback - * URL's path/querystring - */ - $key = $this->_generateSubscriptionKey($params, $hubUrl); - $token = $this->_generateVerifyToken(); - $params['hub.verify_token'] = $token; - - // Note: query string only usable with PuSH 0.2 Hubs - if (!$this->_usePathParameter) { - $params['hub.callback'] = $this->getCallbackUrl() - . '?xhub.subscription=' . Zend_Feed_Pubsubhubbub::urlencode($key); - } else { - $params['hub.callback'] = rtrim($this->getCallbackUrl(), '/') - . '/' . Zend_Feed_Pubsubhubbub::urlencode($key); - } - if ($mode == 'subscribe' && $this->getLeaseSeconds() !== null) { - $params['hub.lease_seconds'] = $this->getLeaseSeconds(); - } - - // hub.secret not currently supported - $optParams = $this->getParameters(); - foreach ($optParams as $name => $value) { - $params[$name] = $value; - } - - // store subscription to storage - $now = new Zend_Date; - $expires = null; - if (isset($params['hub.lease_seconds'])) { - $expires = $now->add($params['hub.lease_seconds'], Zend_Date::SECOND) - ->get('yyyy-MM-dd HH:mm:ss'); - } - $data = array( - 'id' => $key, - 'topic_url' => $params['hub.topic'], - 'hub_url' => $hubUrl, - 'created_time' => $now->get('yyyy-MM-dd HH:mm:ss'), - 'lease_seconds' => $expires, - 'verify_token' => hash('sha256', $params['hub.verify_token']), - 'secret' => null, - 'expiration_time' => $expires, - 'subscription_state' => Zend_Feed_Pubsubhubbub::SUBSCRIPTION_NOTVERIFIED, - ); - $this->getStorage()->setSubscription($data); - - return $this->_toByteValueOrderedString( - $this->_urlEncode($params) - ); - } - - /** - * Simple helper to generate a verification token used in (un)subscribe - * requests to a Hub Server. Follows no particular method, which means - * it might be improved/changed in future. - * - * @return string - */ - protected function _generateVerifyToken() - { - if (!empty($this->_testStaticToken)) { - return $this->_testStaticToken; - } - return uniqid(rand(), true) . time(); - } - - /** - * Simple helper to generate a verification token used in (un)subscribe - * requests to a Hub Server. - * - * @param array $params - * @param string $hubUrl The Hub Server URL for which this token will apply - * @return string - */ - protected function _generateSubscriptionKey(array $params, $hubUrl) - { - $keyBase = $params['hub.topic'] . $hubUrl; - $key = md5($keyBase); - return $key; - } - - /** - * URL Encode an array of parameters - * - * @param array $params - * @return array - */ - protected function _urlEncode(array $params) - { - $encoded = array(); - foreach ($params as $key => $value) { - if (is_array($value)) { - $ekey = Zend_Feed_Pubsubhubbub::urlencode($key); - $encoded[$ekey] = array(); - foreach ($value as $duplicateKey) { - $encoded[$ekey][] - = Zend_Feed_Pubsubhubbub::urlencode($duplicateKey); - } - } else { - $encoded[Zend_Feed_Pubsubhubbub::urlencode($key)] - = Zend_Feed_Pubsubhubbub::urlencode($value); - } - } - return $encoded; - } - - /** - * Order outgoing parameters - * - * @param array $params - * @return array - */ - protected function _toByteValueOrderedString(array $params) - { - $return = array(); - uksort($params, 'strnatcmp'); - foreach ($params as $key => $value) { - if (is_array($value)) { - foreach ($value as $keyduplicate) { - $return[] = $key . '=' . $keyduplicate; - } - } else { - $return[] = $key . '=' . $value; - } - } - return implode('&', $return); - } - - /** - * This is STRICTLY for testing purposes only... - */ - protected $_testStaticToken = null; - - final public function setTestStaticToken($token) - { - $this->_testStaticToken = (string) $token; - } -} diff --git a/library/vendor/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php b/library/vendor/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php deleted file mode 100644 index e50a90e5f..000000000 --- a/library/vendor/Zend/Feed/Pubsubhubbub/Subscriber/Callback.php +++ /dev/null @@ -1,327 +0,0 @@ -_subscriptionKey = $key; - return $this; - } - - /** - * Handle any callback from a Hub Server responding to a subscription or - * unsubscription request. This should be the Hub Server confirming the - * the request prior to taking action on it. - * - * @param array $httpGetData GET data if available and not in $_GET - * @param bool $sendResponseNow Whether to send response now or when asked - * @return void - */ - public function handle(array $httpGetData = null, $sendResponseNow = false) - { - if ($httpGetData === null) { - $httpGetData = $_GET; - } - - /** - * Handle any feed updates (sorry for the mess :P) - * - * This DOES NOT attempt to process a feed update. Feed updates - * SHOULD be validated/processed by an asynchronous process so as - * to avoid holding up responses to the Hub. - */ - $contentType = $this->_getHeader('Content-Type'); - if (strtolower($_SERVER['REQUEST_METHOD']) == 'post' - && $this->_hasValidVerifyToken(null, false) - && (stripos($contentType, 'application/atom+xml') === 0 - || stripos($contentType, 'application/rss+xml') === 0 - || stripos($contentType, 'application/xml') === 0 - || stripos($contentType, 'text/xml') === 0 - || stripos($contentType, 'application/rdf+xml') === 0) - ) { - $this->setFeedUpdate($this->_getRawBody()); - $this->getHttpResponse() - ->setHeader('X-Hub-On-Behalf-Of', $this->getSubscriberCount()); - /** - * Handle any (un)subscribe confirmation requests - */ - } elseif ($this->isValidHubVerification($httpGetData)) { - $data = $this->_currentSubscriptionData; - $this->getHttpResponse()->setBody($httpGetData['hub_challenge']); - $data['subscription_state'] = Zend_Feed_Pubsubhubbub::SUBSCRIPTION_VERIFIED; - if (isset($httpGetData['hub_lease_seconds'])) { - $data['lease_seconds'] = $httpGetData['hub_lease_seconds']; - } - $this->getStorage()->setSubscription($data); - /** - * Hey, C'mon! We tried everything else! - */ - } else { - $this->getHttpResponse()->setHttpResponseCode(404); - } - if ($sendResponseNow) { - $this->sendResponse(); - } - } - - /** - * Checks validity of the request simply by making a quick pass and - * confirming the presence of all REQUIRED parameters. - * - * @param array $httpGetData - * @return bool - */ - public function isValidHubVerification(array $httpGetData) - { - /** - * As per the specification, the hub.verify_token is OPTIONAL. This - * implementation of Pubsubhubbub considers it REQUIRED and will - * always send a hub.verify_token parameter to be echoed back - * by the Hub Server. Therefore, its absence is considered invalid. - */ - if (strtolower($_SERVER['REQUEST_METHOD']) !== 'get') { - return false; - } - $required = array( - 'hub_mode', - 'hub_topic', - 'hub_challenge', - 'hub_verify_token', - ); - foreach ($required as $key) { - if (!array_key_exists($key, $httpGetData)) { - return false; - } - } - if ($httpGetData['hub_mode'] !== 'subscribe' - && $httpGetData['hub_mode'] !== 'unsubscribe' - ) { - return false; - } - if ($httpGetData['hub_mode'] == 'subscribe' - && !array_key_exists('hub_lease_seconds', $httpGetData) - ) { - return false; - } - if (!Zend_Uri::check($httpGetData['hub_topic'])) { - return false; - } - - /** - * Attempt to retrieve any Verification Token Key attached to Callback - * URL's path by our Subscriber implementation - */ - if (!$this->_hasValidVerifyToken($httpGetData)) { - return false; - } - return true; - } - - /** - * Sets a newly received feed (Atom/RSS) sent by a Hub as an update to a - * Topic we've subscribed to. - * - * @param string $feed - * @return Zend_Feed_Pubsubhubbub_Subscriber_Callback - */ - public function setFeedUpdate($feed) - { - $this->_feedUpdate = $feed; - return $this; - } - - /** - * Check if any newly received feed (Atom/RSS) update was received - * - * @return bool - */ - public function hasFeedUpdate() - { - if ($this->_feedUpdate === null) { - return false; - } - return true; - } - - /** - * Gets a newly received feed (Atom/RSS) sent by a Hub as an update to a - * Topic we've subscribed to. - * - * @return string - */ - public function getFeedUpdate() - { - return $this->_feedUpdate; - } - - /** - * Check for a valid verify_token. By default attempts to compare values - * with that sent from Hub, otherwise merely ascertains its existence. - * - * @param array $httpGetData - * @param bool $checkValue - * @return bool - */ - protected function _hasValidVerifyToken(array $httpGetData = null, $checkValue = true) - { - $verifyTokenKey = $this->_detectVerifyTokenKey($httpGetData); - if (empty($verifyTokenKey)) { - return false; - } - $verifyTokenExists = $this->getStorage()->hasSubscription($verifyTokenKey); - if (!$verifyTokenExists) { - return false; - } - if ($checkValue) { - $data = $this->getStorage()->getSubscription($verifyTokenKey); - $verifyToken = $data['verify_token']; - if ($verifyToken !== hash('sha256', $httpGetData['hub_verify_token'])) { - return false; - } - $this->_currentSubscriptionData = $data; - return true; - } - return true; - } - - /** - * Attempt to detect the verification token key. This would be passed in - * the Callback URL (which we are handling with this class!) as a URI - * path part (the last part by convention). - * - * @param null|array $httpGetData - * @return false|string - */ - protected function _detectVerifyTokenKey(array $httpGetData = null) - { - /** - * Available when sub keys encoding in Callback URL path - */ - if (isset($this->_subscriptionKey)) { - return $this->_subscriptionKey; - } - - /** - * Available only if allowed by PuSH 0.2 Hubs - */ - if (is_array($httpGetData) - && isset($httpGetData['xhub_subscription']) - ) { - return $httpGetData['xhub_subscription']; - } - - /** - * Available (possibly) if corrupted in transit and not part of $_GET - */ - $params = $this->_parseQueryString(); - if (isset($params['xhub.subscription'])) { - return rawurldecode($params['xhub.subscription']); - } - - return false; - } - - /** - * Build an array of Query String parameters. - * This bypasses $_GET which munges parameter names and cannot accept - * multiple parameters with the same key. - * - * @return array|void - */ - protected function _parseQueryString() - { - $params = array(); - $queryString = ''; - if (isset($_SERVER['QUERY_STRING'])) { - $queryString = $_SERVER['QUERY_STRING']; - } - if (empty($queryString)) { - return array(); - } - $parts = explode('&', $queryString); - foreach ($parts as $kvpair) { - $pair = explode('=', $kvpair); - $key = rawurldecode($pair[0]); - $value = rawurldecode($pair[1]); - if (isset($params[$key])) { - if (is_array($params[$key])) { - $params[$key][] = $value; - } else { - $params[$key] = array($params[$key], $value); - } - } else { - $params[$key] = $value; - } - } - return $params; - } -} diff --git a/library/vendor/Zend/Feed/Reader.php b/library/vendor/Zend/Feed/Reader.php deleted file mode 100644 index bac41ab13..000000000 --- a/library/vendor/Zend/Feed/Reader.php +++ /dev/null @@ -1,733 +0,0 @@ - array( - 'DublinCore_Feed', - 'Atom_Feed' - ), - 'entry' => array( - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' - ), - 'core' => array( - 'DublinCore_Feed', - 'Atom_Feed', - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' - ) - ); - - /** - * Get the Feed cache - * - * @return Zend_Cache_Core - */ - public static function getCache() - { - return self::$_cache; - } - - /** - * Set the feed cache - * - * @param Zend_Cache_Core $cache - * @return void - */ - public static function setCache(Zend_Cache_Core $cache) - { - self::$_cache = $cache; - } - - /** - * Set the HTTP client instance - * - * Sets the HTTP client object to use for retrieving the feeds. - * - * @param Zend_Http_Client $httpClient - * @return void - */ - public static function setHttpClient(Zend_Http_Client $httpClient) - { - self::$_httpClient = $httpClient; - } - - - /** - * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used. - * - * @return Zend_Http_Client_Abstract - */ - public static function getHttpClient() - { - if (!self::$_httpClient instanceof Zend_Http_Client) { - /** - * @see Zend_Http_Client - */ - self::$_httpClient = new Zend_Http_Client(); - } - - return self::$_httpClient; - } - - /** - * Toggle using POST instead of PUT and DELETE HTTP methods - * - * Some feed implementations do not accept PUT and DELETE HTTP - * methods, or they can't be used because of proxies or other - * measures. This allows turning on using POST where PUT and - * DELETE would normally be used; in addition, an - * X-Method-Override header will be sent with a value of PUT or - * DELETE as appropriate. - * - * @param boolean $override Whether to override PUT and DELETE. - * @return void - */ - public static function setHttpMethodOverride($override = true) - { - self::$_httpMethodOverride = $override; - } - - /** - * Get the HTTP override state - * - * @return boolean - */ - public static function getHttpMethodOverride() - { - return self::$_httpMethodOverride; - } - - /** - * Set the flag indicating whether or not to use HTTP conditional GET - * - * @param bool $bool - * @return void - */ - public static function useHttpConditionalGet($bool = true) - { - self::$_httpConditionalGet = $bool; - } - - /** - * Import a feed by providing a URL - * - * @param string $url The URL to the feed - * @param string $etag OPTIONAL Last received ETag for this resource - * @param string $lastModified OPTIONAL Last-Modified value for this resource - * @return Zend_Feed_Reader_FeedInterface - */ - public static function import($uri, $etag = null, $lastModified = null) - { - $cache = self::getCache(); - $feed = null; - $responseXml = ''; - $client = self::getHttpClient(); - $client->resetParameters(); - $client->setHeaders('If-None-Match', null); - $client->setHeaders('If-Modified-Since', null); - $client->setUri($uri); - $cacheId = 'Zend_Feed_Reader_' . md5($uri); - - if (self::$_httpConditionalGet && $cache) { - $data = $cache->load($cacheId); - if ($data) { - if ($etag === null) { - $etag = $cache->load($cacheId.'_etag'); - } - if ($lastModified === null) { - $lastModified = $cache->load($cacheId.'_lastmodified'); - } - if ($etag) { - $client->setHeaders('If-None-Match', $etag); - } - if ($lastModified) { - $client->setHeaders('If-Modified-Since', $lastModified); - } - } - $response = $client->request('GET'); - if ($response->getStatus() !== 200 && $response->getStatus() !== 304) { - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); - } - if ($response->getStatus() == 304) { - $responseXml = $data; - } else { - $responseXml = $response->getBody(); - $cache->save($responseXml, $cacheId); - if ($response->getHeader('ETag')) { - $cache->save($response->getHeader('ETag'), $cacheId.'_etag'); - } - if ($response->getHeader('Last-Modified')) { - $cache->save($response->getHeader('Last-Modified'), $cacheId.'_lastmodified'); - } - } - if (empty($responseXml)) { - throw new Zend_Feed_Exception('Feed failed to load, got empty response body'); - } - return self::importString($responseXml); - } elseif ($cache) { - $data = $cache->load($cacheId); - if ($data !== false) { - return self::importString($data); - } - $response = $client->request('GET'); - if ($response->getStatus() !== 200) { - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); - } - $responseXml = $response->getBody(); - $cache->save($responseXml, $cacheId); - if (empty($responseXml)) { - throw new Zend_Feed_Exception('Feed failed to load, got empty response body'); - } - return self::importString($responseXml); - } else { - $response = $client->request('GET'); - if ($response->getStatus() !== 200) { - throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus()); - } - $responseXml = $response->getBody(); - if (empty($responseXml)) { - throw new Zend_Feed_Exception('Feed failed to load, got empty response body'); - } - $reader = self::importString($responseXml); - $reader->setOriginalSourceUri($uri); - return $reader; - } - } - - /** - * Import a feed by providing a Zend_Feed_Abstract object - * - * @param Zend_Feed_Abstract $feed A fully instantiated Zend_Feed object - * @return Zend_Feed_Reader_FeedInterface - */ - public static function importFeed(Zend_Feed_Abstract $feed) - { - $dom = $feed->getDOM()->ownerDocument; - $type = self::detectType($dom); - self::_registerCoreExtensions(); - if (substr($type, 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); - } else { - $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); - } - - return $reader; - } - - /** - * Import a feed from a string - * - * @param string $string - * @return Zend_Feed_Reader_FeedInterface - */ - public static function importString($string) - { - $dom = new DOMDocument; - try { - $dom = Zend_Xml_Security::scan($string, $dom); - } catch (Zend_Xml_Exception $e) { - throw new Zend_Feed_Exception( - $e->getMessage() - ); - } - if (!$dom) { - // Build error message - $error = libxml_get_last_error(); - if ($error && $error->message) { - $errormsg = "DOMDocument cannot parse XML: {$error->message}"; - } else { - $errormsg = "DOMDocument cannot parse XML: Please check the XML document's validity"; - } - - throw new Zend_Feed_Exception($errormsg); - } - - $type = self::detectType($dom); - - self::_registerCoreExtensions(); - - if (substr($type, 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Feed_Rss($dom, $type); - } elseif (substr($type, 8, 5) == 'entry') { - $reader = new Zend_Feed_Reader_Entry_Atom($dom->documentElement, 0, Zend_Feed_Reader::TYPE_ATOM_10); - } elseif (substr($type, 0, 4) == 'atom') { - $reader = new Zend_Feed_Reader_Feed_Atom($dom, $type); - } else { - throw new Zend_Feed_Exception('The URI used does not point to a ' - . 'valid Atom, RSS or RDF feed that Zend_Feed_Reader can parse.'); - } - return $reader; - } - - /** - * Imports a feed from a file located at $filename. - * - * @param string $filename - * @throws Zend_Feed_Exception - * @return Zend_Feed_Reader_FeedInterface - */ - public static function importFile($filename) - { - @ini_set('track_errors', 1); - $feed = @file_get_contents($filename); - @ini_restore('track_errors'); - if ($feed === false) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg"); - } - return self::importString($feed); - } - - public static function findFeedLinks($uri) - { - // Get the HTTP response from $uri and save the contents - $client = self::getHttpClient(); - $client->setUri($uri); - $response = $client->request(); - if ($response->getStatus() !== 200) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus()); - } - $responseHtml = $response->getBody(); - $libxml_errflag = libxml_use_internal_errors(true); - $oldValue = libxml_disable_entity_loader(true); - $dom = new DOMDocument; - $status = $dom->loadHTML($responseHtml); - libxml_disable_entity_loader($oldValue); - libxml_use_internal_errors($libxml_errflag); - if (!$status) { - // Build error message - $error = libxml_get_last_error(); - if ($error && $error->message) { - $errormsg = "DOMDocument cannot parse HTML: {$error->message}"; - } else { - $errormsg = "DOMDocument cannot parse HTML: Please check the XML document's validity"; - } - - throw new Zend_Feed_Exception($errormsg); - } - $feedSet = new Zend_Feed_Reader_FeedSet; - $links = $dom->getElementsByTagName('link'); - $feedSet->addLinks($links, $uri); - return $feedSet; - } - - /** - * Detect the feed type of the provided feed - * - * @param Zend_Feed_Abstract|DOMDocument|string $feed - * @param bool $specOnly - * @return string - * @throws Zend_Feed_Exception - */ - public static function detectType($feed, $specOnly = false) - { - if ($feed instanceof Zend_Feed_Reader_FeedInterface) { - $dom = $feed->getDomDocument(); - } elseif($feed instanceof DOMDocument) { - $dom = $feed; - } elseif(is_string($feed) && !empty($feed)) { - @ini_set('track_errors', 1); - //$oldValue = libxml_disable_entity_loader(true); - $dom = new DOMDocument; - try { - $dom = Zend_Xml_Security::scan($feed, $dom); - } catch (Zend_Xml_Exception $e) { - throw new Zend_Feed_Exception( - $e->getMessage() - ); - } - //libxml_disable_entity_loader($oldValue); - @ini_restore('track_errors'); - if (!$dom) { - if (!isset($php_errormsg)) { - if (function_exists('xdebug_is_enabled')) { - $php_errormsg = '(error message not available, when XDebug is running)'; - } else { - $php_errormsg = '(error message not available)'; - } - } - throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg"); - } - } else { - throw new Zend_Feed_Exception('Invalid object/scalar provided: must' - . ' be of type Zend_Feed_Reader_FeedInterface, DomDocument or string'); - } - $xpath = new DOMXPath($dom); - - if ($xpath->query('/rss')->length) { - $type = self::TYPE_RSS_ANY; - $version = $xpath->evaluate('string(/rss/@version)'); - - if (strlen($version) > 0) { - switch($version) { - case '2.0': - $type = self::TYPE_RSS_20; - break; - - case '0.94': - $type = self::TYPE_RSS_094; - break; - - case '0.93': - $type = self::TYPE_RSS_093; - break; - - case '0.92': - $type = self::TYPE_RSS_092; - break; - - case '0.91': - $type = self::TYPE_RSS_091; - break; - } - } - - return $type; - } - - $xpath->registerNamespace('rdf', self::NAMESPACE_RDF); - - if ($xpath->query('/rdf:RDF')->length) { - $xpath->registerNamespace('rss', self::NAMESPACE_RSS_10); - - if ($xpath->query('/rdf:RDF/rss:channel')->length - || $xpath->query('/rdf:RDF/rss:image')->length - || $xpath->query('/rdf:RDF/rss:item')->length - || $xpath->query('/rdf:RDF/rss:textinput')->length - ) { - return self::TYPE_RSS_10; - } - - $xpath->registerNamespace('rss', self::NAMESPACE_RSS_090); - - if ($xpath->query('/rdf:RDF/rss:channel')->length - || $xpath->query('/rdf:RDF/rss:image')->length - || $xpath->query('/rdf:RDF/rss:item')->length - || $xpath->query('/rdf:RDF/rss:textinput')->length - ) { - return self::TYPE_RSS_090; - } - } - - $type = self::TYPE_ATOM_ANY; - $xpath->registerNamespace('atom', self::NAMESPACE_ATOM_10); - - if ($xpath->query('//atom:feed')->length) { - return self::TYPE_ATOM_10; - } - - if ($xpath->query('//atom:entry')->length) { - if ($specOnly == true) { - return self::TYPE_ATOM_10; - } else { - return self::TYPE_ATOM_10_ENTRY; - } - } - - $xpath->registerNamespace('atom', self::NAMESPACE_ATOM_03); - - if ($xpath->query('//atom:feed')->length) { - return self::TYPE_ATOM_03; - } - - return self::TYPE_ANY; - } - - /** - * Set plugin loader for use with Extensions - * - * @param Zend_Loader_PluginLoader_Interface $loader - */ - public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) - { - self::$_pluginLoader = $loader; - } - - /** - * Get plugin loader for use with Extensions - * - * @return Zend_Loader_PluginLoader_Interface $loader - */ - public static function getPluginLoader() - { - if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = new Zend_Loader_PluginLoader(array( - 'Zend_Feed_Reader_Extension_' => 'Zend/Feed/Reader/Extension/', - )); - } - return self::$_pluginLoader; - } - - /** - * Add prefix path for loading Extensions - * - * @param string $prefix - * @param string $path - * @return void - */ - public static function addPrefixPath($prefix, $path) - { - $prefix = rtrim($prefix, '_'); - $path = rtrim($path, DIRECTORY_SEPARATOR); - self::getPluginLoader()->addPrefixPath($prefix, $path); - } - - /** - * Add multiple Extension prefix paths at once - * - * @param array $spec - * @return void - */ - public static function addPrefixPaths(array $spec) - { - if (isset($spec['prefix']) && isset($spec['path'])) { - self::addPrefixPath($spec['prefix'], $spec['path']); - } - foreach ($spec as $prefixPath) { - if (isset($prefixPath['prefix']) && isset($prefixPath['path'])) { - self::addPrefixPath($prefixPath['prefix'], $prefixPath['path']); - } - } - } - - /** - * Register an Extension by name - * - * @param string $name - * @return void - * @throws Zend_Feed_Exception if unable to resolve Extension class - */ - public static function registerExtension($name) - { - $feedName = $name . '_Feed'; - $entryName = $name . '_Entry'; - if (self::isRegistered($name)) { - if (self::getPluginLoader()->isLoaded($feedName) || - self::getPluginLoader()->isLoaded($entryName)) { - return; - } - } - try { - self::getPluginLoader()->load($feedName); - self::$_extensions['feed'][] = $feedName; - } catch (Zend_Loader_PluginLoader_Exception $e) { - } - try { - self::getPluginLoader()->load($entryName); - self::$_extensions['entry'][] = $entryName; - } catch (Zend_Loader_PluginLoader_Exception $e) { - } - if (!self::getPluginLoader()->isLoaded($feedName) - && !self::getPluginLoader()->isLoaded($entryName) - ) { - throw new Zend_Feed_Exception('Could not load extension: ' . $name - . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); - } - } - - /** - * Is a given named Extension registered? - * - * @param string $extensionName - * @return boolean - */ - public static function isRegistered($extensionName) - { - $feedName = $extensionName . '_Feed'; - $entryName = $extensionName . '_Entry'; - if (in_array($feedName, self::$_extensions['feed']) - || in_array($entryName, self::$_extensions['entry']) - ) { - return true; - } - return false; - } - - /** - * Get a list of extensions - * - * @return array - */ - public static function getExtensions() - { - return self::$_extensions; - } - - /** - * Reset class state to defaults - * - * @return void - */ - public static function reset() - { - self::$_cache = null; - self::$_httpClient = null; - self::$_httpMethodOverride = false; - self::$_httpConditionalGet = false; - self::$_pluginLoader = null; - self::$_prefixPaths = array(); - self::$_extensions = array( - 'feed' => array( - 'DublinCore_Feed', - 'Atom_Feed' - ), - 'entry' => array( - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' - ), - 'core' => array( - 'DublinCore_Feed', - 'Atom_Feed', - 'Content_Entry', - 'DublinCore_Entry', - 'Atom_Entry' - ) - ); - } - - /** - * Register core (default) extensions - * - * @return void - */ - protected static function _registerCoreExtensions() - { - self::registerExtension('DublinCore'); - self::registerExtension('Content'); - self::registerExtension('Atom'); - self::registerExtension('Slash'); - self::registerExtension('WellFormedWeb'); - self::registerExtension('Thread'); - self::registerExtension('Podcast'); - } - - /** - * Utility method to apply array_unique operation to a multidimensional - * array. - * - * @param array - * @return array - */ - public static function arrayUnique(array $array) - { - foreach ($array as &$value) { - $value = serialize($value); - } - $array = array_unique($array); - foreach ($array as &$value) { - $value = unserialize($value); - } - return $array; - } - -} diff --git a/library/vendor/Zend/Feed/Reader/Collection.php b/library/vendor/Zend/Feed/Reader/Collection.php deleted file mode 100644 index b12d6744a..000000000 --- a/library/vendor/Zend/Feed/Reader/Collection.php +++ /dev/null @@ -1,33 +0,0 @@ -getIterator() as $element) { - $authors[] = $element['name']; - } - return array_unique($authors); - } - -} diff --git a/library/vendor/Zend/Feed/Reader/Collection/Category.php b/library/vendor/Zend/Feed/Reader/Collection/Category.php deleted file mode 100644 index df7f8a4c9..000000000 --- a/library/vendor/Zend/Feed/Reader/Collection/Category.php +++ /dev/null @@ -1,56 +0,0 @@ -getIterator() as $element) { - if (isset($element['label']) && !empty($element['label'])) { - $categories[] = $element['label']; - } else { - $categories[] = $element['term']; - } - } - return array_unique($categories); - } - -} diff --git a/library/vendor/Zend/Feed/Reader/Collection/CollectionAbstract.php b/library/vendor/Zend/Feed/Reader/Collection/CollectionAbstract.php deleted file mode 100644 index d718d55ed..000000000 --- a/library/vendor/Zend/Feed/Reader/Collection/CollectionAbstract.php +++ /dev/null @@ -1,41 +0,0 @@ -_xpathQuery = '//atom:entry[' . ($this->_entryKey + 1) . ']'; - - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Entry'); - $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); - - $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Thread_Entry'); - $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); - - $threadClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Entry'); - $this->_extensions['DublinCore_Entry'] = new $threadClass($entry, $entryKey, $type); - } - - /** - * Get the specified author - * - * @param int $index - * @return string|null - */ - public function getAuthor($index = 0) - { - $authors = $this->getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $people = $this->getExtension('Atom')->getAuthors(); - - $this->_data['authors'] = $people; - - return $this->_data['authors']; - } - - /** - * Get the entry content - * - * @return string - */ - public function getContent() - { - if (array_key_exists('content', $this->_data)) { - return $this->_data['content']; - } - - $content = $this->getExtension('Atom')->getContent(); - - $this->_data['content'] = $content; - - return $this->_data['content']; - } - - /** - * Get the entry creation date - * - * @return string - */ - public function getDateCreated() - { - if (array_key_exists('datecreated', $this->_data)) { - return $this->_data['datecreated']; - } - - $dateCreated = $this->getExtension('Atom')->getDateCreated(); - - $this->_data['datecreated'] = $dateCreated; - - return $this->_data['datecreated']; - } - - /** - * Get the entry modification date - * - * @return string - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $dateModified = $this->getExtension('Atom')->getDateModified(); - - $this->_data['datemodified'] = $dateModified; - - return $this->_data['datemodified']; - } - - /** - * Get the entry description - * - * @return string - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = $this->getExtension('Atom')->getDescription(); - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the entry enclosure - * - * @return string - */ - public function getEnclosure() - { - if (array_key_exists('enclosure', $this->_data)) { - return $this->_data['enclosure']; - } - - $enclosure = $this->getExtension('Atom')->getEnclosure(); - - $this->_data['enclosure'] = $enclosure; - - return $this->_data['enclosure']; - } - - /** - * Get the entry ID - * - * @return string - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = $this->getExtension('Atom')->getId(); - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get a specific link - * - * @param int $index - * @return string - */ - public function getLink($index = 0) - { - if (!array_key_exists('links', $this->_data)) { - $this->getLinks(); - } - - if (isset($this->_data['links'][$index])) { - return $this->_data['links'][$index]; - } - - return null; - } - - /** - * Get all links - * - * @return array - */ - public function getLinks() - { - if (array_key_exists('links', $this->_data)) { - return $this->_data['links']; - } - - $links = $this->getExtension('Atom')->getLinks(); - - $this->_data['links'] = $links; - - return $this->_data['links']; - } - - /** - * Get a permalink to the entry - * - * @return string - */ - public function getPermalink() - { - return $this->getLink(0); - } - - /** - * Get the entry title - * - * @return string - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = $this->getExtension('Atom')->getTitle(); - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get the number of comments/replies for current entry - * - * @return integer - */ - public function getCommentCount() - { - if (array_key_exists('commentcount', $this->_data)) { - return $this->_data['commentcount']; - } - - $commentcount = $this->getExtension('Thread')->getCommentCount(); - - if (!$commentcount) { - $commentcount = $this->getExtension('Atom')->getCommentCount(); - } - - $this->_data['commentcount'] = $commentcount; - - return $this->_data['commentcount']; - } - - /** - * Returns a URI pointing to the HTML page where comments can be made on this entry - * - * @return string - */ - public function getCommentLink() - { - if (array_key_exists('commentlink', $this->_data)) { - return $this->_data['commentlink']; - } - - $commentlink = $this->getExtension('Atom')->getCommentLink(); - - $this->_data['commentlink'] = $commentlink; - - return $this->_data['commentlink']; - } - - /** - * Returns a URI pointing to a feed of all comments for this entry - * - * @return string - */ - public function getCommentFeedLink() - { - if (array_key_exists('commentfeedlink', $this->_data)) { - return $this->_data['commentfeedlink']; - } - - $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink(); - - $this->_data['commentfeedlink'] = $commentfeedlink; - - return $this->_data['commentfeedlink']; - } - - /** - * Get category data as a Zend_Feed_Reader_Collection_Category object - * - * @return Zend_Feed_Reader_Collection_Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - $categoryCollection = $this->getExtension('Atom')->getCategories(); - - if (count($categoryCollection) == 0) { - $categoryCollection = $this->getExtension('DublinCore')->getCategories(); - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Get source feed metadata from the entry - * - * @return Zend_Feed_Reader_Feed_Atom_Source|null - */ - public function getSource() - { - if (array_key_exists('source', $this->_data)) { - return $this->_data['source']; - } - - $source = $this->getExtension('Atom')->getSource(); - - $this->_data['source'] = $source; - - return $this->_data['source']; - } - - /** - * Set the XPath query (incl. on all Extensions) - * - * @param DOMXPath $xpath - */ - public function setXpath(DOMXPath $xpath) - { - parent::setXpath($xpath); - foreach ($this->_extensions as $extension) { - $extension->setXpath($this->_xpath); - } - } -} diff --git a/library/vendor/Zend/Feed/Reader/Entry/Rss.php b/library/vendor/Zend/Feed/Reader/Entry/Rss.php deleted file mode 100644 index 38a3ff74c..000000000 --- a/library/vendor/Zend/Feed/Reader/Entry/Rss.php +++ /dev/null @@ -1,656 +0,0 @@ -_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; - $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; - - $pluginLoader = Zend_Feed_Reader::getPluginLoader(); - - $dublinCoreClass = $pluginLoader->getClassName('DublinCore_Entry'); - $this->_extensions['DublinCore_Entry'] = new $dublinCoreClass($entry, $entryKey, $type); - - $contentClass = $pluginLoader->getClassName('Content_Entry'); - $this->_extensions['Content_Entry'] = new $contentClass($entry, $entryKey, $type); - - $atomClass = $pluginLoader->getClassName('Atom_Entry'); - $this->_extensions['Atom_Entry'] = new $atomClass($entry, $entryKey, $type); - - $wfwClass = $pluginLoader->getClassName('WellFormedWeb_Entry'); - $this->_extensions['WellFormedWeb_Entry'] = new $wfwClass($entry, $entryKey, $type); - - $slashClass = $pluginLoader->getClassName('Slash_Entry'); - $this->_extensions['Slash_Entry'] = new $slashClass($entry, $entryKey, $type); - - $threadClass = $pluginLoader->getClassName('Thread_Entry'); - $this->_extensions['Thread_Entry'] = new $threadClass($entry, $entryKey, $type); - } - - /** - * Get an author entry - * - * @param DOMElement $element - * @return string - */ - public function getAuthor($index = 0) - { - $authors = $this->getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $authors_dc = $this->getExtension('DublinCore')->getAuthors(); - if (!empty($authors_dc)) { - foreach ($authors_dc as $author) { - $authors[] = array( - 'name' => $author['name'] - ); - } - } - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss . '//author'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf . '//rss:author'); - } - if ($list->length) { - foreach ($list as $author) { - $string = trim($author->nodeValue); - $email = null; - $name = null; - $data = array(); - // Pretty rough parsing - but it's a catchall - if (preg_match("/^.*@[^ ]*/", $string, $matches)) { - $data['email'] = trim($matches[0]); - if (preg_match("/\((.*)\)$/", $string, $matches)) { - $data['name'] = $matches[1]; - } - $authors[] = $data; - } - } - } - - if (count($authors) == 0) { - $authors = $this->getExtension('Atom')->getAuthors(); - } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) - ); - } - - if (count($authors) == 0) { - $authors = null; - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the entry content - * - * @return string - */ - public function getContent() - { - if (array_key_exists('content', $this->_data)) { - return $this->_data['content']; - } - - $content = $this->getExtension('Content')->getContent(); - - if (!$content) { - $content = $this->getDescription(); - } - - if (empty($content)) { - $content = $this->getExtension('Atom')->getContent(); - } - - $this->_data['content'] = $content; - - return $this->_data['content']; - } - - /** - * Get the entry's date of creation - * - * @return string - */ - public function getDateCreated() - { - return $this->getDateModified(); - } - - /** - * Get the entry's date of modification - * - * @return string - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $dateModified = null; - $date = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 - ) { - $dateModified = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/pubDate)'); - if ($dateModified) { - $dateModifiedParsed = strtotime($dateModified); - if ($dateModifiedParsed) { - $date = new Zend_Date($dateModifiedParsed); - } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); - $date = new Zend_Date; - foreach ($dateStandards as $standard) { - try { - $date->set($dateModified, $standard); - break; - } catch (Zend_Date_Exception $e) { - if ($standard == Zend_Date::DATES) { - throw new Zend_Feed_Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); - } - } - } - } - } - } - - if (!$date) { - $date = $this->getExtension('DublinCore')->getDate(); - } - - if (!$date) { - $date = $this->getExtension('Atom')->getDateModified(); - } - - if (!$date) { - $date = null; - } - - $this->_data['datemodified'] = $date; - - return $this->_data['datemodified']; - } - - /** - * Get the entry description - * - * @return string - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 - ) { - $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/description)'); - } else { - $description = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:description)'); - } - - if (!$description) { - $description = $this->getExtension('DublinCore')->getDescription(); - } - - if (empty($description)) { - $description = $this->getExtension('Atom')->getDescription(); - } - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the entry enclosure - * @return string - */ - public function getEnclosure() - { - if (array_key_exists('enclosure', $this->_data)) { - return $this->_data['enclosure']; - } - - $enclosure = null; - - if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_20) { - $nodeList = $this->_xpath->query($this->_xpathQueryRss . '/enclosure'); - - if ($nodeList->length > 0) { - $enclosure = new stdClass(); - $enclosure->url = $nodeList->item(0)->getAttribute('url'); - $enclosure->length = $nodeList->item(0)->getAttribute('length'); - $enclosure->type = $nodeList->item(0)->getAttribute('type'); - } - } - - if (!$enclosure) { - $enclosure = $this->getExtension('Atom')->getEnclosure(); - } - - $this->_data['enclosure'] = $enclosure; - - return $this->_data['enclosure']; - } - - /** - * Get the entry ID - * - * @return string - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 - ) { - $id = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/guid)'); - } - - if (!$id) { - $id = $this->getExtension('DublinCore')->getId(); - } - - if (empty($id)) { - $id = $this->getExtension('Atom')->getId(); - } - - if (!$id) { - if ($this->getPermalink()) { - $id = $this->getPermalink(); - } elseif ($this->getTitle()) { - $id = $this->getTitle(); - } else { - $id = null; - } - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get a specific link - * - * @param int $index - * @return string - */ - public function getLink($index = 0) - { - if (!array_key_exists('links', $this->_data)) { - $this->getLinks(); - } - - if (isset($this->_data['links'][$index])) { - return $this->_data['links'][$index]; - } - - return null; - } - - /** - * Get all links - * - * @return array - */ - public function getLinks() - { - if (array_key_exists('links', $this->_data)) { - return $this->_data['links']; - } - - $links = array(); - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss.'//link'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:link'); - } - - if (!$list->length) { - $links = $this->getExtension('Atom')->getLinks(); - } else { - foreach ($list as $link) { - $links[] = $link->nodeValue; - } - } - - $this->_data['links'] = $links; - - return $this->_data['links']; - } - - /** - * Get all categories - * - * @return Zend_Feed_Reader_Collection_Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->query($this->_xpathQueryRss.'//category'); - } else { - $list = $this->_xpath->query($this->_xpathQueryRdf.'//rss:category'); - } - - if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->nodeValue, - 'scheme' => $category->getAttribute('domain'), - 'label' => $category->nodeValue, - ); - } - } else { - $categoryCollection = $this->getExtension('DublinCore')->getCategories(); - } - - if (count($categoryCollection) == 0) { - $categoryCollection = $this->getExtension('Atom')->getCategories(); - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Get a permalink to the entry - * - * @return string - */ - public function getPermalink() - { - return $this->getLink(0); - } - - /** - * Get the entry title - * - * @return string - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 - ) { - $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/title)'); - } else { - $title = $this->_xpath->evaluate('string('.$this->_xpathQueryRdf.'/rss:title)'); - } - - if (!$title) { - $title = $this->getExtension('DublinCore')->getTitle(); - } - - if (!$title) { - $title = $this->getExtension('Atom')->getTitle(); - } - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get the number of comments/replies for current entry - * - * @return string|null - */ - public function getCommentCount() - { - if (array_key_exists('commentcount', $this->_data)) { - return $this->_data['commentcount']; - } - - $commentcount = $this->getExtension('Slash')->getCommentCount(); - - if (!$commentcount) { - $commentcount = $this->getExtension('Thread')->getCommentCount(); - } - - if (!$commentcount) { - $commentcount = $this->getExtension('Atom')->getCommentCount(); - } - - if (!$commentcount) { - $commentcount = null; - } - - $this->_data['commentcount'] = $commentcount; - - return $this->_data['commentcount']; - } - - /** - * Returns a URI pointing to the HTML page where comments can be made on this entry - * - * @return string - */ - public function getCommentLink() - { - if (array_key_exists('commentlink', $this->_data)) { - return $this->_data['commentlink']; - } - - $commentlink = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 - ) { - $commentlink = $this->_xpath->evaluate('string('.$this->_xpathQueryRss.'/comments)'); - } - - if (!$commentlink) { - $commentlink = $this->getExtension('Atom')->getCommentLink(); - } - - if (!$commentlink) { - $commentlink = null; - } - - $this->_data['commentlink'] = $commentlink; - - return $this->_data['commentlink']; - } - - /** - * Returns a URI pointing to a feed of all comments for this entry - * - * @return string - */ - public function getCommentFeedLink() - { - if (array_key_exists('commentfeedlink', $this->_data)) { - return $this->_data['commentfeedlink']; - } - - $commentfeedlink = $this->getExtension('WellFormedWeb')->getCommentFeedLink(); - - if (!$commentfeedlink) { - $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rss'); - } - - if (!$commentfeedlink) { - $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink('rdf'); - } - - if (!$commentfeedlink) { - $commentfeedlink = null; - } - - $this->_data['commentfeedlink'] = $commentfeedlink; - - return $this->_data['commentfeedlink']; - } - - /** - * Set the XPath query (incl. on all Extensions) - * - * @param DOMXPath $xpath - */ - public function setXpath(DOMXPath $xpath) - { - parent::setXpath($xpath); - foreach ($this->_extensions as $extension) { - $extension->setXpath($this->_xpath); - } - } -} diff --git a/library/vendor/Zend/Feed/Reader/EntryAbstract.php b/library/vendor/Zend/Feed/Reader/EntryAbstract.php deleted file mode 100644 index 6ce5994fc..000000000 --- a/library/vendor/Zend/Feed/Reader/EntryAbstract.php +++ /dev/null @@ -1,241 +0,0 @@ -_entry = $entry; - $this->_entryKey = $entryKey; - $this->_domDocument = $entry->ownerDocument; - if ($type !== null) { - $this->_data['type'] = $type; - } else { - $this->_data['type'] = Zend_Feed_Reader::detectType( - $this->_domDocument - ); - } - $this->_loadExtensions(); - } - - /** - * Get the DOM - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->_domDocument; - } - - /** - * Get the entry element - * - * @return DOMElement - */ - public function getElement() - { - return $this->_entry; - } - - /** - * Get the Entry's encoding - * - * @return string - */ - public function getEncoding() - { - $assumed = $this->getDomDocument()->encoding; - if (empty($assumed)) { - $assumed = 'UTF-8'; - } - return $assumed; - } - - /** - * Get entry as xml - * - * @return string - */ - public function saveXml() - { - $dom = new DOMDocument('1.0', $this->getEncoding()); - $entry = $dom->importNode($this->getElement(), true); - $dom->appendChild($entry); - return $dom->saveXml(); - } - - /** - * Get the entry type - * - * @return string - */ - public function getType() - { - return $this->_data['type']; - } - - /** - * Get the XPath query object - * - * @return DOMXPath - */ - public function getXpath() - { - if (!$this->_xpath) { - $this->setXpath(new DOMXPath($this->getDomDocument())); - } - return $this->_xpath; - } - - /** - * Set the XPath query - * - * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Entry_EntryAbstract - */ - public function setXpath(DOMXPath $xpath) - { - $this->_xpath = $xpath; - return $this; - } - - /** - * Get registered extensions - * - * @return array - */ - public function getExtensions() - { - return $this->_extensions; - } - - /** - * Return an Extension object with the matching name (postfixed with _Entry) - * - * @param string $name - * @return Zend_Feed_Reader_Extension_EntryAbstract - */ - public function getExtension($name) - { - if (array_key_exists($name . '_Entry', $this->_extensions)) { - return $this->_extensions[$name . '_Entry']; - } - return null; - } - - /** - * Method overloading: call given method on first extension implementing it - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method - */ - public function __call($method, $args) - { - foreach ($this->_extensions as $extension) { - if (method_exists($extension, $method)) { - return call_user_func_array(array($extension, $method), $args); - } - } - throw new Zend_Feed_Exception( - 'Method: ' . $method - . 'does not exist and could not be located on a registered Extension' - ); - } - - /** - * Load extensions from Zend_Feed_Reader - * - * @return void - */ - protected function _loadExtensions() - { - $all = Zend_Feed_Reader::getExtensions(); - $feed = $all['entry']; - foreach ($feed as $extension) { - if (in_array($extension, $all['core'])) { - continue; - } - $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); - $this->_extensions[$extension] = new $className( - $this->getElement(), $this->_entryKey, $this->_data['type'] - ); - } - } -} diff --git a/library/vendor/Zend/Feed/Reader/EntryInterface.php b/library/vendor/Zend/Feed/Reader/EntryInterface.php deleted file mode 100644 index 2eee00aa9..000000000 --- a/library/vendor/Zend/Feed/Reader/EntryInterface.php +++ /dev/null @@ -1,143 +0,0 @@ -getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:author'); - - if (!$list->length) { - /** - * TODO: Limit query to feed level els only! - */ - $list = $this->getXpath()->query('//atom:author'); - } - - if ($list->length) { - foreach ($list as $author) { - $author = $this->_getAuthor($author); - if (!empty($author)) { - $authors[] = $author; - } - } - } - - if (count($authors) == 0) { - $authors = null; - } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) - ); - } - - $this->_data['authors'] = $authors; - return $this->_data['authors']; - } - - /** - * Get the entry content - * - * @return string - */ - public function getContent() - { - if (array_key_exists('content', $this->_data)) { - return $this->_data['content']; - } - - $content = null; - - $el = $this->getXpath()->query($this->getXpathPrefix() . '/atom:content'); - if($el->length > 0) { - $el = $el->item(0); - $type = $el->getAttribute('type'); - switch ($type) { - case '': - case 'text': - case 'text/plain': - case 'html': - case 'text/html': - $content = $el->nodeValue; - break; - case 'xhtml': - $this->getXpath()->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml'); - $xhtml = $this->getXpath()->query( - $this->getXpathPrefix() . '/atom:content/xhtml:div' - )->item(0); - //$xhtml->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); - $d = new DOMDocument('1.0', $this->getEncoding()); - $xhtmls = $d->importNode($xhtml, true); - $d->appendChild($xhtmls); - $content = $this->_collectXhtml( - $d->saveXML(), - $d->lookupPrefix('http://www.w3.org/1999/xhtml') - ); - break; - } - } - - if (!$content) { - $content = $this->getDescription(); - } - - $this->_data['content'] = trim($content); - - return $this->_data['content']; - } - - /** - * Parse out XHTML to remove the namespacing - */ - protected function _collectXhtml($xhtml, $prefix) - { - if (!empty($prefix)) $prefix = $prefix . ':'; - $matches = array( - "/<\?xml[^<]*>[^<]*<" . $prefix . "div[^<]*/", - "/<\/" . $prefix . "div>\s*$/" - ); - $xhtml = preg_replace($matches, '', $xhtml); - if (!empty($prefix)) { - $xhtml = preg_replace("/(<[\/]?)" . $prefix . "([a-zA-Z]+)/", '$1$2', $xhtml); - } - return $xhtml; - } - - /** - * Get the entry creation date - * - * @return string - */ - public function getDateCreated() - { - if (array_key_exists('datecreated', $this->_data)) { - return $this->_data['datecreated']; - } - - $date = null; - - if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); - } else { - $dateCreated = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); - } - - if ($dateCreated) { - $date = new Zend_Date; - $date->set($dateCreated, Zend_Date::ISO_8601); - } - - $this->_data['datecreated'] = $date; - - return $this->_data['datecreated']; - } - - /** - * Get the entry modification date - * - * @return string - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $date = null; - - if ($this->_getAtomType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); - } else { - $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); - } - - if ($dateModified) { - $date = new Zend_Date; - $date->set($dateModified, Zend_Date::ISO_8601); - } - - $this->_data['datemodified'] = $date; - - return $this->_data['datemodified']; - } - - /** - * Get the entry description - * - * @return string - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:summary)'); - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the entry enclosure - * - * @return string - */ - public function getEnclosure() - { - if (array_key_exists('enclosure', $this->_data)) { - return $this->_data['enclosure']; - } - - $enclosure = null; - - $nodeList = $this->getXpath()->query($this->getXpathPrefix() . '/atom:link[@rel="enclosure"]'); - - if ($nodeList->length > 0) { - $enclosure = new stdClass(); - $enclosure->url = $nodeList->item(0)->getAttribute('href'); - $enclosure->length = $nodeList->item(0)->getAttribute('length'); - $enclosure->type = $nodeList->item(0)->getAttribute('type'); - } - - $this->_data['enclosure'] = $enclosure; - - return $this->_data['enclosure']; - } - - /** - * Get the entry ID - * - * @return string - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); - - if (!$id) { - if ($this->getPermalink()) { - $id = $this->getPermalink(); - } elseif ($this->getTitle()) { - $id = $this->getTitle(); - } else { - $id = null; - } - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get the base URI of the feed (if set). - * - * @return string|null - */ - public function getBaseUrl() - { - if (array_key_exists('baseUrl', $this->_data)) { - return $this->_data['baseUrl']; - } - - $baseUrl = $this->getXpath()->evaluate('string(' - . $this->getXpathPrefix() . '/@xml:base[1]' - . ')'); - - if (!$baseUrl) { - $baseUrl = $this->getXpath()->evaluate('string(//@xml:base[1])'); - } - - if (!$baseUrl) { - $baseUrl = null; - } - - $this->_data['baseUrl'] = $baseUrl; - - return $this->_data['baseUrl']; - } - - /** - * Get a specific link - * - * @param int $index - * @return string - */ - public function getLink($index = 0) - { - if (!array_key_exists('links', $this->_data)) { - $this->getLinks(); - } - - if (isset($this->_data['links'][$index])) { - return $this->_data['links'][$index]; - } - - return null; - } - - /** - * Get all links - * - * @return array - */ - public function getLinks() - { - if (array_key_exists('links', $this->_data)) { - return $this->_data['links']; - } - - $links = array(); - - $list = $this->getXpath()->query( - $this->getXpathPrefix() . '//atom:link[@rel="alternate"]/@href' . '|' . - $this->getXpathPrefix() . '//atom:link[not(@rel)]/@href' - ); - - if ($list->length) { - foreach ($list as $link) { - $links[] = $this->_absolutiseUri($link->value); - } - } - - $this->_data['links'] = $links; - - return $this->_data['links']; - } - - /** - * Get a permalink to the entry - * - * @return string - */ - public function getPermalink() - { - return $this->getLink(0); - } - - /** - * Get the entry title - * - * @return string - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get the number of comments/replies for current entry - * - * @return integer - */ - public function getCommentCount() - { - if (array_key_exists('commentcount', $this->_data)) { - return $this->_data['commentcount']; - } - - $count = null; - - $this->getXpath()->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0'); - $list = $this->getXpath()->query( - $this->getXpathPrefix() . '//atom:link[@rel="replies"]/@thread10:count' - ); - - if ($list->length) { - $count = $list->item(0)->value; - } - - $this->_data['commentcount'] = $count; - - return $this->_data['commentcount']; - } - - /** - * Returns a URI pointing to the HTML page where comments can be made on this entry - * - * @return string - */ - public function getCommentLink() - { - if (array_key_exists('commentlink', $this->_data)) { - return $this->_data['commentlink']; - } - - $link = null; - - $list = $this->getXpath()->query( - $this->getXpathPrefix() . '//atom:link[@rel="replies" and @type="text/html"]/@href' - ); - - if ($list->length) { - $link = $list->item(0)->value; - $link = $this->_absolutiseUri($link); - } - - $this->_data['commentlink'] = $link; - - return $this->_data['commentlink']; - } - - /** - * Returns a URI pointing to a feed of all comments for this entry - * - * @return string - */ - public function getCommentFeedLink($type = 'atom') - { - if (array_key_exists('commentfeedlink', $this->_data)) { - return $this->_data['commentfeedlink']; - } - - $link = null; - - $list = $this->getXpath()->query( - $this->getXpathPrefix() . '//atom:link[@rel="replies" and @type="application/'.$type.'+xml"]/@href' - ); - - if ($list->length) { - $link = $list->item(0)->value; - $link = $this->_absolutiseUri($link); - } - - $this->_data['commentfeedlink'] = $link; - - return $this->_data['commentfeedlink']; - } - - /** - * Get all categories - * - * @return Zend_Feed_Reader_Collection_Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - if ($this->_getAtomType() == Zend_Feed_Reader::TYPE_ATOM_10) { - $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom:category'); - } else { - /** - * Since Atom 0.3 did not support categories, it would have used the - * Dublin Core extension. However there is a small possibility Atom 0.3 - * may have been retrofittied to use Atom 1.0 instead. - */ - $this->getXpath()->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); - $list = $this->getXpath()->query($this->getXpathPrefix() . '//atom10:category'); - } - - if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->getAttribute('term'), - 'scheme' => $category->getAttribute('scheme'), - 'label' => $category->getAttribute('label') - ); - } - } else { - return new Zend_Feed_Reader_Collection_Category; - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Get source feed metadata from the entry - * - * @return Zend_Feed_Reader_Feed_Atom_Source|null - */ - public function getSource() - { - if (array_key_exists('source', $this->_data)) { - return $this->_data['source']; - } - - $source = null; - // TODO: Investigate why _getAtomType() fails here. Is it even needed? - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { - $list = $this->getXpath()->query($this->getXpathPrefix() . '/atom:source[1]'); - if ($list->length) { - $element = $list->item(0); - $source = new Zend_Feed_Reader_Feed_Atom_Source($element, $this->getXpathPrefix()); - } - } - - $this->_data['source'] = $source; - return $this->_data['source']; - } - - /** - * Attempt to absolutise the URI, i.e. if a relative URI apply the - * xml:base value as a prefix to turn into an absolute URI. - */ - protected function _absolutiseUri($link) - { - if (!Zend_Uri::check($link)) { - if ($this->getBaseUrl() !== null) { - $link = $this->getBaseUrl() . $link; - if (!Zend_Uri::check($link)) { - $link = null; - } - } - } - return $link; - } - - /** - * Get an author entry - * - * @param DOMElement $element - * @return string - */ - protected function _getAuthor(DOMElement $element) - { - $author = array(); - - $emailNode = $element->getElementsByTagName('email'); - $nameNode = $element->getElementsByTagName('name'); - $uriNode = $element->getElementsByTagName('uri'); - - if ($emailNode->length && strlen($emailNode->item(0)->nodeValue) > 0) { - $author['email'] = $emailNode->item(0)->nodeValue; - } - - if ($nameNode->length && strlen($nameNode->item(0)->nodeValue) > 0) { - $author['name'] = $nameNode->item(0)->nodeValue; - } - - if ($uriNode->length && strlen($uriNode->item(0)->nodeValue) > 0) { - $author['uri'] = $uriNode->item(0)->nodeValue; - } - - if (empty($author)) { - return null; - } - return $author; - } - - /** - * Register the default namespaces for the current feed format - */ - protected function _registerNamespaces() - { - switch ($this->_getAtomType()) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); - break; - default: - $this->getXpath()->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); - break; - } - } - - /** - * Detect the presence of any Atom namespaces in use - */ - protected function _getAtomType() - { - $dom = $this->getDomDocument(); - $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); - $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) - || !empty($prefixAtom03)) { - return Zend_Feed_Reader::TYPE_ATOM_03; - } - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) - || !empty($prefixAtom10)) { - return Zend_Feed_Reader::TYPE_ATOM_10; - } - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/Atom/Feed.php b/library/vendor/Zend/Feed/Reader/Extension/Atom/Feed.php deleted file mode 100644 index e6db5e161..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/Atom/Feed.php +++ /dev/null @@ -1,586 +0,0 @@ -getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $list = $this->_xpath->query('//atom:author'); - - $authors = array(); - - if ($list->length) { - foreach ($list as $author) { - $author = $this->_getAuthor($author); - if (!empty($author)) { - $authors[] = $author; - } - } - } - - if (count($authors) == 0) { - $authors = null; - } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) - ); - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; - } - - $copyright = null; - - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:copyright)'); - } else { - $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:rights)'); - } - - if (!$copyright) { - $copyright = null; - } - - $this->_data['copyright'] = $copyright; - - return $this->_data['copyright']; - } - - /** - * Get the feed creation date - * - * @return Zend_Date|null - */ - public function getDateCreated() - { - if (array_key_exists('datecreated', $this->_data)) { - return $this->_data['datecreated']; - } - - $date = null; - - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:created)'); - } else { - $dateCreated = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:published)'); - } - - if ($dateCreated) { - $date = new Zend_Date; - $date->set($dateCreated, Zend_Date::ISO_8601); - } - - $this->_data['datecreated'] = $date; - - return $this->_data['datecreated']; - } - - /** - * Get the feed modification date - * - * @return Zend_Date|null - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $date = null; - - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); - } else { - $dateModified = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); - } - - if ($dateModified) { - $date = new Zend_Date; - $date->set($dateModified, Zend_Date::ISO_8601); - } - - $this->_data['datemodified'] = $date; - - return $this->_data['datemodified']; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - - if ($this->getType() === Zend_Feed_Reader::TYPE_ATOM_03) { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:tagline)'); // TODO: Is this the same as subtitle? - } else { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:subtitle)'); - } - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the feed generator entry - * - * @return string|null - */ - public function getGenerator() - { - if (array_key_exists('generator', $this->_data)) { - return $this->_data['generator']; - } - // TODO: Add uri support - $generator = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:generator)'); - - if (!$generator) { - $generator = null; - } - - $this->_data['generator'] = $generator; - - return $this->_data['generator']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:id)'); - - if (!$id) { - if ($this->getLink()) { - $id = $this->getLink(); - } elseif ($this->getTitle()) { - $id = $this->getTitle(); - } else { - $id = null; - } - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; - } - - $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:lang)'); - - if (!$language) { - $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); - } - - if (!$language) { - $language = null; - } - - $this->_data['language'] = $language; - - return $this->_data['language']; - } - - /** - * Get the feed image - * - * @return array|null - */ - public function getImage() - { - if (array_key_exists('image', $this->_data)) { - return $this->_data['image']; - } - - $imageUrl = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:logo)'); - - if (!$imageUrl) { - $image = null; - } else { - $image = array('uri'=>$imageUrl); - } - - $this->_data['image'] = $image; - - return $this->_data['image']; - } - - /** - * Get the feed image - * - * @return array|null - */ - public function getIcon() - { - if (array_key_exists('icon', $this->_data)) { - return $this->_data['icon']; - } - - $imageUrl = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:icon)'); - - if (!$imageUrl) { - $image = null; - } else { - $image = array('uri'=>$imageUrl); - } - - $this->_data['icon'] = $image; - - return $this->_data['icon']; - } - - /** - * Get the base URI of the feed (if set). - * - * @return string|null - */ - public function getBaseUrl() - { - if (array_key_exists('baseUrl', $this->_data)) { - return $this->_data['baseUrl']; - } - - $baseUrl = $this->_xpath->evaluate('string(//@xml:base[1])'); - - if (!$baseUrl) { - $baseUrl = null; - } - $this->_data['baseUrl'] = $baseUrl; - - return $this->_data['baseUrl']; - } - - /** - * Get a link to the source website - * - * @return string|null - */ - public function getLink() - { - if (array_key_exists('link', $this->_data)) { - return $this->_data['link']; - } - - $link = null; - - $list = $this->_xpath->query( - $this->getXpathPrefix() . '/atom:link[@rel="alternate"]/@href' . '|' . - $this->getXpathPrefix() . '/atom:link[not(@rel)]/@href' - ); - - if ($list->length) { - $link = $list->item(0)->nodeValue; - $link = $this->_absolutiseUri($link); - } - - $this->_data['link'] = $link; - - return $this->_data['link']; - } - - /** - * Get a link to the feed's XML Url - * - * @return string|null - */ - public function getFeedLink() - { - if (array_key_exists('feedlink', $this->_data)) { - return $this->_data['feedlink']; - } - - $link = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:link[@rel="self"]/@href)'); - - $link = $this->_absolutiseUri($link); - - $this->_data['feedlink'] = $link; - - return $this->_data['feedlink']; - } - - /** - * Get an array of any supported Pusubhubbub endpoints - * - * @return array|null - */ - public function getHubs() - { - if (array_key_exists('hubs', $this->_data)) { - return $this->_data['hubs']; - } - $hubs = array(); - - $list = $this->_xpath->query($this->getXpathPrefix() - . '//atom:link[@rel="hub"]/@href'); - - if ($list->length) { - foreach ($list as $uri) { - $hubs[] = $this->_absolutiseUri($uri->nodeValue); - } - } else { - $hubs = null; - } - - $this->_data['hubs'] = $hubs; - - return $this->_data['hubs']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/atom:title)'); - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get all categories - * - * @return Zend_Feed_Reader_Collection_Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10) { - $list = $this->_xpath->query($this->getXpathPrefix() . '/atom:category'); - } else { - /** - * Since Atom 0.3 did not support categories, it would have used the - * Dublin Core extension. However there is a small possibility Atom 0.3 - * may have been retrofittied to use Atom 1.0 instead. - */ - $this->_xpath->registerNamespace('atom10', Zend_Feed_Reader::NAMESPACE_ATOM_10); - $list = $this->_xpath->query($this->getXpathPrefix() . '/atom10:category'); - } - - if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->getAttribute('term'), - 'scheme' => $category->getAttribute('scheme'), - 'label' => $category->getAttribute('label') - ); - } - } else { - return new Zend_Feed_Reader_Collection_Category; - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Get an author entry in RSS format - * - * @param DOMElement $element - * @return string - */ - protected function _getAuthor(DOMElement $element) - { - $author = array(); - - $emailNode = $element->getElementsByTagName('email'); - $nameNode = $element->getElementsByTagName('name'); - $uriNode = $element->getElementsByTagName('uri'); - - if ($emailNode->length && strlen($emailNode->item(0)->nodeValue) > 0) { - $author['email'] = $emailNode->item(0)->nodeValue; - } - - if ($nameNode->length && strlen($nameNode->item(0)->nodeValue) > 0) { - $author['name'] = $nameNode->item(0)->nodeValue; - } - - if ($uriNode->length && strlen($uriNode->item(0)->nodeValue) > 0) { - $author['uri'] = $uriNode->item(0)->nodeValue; - } - - if (empty($author)) { - return null; - } - return $author; - } - - /** - * Attempt to absolutise the URI, i.e. if a relative URI apply the - * xml:base value as a prefix to turn into an absolute URI. - */ - protected function _absolutiseUri($link) - { - if (!Zend_Uri::check($link)) { - if ($this->getBaseUrl() !== null) { - $link = $this->getBaseUrl() . $link; - if (!Zend_Uri::check($link)) { - $link = null; - } - } - } - return $link; - } - - /** - * Register the default namespaces for the current feed format - */ - protected function _registerNamespaces() - { - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 - || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 - ) { - return; // pre-registered at Feed level - } - $atomDetected = $this->_getAtomType(); - switch ($atomDetected) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); - break; - default: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); - break; - } - } - - /** - * Detect the presence of any Atom namespaces in use - */ - protected function _getAtomType() - { - $dom = $this->getDomDocument(); - $prefixAtom03 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_03); - $prefixAtom10 = $dom->lookupPrefix(Zend_Feed_Reader::NAMESPACE_ATOM_10); - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_10) - || !empty($prefixAtom10)) { - return Zend_Feed_Reader::TYPE_ATOM_10; - } - if ($dom->isDefaultNamespace(Zend_Feed_Reader::NAMESPACE_ATOM_03) - || !empty($prefixAtom03)) { - return Zend_Feed_Reader::TYPE_ATOM_03; - } - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/Content/Entry.php b/library/vendor/Zend/Feed/Reader/Extension/Content/Entry.php deleted file mode 100644 index e6ecdf5a0..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/Content/Entry.php +++ /dev/null @@ -1,59 +0,0 @@ -getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090 - ) { - $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); - } else { - $content = $this->_xpath->evaluate('string('.$this->getXpathPrefix().'/content:encoded)'); - } - return $content; - } - - /** - * Register RSS Content Module namespace - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php b/library/vendor/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php deleted file mode 100644 index cce0839e2..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/CreativeCommons/Entry.php +++ /dev/null @@ -1,95 +0,0 @@ -getLicenses(); - - if (isset($licenses[$index])) { - return $licenses[$index]; - } - - return null; - } - - /** - * Get the entry licenses - * - * @return array - */ - public function getLicenses() - { - $name = 'licenses'; - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; - } - - $licenses = array(); - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//cc:license'); - - if ($list->length) { - foreach ($list as $license) { - $licenses[] = $license->nodeValue; - } - - $licenses = array_unique($licenses); - } else { - $cc = new Zend_Feed_Reader_Extension_CreativeCommons_Feed( - $this->_domDocument, $this->_data['type'], $this->_xpath - ); - $licenses = $cc->getLicenses(); - } - - $this->_data[$name] = $licenses; - - return $this->_data[$name]; - } - - /** - * Register Creative Commons namespaces - * - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('cc', 'http://backend.userland.com/creativeCommonsRssModule'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php b/library/vendor/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php deleted file mode 100644 index 28855ffda..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/CreativeCommons/Feed.php +++ /dev/null @@ -1,88 +0,0 @@ -getLicenses(); - - if (isset($licenses[$index])) { - return $licenses[$index]; - } - - return null; - } - - /** - * Get the entry licenses - * - * @return array - */ - public function getLicenses() - { - $name = 'licenses'; - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; - } - - $licenses = array(); - $list = $this->_xpath->evaluate('channel/cc:license'); - - if ($list->length) { - foreach ($list as $license) { - $licenses[] = $license->nodeValue; - } - - $licenses = array_unique($licenses); - } - - $this->_data[$name] = $licenses; - - return $this->_data[$name]; - } - - /** - * Register Creative Commons namespaces - * - * @return void - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('cc', 'http://backend.userland.com/creativeCommonsRssModule'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/DublinCore/Entry.php b/library/vendor/Zend/Feed/Reader/Extension/DublinCore/Entry.php deleted file mode 100644 index 9e2f44a65..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/DublinCore/Entry.php +++ /dev/null @@ -1,263 +0,0 @@ -getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:creator'); - - if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:creator'); - } - if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:publisher'); - - if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:publisher'); - } - } - - if ($list->length) { - foreach ($list as $author) { - $authors[] = array( - 'name' => $author->nodeValue - ); - } - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) - ); - } else { - $authors = null; - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get categories (subjects under DC) - * - * @return Zend_Feed_Reader_Collection_Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:subject'); - - if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:subject'); - } - - if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->nodeValue, - 'scheme' => null, - 'label' => $category->nodeValue, - ); - } - } else { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - } - - $this->_data['categories'] = $categoryCollection; - return $this->_data['categories']; - } - - - /** - * Get the entry content - * - * @return string - */ - public function getContent() - { - return $this->getDescription(); - } - - /** - * Get the entry description - * - * @return string - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); - - if (!$description) { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); - } - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the entry ID - * - * @return string - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = null; - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); - - if (!$id) { - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get the entry title - * - * @return string - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = null; - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); - - if (!$title) { - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); - } - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * - * - * @return Zend_Date|null - */ - public function getDate() - { - if (array_key_exists('date', $this->_data)) { - return $this->_data['date']; - } - - $d = null; - $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); - - if (!$date) { - $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); - } - - if ($date) { - $d = new Zend_Date; - $d->set($date, Zend_Date::ISO_8601); - } - - $this->_data['date'] = $d; - - return $this->_data['date']; - } - - /** - * Register DC namespaces - * - * @return void - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/'); - $this->_xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/DublinCore/Feed.php b/library/vendor/Zend/Feed/Reader/Extension/DublinCore/Feed.php deleted file mode 100644 index e6dd8086d..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/DublinCore/Feed.php +++ /dev/null @@ -1,306 +0,0 @@ -getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $list = $this->_xpath->query('//dc11:creator'); - - if (!$list->length) { - $list = $this->_xpath->query('//dc10:creator'); - } - if (!$list->length) { - $list = $this->_xpath->query('//dc11:publisher'); - - if (!$list->length) { - $list = $this->_xpath->query('//dc10:publisher'); - } - } - - if ($list->length) { - foreach ($list as $author) { - $authors[] = array( - 'name' => $author->nodeValue - ); - } - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) - ); - } else { - $authors = null; - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; - } - - $copyright = null; - $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:rights)'); - - if (!$copyright) { - $copyright = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:rights)'); - } - - if (!$copyright) { - $copyright = null; - } - - $this->_data['copyright'] = $copyright; - - return $this->_data['copyright']; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:description)'); - - if (!$description) { - $description = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:description)'); - } - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = null; - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:identifier)'); - - if (!$id) { - $id = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:identifier)'); - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; - } - - $language = null; - $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:language)'); - - if (!$language) { - $language = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:language)'); - } - - if (!$language) { - $language = null; - } - - $this->_data['language'] = $language; - - return $this->_data['language']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = null; - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:title)'); - - if (!$title) { - $title = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:title)'); - } - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * - * - * @return Zend_Date|null - */ - public function getDate() - { - if (array_key_exists('date', $this->_data)) { - return $this->_data['date']; - } - - $d = null; - $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); - - if (!$date) { - $date = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); - } - - if ($date) { - $d = new Zend_Date; - $d->set($date, Zend_Date::ISO_8601); - } - - $this->_data['date'] = $d; - - return $this->_data['date']; - } - - /** - * Get categories (subjects under DC) - * - * @return Zend_Feed_Reader_Collection_Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc11:subject'); - - if (!$list->length) { - $list = $this->_xpath->evaluate($this->getXpathPrefix() . '//dc10:subject'); - } - - if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->nodeValue, - 'scheme' => null, - 'label' => $category->nodeValue, - ); - } - } else { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - } - - $this->_data['categories'] = $categoryCollection; - return $this->_data['categories']; - } - - /** - * Register the default namespaces for the current feed format - * - * @return void - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('dc10', 'http://purl.org/dc/elements/1.0/'); - $this->_xpath->registerNamespace('dc11', 'http://purl.org/dc/elements/1.1/'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/EntryAbstract.php b/library/vendor/Zend/Feed/Reader/Extension/EntryAbstract.php deleted file mode 100644 index 6b1cda623..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/EntryAbstract.php +++ /dev/null @@ -1,200 +0,0 @@ -_entry = $entry; - $this->_entryKey = $entryKey; - $this->_domDocument = $entry->ownerDocument; - - if ($type !== null) { - $this->_data['type'] = $type; - } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($entry->ownerDocument, true); - } - // set the XPath query prefix for the entry being queried - if ($this->getType() == Zend_Feed_Reader::TYPE_RSS_10 - || $this->getType() == Zend_Feed_Reader::TYPE_RSS_090 - ) { - $this->setXpathPrefix('//rss:item[' . ($this->_entryKey+1) . ']'); - } elseif ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 - || $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03 - ) { - $this->setXpathPrefix('//atom:entry[' . ($this->_entryKey+1) . ']'); - } else { - $this->setXpathPrefix('//item[' . ($this->_entryKey+1) . ']'); - } - } - - /** - * Get the DOM - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->_domDocument; - } - - /** - * Get the Entry's encoding - * - * @return string - */ - public function getEncoding() - { - $assumed = $this->getDomDocument()->encoding; - return $assumed; - } - - /** - * Get the entry type - * - * @return string - */ - public function getType() - { - return $this->_data['type']; - } - - /** - * Set the XPath query - * - * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Extension_EntryAbstract - */ - public function setXpath(DOMXPath $xpath) - { - $this->_xpath = $xpath; - $this->_registerNamespaces(); - return $this; - } - - /** - * Get the XPath query object - * - * @return DOMXPath - */ - public function getXpath() - { - if (!$this->_xpath) { - $this->setXpath(new DOMXPath($this->getDomDocument())); - } - return $this->_xpath; - } - - /** - * Serialize the entry to an array - * - * @return array - */ - public function toArray() - { - return $this->_data; - } - - /** - * Get the XPath prefix - * - * @return string - */ - public function getXpathPrefix() - { - return $this->_xpathPrefix; - } - - /** - * Set the XPath prefix - * - * @param string $prefix - * @return Zend_Feed_Reader_Extension_EntryAbstract - */ - public function setXpathPrefix($prefix) - { - $this->_xpathPrefix = $prefix; - return $this; - } - - /** - * Register XML namespaces - * - * @return void - */ - protected abstract function _registerNamespaces(); -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/FeedAbstract.php b/library/vendor/Zend/Feed/Reader/Extension/FeedAbstract.php deleted file mode 100644 index 3122f9719..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/FeedAbstract.php +++ /dev/null @@ -1,186 +0,0 @@ -_domDocument = $dom; - - if ($type !== null) { - $this->_data['type'] = $type; - } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($dom); - } - - if ($xpath !== null) { - $this->_xpath = $xpath; - } else { - $this->_xpath = new DOMXPath($this->_domDocument); - } - - $this->_registerNamespaces(); - } - - /** - * Get the DOM - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->_domDocument; - } - - /** - * Get the Feed's encoding - * - * @return string - */ - public function getEncoding() - { - $assumed = $this->getDomDocument()->encoding; - return $assumed; - } - - /** - * Get the feed type - * - * @return string - */ - public function getType() - { - return $this->_data['type']; - } - - - /** - * Return the feed as an array - * - * @return array - */ - public function toArray() // untested - { - return $this->_data; - } - - /** - * Set the XPath query - * - * @param DOMXPath $xpath - * @return Zend_Feed_Reader_Extension_EntryAbstract - */ - public function setXpath(DOMXPath $xpath) - { - $this->_xpath = $xpath; - $this->_registerNamespaces(); - return $this; - } - - /** - * Get the DOMXPath object - * - * @return string - */ - public function getXpath() - { - return $this->_xpath; - } - - /** - * Get the XPath prefix - * - * @return string - */ - public function getXpathPrefix() - { - return $this->_xpathPrefix; - } - - /** - * Set the XPath prefix - * - * @return Zend_Feed_Reader_Feed_Atom - */ - public function setXpathPrefix($prefix) - { - $this->_xpathPrefix = $prefix; - } - - /** - * Register the default namespaces for the current feed format - */ - abstract protected function _registerNamespaces(); -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/Podcast/Entry.php b/library/vendor/Zend/Feed/Reader/Extension/Podcast/Entry.php deleted file mode 100644 index 202307a1d..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/Podcast/Entry.php +++ /dev/null @@ -1,200 +0,0 @@ -_data['author'])) { - return $this->_data['author']; - } - - $author = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); - - if (!$author) { - $author = null; - } - - $this->_data['author'] = $author; - - return $this->_data['author']; - } - - /** - * Get the entry block - * - * @return string - */ - public function getBlock() - { - if (isset($this->_data['block'])) { - return $this->_data['block']; - } - - $block = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); - - if (!$block) { - $block = null; - } - - $this->_data['block'] = $block; - - return $this->_data['block']; - } - - /** - * Get the entry duration - * - * @return string - */ - public function getDuration() - { - if (isset($this->_data['duration'])) { - return $this->_data['duration']; - } - - $duration = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:duration)'); - - if (!$duration) { - $duration = null; - } - - $this->_data['duration'] = $duration; - - return $this->_data['duration']; - } - - /** - * Get the entry explicit - * - * @return string - */ - public function getExplicit() - { - if (isset($this->_data['explicit'])) { - return $this->_data['explicit']; - } - - $explicit = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); - - if (!$explicit) { - $explicit = null; - } - - $this->_data['explicit'] = $explicit; - - return $this->_data['explicit']; - } - - /** - * Get the entry keywords - * - * @return string - */ - public function getKeywords() - { - if (isset($this->_data['keywords'])) { - return $this->_data['keywords']; - } - - $keywords = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); - - if (!$keywords) { - $keywords = null; - } - - $this->_data['keywords'] = $keywords; - - return $this->_data['keywords']; - } - - /** - * Get the entry subtitle - * - * @return string - */ - public function getSubtitle() - { - if (isset($this->_data['subtitle'])) { - return $this->_data['subtitle']; - } - - $subtitle = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); - - if (!$subtitle) { - $subtitle = null; - } - - $this->_data['subtitle'] = $subtitle; - - return $this->_data['subtitle']; - } - - /** - * Get the entry summary - * - * @return string - */ - public function getSummary() - { - if (isset($this->_data['summary'])) { - return $this->_data['summary']; - } - - $summary = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); - - if (!$summary) { - $summary = null; - } - - $this->_data['summary'] = $summary; - - return $this->_data['summary']; - } - - /** - * Register iTunes namespace - * - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/Podcast/Feed.php b/library/vendor/Zend/Feed/Reader/Extension/Podcast/Feed.php deleted file mode 100644 index 9835ac726..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/Podcast/Feed.php +++ /dev/null @@ -1,292 +0,0 @@ -_data['author'])) { - return $this->_data['author']; - } - - $author = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); - - if (!$author) { - $author = null; - } - - $this->_data['author'] = $author; - - return $this->_data['author']; - } - - /** - * Get the entry block - * - * @return string - */ - public function getBlock() - { - if (isset($this->_data['block'])) { - return $this->_data['block']; - } - - $block = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); - - if (!$block) { - $block = null; - } - - $this->_data['block'] = $block; - - return $this->_data['block']; - } - - /** - * Get the entry category - * - * @return string - */ - public function getCategories() - { - if (isset($this->_data['categories'])) { - return $this->_data['categories']; - } - - $categoryList = $this->_xpath->query($this->getXpathPrefix() . '/itunes:category'); - - $categories = array(); - - if ($categoryList->length > 0) { - foreach ($categoryList as $node) { - $children = null; - - if ($node->childNodes->length > 0) { - $children = array(); - - foreach ($node->childNodes as $childNode) { - if (!($childNode instanceof DOMText)) { - $children[$childNode->getAttribute('text')] = null; - } - } - } - - $categories[$node->getAttribute('text')] = $children; - } - } - - - if (!$categories) { - $categories = null; - } - - $this->_data['categories'] = $categories; - - return $this->_data['categories']; - } - - /** - * Get the entry explicit - * - * @return string - */ - public function getExplicit() - { - if (isset($this->_data['explicit'])) { - return $this->_data['explicit']; - } - - $explicit = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); - - if (!$explicit) { - $explicit = null; - } - - $this->_data['explicit'] = $explicit; - - return $this->_data['explicit']; - } - - /** - * Get the entry image - * - * @return string - */ - public function getImage() - { - if (isset($this->_data['image'])) { - return $this->_data['image']; - } - - $image = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); - - if (!$image) { - $image = null; - } - - $this->_data['image'] = $image; - - return $this->_data['image']; - } - - /** - * Get the entry keywords - * - * @return string - */ - public function getKeywords() - { - if (isset($this->_data['keywords'])) { - return $this->_data['keywords']; - } - - $keywords = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); - - if (!$keywords) { - $keywords = null; - } - - $this->_data['keywords'] = $keywords; - - return $this->_data['keywords']; - } - - /** - * Get the entry's new feed url - * - * @return string - */ - public function getNewFeedUrl() - { - if (isset($this->_data['new-feed-url'])) { - return $this->_data['new-feed-url']; - } - - $newFeedUrl = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:new-feed-url)'); - - if (!$newFeedUrl) { - $newFeedUrl = null; - } - - $this->_data['new-feed-url'] = $newFeedUrl; - - return $this->_data['new-feed-url']; - } - - /** - * Get the entry owner - * - * @return string - */ - public function getOwner() - { - if (isset($this->_data['owner'])) { - return $this->_data['owner']; - } - - $owner = null; - - $email = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:email)'); - $name = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:name)'); - - if (!empty($email)) { - $owner = $email . (empty($name) ? '' : ' (' . $name . ')'); - } else if (!empty($name)) { - $owner = $name; - } - - if (!$owner) { - $owner = null; - } - - $this->_data['owner'] = $owner; - - return $this->_data['owner']; - } - - /** - * Get the entry subtitle - * - * @return string - */ - public function getSubtitle() - { - if (isset($this->_data['subtitle'])) { - return $this->_data['subtitle']; - } - - $subtitle = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); - - if (!$subtitle) { - $subtitle = null; - } - - $this->_data['subtitle'] = $subtitle; - - return $this->_data['subtitle']; - } - - /** - * Get the entry summary - * - * @return string - */ - public function getSummary() - { - if (isset($this->_data['summary'])) { - return $this->_data['summary']; - } - - $summary = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); - - if (!$summary) { - $summary = null; - } - - $this->_data['summary'] = $summary; - - return $this->_data['summary']; - } - - /** - * Register iTunes namespace - * - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/Slash/Entry.php b/library/vendor/Zend/Feed/Reader/Extension/Slash/Entry.php deleted file mode 100644 index eb02284b4..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/Slash/Entry.php +++ /dev/null @@ -1,142 +0,0 @@ -_getData('section'); - } - - /** - * Get the entry department - * - * @return string|null - */ - public function getDepartment() - { - return $this->_getData('department'); - } - - /** - * Get the entry hit_parade - * - * @return array - */ - public function getHitParade() - { - $name = 'hit_parade'; - - if (isset($this->_data[$name])) { - return $this->_data[$name]; - } - - $stringParade = $this->_getData($name); - $hitParade = array(); - - if (!empty($stringParade)) { - $stringParade = explode(',', $stringParade); - - foreach ($stringParade as $hit) - $hitParade[] = $hit + 0; //cast to integer - } - - $this->_data[$name] = $hitParade; - return $hitParade; - } - - /** - * Get the entry comments - * - * @return int - */ - public function getCommentCount() - { - $name = 'comments'; - - if (isset($this->_data[$name])) { - return $this->_data[$name]; - } - - $comments = $this->_getData($name, 'string'); - - if (!$comments) { - $this->_data[$name] = null; - return $this->_data[$name]; - } - - return $comments; - } - - /** - * Get the entry data specified by name - * @param string $name - * @param string $type - * - * @return mixed|null - */ - protected function _getData($name, $type = 'string') - { - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; - } - - $data = $this->_xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/slash10:' . $name . ')'); - - if (!$data) { - $data = null; - } - - $this->_data[$name] = $data; - - return $data; - } - - /** - * Register Slash namespaces - * - * @return void - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('slash10', 'http://purl.org/rss/1.0/modules/slash/'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/Syndication/Feed.php b/library/vendor/Zend/Feed/Reader/Extension/Syndication/Feed.php deleted file mode 100644 index ef9b98939..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/Syndication/Feed.php +++ /dev/null @@ -1,166 +0,0 @@ -_getData($name); - - if ($period === null) { - $this->_data[$name] = 'daily'; - return 'daily'; //Default specified by spec - } - - switch ($period) - { - case 'hourly': - case 'daily': - case 'weekly': - case 'yearly': - return $period; - default: - throw new Zend_Feed_Exception("Feed specified invalid update period: '$period'." - . " Must be one of hourly, daily, weekly or yearly" - ); - } - } - - /** - * Get update frequency - * @return int - */ - public function getUpdateFrequency() - { - $name = 'updateFrequency'; - $freq = $this->_getData($name, 'number'); - - if (!$freq || $freq < 1) { - $this->_data[$name] = 1; - return 1; - } - - return $freq; - } - - /** - * Get update frequency as ticks - * @return int - */ - public function getUpdateFrequencyAsTicks() - { - $name = 'updateFrequency'; - $freq = $this->_getData($name, 'number'); - - if (!$freq || $freq < 1) { - $this->_data[$name] = 1; - $freq = 1; - } - - $period = $this->getUpdatePeriod(); - $ticks = 1; - - switch ($period) - { - //intentional fall through - case 'yearly': - $ticks *= 52; //TODO: fix generalisation, how? - case 'weekly': - $ticks *= 7; - case 'daily': - $ticks *= 24; - case 'hourly': - $ticks *= 3600; - break; - default: //Never arrive here, exception thrown in getPeriod() - break; - } - - return $ticks / $freq; - } - - /** - * Get update base - * - * @return Zend_Date|null - */ - public function getUpdateBase() - { - $updateBase = $this->_getData('updateBase'); - $date = null; - if ($updateBase) { - $date = new Zend_Date; - $date->set($updateBase, Zend_Date::W3C); - } - return $date; - } - - /** - * Get the entry data specified by name - * - * @param string $name - * @param string $type - * @return mixed|null - */ - private function _getData($name, $type = 'string') - { - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; - } - - $data = $this->_xpath->evaluate($type . '(' . $this->getXpathPrefix() . '/syn10:' . $name . ')'); - - if (!$data) { - $data = null; - } - - $this->_data[$name] = $data; - - return $data; - } - - /** - * Register Syndication namespaces - * - * @return void - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('syn10', 'http://purl.org/rss/1.0/modules/syndication/'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/Thread/Entry.php b/library/vendor/Zend/Feed/Reader/Extension/Thread/Entry.php deleted file mode 100644 index b9dc3f57d..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/Thread/Entry.php +++ /dev/null @@ -1,90 +0,0 @@ -_getData('total'); - } - - /** - * Get the entry data specified by name - * - * @param string $name - * @param string $type - * @return mixed|null - */ - protected function _getData($name) - { - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; - } - - $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/thread10:' . $name . ')'); - - if (!$data) { - $data = null; - } - - $this->_data[$name] = $data; - - return $data; - } - - /** - * Register Atom Thread Extension 1.0 namespace - * - * @return void - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('thread10', 'http://purl.org/syndication/thread/1.0'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php b/library/vendor/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php deleted file mode 100644 index 3f850a9f2..000000000 --- a/library/vendor/Zend/Feed/Reader/Extension/WellFormedWeb/Entry.php +++ /dev/null @@ -1,71 +0,0 @@ -_data)) { - return $this->_data[$name]; - } - - $data = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/wfw:' . $name . ')'); - - if (!$data) { - $data = null; - } - - $this->_data[$name] = $data; - - return $data; - } - - /** - * Register Slash namespaces - * - * @return void - */ - protected function _registerNamespaces() - { - $this->_xpath->registerNamespace('wfw', 'http://wellformedweb.org/CommentAPI/'); - } -} diff --git a/library/vendor/Zend/Feed/Reader/Feed/Atom.php b/library/vendor/Zend/Feed/Reader/Feed/Atom.php deleted file mode 100644 index 2ee910cc1..000000000 --- a/library/vendor/Zend/Feed/Reader/Feed/Atom.php +++ /dev/null @@ -1,419 +0,0 @@ -getClassName('Atom_Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - foreach ($this->_extensions as $extension) { - $extension->setXpathPrefix('/atom:feed'); - } - } - - /** - * Get a single author - * - * @param int $index - * @return string|null - */ - public function getAuthor($index = 0) - { - $authors = $this->getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = $this->getExtension('Atom')->getAuthors(); - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; - } - - $copyright = $this->getExtension('Atom')->getCopyright(); - - if (!$copyright) { - $copyright = null; - } - - $this->_data['copyright'] = $copyright; - - return $this->_data['copyright']; - } - - /** - * Get the feed creation date - * - * @return string|null - */ - public function getDateCreated() - { - if (array_key_exists('datecreated', $this->_data)) { - return $this->_data['datecreated']; - } - - $dateCreated = $this->getExtension('Atom')->getDateCreated(); - - if (!$dateCreated) { - $dateCreated = null; - } - - $this->_data['datecreated'] = $dateCreated; - - return $this->_data['datecreated']; - } - - /** - * Get the feed modification date - * - * @return string|null - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $dateModified = $this->getExtension('Atom')->getDateModified(); - - if (!$dateModified) { - $dateModified = null; - } - - $this->_data['datemodified'] = $dateModified; - - return $this->_data['datemodified']; - } - - /** - * Get the feed lastBuild date. This is not implemented in Atom. - * - * @return string|null - */ - public function getLastBuildDate() - { - return null; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = $this->getExtension('Atom')->getDescription(); - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the feed generator entry - * - * @return string|null - */ - public function getGenerator() - { - if (array_key_exists('generator', $this->_data)) { - return $this->_data['generator']; - } - - $generator = $this->getExtension('Atom')->getGenerator(); - - $this->_data['generator'] = $generator; - - return $this->_data['generator']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = $this->getExtension('Atom')->getId(); - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; - } - - $language = $this->getExtension('Atom')->getLanguage(); - - if (!$language) { - $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); - } - - if (!$language) { - $language = null; - } - - $this->_data['language'] = $language; - - return $this->_data['language']; - } - - /** - * Get a link to the source website - * - * @return string|null - */ - public function getBaseUrl() - { - if (array_key_exists('baseUrl', $this->_data)) { - return $this->_data['baseUrl']; - } - - $baseUrl = $this->getExtension('Atom')->getBaseUrl(); - - $this->_data['baseUrl'] = $baseUrl; - - return $this->_data['baseUrl']; - } - - /** - * Get a link to the source website - * - * @return string|null - */ - public function getLink() - { - if (array_key_exists('link', $this->_data)) { - return $this->_data['link']; - } - - $link = $this->getExtension('Atom')->getLink(); - - $this->_data['link'] = $link; - - return $this->_data['link']; - } - - /** - * Get feed image data - * - * @return array|null - */ - public function getImage() - { - if (array_key_exists('image', $this->_data)) { - return $this->_data['image']; - } - - $link = $this->getExtension('Atom')->getImage(); - - $this->_data['image'] = $link; - - return $this->_data['image']; - } - - /** - * Get a link to the feed's XML Url - * - * @return string|null - */ - public function getFeedLink() - { - if (array_key_exists('feedlink', $this->_data)) { - return $this->_data['feedlink']; - } - - $link = $this->getExtension('Atom')->getFeedLink(); - - if ($link === null || empty($link)) { - $link = $this->getOriginalSourceUri(); - } - - $this->_data['feedlink'] = $link; - - return $this->_data['feedlink']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = $this->getExtension('Atom')->getTitle(); - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get an array of any supported Pusubhubbub endpoints - * - * @return array|null - */ - public function getHubs() - { - if (array_key_exists('hubs', $this->_data)) { - return $this->_data['hubs']; - } - - $hubs = $this->getExtension('Atom')->getHubs(); - - $this->_data['hubs'] = $hubs; - - return $this->_data['hubs']; - } - - /** - * Get all categories - * - * @return Zend_Feed_Reader_Collection_Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - $categoryCollection = $this->getExtension('Atom')->getCategories(); - - if (count($categoryCollection) == 0) { - $categoryCollection = $this->getExtension('DublinCore')->getCategories(); - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Read all entries to the internal entries array - * - * @return void - */ - protected function _indexEntries() - { - if ($this->getType() == Zend_Feed_Reader::TYPE_ATOM_10 || - $this->getType() == Zend_Feed_Reader::TYPE_ATOM_03) { - $entries = array(); - $entries = $this->_xpath->evaluate('//atom:entry'); - - foreach($entries as $index=>$entry) { - $this->_entries[$index] = $entry; - } - } - } - - /** - * Register the default namespaces for the current feed format - * - */ - protected function _registerNamespaces() - { - switch ($this->_data['type']) { - case Zend_Feed_Reader::TYPE_ATOM_03: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_03); - break; - case Zend_Feed_Reader::TYPE_ATOM_10: - default: - $this->_xpath->registerNamespace('atom', Zend_Feed_Reader::NAMESPACE_ATOM_10); - } - } -} diff --git a/library/vendor/Zend/Feed/Reader/Feed/Atom/Source.php b/library/vendor/Zend/Feed/Reader/Feed/Atom/Source.php deleted file mode 100644 index 7a0ff37e6..000000000 --- a/library/vendor/Zend/Feed/Reader/Feed/Atom/Source.php +++ /dev/null @@ -1,101 +0,0 @@ -_domDocument = $source->ownerDocument; - $this->_xpath = new DOMXPath($this->_domDocument); - $this->_data['type'] = $type; - $this->_registerNamespaces(); - $this->_loadExtensions(); - - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); - foreach ($this->_extensions as $extension) { - $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source'); - } - } - - /** - * Since this is not an Entry carrier but a vehicle for Feed metadata, any - * applicable Entry methods are stubbed out and do nothing. - */ - - /** - * @return void - */ - public function count() {} - - /** - * @return void - */ - public function current() {} - - /** - * @return void - */ - public function key() {} - - /** - * @return void - */ - public function next() {} - - /** - * @return void - */ - public function rewind() {} - - /** - * @return void - */ - public function valid() {} - - /** - * @return void - */ - protected function _indexEntries() {} - -} diff --git a/library/vendor/Zend/Feed/Reader/Feed/Rss.php b/library/vendor/Zend/Feed/Reader/Feed/Rss.php deleted file mode 100644 index b4f3a5c88..000000000 --- a/library/vendor/Zend/Feed/Reader/Feed/Rss.php +++ /dev/null @@ -1,726 +0,0 @@ -getClassName('DublinCore_Feed'); - $this->_extensions['DublinCore_Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); - $atomClass = Zend_Feed_Reader::getPluginLoader()->getClassName('Atom_Feed'); - $this->_extensions['Atom_Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $xpathPrefix = '/rss/channel'; - } else { - $xpathPrefix = '/rdf:RDF/rss:channel'; - } - foreach ($this->_extensions as $extension) { - $extension->setXpathPrefix($xpathPrefix); - } - } - - /** - * Get a single author - * - * @param int $index - * @return string|null - */ - public function getAuthor($index = 0) - { - $authors = $this->getAuthors(); - - if (isset($authors[$index])) { - return $authors[$index]; - } - - return null; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (array_key_exists('authors', $this->_data)) { - return $this->_data['authors']; - } - - $authors = array(); - $authors_dc = $this->getExtension('DublinCore')->getAuthors(); - if (!empty($authors_dc)) { - foreach ($authors_dc as $author) { - $authors[] = array( - 'name' => $author['name'] - ); - } - } - - /** - * Technically RSS doesn't specific author element use at the feed level - * but it's supported on a "just in case" basis. - */ - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 - && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('//author'); - } else { - $list = $this->_xpath->query('//rss:author'); - } - if ($list->length) { - foreach ($list as $author) { - $string = trim($author->nodeValue); - $email = null; - $name = null; - $data = array(); - // Pretty rough parsing - but it's a catchall - if (preg_match("/^.*@[^ ]*/", $string, $matches)) { - $data['email'] = trim($matches[0]); - if (preg_match("/\((.*)\)$/", $string, $matches)) { - $data['name'] = $matches[1]; - } - $authors[] = $data; - } - } - } - - if (count($authors) == 0) { - $authors = $this->getExtension('Atom')->getAuthors(); - } else { - $authors = new Zend_Feed_Reader_Collection_Author( - Zend_Feed_Reader::arrayUnique($authors) - ); - } - - if (count($authors) == 0) { - $authors = null; - } - - $this->_data['authors'] = $authors; - - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (array_key_exists('copyright', $this->_data)) { - return $this->_data['copyright']; - } - - $copyright = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $copyright = $this->_xpath->evaluate('string(/rss/channel/copyright)'); - } - - if (!$copyright && $this->getExtension('DublinCore') !== null) { - $copyright = $this->getExtension('DublinCore')->getCopyright(); - } - - if (empty($copyright)) { - $copyright = $this->getExtension('Atom')->getCopyright(); - } - - if (!$copyright) { - $copyright = null; - } - - $this->_data['copyright'] = $copyright; - - return $this->_data['copyright']; - } - - /** - * Get the feed creation date - * - * @return string|null - */ - public function getDateCreated() - { - return $this->getDateModified(); - } - - /** - * Get the feed modification date - * - * @return Zend_Date - */ - public function getDateModified() - { - if (array_key_exists('datemodified', $this->_data)) { - return $this->_data['datemodified']; - } - - $dateModified = null; - $date = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $dateModified = $this->_xpath->evaluate('string(/rss/channel/pubDate)'); - if (!$dateModified) { - $dateModified = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); - } - if ($dateModified) { - $dateModifiedParsed = strtotime($dateModified); - if ($dateModifiedParsed) { - $date = new Zend_Date($dateModifiedParsed); - } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); - $date = new Zend_Date; - foreach ($dateStandards as $standard) { - try { - $date->set($dateModified, $standard); - break; - } catch (Zend_Date_Exception $e) { - if ($standard == Zend_Date::DATES) { - throw new Zend_Feed_Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); - } - } - } - } - } - } - - if (!$date) { - $date = $this->getExtension('DublinCore')->getDate(); - } - - if (!$date) { - $date = $this->getExtension('Atom')->getDateModified(); - } - - if (!$date) { - $date = null; - } - - $this->_data['datemodified'] = $date; - - return $this->_data['datemodified']; - } - - /** - * Get the feed lastBuild date - * - * @return Zend_Date - */ - public function getLastBuildDate() - { - if (array_key_exists('lastBuildDate', $this->_data)) { - return $this->_data['lastBuildDate']; - } - - $lastBuildDate = null; - $date = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $lastBuildDate = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)'); - if ($lastBuildDate) { - $lastBuildDateParsed = strtotime($lastBuildDate); - if ($lastBuildDateParsed) { - $date = new Zend_Date($lastBuildDateParsed); - } else { - $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, - Zend_Date::RFC_2822, Zend_Date::DATES); - $date = new Zend_Date; - foreach ($dateStandards as $standard) { - try { - $date->set($lastBuildDate, $standard); - break; - } catch (Zend_Date_Exception $e) { - if ($standard == Zend_Date::DATES) { - throw new Zend_Feed_Exception( - 'Could not load date due to unrecognised' - .' format (should follow RFC 822 or 2822):' - . $e->getMessage(), - 0, $e - ); - } - } - } - } - } - } - - if (!$date) { - $date = null; - } - - $this->_data['lastBuildDate'] = $date; - - return $this->_data['lastBuildDate']; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (array_key_exists('description', $this->_data)) { - return $this->_data['description']; - } - - $description = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $description = $this->_xpath->evaluate('string(/rss/channel/description)'); - } else { - $description = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:description)'); - } - - if (!$description && $this->getExtension('DublinCore') !== null) { - $description = $this->getExtension('DublinCore')->getDescription(); - } - - if (empty($description)) { - $description = $this->getExtension('Atom')->getDescription(); - } - - if (!$description) { - $description = null; - } - - $this->_data['description'] = $description; - - return $this->_data['description']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (array_key_exists('id', $this->_data)) { - return $this->_data['id']; - } - - $id = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $id = $this->_xpath->evaluate('string(/rss/channel/guid)'); - } - - if (!$id && $this->getExtension('DublinCore') !== null) { - $id = $this->getExtension('DublinCore')->getId(); - } - - if (empty($id)) { - $id = $this->getExtension('Atom')->getId(); - } - - if (!$id) { - if ($this->getLink()) { - $id = $this->getLink(); - } elseif ($this->getTitle()) { - $id = $this->getTitle(); - } else { - $id = null; - } - } - - $this->_data['id'] = $id; - - return $this->_data['id']; - } - - /** - * Get the feed image data - * - * @return array|null - */ - public function getImage() - { - if (array_key_exists('image', $this->_data)) { - return $this->_data['image']; - } - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('/rss/channel/image'); - $prefix = '/rss/channel/image[1]'; - } else { - $list = $this->_xpath->query('/rdf:RDF/rss:channel/rss:image'); - $prefix = '/rdf:RDF/rss:channel/rss:image[1]'; - } - if ($list->length > 0) { - $image = array(); - $value = $this->_xpath->evaluate('string(' . $prefix . '/url)'); - if ($value) { - $image['uri'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/link)'); - if ($value) { - $image['link'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/title)'); - if ($value) { - $image['title'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/height)'); - if ($value) { - $image['height'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/width)'); - if ($value) { - $image['width'] = $value; - } - $value = $this->_xpath->evaluate('string(' . $prefix . '/description)'); - if ($value) { - $image['description'] = $value; - } - } else { - $image = null; - } - - $this->_data['image'] = $image; - - return $this->_data['image']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (array_key_exists('language', $this->_data)) { - return $this->_data['language']; - } - - $language = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $language = $this->_xpath->evaluate('string(/rss/channel/language)'); - } - - if (!$language && $this->getExtension('DublinCore') !== null) { - $language = $this->getExtension('DublinCore')->getLanguage(); - } - - if (empty($language)) { - $language = $this->getExtension('Atom')->getLanguage(); - } - - if (!$language) { - $language = $this->_xpath->evaluate('string(//@xml:lang[1])'); - } - - if (!$language) { - $language = null; - } - - $this->_data['language'] = $language; - - return $this->_data['language']; - } - - /** - * Get a link to the feed - * - * @return string|null - */ - public function getLink() - { - if (array_key_exists('link', $this->_data)) { - return $this->_data['link']; - } - - $link = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $link = $this->_xpath->evaluate('string(/rss/channel/link)'); - } else { - $link = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:link)'); - } - - if (empty($link)) { - $link = $this->getExtension('Atom')->getLink(); - } - - if (!$link) { - $link = null; - } - - $this->_data['link'] = $link; - - return $this->_data['link']; - } - - /** - * Get a link to the feed XML - * - * @return string|null - */ - public function getFeedLink() - { - if (array_key_exists('feedlink', $this->_data)) { - return $this->_data['feedlink']; - } - - $link = null; - - $link = $this->getExtension('Atom')->getFeedLink(); - - if ($link === null || empty($link)) { - $link = $this->getOriginalSourceUri(); - } - - $this->_data['feedlink'] = $link; - - return $this->_data['feedlink']; - } - - /** - * Get the feed generator entry - * - * @return string|null - */ - public function getGenerator() - { - if (array_key_exists('generator', $this->_data)) { - return $this->_data['generator']; - } - - $generator = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $generator = $this->_xpath->evaluate('string(/rss/channel/generator)'); - } - - if (!$generator) { - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $generator = $this->_xpath->evaluate('string(/rss/channel/atom:generator)'); - } else { - $generator = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/atom:generator)'); - } - } - - if (empty($generator)) { - $generator = $this->getExtension('Atom')->getGenerator(); - } - - if (!$generator) { - $generator = null; - } - - $this->_data['generator'] = $generator; - - return $this->_data['generator']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (array_key_exists('title', $this->_data)) { - return $this->_data['title']; - } - - $title = null; - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $title = $this->_xpath->evaluate('string(/rss/channel/title)'); - } else { - $title = $this->_xpath->evaluate('string(/rdf:RDF/rss:channel/rss:title)'); - } - - if (!$title && $this->getExtension('DublinCore') !== null) { - $title = $this->getExtension('DublinCore')->getTitle(); - } - - if (!$title) { - $title = $this->getExtension('Atom')->getTitle(); - } - - if (!$title) { - $title = null; - } - - $this->_data['title'] = $title; - - return $this->_data['title']; - } - - /** - * Get an array of any supported Pusubhubbub endpoints - * - * @return array|null - */ - public function getHubs() - { - if (array_key_exists('hubs', $this->_data)) { - return $this->_data['hubs']; - } - - $hubs = $this->getExtension('Atom')->getHubs(); - - if (empty($hubs)) { - $hubs = null; - } else { - $hubs = array_unique($hubs); - } - - $this->_data['hubs'] = $hubs; - - return $this->_data['hubs']; - } - - /** - * Get all categories - * - * @return Zend_Feed_Reader_Collection_Category - */ - public function getCategories() - { - if (array_key_exists('categories', $this->_data)) { - return $this->_data['categories']; - } - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && - $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $list = $this->_xpath->query('/rss/channel//category'); - } else { - $list = $this->_xpath->query('/rdf:RDF/rss:channel//rss:category'); - } - - if ($list->length) { - $categoryCollection = new Zend_Feed_Reader_Collection_Category; - foreach ($list as $category) { - $categoryCollection[] = array( - 'term' => $category->nodeValue, - 'scheme' => $category->getAttribute('domain'), - 'label' => $category->nodeValue, - ); - } - } else { - $categoryCollection = $this->getExtension('DublinCore')->getCategories(); - } - - if (count($categoryCollection) == 0) { - $categoryCollection = $this->getExtension('Atom')->getCategories(); - } - - $this->_data['categories'] = $categoryCollection; - - return $this->_data['categories']; - } - - /** - * Read all entries to the internal entries array - * - */ - protected function _indexEntries() - { - $entries = array(); - - if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) { - $entries = $this->_xpath->evaluate('//item'); - } else { - $entries = $this->_xpath->evaluate('//rss:item'); - } - - foreach($entries as $index=>$entry) { - $this->_entries[$index] = $entry; - } - } - - /** - * Register the default namespaces for the current feed format - * - */ - protected function _registerNamespaces() - { - switch ($this->_data['type']) { - case Zend_Feed_Reader::TYPE_RSS_10: - $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_10); - break; - - case Zend_Feed_Reader::TYPE_RSS_090: - $this->_xpath->registerNamespace('rdf', Zend_Feed_Reader::NAMESPACE_RDF); - $this->_xpath->registerNamespace('rss', Zend_Feed_Reader::NAMESPACE_RSS_090); - break; - } - } -} diff --git a/library/vendor/Zend/Feed/Reader/FeedAbstract.php b/library/vendor/Zend/Feed/Reader/FeedAbstract.php deleted file mode 100644 index 353e2c755..000000000 --- a/library/vendor/Zend/Feed/Reader/FeedAbstract.php +++ /dev/null @@ -1,318 +0,0 @@ -_domDocument = $domDocument; - $this->_xpath = new DOMXPath($this->_domDocument); - - if ($type !== null) { - $this->_data['type'] = $type; - } else { - $this->_data['type'] = Zend_Feed_Reader::detectType($this->_domDocument); - } - $this->_registerNamespaces(); - $this->_indexEntries(); - $this->_loadExtensions(); - } - - /** - * Set an original source URI for the feed being parsed. This value - * is returned from getFeedLink() method if the feed does not carry - * a self-referencing URI. - * - * @param string $uri - */ - public function setOriginalSourceUri($uri) - { - $this->_originalSourceUri = $uri; - } - - /** - * Get an original source URI for the feed being parsed. Returns null if - * unset or the feed was not imported from a URI. - * - * @return string|null - */ - public function getOriginalSourceUri() - { - return $this->_originalSourceUri; - } - - /** - * Get the number of feed entries. - * Required by the Iterator interface. - * - * @return int - */ - public function count() - { - return count($this->_entries); - } - - /** - * Return the current entry - * - * @return Zend_Feed_Reader_EntryInterface - */ - public function current() - { - if (substr($this->getType(), 0, 3) == 'rss') { - $reader = new Zend_Feed_Reader_Entry_Rss($this->_entries[$this->key()], $this->key(), $this->getType()); - } else { - $reader = new Zend_Feed_Reader_Entry_Atom($this->_entries[$this->key()], $this->key(), $this->getType()); - } - - $reader->setXpath($this->_xpath); - - return $reader; - } - - /** - * Get the DOM - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->_domDocument; - } - - /** - * Get the Feed's encoding - * - * @return string - */ - public function getEncoding() - { - $assumed = $this->getDomDocument()->encoding; - if (empty($assumed)) { - $assumed = 'UTF-8'; - } - return $assumed; - } - - /** - * Get feed as xml - * - * @return string - */ - public function saveXml() - { - return $this->getDomDocument()->saveXml(); - } - - /** - * Get the DOMElement representing the items/feed element - * - * @return DOMElement - */ - public function getElement() - { - return $this->getDomDocument()->documentElement; - } - - /** - * Get the DOMXPath object for this feed - * - * @return DOMXPath - */ - public function getXpath() - { - return $this->_xpath; - } - - /** - * Get the feed type - * - * @return string - */ - public function getType() - { - return $this->_data['type']; - } - - /** - * Return the current feed key - * - * @return unknown - */ - public function key() - { - return $this->_entriesKey; - } - - /** - * Move the feed pointer forward - * - */ - public function next() - { - ++$this->_entriesKey; - } - - /** - * Reset the pointer in the feed object - * - */ - public function rewind() - { - $this->_entriesKey = 0; - } - - /** - * Check to see if the iterator is still valid - * - * @return boolean - */ - public function valid() - { - return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); - } - - public function getExtensions() - { - return $this->_extensions; - } - - public function __call($method, $args) - { - foreach ($this->_extensions as $extension) { - if (method_exists($extension, $method)) { - return call_user_func_array(array($extension, $method), $args); - } - } - throw new Zend_Feed_Exception('Method: ' . $method - . 'does not exist and could not be located on a registered Extension'); - } - - /** - * Return an Extension object with the matching name (postfixed with _Feed) - * - * @param string $name - * @return Zend_Feed_Reader_Extension_FeedAbstract - */ - public function getExtension($name) - { - if (array_key_exists($name . '_Feed', $this->_extensions)) { - return $this->_extensions[$name . '_Feed']; - } - return null; - } - - protected function _loadExtensions() - { - $all = Zend_Feed_Reader::getExtensions(); - $feed = $all['feed']; - foreach ($feed as $extension) { - if (in_array($extension, $all['core'])) { - continue; - } - $className = Zend_Feed_Reader::getPluginLoader()->getClassName($extension); - $this->_extensions[$extension] = new $className( - $this->getDomDocument(), $this->_data['type'], $this->_xpath - ); - } - } - - /** - * Read all entries to the internal entries array - * - */ - abstract protected function _indexEntries(); - - /** - * Register the default namespaces for the current feed format - * - */ - abstract protected function _registerNamespaces(); -} diff --git a/library/vendor/Zend/Feed/Reader/FeedInterface.php b/library/vendor/Zend/Feed/Reader/FeedInterface.php deleted file mode 100644 index be65c725f..000000000 --- a/library/vendor/Zend/Feed/Reader/FeedInterface.php +++ /dev/null @@ -1,122 +0,0 @@ -getAttribute('rel')) !== 'alternate' - || !$link->getAttribute('type') || !$link->getAttribute('href')) { - continue; - } - if (!isset($this->rss) && $link->getAttribute('type') == 'application/rss+xml') { - $this->rss = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri); - } elseif(!isset($this->atom) && $link->getAttribute('type') == 'application/atom+xml') { - $this->atom = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri); - } elseif(!isset($this->rdf) && $link->getAttribute('type') == 'application/rdf+xml') { - $this->rdf = $this->_absolutiseUri(trim($link->getAttribute('href')), $uri); - } - $this[] = new self(array( - 'rel' => 'alternate', - 'type' => $link->getAttribute('type'), - 'href' => $this->_absolutiseUri(trim($link->getAttribute('href')), $uri), - )); - } - } - - /** - * Attempt to turn a relative URI into an absolute URI - */ - protected function _absolutiseUri($link, $uri = null) - { - if (!Zend_Uri::check($link)) { - if ($uri !== null) { - $uri = Zend_Uri::factory($uri); - - if ($link[0] !== '/') { - $link = $uri->getPath() . '/' . $link; - } - - $link = $uri->getScheme() . '://' . $uri->getHost() . '/' . $this->_canonicalizePath($link); - if (!Zend_Uri::check($link)) { - $link = null; - } - } - } - return $link; - } - - /** - * Canonicalize relative path - */ - protected function _canonicalizePath($path) - { - $parts = array_filter(explode('/', $path)); - $absolutes = array(); - foreach ($parts as $part) { - if ('.' == $part) { - continue; - } - if ('..' == $part) { - array_pop($absolutes); - } else { - $absolutes[] = $part; - } - } - return implode('/', $absolutes); - } - - /** - * Supports lazy loading of feeds using Zend_Feed_Reader::import() but - * delegates any other operations to the parent class. - * - * @param string $offset - * @return mixed - * @uses Zend_Feed_Reader - */ - public function offsetGet($offset) - { - if ($offset == 'feed' && !$this->offsetExists('feed')) { - if (!$this->offsetExists('href')) { - return null; - } - $feed = Zend_Feed_Reader::import($this->offsetGet('href')); - $this->offsetSet('feed', $feed); - return $feed; - } - return parent::offsetGet($offset); - } - -} diff --git a/library/vendor/Zend/Feed/Rss.php b/library/vendor/Zend/Feed/Rss.php deleted file mode 100644 index 149aaffc7..000000000 --- a/library/vendor/Zend/Feed/Rss.php +++ /dev/null @@ -1,526 +0,0 @@ -s). - * - * @var string - */ - protected $_entryElementName = 'item'; - - /** - * The default namespace for RSS channels. - * - * @var string - */ - protected $_defaultNamespace = 'rss'; - - /** - * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases. - * - * @return void - * @throws Zend_Feed_Exception - */ - public function __wakeup() - { - parent::__wakeup(); - - // Find the base channel element and create an alias to it. - $rdfTags = $this->_element->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'RDF'); - if ($rdfTags->length != 0) { - $this->_element = $rdfTags->item(0); - } else { - $this->_element = $this->_element->getElementsByTagName('channel')->item(0); - } - if (!$this->_element) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('No root element found, cannot parse channel.'); - } - - // Find the entries and save a pointer to them for speed and - // simplicity. - $this->_buildEntryCache(); - } - - - /** - * Make accessing some individual elements of the channel easier. - * - * Special accessors 'item' and 'items' are provided so that if - * you wish to iterate over an RSS channel's items, you can do so - * using foreach ($channel->items as $item) or foreach - * ($channel->item as $item). - * - * @param string $var The property to access. - * @return mixed - */ - public function __get($var) - { - switch ($var) { - case 'item': - // fall through to the next case - case 'items': - return $this; - - default: - return parent::__get($var); - } - } - - /** - * Generate the header of the feed when working in write mode - * - * @param array $array the data to use - * @return DOMElement root node - */ - protected function _mapFeedHeaders($array) - { - $channel = $this->_element->createElement('channel'); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($array->title)); - $channel->appendChild($title); - - $link = $this->_element->createElement('link', $array->link); - $channel->appendChild($link); - - $desc = isset($array->description) ? $array->description : ''; - $description = $this->_element->createElement('description'); - $description->appendChild($this->_element->createCDATASection($desc)); - $channel->appendChild($description); - - $pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time(); - $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); - $channel->appendChild($pubdate); - - if (isset($array->published)) { - $lastBuildDate = $this->_element->createElement('lastBuildDate', date(DATE_RSS, $array->published)); - $channel->appendChild($lastBuildDate); - } - - $editor = ''; - if (!empty($array->email)) { - $editor .= $array->email; - } - if (!empty($array->author)) { - $editor .= ' (' . $array->author . ')'; - } - if (!empty($editor)) { - $author = $this->_element->createElement('managingEditor', ltrim($editor)); - $channel->appendChild($author); - } - if (isset($array->webmaster)) { - $channel->appendChild($this->_element->createElement('webMaster', $array->webmaster)); - } - - if (!empty($array->copyright)) { - $copyright = $this->_element->createElement('copyright', $array->copyright); - $channel->appendChild($copyright); - } - - if (isset($array->category)) { - $category = $this->_element->createElement('category', $array->category); - $channel->appendChild($category); - } - - if (!empty($array->image)) { - $image = $this->_element->createElement('image'); - $url = $this->_element->createElement('url', $array->image); - $image->appendChild($url); - $imagetitle = $this->_element->createElement('title'); - $imagetitle->appendChild($this->_element->createCDATASection($array->title)); - $image->appendChild($imagetitle); - $imagelink = $this->_element->createElement('link', $array->link); - $image->appendChild($imagelink); - - $channel->appendChild($image); - } - - $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed'; - $generator = $this->_element->createElement('generator', $generator); - $channel->appendChild($generator); - - if (!empty($array->language)) { - $language = $this->_element->createElement('language', $array->language); - $channel->appendChild($language); - } - - $doc = $this->_element->createElement('docs', 'http://blogs.law.harvard.edu/tech/rss'); - $channel->appendChild($doc); - - if (isset($array->cloud)) { - $cloud = $this->_element->createElement('cloud'); - $cloud->setAttribute('domain', $array->cloud['uri']->getHost()); - $cloud->setAttribute('port', $array->cloud['uri']->getPort()); - $cloud->setAttribute('path', $array->cloud['uri']->getPath()); - $cloud->setAttribute('registerProcedure', $array->cloud['procedure']); - $cloud->setAttribute('protocol', $array->cloud['protocol']); - $channel->appendChild($cloud); - } - - if (isset($array->ttl)) { - $ttl = $this->_element->createElement('ttl', $array->ttl); - $channel->appendChild($ttl); - } - - if (isset($array->rating)) { - $rating = $this->_element->createElement('rating', $array->rating); - $channel->appendChild($rating); - } - - if (isset($array->textInput)) { - $textinput = $this->_element->createElement('textInput'); - $textinput->appendChild($this->_element->createElement('title', $array->textInput['title'])); - $textinput->appendChild($this->_element->createElement('description', $array->textInput['description'])); - $textinput->appendChild($this->_element->createElement('name', $array->textInput['name'])); - $textinput->appendChild($this->_element->createElement('link', $array->textInput['link'])); - $channel->appendChild($textinput); - } - - if (isset($array->skipHours)) { - $skipHours = $this->_element->createElement('skipHours'); - foreach ($array->skipHours as $hour) { - $skipHours->appendChild($this->_element->createElement('hour', $hour)); - } - $channel->appendChild($skipHours); - } - - if (isset($array->skipDays)) { - $skipDays = $this->_element->createElement('skipDays'); - foreach ($array->skipDays as $day) { - $skipDays->appendChild($this->_element->createElement('day', $day)); - } - $channel->appendChild($skipDays); - } - - if (isset($array->itunes)) { - $this->_buildiTunes($channel, $array); - } - - return $channel; - } - - /** - * Adds the iTunes extensions to a root node - * - * @param DOMElement $root - * @param array $array - * @return void - */ - private function _buildiTunes(DOMElement $root, $array) - { - /* author node */ - $author = ''; - if (isset($array->itunes->author)) { - $author = $array->itunes->author; - } elseif (isset($array->author)) { - $author = $array->author; - } - if (!empty($author)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:author', $author); - $root->appendChild($node); - } - - /* owner node */ - $author = ''; - $email = ''; - if (isset($array->itunes->owner)) { - if (isset($array->itunes->owner['name'])) { - $author = $array->itunes->owner['name']; - } - if (isset($array->itunes->owner['email'])) { - $email = $array->itunes->owner['email']; - } - } - if (empty($author) && isset($array->author)) { - $author = $array->author; - } - if (empty($email) && isset($array->email)) { - $email = $array->email; - } - if (!empty($author) || !empty($email)) { - $owner = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:owner'); - if (!empty($author)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:name', $author); - $owner->appendChild($node); - } - if (!empty($email)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:email', $email); - $owner->appendChild($node); - } - $root->appendChild($owner); - } - $image = ''; - if (isset($array->itunes->image)) { - $image = $array->itunes->image; - } elseif (isset($array->image)) { - $image = $array->image; - } - if (!empty($image)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:image'); - $node->setAttribute('href', $image); - $root->appendChild($node); - } - $subtitle = ''; - if (isset($array->itunes->subtitle)) { - $subtitle = $array->itunes->subtitle; - } elseif (isset($array->description)) { - $subtitle = $array->description; - } - if (!empty($subtitle)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:subtitle', $subtitle); - $root->appendChild($node); - } - $summary = ''; - if (isset($array->itunes->summary)) { - $summary = $array->itunes->summary; - } elseif (isset($array->description)) { - $summary = $array->description; - } - if (!empty($summary)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:summary', $summary); - $root->appendChild($node); - } - if (isset($array->itunes->block)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:block', $array->itunes->block); - $root->appendChild($node); - } - if (isset($array->itunes->explicit)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:explicit', $array->itunes->explicit); - $root->appendChild($node); - } - if (isset($array->itunes->keywords)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:keywords', $array->itunes->keywords); - $root->appendChild($node); - } - if (isset($array->itunes->new_feed_url)) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:new-feed-url', $array->itunes->new_feed_url); - $root->appendChild($node); - } - if (isset($array->itunes->category)) { - foreach ($array->itunes->category as $i => $category) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $node->setAttribute('text', $category['main']); - $root->appendChild($node); - $add_end_category = false; - if (!empty($category['sub'])) { - $add_end_category = true; - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $node->setAttribute('text', $category['sub']); - $root->appendChild($node); - } - if ($i > 0 || $add_end_category) { - $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category'); - $root->appendChild($node); - } - } - } - } - - /** - * Generate the entries of the feed when working in write mode - * - * The following nodes are constructed for each feed entry - * - * entry title - * url to feed entry - * url to feed entry - * short text - * long version, can contain html - * - * - * @param DOMElement $root the root node to use - * @param array $array the data to use - * @return void - */ - protected function _mapFeedEntries(DOMElement $root, $array) - { - Zend_Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); - - foreach ($array as $dataentry) { - $item = $this->_element->createElement('item'); - - $title = $this->_element->createElement('title'); - $title->appendChild($this->_element->createCDATASection($dataentry->title)); - $item->appendChild($title); - - if (isset($dataentry->author)) { - $author = $this->_element->createElement('author', $dataentry->author); - $item->appendChild($author); - } - - $link = $this->_element->createElement('link', $dataentry->link); - $item->appendChild($link); - - if (isset($dataentry->guid)) { - $guid = $this->_element->createElement('guid', $dataentry->guid); - if (!Zend_Uri::check($dataentry->guid)) { - $guid->setAttribute('isPermaLink', 'false'); - } - $item->appendChild($guid); - } - - $description = $this->_element->createElement('description'); - $description->appendChild($this->_element->createCDATASection($dataentry->description)); - $item->appendChild($description); - - if (isset($dataentry->content)) { - $content = $this->_element->createElement('content:encoded'); - $content->appendChild($this->_element->createCDATASection($dataentry->content)); - $item->appendChild($content); - } - - $pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time(); - $pubdate = $this->_element->createElement('pubDate', date(DATE_RSS, $pubdate)); - $item->appendChild($pubdate); - - if (isset($dataentry->category)) { - foreach ($dataentry->category as $category) { - $node = $this->_element->createElement('category'); - $node->appendChild($this->_element->createCDATASection($category['term'])); - if (isset($category['scheme'])) { - $node->setAttribute('domain', $category['scheme']); - } - $item->appendChild($node); - } - } - - if (isset($dataentry->source)) { - $source = $this->_element->createElement('source', $dataentry->source['title']); - $source->setAttribute('url', $dataentry->source['url']); - $item->appendChild($source); - } - - if (isset($dataentry->comments)) { - $comments = $this->_element->createElement('comments', $dataentry->comments); - $item->appendChild($comments); - } - if (isset($dataentry->commentRss)) { - $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/', - 'wfw:commentRss', - $dataentry->commentRss); - $item->appendChild($comments); - } - - - if (isset($dataentry->enclosure)) { - foreach ($dataentry->enclosure as $enclosure) { - $node = $this->_element->createElement('enclosure'); - $node->setAttribute('url', $enclosure['url']); - if (isset($enclosure['type'])) { - $node->setAttribute('type', $enclosure['type']); - } - if (isset($enclosure['length'])) { - $node->setAttribute('length', $enclosure['length']); - } - $item->appendChild($node); - } - } - - $root->appendChild($item); - } - } - - /** - * Override Zend_Feed_Element to include root node - * - * @return string - */ - public function saveXml() - { - // Return a complete document including XML prologue. - $doc = new DOMDocument($this->_element->ownerDocument->version, - $this->_element->ownerDocument->actualEncoding); - $root = $doc->createElement('rss'); - - // Use rss version 2.0 - $root->setAttribute('version', '2.0'); - - // Content namespace - $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:content', 'http://purl.org/rss/1.0/modules/content/'); - $root->appendChild($doc->importNode($this->_element, true)); - - // Append root node - $doc->appendChild($root); - - // Format output - $doc->formatOutput = true; - - return $doc->saveXML(); - } - - /** - * Send feed to a http client with the correct header - * - * @return void - * @throws Zend_Feed_Exception if headers have already been sent - */ - public function send() - { - if (headers_sent()) { - /** - * @see Zend_Feed_Exception - */ - throw new Zend_Feed_Exception('Cannot send RSS because headers have already been sent.'); - } - - header('Content-Type: application/rss+xml; charset=' . $this->_element->ownerDocument->actualEncoding); - - echo $this->saveXml(); - } - -} diff --git a/library/vendor/Zend/Feed/Writer.php b/library/vendor/Zend/Feed/Writer.php deleted file mode 100644 index 2b9215e9f..000000000 --- a/library/vendor/Zend/Feed/Writer.php +++ /dev/null @@ -1,265 +0,0 @@ - array(), - 'feed' => array(), - 'entryRenderer' => array(), - 'feedRenderer' => array(), - ); - - /** - * Set plugin loader for use with Extensions - * - * @param Zend_Loader_PluginLoader_Interface - */ - public static function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) - { - self::$_pluginLoader = $loader; - } - - /** - * Get plugin loader for use with Extensions - * - * @return Zend_Loader_PluginLoader_Interface - */ - public static function getPluginLoader() - { - if (!isset(self::$_pluginLoader)) { - self::$_pluginLoader = new Zend_Loader_PluginLoader(array( - 'Zend_Feed_Writer_Extension_' => 'Zend/Feed/Writer/Extension/', - )); - } - return self::$_pluginLoader; - } - - /** - * Add prefix path for loading Extensions - * - * @param string $prefix - * @param string $path - * @return void - */ - public static function addPrefixPath($prefix, $path) - { - $prefix = rtrim($prefix, '_'); - $path = rtrim($path, DIRECTORY_SEPARATOR); - self::getPluginLoader()->addPrefixPath($prefix, $path); - } - - /** - * Add multiple Extension prefix paths at once - * - * @param array $spec - * @return void - */ - public static function addPrefixPaths(array $spec) - { - if (isset($spec['prefix']) && isset($spec['path'])) { - self::addPrefixPath($spec['prefix'], $spec['path']); - } - foreach ($spec as $prefixPath) { - if (isset($prefixPath['prefix']) && isset($prefixPath['path'])) { - self::addPrefixPath($prefixPath['prefix'], $prefixPath['path']); - } - } - } - - /** - * Register an Extension by name - * - * @param string $name - * @return void - * @throws Zend_Feed_Exception if unable to resolve Extension class - */ - public static function registerExtension($name) - { - $feedName = $name . '_Feed'; - $entryName = $name . '_Entry'; - $feedRendererName = $name . '_Renderer_Feed'; - $entryRendererName = $name . '_Renderer_Entry'; - if (self::isRegistered($name)) { - if (self::getPluginLoader()->isLoaded($feedName) - || self::getPluginLoader()->isLoaded($entryName) - || self::getPluginLoader()->isLoaded($feedRendererName) - || self::getPluginLoader()->isLoaded($entryRendererName) - ) { - return; - } - } - try { - self::getPluginLoader()->load($feedName); - self::$_extensions['feed'][] = $feedName; - } catch (Zend_Loader_PluginLoader_Exception $e) { - } - try { - self::getPluginLoader()->load($entryName); - self::$_extensions['entry'][] = $entryName; - } catch (Zend_Loader_PluginLoader_Exception $e) { - } - try { - self::getPluginLoader()->load($feedRendererName); - self::$_extensions['feedRenderer'][] = $feedRendererName; - } catch (Zend_Loader_PluginLoader_Exception $e) { - } - try { - self::getPluginLoader()->load($entryRendererName); - self::$_extensions['entryRenderer'][] = $entryRendererName; - } catch (Zend_Loader_PluginLoader_Exception $e) { - } - if (!self::getPluginLoader()->isLoaded($feedName) - && !self::getPluginLoader()->isLoaded($entryName) - && !self::getPluginLoader()->isLoaded($feedRendererName) - && !self::getPluginLoader()->isLoaded($entryRendererName) - ) { - throw new Zend_Feed_Exception('Could not load extension: ' . $name - . 'using Plugin Loader. Check prefix paths are configured and extension exists.'); - } - } - - /** - * Is a given named Extension registered? - * - * @param string $extensionName - * @return boolean - */ - public static function isRegistered($extensionName) - { - $feedName = $extensionName . '_Feed'; - $entryName = $extensionName . '_Entry'; - $feedRendererName = $extensionName . '_Renderer_Feed'; - $entryRendererName = $extensionName . '_Renderer_Entry'; - if (in_array($feedName, self::$_extensions['feed']) - || in_array($entryName, self::$_extensions['entry']) - || in_array($feedRendererName, self::$_extensions['feedRenderer']) - || in_array($entryRendererName, self::$_extensions['entryRenderer']) - ) { - return true; - } - return false; - } - - /** - * Get a list of extensions - * - * @return array - */ - public static function getExtensions() - { - return self::$_extensions; - } - - /** - * Reset class state to defaults - * - * @return void - */ - public static function reset() - { - self::$_pluginLoader = null; - self::$_prefixPaths = array(); - self::$_extensions = array( - 'entry' => array(), - 'feed' => array(), - 'entryRenderer' => array(), - 'feedRenderer' => array(), - ); - } - - /** - * Register core (default) extensions - * - * @return void - */ - public static function registerCoreExtensions() - { - self::registerExtension('DublinCore'); - self::registerExtension('Content'); - self::registerExtension('Atom'); - self::registerExtension('Slash'); - self::registerExtension('WellFormedWeb'); - self::registerExtension('Threading'); - self::registerExtension('ITunes'); - } - - public static function lcfirst($str) - { - $str[0] = strtolower($str[0]); - return $str; - } - -} diff --git a/library/vendor/Zend/Feed/Writer/Deleted.php b/library/vendor/Zend/Feed/Writer/Deleted.php deleted file mode 100644 index 0302bed16..000000000 --- a/library/vendor/Zend/Feed/Writer/Deleted.php +++ /dev/null @@ -1,195 +0,0 @@ -_data['encoding'] = $encoding; - } - - /** - * Get the feed character encoding - * - * @return string|null - */ - public function getEncoding() - { - if (!array_key_exists('encoding', $this->_data)) { - return 'UTF-8'; - } - return $this->_data['encoding']; - } - - /** - * Unset a specific data point - * - * @param string $name - */ - public function remove($name) - { - if (isset($this->_data[$name])) { - unset($this->_data[$name]); - } - } - - /** - * Set the current feed type being exported to "rss" or "atom". This allows - * other objects to gracefully choose whether to execute or not, depending - * on their appropriateness for the current type, e.g. renderers. - * - * @param string $type - */ - public function setType($type) - { - $this->_type = $type; - } - - /** - * Retrieve the current or last feed type exported. - * - * @return string Value will be "rss" or "atom" - */ - public function getType() - { - return $this->_type; - } - - public function setReference($reference) - { - if (empty($reference) || !is_string($reference)) { - throw new Zend_Feed_Exception('Invalid parameter: reference must be a non-empty string'); - } - $this->_data['reference'] = $reference; - } - - public function getReference() - { - if (!array_key_exists('reference', $this->_data)) { - return null; - } - return $this->_data['reference']; - } - - public function setWhen($date = null) - { - $zdate = null; - if ($date === null) { - $zdate = new Zend_Date; - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['when'] = $zdate; - } - - public function getWhen() - { - if (!array_key_exists('when', $this->_data)) { - return null; - } - return $this->_data['when']; - } - - public function setBy(array $by) - { - $author = array(); - if (!array_key_exists('name', $by) - || empty($by['name']) - || !is_string($by['name']) - ) { - throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); - } - $author['name'] = $by['name']; - if (isset($by['email'])) { - if (empty($by['email']) || !is_string($by['email'])) { - throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); - } - $author['email'] = $by['email']; - } - if (isset($by['uri'])) { - if (empty($by['uri']) - || !is_string($by['uri']) - || !Zend_Uri::check($by['uri']) - ) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $by['uri']; - } - $this->_data['by'] = $author; - } - - public function getBy() - { - if (!array_key_exists('by', $this->_data)) { - return null; - } - return $this->_data['by']; - } - - public function setComment($comment) - { - $this->_data['comment'] = $comment; - } - - public function getComment() - { - if (!array_key_exists('comment', $this->_data)) { - return null; - } - return $this->_data['comment']; - } - -} diff --git a/library/vendor/Zend/Feed/Writer/Entry.php b/library/vendor/Zend/Feed/Writer/Entry.php deleted file mode 100644 index fd8cb4e9f..000000000 --- a/library/vendor/Zend/Feed/Writer/Entry.php +++ /dev/null @@ -1,734 +0,0 @@ -_loadExtensions(); - } - - /** - * Set a single author - * - * @param int $index - * @return string|null - */ - public function addAuthor($name, $email = null, $uri = null) - { - $author = array(); - if (is_array($name)) { - if (!array_key_exists('name', $name) - || empty($name['name']) - || !is_string($name['name']) - ) { - throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); - } - $author['name'] = $name['name']; - if (isset($name['email'])) { - if (empty($name['email']) || !is_string($name['email'])) { - throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); - } - $author['email'] = $name['email']; - } - if (isset($name['uri'])) { - if (empty($name['uri']) - || !is_string($name['uri']) - || !Zend_Uri::check($name['uri']) - ) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $name['uri']; - } - /** - * @deprecated - * Array notation (above) is preferred and will be the sole supported input from ZF 2.0 - */ - } else { - if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); - } - $author['name'] = $name; - if (isset($email)) { - if (empty($email) || !is_string($email)) { - throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); - } - $author['email'] = $email; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $uri; - } - } - $this->_data['authors'][] = $author; - } - - /** - * Set an array with feed authors - * - * @return array - */ - public function addAuthors(array $authors) - { - foreach($authors as $author) { - $this->addAuthor($author); - } - } - - /** - * Set the feed character encoding - * - * @return string|null - */ - public function setEncoding($encoding) - { - if (empty($encoding) || !is_string($encoding)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['encoding'] = $encoding; - } - - /** - * Get the feed character encoding - * - * @return string|null - */ - public function getEncoding() - { - if (!array_key_exists('encoding', $this->_data)) { - return 'UTF-8'; - } - return $this->_data['encoding']; - } - - /** - * Set the copyright entry - * - * @return string|null - */ - public function setCopyright($copyright) - { - if (empty($copyright) || !is_string($copyright)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['copyright'] = $copyright; - } - - /** - * Set the entry's content - * - * @return string|null - */ - public function setContent($content) - { - if (empty($content) || !is_string($content)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['content'] = $content; - } - - /** - * Set the feed creation date - * - * @return string|null - */ - public function setDateCreated($date = null) - { - $zdate = null; - if ($date === null) { - $zdate = new Zend_Date; - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateCreated'] = $zdate; - } - - /** - * Set the feed modification date - * - * @return string|null - */ - public function setDateModified($date = null) - { - $zdate = null; - if ($date === null) { - $zdate = new Zend_Date; - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateModified'] = $zdate; - } - - /** - * Set the feed description - * - * @return string|null - */ - public function setDescription($description) - { - if (empty($description) || !is_string($description)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['description'] = $description; - } - - /** - * Set the feed ID - * - * @return string|null - */ - public function setId($id) - { - if (empty($id) || !is_string($id)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['id'] = $id; - } - - /** - * Set a link to the HTML source of this entry - * - * @return string|null - */ - public function setLink($link) - { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); - } - $this->_data['link'] = $link; - } - - /** - * Set the number of comments associated with this entry - * - * @return string|null - */ - public function setCommentCount($count) - { - if ( !is_numeric($count) || (int) $count < 0) { - throw new Zend_Feed_Exception('Invalid parameter: "count" must be a non-empty integer number'); - } - $this->_data['commentCount'] = (int) $count; - } - - /** - * Set a link to a HTML page containing comments associated with this entry - * - * @return string|null - */ - public function setCommentLink($link) - { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); - } - $this->_data['commentLink'] = $link; - } - - /** - * Set a link to an XML feed for any comments associated with this entry - * - * @return string|null - */ - public function setCommentFeedLink(array $link) - { - if (!isset($link['uri']) || !is_string($link['uri']) || !Zend_Uri::check($link['uri'])) { - throw new Zend_Feed_Exception('Invalid parameter: "link" must be a non-empty string and valid URI/IRI'); - } - if (!isset($link['type']) || !in_array($link['type'], array('atom', 'rss', 'rdf'))) { - throw new Zend_Feed_Exception('Invalid parameter: "type" must be one' - . ' of "atom", "rss" or "rdf"'); - } - if (!isset($this->_data['commentFeedLinks'])) { - $this->_data['commentFeedLinks'] = array(); - } - $this->_data['commentFeedLinks'][] = $link; - } - - /** - * Set a links to an XML feed for any comments associated with this entry. - * Each link is an array with keys "uri" and "type", where type is one of: - * "atom", "rss" or "rdf". - * - * @return string|null - */ - public function setCommentFeedLinks(array $links) - { - foreach ($links as $link) { - $this->setCommentFeedLink($link); - } - } - - /** - * Set the feed title - * - * @return string|null - */ - public function setTitle($title) - { - if (empty($title) || !is_string($title)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['title'] = $title; - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (!array_key_exists('authors', $this->_data)) { - return null; - } - return $this->_data['authors']; - } - - /** - * Get the entry content - * - * @return string - */ - public function getContent() - { - if (!array_key_exists('content', $this->_data)) { - return null; - } - return $this->_data['content']; - } - - /** - * Get the entry copyright information - * - * @return string - */ - public function getCopyright() - { - if (!array_key_exists('copyright', $this->_data)) { - return null; - } - return $this->_data['copyright']; - } - - /** - * Get the entry creation date - * - * @return string - */ - public function getDateCreated() - { - if (!array_key_exists('dateCreated', $this->_data)) { - return null; - } - return $this->_data['dateCreated']; - } - - /** - * Get the entry modification date - * - * @return string - */ - public function getDateModified() - { - if (!array_key_exists('dateModified', $this->_data)) { - return null; - } - return $this->_data['dateModified']; - } - - /** - * Get the entry description - * - * @return string - */ - public function getDescription() - { - if (!array_key_exists('description', $this->_data)) { - return null; - } - return $this->_data['description']; - } - - /** - * Get the entry ID - * - * @return string - */ - public function getId() - { - if (!array_key_exists('id', $this->_data)) { - return null; - } - return $this->_data['id']; - } - - /** - * Get a link to the HTML source - * - * @return string|null - */ - public function getLink() - { - if (!array_key_exists('link', $this->_data)) { - return null; - } - return $this->_data['link']; - } - - - /** - * Get all links - * - * @return array - */ - public function getLinks() - { - if (!array_key_exists('links', $this->_data)) { - return null; - } - return $this->_data['links']; - } - - /** - * Get the entry title - * - * @return string - */ - public function getTitle() - { - if (!array_key_exists('title', $this->_data)) { - return null; - } - return $this->_data['title']; - } - - /** - * Get the number of comments/replies for current entry - * - * @return integer - */ - public function getCommentCount() - { - if (!array_key_exists('commentCount', $this->_data)) { - return null; - } - return $this->_data['commentCount']; - } - - /** - * Returns a URI pointing to the HTML page where comments can be made on this entry - * - * @return string - */ - public function getCommentLink() - { - if (!array_key_exists('commentLink', $this->_data)) { - return null; - } - return $this->_data['commentLink']; - } - - /** - * Returns an array of URIs pointing to a feed of all comments for this entry - * where the array keys indicate the feed type (atom, rss or rdf). - * - * @return string - */ - public function getCommentFeedLinks() - { - if (!array_key_exists('commentFeedLinks', $this->_data)) { - return null; - } - return $this->_data['commentFeedLinks']; - } - - /** - * Add a entry category - * - * @param string $category - */ - public function addCategory(array $category) - { - if (!isset($category['term'])) { - throw new Zend_Feed_Exception('Each category must be an array and ' - . 'contain at least a "term" element containing the machine ' - . ' readable category name'); - } - if (isset($category['scheme'])) { - if (empty($category['scheme']) - || !is_string($category['scheme']) - || !Zend_Uri::check($category['scheme']) - ) { - throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' - . ' a category must be a valid URI'); - } - } - if (!isset($this->_data['categories'])) { - $this->_data['categories'] = array(); - } - $this->_data['categories'][] = $category; - } - - /** - * Set an array of entry categories - * - * @param array $categories - */ - public function addCategories(array $categories) - { - foreach ($categories as $category) { - $this->addCategory($category); - } - } - - /** - * Get the entry categories - * - * @return string|null - */ - public function getCategories() - { - if (!array_key_exists('categories', $this->_data)) { - return null; - } - return $this->_data['categories']; - } - - /** - * Adds an enclosure to the entry. The array parameter may contain the - * keys 'uri', 'type' and 'length'. Only 'uri' is required for Atom, though the - * others must also be provided or RSS rendering (where they are required) - * will throw an Exception. - * - * @param array $enclosures - */ - public function setEnclosure(array $enclosure) - { - if (!isset($enclosure['uri'])) { - throw new Zend_Feed_Exception('Enclosure "uri" is not set'); - } - if (!Zend_Uri::check($enclosure['uri'])) { - throw new Zend_Feed_Exception('Enclosure "uri" is not a valid URI/IRI'); - } - $this->_data['enclosure'] = $enclosure; - } - - /** - * Retrieve an array of all enclosures to be added to entry. - * - * @return array - */ - public function getEnclosure() - { - if (!array_key_exists('enclosure', $this->_data)) { - return null; - } - return $this->_data['enclosure']; - } - - /** - * Unset a specific data point - * - * @param string $name - */ - public function remove($name) - { - if (isset($this->_data[$name])) { - unset($this->_data[$name]); - } - } - - /** - * Get registered extensions - * - * @return array - */ - public function getExtensions() - { - return $this->_extensions; - } - - /** - * Return an Extension object with the matching name (postfixed with _Entry) - * - * @param string $name - * @return object - */ - public function getExtension($name) - { - if (array_key_exists($name . '_Entry', $this->_extensions)) { - return $this->_extensions[$name . '_Entry']; - } - return null; - } - - /** - * Set the current feed type being exported to "rss" or "atom". This allows - * other objects to gracefully choose whether to execute or not, depending - * on their appropriateness for the current type, e.g. renderers. - * - * @param string $type - */ - public function setType($type) - { - $this->_type = $type; - } - - /** - * Retrieve the current or last feed type exported. - * - * @return string Value will be "rss" or "atom" - */ - public function getType() - { - return $this->_type; - } - - /** - * Method overloading: call given method on first extension implementing it - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method - */ - public function __call($method, $args) - { - foreach ($this->_extensions as $extension) { - try { - return call_user_func_array(array($extension, $method), $args); - } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { - } - } - throw new Zend_Feed_Exception('Method: ' . $method - . ' does not exist and could not be located on a registered Extension'); - } - - /** - * Creates a new Zend_Feed_Writer_Source data container for use. This is NOT - * added to the current feed automatically, but is necessary to create a - * container with some initial values preset based on the current feed data. - * - * @return Zend_Feed_Writer_Source - */ - public function createSource() - { - $source = new Zend_Feed_Writer_Source; - if ($this->getEncoding()) { - $source->setEncoding($this->getEncoding()); - } - $source->setType($this->getType()); - return $source; - } - - /** - * Appends a Zend_Feed_Writer_Entry object representing a new entry/item - * the feed data container's internal group of entries. - * - * @param Zend_Feed_Writer_Source $source - */ - public function setSource(Zend_Feed_Writer_Source $source) - { - $this->_data['source'] = $source; - } - - /** - * @return Zend_Feed_Writer_Source - */ - public function getSource() - { - if (isset($this->_data['source'])) { - return $this->_data['source']; - } - return null; - } - - /** - * Load extensions from Zend_Feed_Writer - * - * @return void - */ - protected function _loadExtensions() - { - $all = Zend_Feed_Writer::getExtensions(); - $exts = $all['entry']; - foreach ($exts as $ext) { - $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); - $this->_extensions[$ext] = new $className(); - $this->_extensions[$ext]->setEncoding($this->getEncoding()); - } - } -} diff --git a/library/vendor/Zend/Feed/Writer/Exception/InvalidMethodException.php b/library/vendor/Zend/Feed/Writer/Exception/InvalidMethodException.php deleted file mode 100644 index bcbcf3ea1..000000000 --- a/library/vendor/Zend/Feed/Writer/Exception/InvalidMethodException.php +++ /dev/null @@ -1,40 +0,0 @@ -getType()) == 'atom') { - return; - } - $this->_setFeedLinks($this->_dom, $this->_base); - $this->_setHubs($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append namespaces to root element of feed - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:atom', - 'http://www.w3.org/2005/Atom'); - } - - /** - * Set feed link elements - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) - { - $flinks = $this->getDataContainer()->getFeedLinks(); - if(!$flinks || empty($flinks)) { - return; - } - foreach ($flinks as $type => $href) { - $mime = 'application/' . strtolower($type) . '+xml'; - $flink = $dom->createElement('atom:link'); - $root->appendChild($flink); - $flink->setAttribute('rel', 'self'); - $flink->setAttribute('type', $mime); - $flink->setAttribute('href', $href); - } - $this->_called = true; - } - - /** - * Set PuSH hubs - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setHubs(DOMDocument $dom, DOMElement $root) - { - $hubs = $this->getDataContainer()->getHubs(); - if (!$hubs || empty($hubs)) { - return; - } - foreach ($hubs as $hubUrl) { - $hub = $dom->createElement('atom:link'); - $hub->setAttribute('rel', 'hub'); - $hub->setAttribute('href', $hubUrl); - $root->appendChild($hub); - } - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/Content/Renderer/Entry.php b/library/vendor/Zend/Feed/Writer/Extension/Content/Renderer/Entry.php deleted file mode 100644 index 89ab7cd10..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/Content/Renderer/Entry.php +++ /dev/null @@ -1,91 +0,0 @@ -getType()) == 'atom') { - return; - } - $this->_setContent($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append namespaces to root element - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:content', - 'http://purl.org/rss/1.0/modules/content/'); - } - - /** - * Set entry content - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setContent(DOMDocument $dom, DOMElement $root) - { - $content = $this->getDataContainer()->getContent(); - if (!$content) { - return; - } - $element = $dom->createElement('content:encoded'); - $root->appendChild($element); - $cdata = $dom->createCDATASection($content); - $element->appendChild($cdata); - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/DublinCore/Renderer/Entry.php b/library/vendor/Zend/Feed/Writer/Extension/DublinCore/Renderer/Entry.php deleted file mode 100644 index 91e38df53..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/DublinCore/Renderer/Entry.php +++ /dev/null @@ -1,95 +0,0 @@ -getType()) == 'atom') { - return; - } - $this->_setAuthors($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append namespaces to entry - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:dc', - 'http://purl.org/dc/elements/1.1/'); - } - - /** - * Set entry author elements - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->getDataContainer()->getAuthors(); - if (!$authors || empty($authors)) { - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('dc:creator'); - if (array_key_exists('name', $data)) { - $text = $dom->createTextNode($data['name']); - $author->appendChild($text); - $root->appendChild($author); - } - } - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/DublinCore/Renderer/Feed.php b/library/vendor/Zend/Feed/Writer/Extension/DublinCore/Renderer/Feed.php deleted file mode 100644 index ac0a2b188..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/DublinCore/Renderer/Feed.php +++ /dev/null @@ -1,95 +0,0 @@ -getType()) == 'atom') { - return; - } - $this->_setAuthors($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append namespaces to feed element - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:dc', - 'http://purl.org/dc/elements/1.1/'); - } - - /** - * Set feed authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->getDataContainer()->getAuthors(); - if (!$authors || empty($authors)) { - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('dc:creator'); - if (array_key_exists('name', $data)) { - $text = $dom->createTextNode($data['name']); - $author->appendChild($text); - $root->appendChild($author); - } - } - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/ITunes/Entry.php b/library/vendor/Zend/Feed/Writer/Extension/ITunes/Entry.php deleted file mode 100644 index 4c33393e5..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/ITunes/Entry.php +++ /dev/null @@ -1,232 +0,0 @@ -_encoding = $enc; - return $this; - } - - /** - * Get feed encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set a block value of "yes" or "no". You may also set an empty string. - * - * @param string - * @return Zend_Feed_Writer_Extension_ITunes_Entry - */ - public function setItunesBlock($value) - { - if (!ctype_alpha($value) && strlen($value) > 0) { - throw new Zend_Feed_Exception('invalid parameter: "block" may only' - . ' contain alphabetic characters'); - } - if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "block" may only' - . ' contain a maximum of 255 characters'); - } - $this->_data['block'] = $value; - } - - /** - * Add authors to itunes entry - * - * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Entry - */ - public function addItunesAuthors(array $values) - { - foreach ($values as $value) { - $this->addItunesAuthor($value); - } - return $this; - } - - /** - * Add author to itunes entry - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry - */ - public function addItunesAuthor($value) - { - if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "author" may only' - . ' contain a maximum of 255 characters each'); - } - if (!isset($this->_data['authors'])) { - $this->_data['authors'] = array(); - } - $this->_data['authors'][] = $value; - return $this; - } - - /** - * Set duration - * - * @param int $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry - */ - public function setItunesDuration($value) - { - $value = (string) $value; - if (!ctype_digit($value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) - ) { - throw new Zend_Feed_Exception('invalid parameter: "duration" may only' - . ' be of a specified [[HH:]MM:]SS format'); - } - $this->_data['duration'] = $value; - return $this; - } - - /** - * Set "explicit" flag - * - * @param bool $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry - */ - public function setItunesExplicit($value) - { - if (!in_array($value, array('yes','no','clean'))) { - throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' - . ' be one of "yes", "no" or "clean"'); - } - $this->_data['explicit'] = $value; - return $this; - } - - /** - * Set keywords - * - * @param array $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry - */ - public function setItunesKeywords(array $value) - { - if (count($value) > 12) { - throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' - . ' contain a maximum of 12 terms'); - } - $concat = implode(',', $value); - if (iconv_strlen($concat, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' - . ' have a concatenated length of 255 chars where terms are delimited' - . ' by a comma'); - } - $this->_data['keywords'] = $value; - return $this; - } - - /** - * Set subtitle - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry - */ - public function setItunesSubtitle($value) - { - if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' - . ' contain a maximum of 255 characters'); - } - $this->_data['subtitle'] = $value; - return $this; - } - - /** - * Set summary - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Entry - */ - public function setItunesSummary($value) - { - if (iconv_strlen($value, $this->getEncoding()) > 4000) { - throw new Zend_Feed_Exception('invalid parameter: "summary" may only' - . ' contain a maximum of 4000 characters'); - } - $this->_data['summary'] = $value; - return $this; - } - - /** - * Overloading to itunes specific setters - * - * @param string $method - * @param array $params - * @return mixed - */ - public function __call($method, array $params) - { - $point = Zend_Feed_Writer::lcfirst(substr($method, 9)); - if (!method_exists($this, 'setItunes' . ucfirst($point)) - && !method_exists($this, 'addItunes' . ucfirst($point)) - ) { - throw new Zend_Feed_Writer_Exception_InvalidMethodException( - 'invalid method: ' . $method - ); - } - if (!array_key_exists($point, $this->_data) - || empty($this->_data[$point]) - ) { - return null; - } - return $this->_data[$point]; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/ITunes/Feed.php b/library/vendor/Zend/Feed/Writer/Extension/ITunes/Feed.php deleted file mode 100644 index 43c2883e0..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/ITunes/Feed.php +++ /dev/null @@ -1,343 +0,0 @@ -_encoding = $enc; - return $this; - } - - /** - * Get feed encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set a block value of "yes" or "no". You may also set an empty string. - * - * @param string - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesBlock($value) - { - if (!ctype_alpha($value) && strlen($value) > 0) { - throw new Zend_Feed_Exception('invalid parameter: "block" may only' - . ' contain alphabetic characters'); - } - if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "block" may only' - . ' contain a maximum of 255 characters'); - } - $this->_data['block'] = $value; - return $this; - } - - /** - * Add feed authors - * - * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function addItunesAuthors(array $values) - { - foreach ($values as $value) { - $this->addItunesAuthor($value); - } - return $this; - } - - /** - * Add feed author - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function addItunesAuthor($value) - { - if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "author" may only' - . ' contain a maximum of 255 characters each'); - } - if (!isset($this->_data['authors'])) { - $this->_data['authors'] = array(); - } - $this->_data['authors'][] = $value; - return $this; - } - - /** - * Set feed categories - * - * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesCategories(array $values) - { - if (!isset($this->_data['categories'])) { - $this->_data['categories'] = array(); - } - foreach ($values as $key=>$value) { - if (!is_array($value)) { - if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "category" may only' - . ' contain a maximum of 255 characters each'); - } - $this->_data['categories'][] = $value; - } else { - if (iconv_strlen($key, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "category" may only' - . ' contain a maximum of 255 characters each'); - } - $this->_data['categories'][$key] = array(); - foreach ($value as $val) { - if (iconv_strlen($val, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: any "category" may only' - . ' contain a maximum of 255 characters each'); - } - $this->_data['categories'][$key][] = $val; - } - } - } - return $this; - } - - /** - * Set feed image (icon) - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesImage($value) - { - if (!Zend_Uri::check($value)) { - throw new Zend_Feed_Exception('invalid parameter: "image" may only' - . ' be a valid URI/IRI'); - } - if (!in_array(substr($value, -3), array('jpg','png'))) { - throw new Zend_Feed_Exception('invalid parameter: "image" may only' - . ' use file extension "jpg" or "png" which must be the last three' - . ' characters of the URI (i.e. no query string or fragment)'); - } - $this->_data['image'] = $value; - return $this; - } - - /** - * Set feed cumulative duration - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesDuration($value) - { - $value = (string) $value; - if (!ctype_digit($value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}$/", $value) - && !preg_match("/^\d+:[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$/", $value) - ) { - throw new Zend_Feed_Exception('invalid parameter: "duration" may only' - . ' be of a specified [[HH:]MM:]SS format'); - } - $this->_data['duration'] = $value; - return $this; - } - - /** - * Set "explicit" flag - * - * @param string $value Valid values: "yes", "no" or "clean" - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesExplicit($value) - { - if (!in_array($value, array('yes','no','clean'))) { - throw new Zend_Feed_Exception('invalid parameter: "explicit" may only' - . ' be one of "yes", "no" or "clean"'); - } - $this->_data['explicit'] = $value; - return $this; - } - - /** - * Set feed keywords - * - * @param array $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesKeywords(array $value) - { - if (count($value) > 12) { - throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' - . ' contain a maximum of 12 terms'); - } - $concat = implode(',', $value); - if (iconv_strlen($concat, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "keywords" may only' - . ' have a concatenated length of 255 chars where terms are delimited' - . ' by a comma'); - } - $this->_data['keywords'] = $value; - return $this; - } - - /** - * Set new feed URL - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesNewFeedUrl($value) - { - if (!Zend_Uri::check($value)) { - throw new Zend_Feed_Exception('invalid parameter: "newFeedUrl" may only' - . ' be a valid URI/IRI'); - } - $this->_data['newFeedUrl'] = $value; - return $this; - } - - /** - * Add feed owners - * - * @param array $values - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function addItunesOwners(array $values) - { - foreach ($values as $value) { - $this->addItunesOwner($value); - } - return $this; - } - - /** - * Add feed owner - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function addItunesOwner(array $value) - { - if (!isset($value['name']) || !isset($value['email'])) { - throw new Zend_Feed_Exception('invalid parameter: any "owner" must' - . ' be an array containing keys "name" and "email"'); - } - if (iconv_strlen($value['name'], $this->getEncoding()) > 255 - || iconv_strlen($value['email'], $this->getEncoding()) > 255 - ) { - throw new Zend_Feed_Exception('invalid parameter: any "owner" may only' - . ' contain a maximum of 255 characters each for "name" and "email"'); - } - if (!isset($this->_data['owners'])) { - $this->_data['owners'] = array(); - } - $this->_data['owners'][] = $value; - return $this; - } - - /** - * Set feed subtitle - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesSubtitle($value) - { - if (iconv_strlen($value, $this->getEncoding()) > 255) { - throw new Zend_Feed_Exception('invalid parameter: "subtitle" may only' - . ' contain a maximum of 255 characters'); - } - $this->_data['subtitle'] = $value; - return $this; - } - - /** - * Set feed summary - * - * @param string $value - * @return Zend_Feed_Writer_Extension_ITunes_Feed - */ - public function setItunesSummary($value) - { - if (iconv_strlen($value, $this->getEncoding()) > 4000) { - throw new Zend_Feed_Exception('invalid parameter: "summary" may only' - . ' contain a maximum of 4000 characters'); - } - $this->_data['summary'] = $value; - return $this; - } - - /** - * Overloading: proxy to internal setters - * - * @param string $method - * @param array $params - * @return mixed - */ - public function __call($method, array $params) - { - $point = Zend_Feed_Writer::lcfirst(substr($method, 9)); - if (!method_exists($this, 'setItunes' . ucfirst($point)) - && !method_exists($this, 'addItunes' . ucfirst($point)) - ) { - throw new Zend_Feed_Writer_Exception_InvalidMethodException( - 'invalid method: ' . $method - ); - } - if (!array_key_exists($point, $this->_data) || empty($this->_data[$point])) { - return null; - } - return $this->_data[$point]; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/ITunes/Renderer/Entry.php b/library/vendor/Zend/Feed/Writer/Extension/ITunes/Renderer/Entry.php deleted file mode 100644 index 7f8578b56..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/ITunes/Renderer/Entry.php +++ /dev/null @@ -1,215 +0,0 @@ -_setAuthors($this->_dom, $this->_base); - $this->_setBlock($this->_dom, $this->_base); - $this->_setDuration($this->_dom, $this->_base); - $this->_setExplicit($this->_dom, $this->_base); - $this->_setKeywords($this->_dom, $this->_base); - $this->_setSubtitle($this->_dom, $this->_base); - $this->_setSummary($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append namespaces to entry root - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:itunes', - 'http://www.itunes.com/dtds/podcast-1.0.dtd'); - } - - /** - * Set entry authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->getDataContainer()->getItunesAuthors(); - if (!$authors || empty($authors)) { - return; - } - foreach ($authors as $author) { - $el = $dom->createElement('itunes:author'); - $text = $dom->createTextNode($author); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - } - - /** - * Set itunes block - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setBlock(DOMDocument $dom, DOMElement $root) - { - $block = $this->getDataContainer()->getItunesBlock(); - if ($block === null) { - return; - } - $el = $dom->createElement('itunes:block'); - $text = $dom->createTextNode($block); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set entry duration - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDuration(DOMDocument $dom, DOMElement $root) - { - $duration = $this->getDataContainer()->getItunesDuration(); - if (!$duration) { - return; - } - $el = $dom->createElement('itunes:duration'); - $text = $dom->createTextNode($duration); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set explicit flag - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setExplicit(DOMDocument $dom, DOMElement $root) - { - $explicit = $this->getDataContainer()->getItunesExplicit(); - if ($explicit === null) { - return; - } - $el = $dom->createElement('itunes:explicit'); - $text = $dom->createTextNode($explicit); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set entry keywords - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setKeywords(DOMDocument $dom, DOMElement $root) - { - $keywords = $this->getDataContainer()->getItunesKeywords(); - if (!$keywords || empty($keywords)) { - return; - } - $el = $dom->createElement('itunes:keywords'); - $text = $dom->createTextNode(implode(',', $keywords)); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set entry subtitle - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setSubtitle(DOMDocument $dom, DOMElement $root) - { - $subtitle = $this->getDataContainer()->getItunesSubtitle(); - if (!$subtitle) { - return; - } - $el = $dom->createElement('itunes:subtitle'); - $text = $dom->createTextNode($subtitle); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set entry summary - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setSummary(DOMDocument $dom, DOMElement $root) - { - $summary = $this->getDataContainer()->getItunesSummary(); - if (!$summary) { - return; - } - $el = $dom->createElement('itunes:summary'); - $text = $dom->createTextNode($summary); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/ITunes/Renderer/Feed.php b/library/vendor/Zend/Feed/Writer/Extension/ITunes/Renderer/Feed.php deleted file mode 100644 index 7dd10dc17..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/ITunes/Renderer/Feed.php +++ /dev/null @@ -1,319 +0,0 @@ -_setAuthors($this->_dom, $this->_base); - $this->_setBlock($this->_dom, $this->_base); - $this->_setCategories($this->_dom, $this->_base); - $this->_setImage($this->_dom, $this->_base); - $this->_setDuration($this->_dom, $this->_base); - $this->_setExplicit($this->_dom, $this->_base); - $this->_setKeywords($this->_dom, $this->_base); - $this->_setNewFeedUrl($this->_dom, $this->_base); - $this->_setOwners($this->_dom, $this->_base); - $this->_setSubtitle($this->_dom, $this->_base); - $this->_setSummary($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append feed namespaces - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:itunes', - 'http://www.itunes.com/dtds/podcast-1.0.dtd'); - } - - /** - * Set feed authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->getDataContainer()->getItunesAuthors(); - if (!$authors || empty($authors)) { - return; - } - foreach ($authors as $author) { - $el = $dom->createElement('itunes:author'); - $text = $dom->createTextNode($author); - $el->appendChild($text); - $root->appendChild($el); - } - $this->_called = true; - } - - /** - * Set feed itunes block - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setBlock(DOMDocument $dom, DOMElement $root) - { - $block = $this->getDataContainer()->getItunesBlock(); - if ($block === null) { - return; - } - $el = $dom->createElement('itunes:block'); - $text = $dom->createTextNode($block); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set feed categories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) - { - $cats = $this->getDataContainer()->getItunesCategories(); - if (!$cats || empty($cats)) { - return; - } - foreach ($cats as $key=>$cat) { - if (!is_array($cat)) { - $el = $dom->createElement('itunes:category'); - $el->setAttribute('text', $cat); - $root->appendChild($el); - } else { - $el = $dom->createElement('itunes:category'); - $el->setAttribute('text', $key); - $root->appendChild($el); - foreach ($cat as $subcat) { - $el2 = $dom->createElement('itunes:category'); - $el2->setAttribute('text', $subcat); - $el->appendChild($el2); - } - } - } - $this->_called = true; - } - - /** - * Set feed image (icon) - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setImage(DOMDocument $dom, DOMElement $root) - { - $image = $this->getDataContainer()->getItunesImage(); - if (!$image) { - return; - } - $el = $dom->createElement('itunes:image'); - $el->setAttribute('href', $image); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set feed cumulative duration - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDuration(DOMDocument $dom, DOMElement $root) - { - $duration = $this->getDataContainer()->getItunesDuration(); - if (!$duration) { - return; - } - $el = $dom->createElement('itunes:duration'); - $text = $dom->createTextNode($duration); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set explicit flag - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setExplicit(DOMDocument $dom, DOMElement $root) - { - $explicit = $this->getDataContainer()->getItunesExplicit(); - if ($explicit === null) { - return; - } - $el = $dom->createElement('itunes:explicit'); - $text = $dom->createTextNode($explicit); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set feed keywords - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setKeywords(DOMDocument $dom, DOMElement $root) - { - $keywords = $this->getDataContainer()->getItunesKeywords(); - if (!$keywords || empty($keywords)) { - return; - } - $el = $dom->createElement('itunes:keywords'); - $text = $dom->createTextNode(implode(',', $keywords)); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set feed's new URL - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setNewFeedUrl(DOMDocument $dom, DOMElement $root) - { - $url = $this->getDataContainer()->getItunesNewFeedUrl(); - if (!$url) { - return; - } - $el = $dom->createElement('itunes:new-feed-url'); - $text = $dom->createTextNode($url); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set feed owners - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setOwners(DOMDocument $dom, DOMElement $root) - { - $owners = $this->getDataContainer()->getItunesOwners(); - if (!$owners || empty($owners)) { - return; - } - foreach ($owners as $owner) { - $el = $dom->createElement('itunes:owner'); - $name = $dom->createElement('itunes:name'); - $text = $dom->createTextNode($owner['name']); - $name->appendChild($text); - $email = $dom->createElement('itunes:email'); - $text = $dom->createTextNode($owner['email']); - $email->appendChild($text); - $root->appendChild($el); - $el->appendChild($name); - $el->appendChild($email); - } - $this->_called = true; - } - - /** - * Set feed subtitle - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setSubtitle(DOMDocument $dom, DOMElement $root) - { - $subtitle = $this->getDataContainer()->getItunesSubtitle(); - if (!$subtitle) { - return; - } - $el = $dom->createElement('itunes:subtitle'); - $text = $dom->createTextNode($subtitle); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } - - /** - * Set feed summary - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setSummary(DOMDocument $dom, DOMElement $root) - { - $summary = $this->getDataContainer()->getItunesSummary(); - if (!$summary) { - return; - } - $el = $dom->createElement('itunes:summary'); - $text = $dom->createTextNode($summary); - $el->appendChild($text); - $root->appendChild($el); - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/RendererAbstract.php b/library/vendor/Zend/Feed/Writer/Extension/RendererAbstract.php deleted file mode 100644 index b1be96365..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/RendererAbstract.php +++ /dev/null @@ -1,179 +0,0 @@ -_container = $container; - } - - /** - * Set feed encoding - * - * @param string $enc - * @return Zend_Feed_Writer_Extension_RendererAbstract - */ - public function setEncoding($enc) - { - $this->_encoding = $enc; - return $this; - } - - /** - * Get feed encoding - * - * @return void - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set DOMDocument and DOMElement on which to operate - * - * @param DOMDocument $dom - * @param DOMElement $base - * @return Zend_Feed_Writer_Extension_RendererAbstract - */ - public function setDomDocument(DOMDocument $dom, DOMElement $base) - { - $this->_dom = $dom; - $this->_base = $base; - return $this; - } - - /** - * Get data container being rendered - * - * @return mixed - */ - public function getDataContainer() - { - return $this->_container; - } - - /** - * Set feed type - * - * @param string $type - * @return Zend_Feed_Writer_Extension_RendererAbstract - */ - public function setType($type) - { - $this->_type = $type; - return $this; - } - - /** - * Get feedtype - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * Set root element of document - * - * @param DOMElement $root - * @return Zend_Feed_Writer_Extension_RendererAbstract - */ - public function setRootElement(DOMElement $root) - { - $this->_rootElement = $root; - return $this; - } - - /** - * Get root element - * - * @return DOMElement - */ - public function getRootElement() - { - return $this->_rootElement; - } - - /** - * Append namespaces to feed - * - * @return void - */ - abstract protected function _appendNamespaces(); -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/RendererInterface.php b/library/vendor/Zend/Feed/Writer/Extension/RendererInterface.php deleted file mode 100644 index 4c4e9ccbb..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/RendererInterface.php +++ /dev/null @@ -1,60 +0,0 @@ -getType()) == 'atom') { - return; // RSS 2.0 only - } - $this->_setCommentCount($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append entry namespaces - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:slash', - 'http://purl.org/rss/1.0/modules/slash/'); - } - - /** - * Set entry comment count - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCommentCount(DOMDocument $dom, DOMElement $root) - { - $count = $this->getDataContainer()->getCommentCount(); - if (!$count) { - return; - } - $tcount = $this->_dom->createElement('slash:comments'); - $tcount->nodeValue = $count; - $root->appendChild($tcount); - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.php b/library/vendor/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.php deleted file mode 100644 index 87267140f..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/Threading/Renderer/Entry.php +++ /dev/null @@ -1,144 +0,0 @@ -getType()) == 'rss') { - return; // Atom 1.0 only - } - $this->_setCommentLink($this->_dom, $this->_base); - $this->_setCommentFeedLinks($this->_dom, $this->_base); - $this->_setCommentCount($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append entry namespaces - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:thr', - 'http://purl.org/syndication/thread/1.0'); - } - - /** - * Set comment link - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCommentLink(DOMDocument $dom, DOMElement $root) - { - $link = $this->getDataContainer()->getCommentLink(); - if (!$link) { - return; - } - $clink = $this->_dom->createElement('link'); - $clink->setAttribute('rel', 'replies'); - $clink->setAttribute('type', 'text/html'); - $clink->setAttribute('href', $link); - $count = $this->getDataContainer()->getCommentCount(); - if ($count !== null) { - $clink->setAttribute('thr:count', $count); - } - $root->appendChild($clink); - $this->_called = true; - } - - /** - * Set comment feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) - { - $links = $this->getDataContainer()->getCommentFeedLinks(); - if (!$links || empty($links)) { - return; - } - foreach ($links as $link) { - $flink = $this->_dom->createElement('link'); - $flink->setAttribute('rel', 'replies'); - $flink->setAttribute('type', 'application/'. $link['type'] .'+xml'); - $flink->setAttribute('href', $link['uri']); - $count = $this->getDataContainer()->getCommentCount(); - if ($count !== null) { - $flink->setAttribute('thr:count', $count); - } - $root->appendChild($flink); - $this->_called = true; - } - } - - /** - * Set entry comment count - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCommentCount(DOMDocument $dom, DOMElement $root) - { - $count = $this->getDataContainer()->getCommentCount(); - if ($count === null) { - return; - } - $tcount = $this->_dom->createElement('thr:total'); - $tcount->nodeValue = $count; - $root->appendChild($tcount); - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Extension/WellFormedWeb/Renderer/Entry.php b/library/vendor/Zend/Feed/Writer/Extension/WellFormedWeb/Renderer/Entry.php deleted file mode 100644 index 13ad38b43..000000000 --- a/library/vendor/Zend/Feed/Writer/Extension/WellFormedWeb/Renderer/Entry.php +++ /dev/null @@ -1,95 +0,0 @@ -getType()) == 'atom') { - return; // RSS 2.0 only - } - $this->_setCommentFeedLinks($this->_dom, $this->_base); - if ($this->_called) { - $this->_appendNamespaces(); - } - } - - /** - * Append entry namespaces - * - * @return void - */ - protected function _appendNamespaces() - { - $this->getRootElement()->setAttribute('xmlns:wfw', - 'http://wellformedweb.org/CommentAPI/'); - } - - /** - * Set entry comment feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCommentFeedLinks(DOMDocument $dom, DOMElement $root) - { - $links = $this->getDataContainer()->getCommentFeedLinks(); - if (!$links || empty($links)) { - return; - } - foreach ($links as $link) { - if ($link['type'] == 'rss') { - $flink = $this->_dom->createElement('wfw:commentRss'); - $text = $dom->createTextNode($link['uri']); - $flink->appendChild($text); - $root->appendChild($flink); - } - } - $this->_called = true; - } -} diff --git a/library/vendor/Zend/Feed/Writer/Feed.php b/library/vendor/Zend/Feed/Writer/Feed.php deleted file mode 100644 index 6a9add942..000000000 --- a/library/vendor/Zend/Feed/Writer/Feed.php +++ /dev/null @@ -1,271 +0,0 @@ -getEncoding()) { - $entry->setEncoding($this->getEncoding()); - } - $entry->setType($this->getType()); - return $entry; - } - - /** - * Appends a Zend_Feed_Writer_Deleted object representing a new entry tombstone - * to the feed data container's internal group of entries. - * - * @param Zend_Feed_Writer_Deleted $entry - */ - public function addTombstone(Zend_Feed_Writer_Deleted $deleted) - { - $this->_entries[] = $deleted; - } - - /** - * Creates a new Zend_Feed_Writer_Deleted data container for use. This is NOT - * added to the current feed automatically, but is necessary to create a - * container with some initial values preset based on the current feed data. - * - * @return Zend_Feed_Writer_Deleted - */ - public function createTombstone() - { - $deleted = new Zend_Feed_Writer_Deleted; - if ($this->getEncoding()) { - $deleted->setEncoding($this->getEncoding()); - } - $deleted->setType($this->getType()); - return $deleted; - } - - /** - * Appends a Zend_Feed_Writer_Entry object representing a new entry/item - * the feed data container's internal group of entries. - * - * @param Zend_Feed_Writer_Entry $entry - */ - public function addEntry(Zend_Feed_Writer_Entry $entry) - { - $this->_entries[] = $entry; - } - - /** - * Removes a specific indexed entry from the internal queue. Entries must be - * added to a feed container in order to be indexed. - * - * @param int $index - */ - public function removeEntry($index) - { - if (isset($this->_entries[$index])) { - unset($this->_entries[$index]); - } - throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); - } - - /** - * Retrieve a specific indexed entry from the internal queue. Entries must be - * added to a feed container in order to be indexed. - * - * @param int $index - */ - public function getEntry($index = 0) - { - if (isset($this->_entries[$index])) { - return $this->_entries[$index]; - } - throw new Zend_Feed_Exception('Undefined index: ' . $index . '. Entry does not exist.'); - } - - /** - * Orders all indexed entries by date, thus offering date ordered readable - * content where a parser (or Homo Sapien) ignores the generic rule that - * XML element order is irrelevant and has no intrinsic meaning. - * - * Using this method will alter the original indexation. - * - * @return void - */ - public function orderByDate() - { - /** - * Could do with some improvement for performance perhaps - */ - $timestamp = time(); - $entries = array(); - foreach ($this->_entries as $entry) { - if ($entry->getDateModified()) { - $timestamp = (int) $entry->getDateModified()->get(Zend_Date::TIMESTAMP); - } elseif ($entry->getDateCreated()) { - $timestamp = (int) $entry->getDateCreated()->get(Zend_Date::TIMESTAMP); - } - $entries[$timestamp] = $entry; - } - krsort($entries, SORT_NUMERIC); - $this->_entries = array_values($entries); - } - - /** - * Get the number of feed entries. - * Required by the Iterator interface. - * - * @return int - */ - public function count() - { - return count($this->_entries); - } - - /** - * Return the current entry - * - * @return Zend_Feed_Reader_Entry_Interface - */ - public function current() - { - return $this->_entries[$this->key()]; - } - - /** - * Return the current feed key - * - * @return unknown - */ - public function key() - { - return $this->_entriesKey; - } - - /** - * Move the feed pointer forward - * - * @return void - */ - public function next() - { - ++$this->_entriesKey; - } - - /** - * Reset the pointer in the feed object - * - * @return void - */ - public function rewind() - { - $this->_entriesKey = 0; - } - - /** - * Check to see if the iterator is still valid - * - * @return boolean - */ - public function valid() - { - return 0 <= $this->_entriesKey && $this->_entriesKey < $this->count(); - } - - /** - * Attempt to build and return the feed resulting from the data set - * - * @param string $type The feed type "rss" or "atom" to export as - * @param bool $ignoreExceptions - * @return string - */ - public function export($type, $ignoreExceptions = false) - { - $this->setType(strtolower($type)); - $type = ucfirst($this->getType()); - if ($type !== 'Rss' && $type !== 'Atom') { - throw new Zend_Feed_Exception('Invalid feed type specified: ' . $type . '.' - . ' Should be one of "rss" or "atom".'); - } - $renderClass = 'Zend_Feed_Writer_Renderer_Feed_' . $type; - $renderer = new $renderClass($this); - if ($ignoreExceptions) { - $renderer->ignoreExceptions(); - } - return $renderer->render()->saveXml(); - } - -} diff --git a/library/vendor/Zend/Feed/Writer/Feed/FeedAbstract.php b/library/vendor/Zend/Feed/Writer/Feed/FeedAbstract.php deleted file mode 100644 index 90023f39d..000000000 --- a/library/vendor/Zend/Feed/Writer/Feed/FeedAbstract.php +++ /dev/null @@ -1,834 +0,0 @@ -_loadExtensions(); - } - - /** - * Set a single author - * - * @param int $index - * @return string|null - */ - public function addAuthor($name, $email = null, $uri = null) - { - $author = array(); - if (is_array($name)) { - if (!array_key_exists('name', $name) || empty($name['name']) || !is_string($name['name'])) { - throw new Zend_Feed_Exception('Invalid parameter: author array must include a "name" key with a non-empty string value'); - } - $author['name'] = $name['name']; - if (isset($name['email'])) { - if (empty($name['email']) || !is_string($name['email'])) { - throw new Zend_Feed_Exception('Invalid parameter: "email" array value must be a non-empty string'); - } - $author['email'] = $name['email']; - } - if (isset($name['uri'])) { - if (empty($name['uri']) || !is_string($name['uri']) || !Zend_Uri::check($name['uri'])) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" array value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $name['uri']; - } - } else { - if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string value'); - } - $author['name'] = $name; - if (isset($email)) { - if (empty($email) || !is_string($email)) { - throw new Zend_Feed_Exception('Invalid parameter: "email" value must be a non-empty string'); - } - $author['email'] = $email; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" value must be a non-empty string and valid URI/IRI'); - } - $author['uri'] = $uri; - } - } - $this->_data['authors'][] = $author; - } - - /** - * Set an array with feed authors - * - * @return array - */ - public function addAuthors(array $authors) - { - foreach($authors as $author) { - $this->addAuthor($author); - } - } - - /** - * Set the copyright entry - * - * @return string|null - */ - public function setCopyright($copyright) - { - if (empty($copyright) || !is_string($copyright)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['copyright'] = $copyright; - } - - /** - * Set the feed creation date - * - * @param null|integer|Zend_Date - */ - public function setDateCreated($date = null) - { - $zdate = null; - if ($date === null) { - $zdate = new Zend_Date; - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateCreated'] = $zdate; - } - - /** - * Set the feed modification date - * - * @param null|integer|Zend_Date - */ - public function setDateModified($date = null) - { - $zdate = null; - if ($date === null) { - $zdate = new Zend_Date; - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['dateModified'] = $zdate; - } - - /** - * Set the feed last-build date. Ignored for Atom 1.0. - * - * @param null|integer|Zend_Date - */ - public function setLastBuildDate($date = null) - { - $zdate = null; - if ($date === null) { - $zdate = new Zend_Date; - } elseif ($date instanceof Zend_Date) { - $zdate = $date; - } elseif (ctype_digit((string)$date)) { - $zdate = new Zend_Date($date, Zend_Date::TIMESTAMP); - } else { - throw new Zend_Feed_Exception('Invalid Zend_Date object or UNIX Timestamp passed as parameter'); - } - $this->_data['lastBuildDate'] = $zdate; - } - - /** - * Set the feed description - * - * @return string|null - */ - public function setDescription($description) - { - if (empty($description) || !is_string($description)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['description'] = $description; - } - - /** - * Set the feed generator entry - * - * @return string|null - */ - public function setGenerator($name, $version = null, $uri = null) - { - if (is_array($name)) { - $data = $name; - if (empty($data['name']) || !is_string($data['name'])) { - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); - } - $generator = array('name' => $data['name']); - if (isset($data['version'])) { - if (empty($data['version']) || !is_string($data['version'])) { - throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); - } - $generator['version'] = $data['version']; - } - if (isset($data['uri'])) { - if (empty($data['uri']) || !is_string($data['uri']) || !Zend_Uri::check($data['uri'])) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); - } - $generator['uri'] = $data['uri']; - } - } else { - if (empty($name) || !is_string($name)) { - throw new Zend_Feed_Exception('Invalid parameter: "name" must be a non-empty string'); - } - $generator = array('name' => $name); - if (isset($version)) { - if (empty($version) || !is_string($version)) { - throw new Zend_Feed_Exception('Invalid parameter: "version" must be a non-empty string'); - } - $generator['version'] = $version; - } - if (isset($uri)) { - if (empty($uri) || !is_string($uri) || !Zend_Uri::check($uri)) { - throw new Zend_Feed_Exception('Invalid parameter: "uri" must be a non-empty string and a valid URI/IRI'); - } - $generator['uri'] = $uri; - } - } - $this->_data['generator'] = $generator; - } - - /** - * Set the feed ID - URI or URN (via PCRE pattern) supported - * - * @param string $id - */ - public function setId($id) - { - if ((empty($id) || !is_string($id) || !Zend_Uri::check($id)) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) - && !$this->_validateTagUri($id)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); - } - $this->_data['id'] = $id; - } - - /** - * Validate a URI using the tag scheme (RFC 4151) - * - * @param string $id - * @return bool - */ - protected function _validateTagUri($id) - { - if (preg_match('/^tag:(?.*),(?\d{4}-?\d{0,2}-?\d{0,2}):(?.*)(.*:)*$/', $id, $matches)) { - $dvalid = false; - $nvalid = false; - $date = $matches['date']; - $d6 = strtotime($date); - if ((strlen($date) == 4) && $date <= date('Y')) { - $dvalid = true; - } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) { - $dvalid = true; - } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) { - $dvalid = true; - } - $validator = new Zend_Validate_EmailAddress; - if ($validator->isValid($matches['name'])) { - $nvalid = true; - } else { - $nvalid = $validator->isValid('info@' . $matches['name']); - } - return $dvalid && $nvalid; - - } - return false; - } - - /** - * Set a feed image (URI at minimum). Parameter is a single array with the - * required key 'uri'. When rendering as RSS, the required keys are 'uri', - * 'title' and 'link'. RSS also specifies three optional parameters 'width', - * 'height' and 'description'. Only 'uri' is required and used for Atom rendering. - * - * @param array $data - */ - public function setImage(array $data) - { - if (empty($data['uri']) || !is_string($data['uri']) - || !Zend_Uri::check($data['uri'])) { - throw new Zend_Feed_Exception('Invalid parameter: parameter \'uri\'' - . ' must be a non-empty string and valid URI/IRI'); - } - $this->_data['image'] = $data; - } - - /** - * Set a feed icon (URI at minimum). Parameter is a single array with the - * required key 'uri'. Only 'uri' is required and used for Atom rendering. - * RSS does not support an Icon tag except via Atom 1.0 as an extension. - * - * @param array $data - */ - public function setIcon(array $data) - { - if (empty($data['uri']) || !is_string($data['uri']) - || !Zend_Uri::check($data['uri'])) { - throw new Zend_Feed_Exception('Invalid parameter: parameter \'uri\'' - . ' must be a non-empty string and valid URI/IRI'); - } - $this->_data['icon'] = $data; - } - - /** - * Set the feed language - * - * @return string|null - */ - public function setLanguage($language) - { - if (empty($language) || !is_string($language)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['language'] = $language; - } - - /** - * Set a link to the HTML source - * - * @param string $link - */ - public function setLink($link) - { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); - } - $this->_data['link'] = $link; - } - - /** - * Set a link to an XML feed for any feed type/version - * - * @return string|null - */ - public function setFeedLink($link, $type) - { - if (empty($link) || !is_string($link) || !Zend_Uri::check($link)) { - throw new Zend_Feed_Exception('Invalid parameter: "link"" must be a non-empty string and valid URI/IRI'); - } - if (!in_array(strtolower($type), array('rss', 'rdf', 'atom'))) { - throw new Zend_Feed_Exception('Invalid parameter: "type"; You must declare the type of feed the link points to, i.e. RSS, RDF or Atom'); - } - $this->_data['feedLinks'][strtolower($type)] = $link; - } - - /** - * Set the feed title - * - * @return string|null - */ - public function setTitle($title) - { - if (empty($title) || !is_string($title)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['title'] = $title; - } - - /** - * Set the feed character encoding - * - * @param string $encoding - */ - public function setEncoding($encoding) - { - if (empty($encoding) || !is_string($encoding)) { - throw new Zend_Feed_Exception('Invalid parameter: parameter must be a non-empty string'); - } - $this->_data['encoding'] = $encoding; - } - - /** - * Set the feed's base URL - * - * @param string $url - */ - public function setBaseUrl($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Exception('Invalid parameter: "url" array value' - . ' must be a non-empty string and valid URI/IRI'); - } - $this->_data['baseUrl'] = $url; - } - - /** - * Add a Pubsubhubbub hub endpoint URL - * - * @param string $url - */ - public function addHub($url) - { - if (empty($url) || !is_string($url) || !Zend_Uri::check($url)) { - throw new Zend_Feed_Exception('Invalid parameter: "url" array value' - . ' must be a non-empty string and valid URI/IRI'); - } - if (!isset($this->_data['hubs'])) { - $this->_data['hubs'] = array(); - } - $this->_data['hubs'][] = $url; - } - - /** - * Add Pubsubhubbub hub endpoint URLs - * - * @param array $urls - */ - public function addHubs(array $urls) - { - foreach ($urls as $url) { - $this->addHub($url); - } - } - - /** - * Add a feed category - * - * @param string $category - */ - public function addCategory(array $category) - { - if (!isset($category['term'])) { - throw new Zend_Feed_Exception('Each category must be an array and ' - . 'contain at least a "term" element containing the machine ' - . ' readable category name'); - } - if (isset($category['scheme'])) { - if (empty($category['scheme']) - || !is_string($category['scheme']) - || !Zend_Uri::check($category['scheme']) - ) { - throw new Zend_Feed_Exception('The Atom scheme or RSS domain of' - . ' a category must be a valid URI'); - } - } - if (!isset($this->_data['categories'])) { - $this->_data['categories'] = array(); - } - $this->_data['categories'][] = $category; - } - - /** - * Set an array of feed categories - * - * @param array $categories - */ - public function addCategories(array $categories) - { - foreach ($categories as $category) { - $this->addCategory($category); - } - } - - /** - * Get a single author - * - * @param int $index - * @return string|null - */ - public function getAuthor($index = 0) - { - if (isset($this->_data['authors'][$index])) { - return $this->_data['authors'][$index]; - } else { - return null; - } - } - - /** - * Get an array with feed authors - * - * @return array - */ - public function getAuthors() - { - if (!array_key_exists('authors', $this->_data)) { - return null; - } - return $this->_data['authors']; - } - - /** - * Get the copyright entry - * - * @return string|null - */ - public function getCopyright() - { - if (!array_key_exists('copyright', $this->_data)) { - return null; - } - return $this->_data['copyright']; - } - - /** - * Get the feed creation date - * - * @return string|null - */ - public function getDateCreated() - { - if (!array_key_exists('dateCreated', $this->_data)) { - return null; - } - return $this->_data['dateCreated']; - } - - /** - * Get the feed modification date - * - * @return string|null - */ - public function getDateModified() - { - if (!array_key_exists('dateModified', $this->_data)) { - return null; - } - return $this->_data['dateModified']; - } - - /** - * Get the feed last-build date - * - * @return string|null - */ - public function getLastBuildDate() - { - if (!array_key_exists('lastBuildDate', $this->_data)) { - return null; - } - return $this->_data['lastBuildDate']; - } - - /** - * Get the feed description - * - * @return string|null - */ - public function getDescription() - { - if (!array_key_exists('description', $this->_data)) { - return null; - } - return $this->_data['description']; - } - - /** - * Get the feed generator entry - * - * @return string|null - */ - public function getGenerator() - { - if (!array_key_exists('generator', $this->_data)) { - return null; - } - return $this->_data['generator']; - } - - /** - * Get the feed ID - * - * @return string|null - */ - public function getId() - { - if (!array_key_exists('id', $this->_data)) { - return null; - } - return $this->_data['id']; - } - - /** - * Get the feed image URI - * - * @return array - */ - public function getImage() - { - if (!array_key_exists('image', $this->_data)) { - return null; - } - return $this->_data['image']; - } - - /** - * Get the feed icon URI - * - * @return array - */ - public function getIcon() - { - if (!array_key_exists('icon', $this->_data)) { - return null; - } - return $this->_data['icon']; - } - - /** - * Get the feed language - * - * @return string|null - */ - public function getLanguage() - { - if (!array_key_exists('language', $this->_data)) { - return null; - } - return $this->_data['language']; - } - - /** - * Get a link to the HTML source - * - * @return string|null - */ - public function getLink() - { - if (!array_key_exists('link', $this->_data)) { - return null; - } - return $this->_data['link']; - } - - /** - * Get a link to the XML feed - * - * @return string|null - */ - public function getFeedLinks() - { - if (!array_key_exists('feedLinks', $this->_data)) { - return null; - } - return $this->_data['feedLinks']; - } - - /** - * Get the feed title - * - * @return string|null - */ - public function getTitle() - { - if (!array_key_exists('title', $this->_data)) { - return null; - } - return $this->_data['title']; - } - - /** - * Get the feed character encoding - * - * @return string|null - */ - public function getEncoding() - { - if (!array_key_exists('encoding', $this->_data)) { - return 'UTF-8'; - } - return $this->_data['encoding']; - } - - /** - * Get the feed's base url - * - * @return string|null - */ - public function getBaseUrl() - { - if (!array_key_exists('baseUrl', $this->_data)) { - return null; - } - return $this->_data['baseUrl']; - } - - /** - * Get the URLs used as Pubsubhubbub hubs endpoints - * - * @return string|null - */ - public function getHubs() - { - if (!array_key_exists('hubs', $this->_data)) { - return null; - } - return $this->_data['hubs']; - } - - /** - * Get the feed categories - * - * @return string|null - */ - public function getCategories() - { - if (!array_key_exists('categories', $this->_data)) { - return null; - } - return $this->_data['categories']; - } - - /** - * Resets the instance and deletes all data - * - * @return void - */ - public function reset() - { - $this->_data = array(); - } - - /** - * Set the current feed type being exported to "rss" or "atom". This allows - * other objects to gracefully choose whether to execute or not, depending - * on their appropriateness for the current type, e.g. renderers. - * - * @param string $type - */ - public function setType($type) - { - $this->_type = $type; - } - - /** - * Retrieve the current or last feed type exported. - * - * @return string Value will be "rss" or "atom" - */ - public function getType() - { - return $this->_type; - } - - /** - * Unset a specific data point - * - * @param string $name - */ - public function remove($name) - { - if (isset($this->_data[$name])) { - unset($this->_data[$name]); - } - } - - /** - * Method overloading: call given method on first extension implementing it - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Feed_Exception if no extensions implements the method - */ - public function __call($method, $args) - { - foreach ($this->_extensions as $extension) { - try { - return call_user_func_array(array($extension, $method), $args); - } catch (Zend_Feed_Writer_Exception_InvalidMethodException $e) { - } - } - throw new Zend_Feed_Exception('Method: ' . $method - . ' does not exist and could not be located on a registered Extension'); - } - - /** - * Load extensions from Zend_Feed_Writer - * - * @return void - */ - protected function _loadExtensions() - { - $all = Zend_Feed_Writer::getExtensions(); - $exts = $all['feed']; - foreach ($exts as $ext) { - $className = Zend_Feed_Writer::getPluginLoader()->getClassName($ext); - $this->_extensions[$ext] = new $className(); - $this->_extensions[$ext]->setEncoding($this->getEncoding()); - } - } -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/Entry/Atom.php b/library/vendor/Zend/Feed/Writer/Renderer/Entry/Atom.php deleted file mode 100644 index 15506097a..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/Entry/Atom.php +++ /dev/null @@ -1,440 +0,0 @@ -_dom = new DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $entry = $this->_dom->createElementNS(Zend_Feed_Writer::NAMESPACE_ATOM_10, 'entry'); - $this->_dom->appendChild($entry); - - $this->_setSource($this->_dom, $entry); - $this->_setTitle($this->_dom, $entry); - $this->_setDescription($this->_dom, $entry); - $this->_setDateCreated($this->_dom, $entry); - $this->_setDateModified($this->_dom, $entry); - $this->_setLink($this->_dom, $entry); - $this->_setId($this->_dom, $entry); - $this->_setAuthors($this->_dom, $entry); - $this->_setEnclosure($this->_dom, $entry); - $this->_setContent($this->_dom, $entry); - $this->_setCategories($this->_dom, $entry); - - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $entry); - $ext->render(); - } - - return $this; - } - - /** - * Set entry title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getTitle()) { - $message = 'Atom 1.0 entry elements MUST contain exactly one' - . ' atom:title element but a title has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $title = $dom->createElement('title'); - $root->appendChild($title); - $title->setAttribute('type', 'html'); - $cdata = $dom->createCDATASection($this->getDataContainer()->getTitle()); - $title->appendChild($cdata); - } - - /** - * Set entry description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDescription()) { - return; // unless src content or base64 - } - $subtitle = $dom->createElement('summary'); - $root->appendChild($subtitle); - $subtitle->setAttribute('type', 'html'); - $cdata = $dom->createCDATASection( - $this->getDataContainer()->getDescription() - ); - $subtitle->appendChild($cdata); - } - - /** - * Set date entry was modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - $message = 'Atom 1.0 entry elements MUST contain exactly one' - . ' atom:updated element but a modification date has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - $updated = $dom->createElement('updated'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) - ); - $updated->appendChild($text); - } - - /** - * Set date entry was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) - { - if (!$this->getDataContainer()->getDateCreated()) { - return; - } - $el = $dom->createElement('published'); - $root->appendChild($el); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateCreated()->get(Zend_Date::ISO_8601) - ); - $el->appendChild($text); - } - - /** - * Set entry authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->_container->getAuthors(); - if ((!$authors || empty($authors))) { - /** - * This will actually trigger an Exception at the feed level if - * a feed level author is not set. - */ - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $this->_dom->createElement('name'); - $author->appendChild($name); - $root->appendChild($author); - $text = $dom->createTextNode($data['name']); - $name->appendChild($text); - if (array_key_exists('email', $data)) { - $email = $this->_dom->createElement('email'); - $author->appendChild($email); - $text = $dom->createTextNode($data['email']); - $email->appendChild($text); - } - if (array_key_exists('uri', $data)) { - $uri = $this->_dom->createElement('uri'); - $author->appendChild($uri); - $text = $dom->createTextNode($data['uri']); - $uri->appendChild($text); - } - } - } - - /** - * Set entry enclosure - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setEnclosure(DOMDocument $dom, DOMElement $root) - { - $data = $this->_container->getEnclosure(); - if ((!$data || empty($data))) { - return; - } - $enclosure = $this->_dom->createElement('link'); - $enclosure->setAttribute('rel', 'enclosure'); - if (isset($data['type'])) { - $enclosure->setAttribute('type', $data['type']); - } - if (isset($data['length'])) { - $enclosure->setAttribute('length', $data['length']); - } - $enclosure->setAttribute('href', $data['uri']); - $root->appendChild($enclosure); - } - - protected function _setLink(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getLink()) { - return; - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('type', 'text/html'); - $link->setAttribute('href', $this->getDataContainer()->getLink()); - } - - /** - * Set entry identifier - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setId(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { - $message = 'Atom 1.0 entry elements MUST contain exactly one ' - . 'atom:id element, or as an alternative, we can use the same ' - . 'value as atom:link however neither a suitable link nor an ' - . 'id have been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - if (!$this->getDataContainer()->getId()) { - $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); - } - if (!Zend_Uri::check($this->getDataContainer()->getId()) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", - $this->getDataContainer()->getId() - ) && !$this->_validateTagUri($this->getDataContainer()->getId())) { - throw new Zend_Feed_Exception('Atom 1.0 IDs must be a valid URI/IRI'); - } - $id = $dom->createElement('id'); - $root->appendChild($id); - $text = $dom->createTextNode($this->getDataContainer()->getId()); - $id->appendChild($text); - } - - /** - * Validate a URI using the tag scheme (RFC 4151) - * - * @param string $id - * @return bool - */ - protected function _validateTagUri($id) - { - if (preg_match('/^tag:(?.*),(?\d{4}-?\d{0,2}-?\d{0,2}):(?.*)(.*:)*$/', $id, $matches)) { - $dvalid = false; - $nvalid = false; - $date = $matches['date']; - $d6 = strtotime($date); - if ((strlen($date) == 4) && $date <= date('Y')) { - $dvalid = true; - } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) { - $dvalid = true; - } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) { - $dvalid = true; - } - $validator = new Zend_Validate_EmailAddress; - if ($validator->isValid($matches['name'])) { - $nvalid = true; - } else { - $nvalid = $validator->isValid('info@' . $matches['name']); - } - return $dvalid && $nvalid; - - } - return false; - } - - /** - * Set entry content - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setContent(DOMDocument $dom, DOMElement $root) - { - $content = $this->getDataContainer()->getContent(); - if (!$content && !$this->getDataContainer()->getLink()) { - $message = 'Atom 1.0 entry elements MUST contain exactly one ' - . 'atom:content element, or as an alternative, at least one link ' - . 'with a rel attribute of "alternate" to indicate an alternate ' - . 'method to consume the content.'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (!$content) { - return; - } - $element = $dom->createElement('content'); - $element->setAttribute('type', 'xhtml'); - $xhtmlElement = $this->_loadXhtml($content); - $xhtml = $dom->importNode($xhtmlElement, true); - $element->appendChild($xhtml); - $root->appendChild($element); - } - - /** - * Load a HTML string and attempt to normalise to XML - */ - protected function _loadXhtml($content) - { - $xhtml = ''; - if (class_exists('tidy', false)) { - $tidy = new tidy; - $config = array( - 'output-xhtml' => true, - 'show-body-only' => true, - 'quote-nbsp' => false - ); - $encoding = str_replace('-', '', $this->getEncoding()); - $tidy->parseString($content, $config, $encoding); - $tidy->cleanRepair(); - $xhtml = (string) $tidy; - } else { - $xhtml = $content; - } - $xhtml = preg_replace(array( - "/(<[\/]?)([a-zA-Z]+)/" - ), '$1xhtml:$2', $xhtml); - $dom = new DOMDocument('1.0', $this->getEncoding()); - - $dom = Zend_Xml_Security::scan('' - . $xhtml . '', $dom); - return $dom->documentElement; - } - - /** - * Set entry cateories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - $category->setAttribute('term', $cat['term']); - if (isset($cat['label'])) { - $category->setAttribute('label', $cat['label']); - } else { - $category->setAttribute('label', $cat['term']); - } - if (isset($cat['scheme'])) { - $category->setAttribute('scheme', $cat['scheme']); - } - $root->appendChild($category); - } - } - - /** - * Append Source element (Atom 1.0 Feed Metadata) - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setSource(DOMDocument $dom, DOMElement $root) - { - $source = $this->getDataContainer()->getSource(); - if (!$source) { - return; - } - $renderer = new Zend_Feed_Writer_Renderer_Feed_Atom_Source($source); - $renderer->setType($this->getType()); - $element = $renderer->render()->getElement(); - $imported = $dom->importNode($element, true); - $root->appendChild($imported); - } -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php b/library/vendor/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php deleted file mode 100644 index 32fc00d6a..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/Entry/Atom/Deleted.php +++ /dev/null @@ -1,120 +0,0 @@ -_dom = new DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $entry = $this->_dom->createElement('at:deleted-entry'); - $this->_dom->appendChild($entry); - - $entry->setAttribute('ref', $this->_container->getReference()); - $entry->setAttribute('when', $this->_container->getWhen()->get(Zend_Date::ISO_8601)); - - $this->_setBy($this->_dom, $entry); - $this->_setComment($this->_dom, $entry); - - return $this; - } - - /** - * Set tombstone comment - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setComment(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getComment()) { - return; - } - $c = $dom->createElement('at:comment'); - $root->appendChild($c); - $c->setAttribute('type', 'html'); - $cdata = $dom->createCDATASection($this->getDataContainer()->getComment()); - $c->appendChild($cdata); - } - - /** - * Set entry authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setBy(DOMDocument $dom, DOMElement $root) - { - $data = $this->_container->getBy(); - if ((!$data || empty($data))) { - return; - } - $author = $this->_dom->createElement('at:by'); - $name = $this->_dom->createElement('name'); - $author->appendChild($name); - $root->appendChild($author); - $text = $dom->createTextNode($data['name']); - $name->appendChild($text); - if (array_key_exists('email', $data)) { - $email = $this->_dom->createElement('email'); - $author->appendChild($email); - $text = $dom->createTextNode($data['email']); - $email->appendChild($text); - } - if (array_key_exists('uri', $data)) { - $uri = $this->_dom->createElement('uri'); - $author->appendChild($uri); - $text = $dom->createTextNode($data['uri']); - $uri->appendChild($text); - } - } - -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/Entry/Rss.php b/library/vendor/Zend/Feed/Writer/Renderer/Entry/Rss.php deleted file mode 100644 index 5f5ee9cd9..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/Entry/Rss.php +++ /dev/null @@ -1,340 +0,0 @@ -_dom = new DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $this->_dom->substituteEntities = false; - $entry = $this->_dom->createElement('item'); - $this->_dom->appendChild($entry); - - $this->_setTitle($this->_dom, $entry); - $this->_setDescription($this->_dom, $entry); - $this->_setDateCreated($this->_dom, $entry); - $this->_setDateModified($this->_dom, $entry); - $this->_setLink($this->_dom, $entry); - $this->_setId($this->_dom, $entry); - $this->_setAuthors($this->_dom, $entry); - $this->_setEnclosure($this->_dom, $entry); - $this->_setCommentLink($this->_dom, $entry); - $this->_setCategories($this->_dom, $entry); - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $entry); - $ext->render(); - } - - return $this; - } - - /** - * Set entry title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDescription() - && !$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' title element but a title has not been set. In addition, there' - . ' is no description as required in the absence of a title.'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $title = $dom->createElement('title'); - $root->appendChild($title); - $text = $dom->createTextNode($this->getDataContainer()->getTitle()); - $title->appendChild($text); - } - - /** - * Set entry description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDescription() - && !$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 entry elements SHOULD contain exactly one' - . ' description element but a description has not been set. In' - . ' addition, there is no title element as required in the absence' - . ' of a description.'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (!$this->getDataContainer()->getDescription()) { - return; - } - $subtitle = $dom->createElement('description'); - $root->appendChild($subtitle); - $text = $dom->createCDATASection($this->getDataContainer()->getDescription()); - $subtitle->appendChild($text); - } - - /** - * Set date entry was last modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - return; - } - - $updated = $dom->createElement('pubDate'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::RSS) - ); - $updated->appendChild($text); - } - - /** - * Set date entry was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) - { - if (!$this->getDataContainer()->getDateCreated()) { - return; - } - if (!$this->getDataContainer()->getDateModified()) { - $this->getDataContainer()->setDateModified( - $this->getDataContainer()->getDateCreated() - ); - } - } - - /** - * Set entry authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->_container->getAuthors(); - if ((!$authors || empty($authors))) { - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $data['name']; - if (array_key_exists('email', $data)) { - $name = $data['email'] . ' (' . $data['name'] . ')'; - } - $text = $dom->createTextNode($name); - $author->appendChild($text); - $root->appendChild($author); - } - } - - /** - * Set entry enclosure - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setEnclosure(DOMDocument $dom, DOMElement $root) - { - $data = $this->_container->getEnclosure(); - if ((!$data || empty($data))) { - return; - } - if (!isset($data['type'])) { - $exception = new Zend_Feed_Exception('Enclosure "type" is not set'); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (!isset($data['length'])) { - $exception = new Zend_Feed_Exception('Enclosure "length" is not set'); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (isset($data['length']) && (int) $data['length'] <= 0) { - $exception = new Zend_Feed_Exception('Enclosure "length" must be an integer' - . ' indicating the content\'s length in bytes'); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $enclosure = $this->_dom->createElement('enclosure'); - $enclosure->setAttribute('type', $data['type']); - $enclosure->setAttribute('length', $data['length']); - $enclosure->setAttribute('url', $data['uri']); - $root->appendChild($enclosure); - } - - /** - * Set link to entry - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLink(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getLink()) { - return; - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $text = $dom->createTextNode($this->getDataContainer()->getLink()); - $link->appendChild($text); - } - - /** - * Set entry identifier - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setId(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { - return; - } - - $id = $dom->createElement('guid'); - $root->appendChild($id); - if (!$this->getDataContainer()->getId()) { - $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); - } - $text = $dom->createTextNode($this->getDataContainer()->getId()); - $id->appendChild($text); - if (!Zend_Uri::check($this->getDataContainer()->getId())) { - $id->setAttribute('isPermaLink', 'false'); - } - } - - /** - * Set link to entry comments - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCommentLink(DOMDocument $dom, DOMElement $root) - { - $link = $this->getDataContainer()->getCommentLink(); - if (!$link) { - return; - } - $clink = $this->_dom->createElement('comments'); - $text = $dom->createTextNode($link); - $clink->appendChild($text); - $root->appendChild($clink); - } - - /** - * Set entry categories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - if (isset($cat['scheme'])) { - $category->setAttribute('domain', $cat['scheme']); - } - $text = $dom->createCDATASection($cat['term']); - $category->appendChild($text); - $root->appendChild($category); - } - } -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom.php b/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom.php deleted file mode 100644 index eebd8044d..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom.php +++ /dev/null @@ -1,124 +0,0 @@ -_container->getEncoding()) { - $this->_container->setEncoding('UTF-8'); - } - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $root = $this->_dom->createElementNS( - Zend_Feed_Writer::NAMESPACE_ATOM_10, 'feed' - ); - $this->setRootElement($root); - $this->_dom->appendChild($root); - $this->_setLanguage($this->_dom, $root); - $this->_setBaseUrl($this->_dom, $root); - $this->_setTitle($this->_dom, $root); - $this->_setDescription($this->_dom, $root); - $this->_setImage($this->_dom, $root); - $this->_setIcon($this->_dom, $root); - $this->_setDateCreated($this->_dom, $root); - $this->_setDateModified($this->_dom, $root); - $this->_setGenerator($this->_dom, $root); - $this->_setLink($this->_dom, $root); - $this->_setFeedLinks($this->_dom, $root); - $this->_setId($this->_dom, $root); - $this->_setAuthors($this->_dom, $root); - $this->_setCopyright($this->_dom, $root); - $this->_setCategories($this->_dom, $root); - $this->_setHubs($this->_dom, $root); - - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $root); - $ext->render(); - } - - foreach ($this->_container as $entry) { - if ($this->getDataContainer()->getEncoding()) { - $entry->setEncoding($this->getDataContainer()->getEncoding()); - } - if ($entry instanceof Zend_Feed_Writer_Entry) { - $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom($entry); - } else { - if (!$this->_dom->documentElement->hasAttribute('xmlns:at')) { - $this->_dom->documentElement->setAttribute( - 'xmlns:at', 'http://purl.org/atompub/tombstones/1.0' - ); - } - $renderer = new Zend_Feed_Writer_Renderer_Entry_Atom_Deleted($entry); - } - if ($this->_ignoreExceptions === true) { - $renderer->ignoreExceptions(); - } - $renderer->setType($this->getType()); - $renderer->setRootElement($this->_dom->documentElement); - $renderer->render(); - $element = $renderer->getElement(); - $imported = $this->_dom->importNode($element, true); - $root->appendChild($imported); - } - return $this; - } - -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php b/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php deleted file mode 100644 index bd3db6306..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom/AtomAbstract.php +++ /dev/null @@ -1,437 +0,0 @@ -getDataContainer()->getLanguage()) { - $root->setAttribute('xml:lang', $this->getDataContainer() - ->getLanguage()); - } - } - - /** - * Set feed title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getTitle()) { - $message = 'Atom 1.0 feed elements MUST contain exactly one' - . ' atom:title element but a title has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - $title = $dom->createElement('title'); - $root->appendChild($title); - $title->setAttribute('type', 'text'); - $text = $dom->createTextNode($this->getDataContainer()->getTitle()); - $title->appendChild($text); - } - - /** - * Set feed description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDescription()) { - return; - } - $subtitle = $dom->createElement('subtitle'); - $root->appendChild($subtitle); - $subtitle->setAttribute('type', 'text'); - $text = $dom->createTextNode($this->getDataContainer()->getDescription()); - $subtitle->appendChild($text); - } - - /** - * Set date feed was last modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - $message = 'Atom 1.0 feed elements MUST contain exactly one' - . ' atom:updated element but a modification date has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - $updated = $dom->createElement('updated'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::ISO_8601) - ); - $updated->appendChild($text); - } - - /** - * Set feed generator string - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setGenerator(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getGenerator()) { - $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - Zend_Version::VERSION, 'http://framework.zend.com'); - } - - $gdata = $this->getDataContainer()->getGenerator(); - $generator = $dom->createElement('generator'); - $root->appendChild($generator); - $text = $dom->createTextNode($gdata['name']); - $generator->appendChild($text); - if (array_key_exists('uri', $gdata)) { - $generator->setAttribute('uri', $gdata['uri']); - } - if (array_key_exists('version', $gdata)) { - $generator->setAttribute('version', $gdata['version']); - } - } - - /** - * Set link to feed - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLink(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getLink()) { - return; - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $link->setAttribute('rel', 'alternate'); - $link->setAttribute('type', 'text/html'); - $link->setAttribute('href', $this->getDataContainer()->getLink()); - } - - /** - * Set feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setFeedLinks(DOMDocument $dom, DOMElement $root) - { - $flinks = $this->getDataContainer()->getFeedLinks(); - if(!$flinks || !array_key_exists('atom', $flinks)) { - $message = 'Atom 1.0 feed elements SHOULD contain one atom:link ' - . 'element with a rel attribute value of "self". This is the ' - . 'preferred URI for retrieving Atom Feed Documents representing ' - . 'this Atom feed but a feed link has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - foreach ($flinks as $type => $href) { - $mime = 'application/' . strtolower($type) . '+xml'; - $flink = $dom->createElement('link'); - $root->appendChild($flink); - $flink->setAttribute('rel', 'self'); - $flink->setAttribute('type', $mime); - $flink->setAttribute('href', $href); - } - } - - /** - * Set feed authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->_container->getAuthors(); - if (!$authors || empty($authors)) { - /** - * Technically we should defer an exception until we can check - * that all entries contain an author. If any entry is missing - * an author, then a missing feed author element is invalid - */ - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $this->_dom->createElement('name'); - $author->appendChild($name); - $root->appendChild($author); - $text = $dom->createTextNode($data['name']); - $name->appendChild($text); - if (array_key_exists('email', $data)) { - $email = $this->_dom->createElement('email'); - $author->appendChild($email); - $text = $dom->createTextNode($data['email']); - $email->appendChild($text); - } - if (array_key_exists('uri', $data)) { - $uri = $this->_dom->createElement('uri'); - $author->appendChild($uri); - $text = $dom->createTextNode($data['uri']); - $uri->appendChild($text); - } - } - } - - /** - * Set feed identifier - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setId(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getId() - && !$this->getDataContainer()->getLink()) { - $message = 'Atom 1.0 feed elements MUST contain exactly one ' - . 'atom:id element, or as an alternative, we can use the same ' - . 'value as atom:link however neither a suitable link nor an ' - . 'id have been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - if (!$this->getDataContainer()->getId()) { - $this->getDataContainer()->setId( - $this->getDataContainer()->getLink()); - } - $id = $dom->createElement('id'); - $root->appendChild($id); - $text = $dom->createTextNode($this->getDataContainer()->getId()); - $id->appendChild($text); - } - - /** - * Set feed copyright - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCopyright(DOMDocument $dom, DOMElement $root) - { - $copyright = $this->getDataContainer()->getCopyright(); - if (!$copyright) { - return; - } - $copy = $dom->createElement('rights'); - $root->appendChild($copy); - $text = $dom->createTextNode($copyright); - $copy->appendChild($text); - } - - /** - * Set feed level logo (image) - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setImage(DOMDocument $dom, DOMElement $root) - { - $image = $this->getDataContainer()->getImage(); - if (!$image) { - return; - } - $img = $dom->createElement('logo'); - $root->appendChild($img); - $text = $dom->createTextNode($image['uri']); - $img->appendChild($text); - } - - /** - * Set feed level icon (image) - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setIcon(DOMDocument $dom, DOMElement $root) - { - $image = $this->getDataContainer()->getIcon(); - if (!$image) { - return; - } - $img = $dom->createElement('icon'); - $root->appendChild($img); - $text = $dom->createTextNode($image['uri']); - $img->appendChild($text); - } - - /** - * Set date feed was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDateCreated()) { - return; - } - if(!$this->getDataContainer()->getDateModified()) { - $this->getDataContainer()->setDateModified( - $this->getDataContainer()->getDateCreated() - ); - } - } - - /** - * Set base URL to feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) - { - $baseUrl = $this->getDataContainer()->getBaseUrl(); - if (!$baseUrl) { - return; - } - $root->setAttribute('xml:base', $baseUrl); - } - - /** - * Set hubs to which this feed pushes - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setHubs(DOMDocument $dom, DOMElement $root) - { - $hubs = $this->getDataContainer()->getHubs(); - if (!$hubs) { - return; - } - foreach ($hubs as $hubUrl) { - $hub = $dom->createElement('link'); - $hub->setAttribute('rel', 'hub'); - $hub->setAttribute('href', $hubUrl); - $root->appendChild($hub); - } - } - - /** - * Set feed cateories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - $category->setAttribute('term', $cat['term']); - if (isset($cat['label'])) { - $category->setAttribute('label', $cat['label']); - } else { - $category->setAttribute('label', $cat['term']); - } - if (isset($cat['scheme'])) { - $category->setAttribute('scheme', $cat['scheme']); - } - $root->appendChild($category); - } - } -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php b/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php deleted file mode 100644 index 2b28085bc..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/Feed/Atom/Source.php +++ /dev/null @@ -1,109 +0,0 @@ -_container->getEncoding()) { - $this->_container->setEncoding('UTF-8'); - } - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $root = $this->_dom->createElement('source'); - $this->setRootElement($root); - $this->_dom->appendChild($root); - $this->_setLanguage($this->_dom, $root); - $this->_setBaseUrl($this->_dom, $root); - $this->_setTitle($this->_dom, $root); - $this->_setDescription($this->_dom, $root); - $this->_setDateCreated($this->_dom, $root); - $this->_setDateModified($this->_dom, $root); - $this->_setGenerator($this->_dom, $root); - $this->_setLink($this->_dom, $root); - $this->_setFeedLinks($this->_dom, $root); - $this->_setId($this->_dom, $root); - $this->_setAuthors($this->_dom, $root); - $this->_setCopyright($this->_dom, $root); - $this->_setCategories($this->_dom, $root); - - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $root); - $ext->render(); - } - return $this; - } - - /** - * Set feed generator string - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setGenerator(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getGenerator()) { - return; - } - - $gdata = $this->getDataContainer()->getGenerator(); - $generator = $dom->createElement('generator'); - $root->appendChild($generator); - $text = $dom->createTextNode($gdata['name']); - $generator->appendChild($text); - if (array_key_exists('uri', $gdata)) { - $generator->setAttribute('uri', $gdata['uri']); - } - if (array_key_exists('version', $gdata)) { - $generator->setAttribute('version', $gdata['version']); - } - } - -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/Feed/Rss.php b/library/vendor/Zend/Feed/Writer/Renderer/Feed/Rss.php deleted file mode 100644 index 79d0e5795..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/Feed/Rss.php +++ /dev/null @@ -1,492 +0,0 @@ -_container->getEncoding()) { - $this->_container->setEncoding('UTF-8'); - } - $this->_dom = new DOMDocument('1.0', $this->_container->getEncoding()); - $this->_dom->formatOutput = true; - $this->_dom->substituteEntities = false; - $rss = $this->_dom->createElement('rss'); - $this->setRootElement($rss); - $rss->setAttribute('version', '2.0'); - - $channel = $this->_dom->createElement('channel'); - $rss->appendChild($channel); - $this->_dom->appendChild($rss); - $this->_setLanguage($this->_dom, $channel); - $this->_setBaseUrl($this->_dom, $channel); - $this->_setTitle($this->_dom, $channel); - $this->_setDescription($this->_dom, $channel); - $this->_setImage($this->_dom, $channel); - $this->_setDateCreated($this->_dom, $channel); - $this->_setDateModified($this->_dom, $channel); - $this->_setLastBuildDate($this->_dom, $channel); - $this->_setGenerator($this->_dom, $channel); - $this->_setLink($this->_dom, $channel); - $this->_setAuthors($this->_dom, $channel); - $this->_setCopyright($this->_dom, $channel); - $this->_setCategories($this->_dom, $channel); - - foreach ($this->_extensions as $ext) { - $ext->setType($this->getType()); - $ext->setRootElement($this->getRootElement()); - $ext->setDomDocument($this->getDomDocument(), $channel); - $ext->render(); - } - - foreach ($this->_container as $entry) { - if ($this->getDataContainer()->getEncoding()) { - $entry->setEncoding($this->getDataContainer()->getEncoding()); - } - if ($entry instanceof Zend_Feed_Writer_Entry) { - $renderer = new Zend_Feed_Writer_Renderer_Entry_Rss($entry); - } else { - continue; - } - if ($this->_ignoreExceptions === true) { - $renderer->ignoreExceptions(); - } - $renderer->setType($this->getType()); - $renderer->setRootElement($this->_dom->documentElement); - $renderer->render(); - $element = $renderer->getElement(); - $imported = $this->_dom->importNode($element, true); - $channel->appendChild($imported); - } - return $this; - } - - /** - * Set feed language - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLanguage(DOMDocument $dom, DOMElement $root) - { - $lang = $this->getDataContainer()->getLanguage(); - if (!$lang) { - return; - } - $language = $dom->createElement('language'); - $root->appendChild($language); - $language->nodeValue = $lang; - } - - /** - * Set feed title - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setTitle(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getTitle()) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' title element but a title has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - - $title = $dom->createElement('title'); - $root->appendChild($title); - $text = $dom->createTextNode($this->getDataContainer()->getTitle()); - $title->appendChild($text); - } - - /** - * Set feed description - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDescription(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDescription()) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' description element but one has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $subtitle = $dom->createElement('description'); - $root->appendChild($subtitle); - $text = $dom->createTextNode($this->getDataContainer()->getDescription()); - $subtitle->appendChild($text); - } - - /** - * Set date feed was last modified - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateModified(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDateModified()) { - return; - } - - $updated = $dom->createElement('pubDate'); - $root->appendChild($updated); - $text = $dom->createTextNode( - $this->getDataContainer()->getDateModified()->get(Zend_Date::RSS) - ); - $updated->appendChild($text); - } - - /** - * Set feed generator string - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setGenerator(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getGenerator()) { - $this->getDataContainer()->setGenerator('Zend_Feed_Writer', - Zend_Version::VERSION, 'http://framework.zend.com'); - } - - $gdata = $this->getDataContainer()->getGenerator(); - $generator = $dom->createElement('generator'); - $root->appendChild($generator); - $name = $gdata['name']; - if (array_key_exists('version', $gdata)) { - $name .= ' ' . $gdata['version']; - } - if (array_key_exists('uri', $gdata)) { - $name .= ' (' . $gdata['uri'] . ')'; - } - $text = $dom->createTextNode($name); - $generator->appendChild($text); - } - - /** - * Set link to feed - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLink(DOMDocument $dom, DOMElement $root) - { - $value = $this->getDataContainer()->getLink(); - if(!$value) { - $message = 'RSS 2.0 feed elements MUST contain exactly one' - . ' link element but one has not been set'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $link = $dom->createElement('link'); - $root->appendChild($link); - $text = $dom->createTextNode($value); - $link->appendChild($text); - if (!Zend_Uri::check($value)) { - $link->setAttribute('isPermaLink', 'false'); - } - } - - /** - * Set feed authors - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setAuthors(DOMDocument $dom, DOMElement $root) - { - $authors = $this->getDataContainer()->getAuthors(); - if (!$authors || empty($authors)) { - return; - } - foreach ($authors as $data) { - $author = $this->_dom->createElement('author'); - $name = $data['name']; - if (array_key_exists('email', $data)) { - $name = $data['email'] . ' (' . $data['name'] . ')'; - } - $text = $dom->createTextNode($name); - $author->appendChild($text); - $root->appendChild($author); - } - } - - /** - * Set feed copyright - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCopyright(DOMDocument $dom, DOMElement $root) - { - $copyright = $this->getDataContainer()->getCopyright(); - if (!$copyright) { - return; - } - $copy = $dom->createElement('copyright'); - $root->appendChild($copy); - $text = $dom->createTextNode($copyright); - $copy->appendChild($text); - } - - /** - * Set feed channel image - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setImage(DOMDocument $dom, DOMElement $root) - { - $image = $this->getDataContainer()->getImage(); - if (!$image) { - return; - } - if (!isset($image['title']) || empty($image['title']) - || !is_string($image['title'])) { - $message = 'RSS 2.0 feed images must include a title'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - if (empty($image['link']) || !is_string($image['link']) - || !Zend_Uri::check($image['link'])) { - $message = 'Invalid parameter: parameter \'link\'' - . ' must be a non-empty string and valid URI/IRI'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $img = $dom->createElement('image'); - $root->appendChild($img); - $url = $dom->createElement('url'); - $text = $dom->createTextNode($image['uri']); - $url->appendChild($text); - $title = $dom->createElement('title'); - $text = $dom->createTextNode($image['title']); - $title->appendChild($text); - $link = $dom->createElement('link'); - $text = $dom->createTextNode($image['link']); - $link->appendChild($text); - $img->appendChild($url); - $img->appendChild($title); - $img->appendChild($link); - if (isset($image['height'])) { - if (!ctype_digit((string) $image['height']) || $image['height'] > 400) { - $message = 'Invalid parameter: parameter \'height\'' - . ' must be an integer not exceeding 400'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $height = $dom->createElement('height'); - $text = $dom->createTextNode($image['height']); - $height->appendChild($text); - $img->appendChild($height); - } - if (isset($image['width'])) { - if (!ctype_digit((string) $image['width']) || $image['width'] > 144) { - $message = 'Invalid parameter: parameter \'width\'' - . ' must be an integer not exceeding 144'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $width = $dom->createElement('width'); - $text = $dom->createTextNode($image['width']); - $width->appendChild($text); - $img->appendChild($width); - } - if (isset($image['description'])) { - if (empty($image['description']) || !is_string($image['description'])) { - $message = 'Invalid parameter: parameter \'description\'' - . ' must be a non-empty string'; - $exception = new Zend_Feed_Exception($message); - if (!$this->_ignoreExceptions) { - throw $exception; - } else { - $this->_exceptions[] = $exception; - return; - } - } - $desc = $dom->createElement('description'); - $text = $dom->createTextNode($image['description']); - $desc->appendChild($text); - $img->appendChild($desc); - } - } - - /** - * Set date feed was created - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setDateCreated(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getDateCreated()) { - return; - } - if(!$this->getDataContainer()->getDateModified()) { - $this->getDataContainer()->setDateModified( - $this->getDataContainer()->getDateCreated() - ); - } - } - - /** - * Set date feed last build date - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setLastBuildDate(DOMDocument $dom, DOMElement $root) - { - if(!$this->getDataContainer()->getLastBuildDate()) { - return; - } - - $lastBuildDate = $dom->createElement('lastBuildDate'); - $root->appendChild($lastBuildDate); - $text = $dom->createTextNode( - $this->getDataContainer()->getLastBuildDate()->get(Zend_Date::RSS) - ); - $lastBuildDate->appendChild($text); - } - - /** - * Set base URL to feed links - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setBaseUrl(DOMDocument $dom, DOMElement $root) - { - $baseUrl = $this->getDataContainer()->getBaseUrl(); - if (!$baseUrl) { - return; - } - $root->setAttribute('xml:base', $baseUrl); - } - - /** - * Set feed categories - * - * @param DOMDocument $dom - * @param DOMElement $root - * @return void - */ - protected function _setCategories(DOMDocument $dom, DOMElement $root) - { - $categories = $this->getDataContainer()->getCategories(); - if (!$categories) { - return; - } - foreach ($categories as $cat) { - $category = $dom->createElement('category'); - if (isset($cat['scheme'])) { - $category->setAttribute('domain', $cat['scheme']); - } - $text = $dom->createTextNode($cat['term']); - $category->appendChild($text); - $root->appendChild($category); - } - } -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/RendererAbstract.php b/library/vendor/Zend/Feed/Writer/Renderer/RendererAbstract.php deleted file mode 100644 index eade2e05d..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/RendererAbstract.php +++ /dev/null @@ -1,247 +0,0 @@ -_container = $container; - $this->setType($container->getType()); - $this->_loadExtensions(); - } - - /** - * Save XML to string - * - * @return string - */ - public function saveXml() - { - return $this->getDomDocument()->saveXml(); - } - - /** - * Get DOM document - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->_dom; - } - - /** - * Get document element from DOM - * - * @return DOMElement - */ - public function getElement() - { - return $this->getDomDocument()->documentElement; - } - - /** - * Get data container of items being rendered - * - * @return mixed - */ - public function getDataContainer() - { - return $this->_container; - } - - /** - * Set feed encoding - * - * @param string $enc - * @return Zend_Feed_Writer_Renderer_RendererAbstract - */ - public function setEncoding($enc) - { - $this->_encoding = $enc; - return $this; - } - - /** - * Get feed encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Indicate whether or not to ignore exceptions - * - * @param bool $bool - * @return Zend_Feed_Writer_Renderer_RendererAbstract - */ - public function ignoreExceptions($bool = true) - { - if (!is_bool($bool)) { - throw new Zend_Feed_Exception('Invalid parameter: $bool. Should be TRUE or FALSE (defaults to TRUE if null)'); - } - $this->_ignoreExceptions = $bool; - return $this; - } - - /** - * Get exception list - * - * @return array - */ - public function getExceptions() - { - return $this->_exceptions; - } - - /** - * Set the current feed type being exported to "rss" or "atom". This allows - * other objects to gracefully choose whether to execute or not, depending - * on their appropriateness for the current type, e.g. renderers. - * - * @param string $type - */ - public function setType($type) - { - $this->_type = $type; - } - - /** - * Retrieve the current or last feed type exported. - * - * @return string Value will be "rss" or "atom" - */ - public function getType() - { - return $this->_type; - } - - /** - * Sets the absolute root element for the XML feed being generated. This - * helps simplify the appending of namespace declarations, but also ensures - * namespaces are added to the root element - not scattered across the entire - * XML file - may assist namespace unsafe parsers and looks pretty ;). - * - * @param DOMElement $root - */ - public function setRootElement(DOMElement $root) - { - $this->_rootElement = $root; - } - - /** - * Retrieve the absolute root element for the XML feed being generated. - * - * @return DOMElement - */ - public function getRootElement() - { - return $this->_rootElement; - } - - /** - * Load extensions from Zend_Feed_Writer - * - * @return void - */ - protected function _loadExtensions() - { - Zend_Feed_Writer::registerCoreExtensions(); - $all = Zend_Feed_Writer::getExtensions(); - if (stripos(get_class($this), 'entry')) { - $exts = $all['entryRenderer']; - } else { - $exts = $all['feedRenderer']; - } - foreach ($exts as $extension) { - $className = Zend_Feed_Writer::getPluginLoader()->getClassName($extension); - $this->_extensions[$extension] = new $className( - $this->getDataContainer() - ); - $this->_extensions[$extension]->setEncoding($this->getEncoding()); - } - } -} diff --git a/library/vendor/Zend/Feed/Writer/Renderer/RendererInterface.php b/library/vendor/Zend/Feed/Writer/Renderer/RendererInterface.php deleted file mode 100644 index 7bd04a012..000000000 --- a/library/vendor/Zend/Feed/Writer/Renderer/RendererInterface.php +++ /dev/null @@ -1,111 +0,0 @@ -=')) { return; } - if (!self::$_srandCalled) { - srand((double) microtime() * 1000000); + srand(Zend_Crypt_Math::randInteger(0, PHP_INT_MAX)); self::$_srandCalled = true; } } diff --git a/library/vendor/Zend/Form/Decorator/Captcha/ReCaptcha.php b/library/vendor/Zend/Form/Decorator/Captcha/ReCaptcha.php deleted file mode 100644 index 9d2833939..000000000 --- a/library/vendor/Zend/Form/Decorator/Captcha/ReCaptcha.php +++ /dev/null @@ -1,127 +0,0 @@ -getElement(); - if (!$element instanceof Zend_Form_Element_Captcha) { - return $content; - } - - $view = $element->getView(); - if (null === $view) { - return $content; - } - - $id = $element->getId(); - $name = $element->getBelongsTo(); - $placement = $this->getPlacement(); - $separator = $this->getSeparator(); - $challengeName = empty($name) ? 'recaptcha_challenge_field' : $name . '[recaptcha_challenge_field]'; - $responseName = empty($name) ? 'recaptcha_response_field' : $name . '[recaptcha_response_field]'; - $challengeId = $id . '-challenge'; - $responseId = $id . '-response'; - $captcha = $element->getCaptcha(); - $markup = $captcha->render($view, $element); - - // Create hidden fields for holding the final recaptcha values - // Placing "id" in "attribs" to ensure it is not overwritten with the name - $hidden = $view->formHidden(array( - 'name' => $challengeName, - 'attribs' => array('id' => $challengeId), - )); - $hidden .= $view->formHidden(array( - 'name' => $responseName, - 'attribs' => array('id' => $responseId), - )); - - // Create a window.onload event so that we can bind to the form. - // Once bound, add an onsubmit event that will replace the hidden field - // values with those produced by ReCaptcha - // zendBindEvent mediates between Mozilla's addEventListener and - // IE's sole support for addEvent. - $js =<< -function windowOnLoad(fn) { - var old = window.onload; - window.onload = function() { - if (old) { - old(); - } - fn(); - }; -} -function zendBindEvent(el, eventName, eventHandler) { - if (el.addEventListener){ - el.addEventListener(eventName, eventHandler, false); - } else if (el.attachEvent){ - el.attachEvent('on'+eventName, eventHandler); - } -} -windowOnLoad(function(){ - zendBindEvent( - document.getElementById("$challengeId").form, - 'submit', - function(e) { - document.getElementById("$challengeId").value = document.getElementById("recaptcha_challenge_field").value; - document.getElementById("$responseId").value = document.getElementById("recaptcha_response_field").value; - } - ); -}); - -EOJ; - - // Always place the hidden fields before the captcha markup, and follow - // with the JS from above - switch ($placement) { - case 'PREPEND': - $content = $hidden . $markup . $js . $separator . $content; - break; - case 'APPEND': - default: - $content = $content . $separator . $hidden . $markup . $js; - } - return $content; - } -} - diff --git a/library/vendor/Zend/Form/Decorator/Captcha/Word.php b/library/vendor/Zend/Form/Decorator/Captcha/Word.php deleted file mode 100644 index 38332357b..000000000 --- a/library/vendor/Zend/Form/Decorator/Captcha/Word.php +++ /dev/null @@ -1,77 +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/vendor/Zend/Form/Decorator/ViewHelper.php b/library/vendor/Zend/Form/Decorator/ViewHelper.php index cf94e650e..a0f71af92 100644 --- a/library/vendor/Zend/Form/Decorator/ViewHelper.php +++ b/library/vendor/Zend/Form/Decorator/ViewHelper.php @@ -244,7 +244,7 @@ class Zend_Form_Decorator_ViewHelper extends Zend_Form_Decorator_Abstract // Check list separator if (isset($attribs['listsep']) - && in_array($helper, array('formMulticheckbox', 'formRadio', 'formSelect')) + && in_array($helper, array('formMultiCheckbox', 'formRadio', 'formSelect')) ) { $listsep = $attribs['listsep']; unset($attribs['listsep']); diff --git a/library/vendor/Zend/Form/Element/Captcha.php b/library/vendor/Zend/Form/Element/Captcha.php deleted file mode 100644 index 09d738f81..000000000 --- a/library/vendor/Zend/Form/Element/Captcha.php +++ /dev/null @@ -1,299 +0,0 @@ -_captcha; - } - - /** - * Set captcha adapter - * - * @param string|array|Zend_Captcha_Adapter $captcha - * @param array $options - */ - public function setCaptcha($captcha, $options = array()) - { - 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(array($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 string|array|Zend_Config $spec - * @return void - */ - 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 - * - * @param array $options - * @return Zend_Form_Element_Captcha - */ - public function setOptions(array $options) - { - $captcha = null; - $captchaOptions = array(); - - 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 - * - * @param Zend_View_Interface $view - * @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 = array('Captcha', array('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 - * @throws Zend_Loader_Exception on invalid type. - */ - public function getPluginLoader($type) - { - $type = strtoupper($type); - if ($type == self::CAPTCHA) { - if (!isset($this->_loaders[$type])) { - $this->_loaders[$type] = new Zend_Loader_PluginLoader( - array('Zend_Captcha' => 'Zend/Captcha/') - ); - } - return $this->_loaders[$type]; - } else { - 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', array('tag' => 'p', 'class' => 'description')) - ->addDecorator('HtmlTag', array('tag' => 'dd', 'id' => $this->getName() . '-element')) - ->addDecorator('Label', array('tag' => 'dt')); - } - return $this; - } - - /** - * Is the captcha valid? - * - * @param mixed $value - * @param mixed $context - * @return boolean - */ - 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/vendor/Zend/Form/Element/Hash.php b/library/vendor/Zend/Form/Element/Hash.php deleted file mode 100644 index b807727f4..000000000 --- a/library/vendor/Zend/Form/Element/Hash.php +++ /dev/null @@ -1,257 +0,0 @@ -setAllowEmpty(false) - ->setRequired(true) - ->initCsrfValidator(); - } - - /** - * Set session object - * - * @param Zend_Session_Namespace $session - * @return Zend_Form_Element_Hash - */ - public function setSession($session) - { - $this->_session = $session; - return $this; - } - - /** - * Get session object - * - * Instantiate session object if none currently exists - * - * @return Zend_Session_Namespace - */ - public function getSession() - { - if (null === $this->_session) { - $this->_session = new Zend_Session_Namespace($this->getSessionName()); - } - return $this->_session; - } - - /** - * Initialize CSRF validator - * - * Creates Session namespace, and initializes CSRF token in session. - * Additionally, adds validator for validating CSRF token. - * - * @return Zend_Form_Element_Hash - */ - public function initCsrfValidator() - { - $session = $this->getSession(); - if (isset($session->hash)) { - $rightHash = $session->hash; - } else { - $rightHash = null; - } - - $this->addValidator('Identical', true, array($rightHash)); - return $this; - } - - /** - * Salt for CSRF token - * - * @param string $salt - * @return Zend_Form_Element_Hash - */ - public function setSalt($salt) - { - $this->_salt = (string) $salt; - return $this; - } - - /** - * Retrieve salt for CSRF token - * - * @return string - */ - public function getSalt() - { - return $this->_salt; - } - - /** - * Retrieve CSRF token - * - * If no CSRF token currently exists, generates one. - * - * @return string - */ - public function getHash() - { - if (null === $this->_hash) { - $this->_generateHash(); - } - return $this->_hash; - } - - /** - * Get session namespace for CSRF token - * - * Generates a session namespace based on salt, element name, and class. - * - * @return string - */ - public function getSessionName() - { - return __CLASS__ . '_' . $this->getSalt() . '_' . $this->getName(); - } - - /** - * Set timeout for CSRF session token - * - * @param int $ttl - * @return Zend_Form_Element_Hash - */ - public function setTimeout($ttl) - { - $this->_timeout = (int) $ttl; - return $this; - } - - /** - * Get CSRF session token timeout - * - * @return int - */ - public function getTimeout() - { - return $this->_timeout; - } - - /** - * Override getLabel() to always be empty - * - * @return null - */ - public function getLabel() - { - return null; - } - - /** - * Initialize CSRF token in session - * - * @return void - */ - public function initCsrfToken() - { - $session = $this->getSession(); - $session->setExpirationHops(1, null, true); - $session->setExpirationSeconds($this->getTimeout()); - $session->hash = $this->getHash(); - } - - /** - * Render CSRF token in form - * - * @param Zend_View_Interface $view - * @return string - */ - public function render(Zend_View_Interface $view = null) - { - $this->initCsrfToken(); - return parent::render($view); - } - - /** - * Generate CSRF token - * - * Generates CSRF token and stores both in {@link $_hash} and element - * value. - * - * @return void - */ - protected function _generateHash() - { - $this->_hash = md5( - mt_rand(1,1000000) - . $this->getSalt() - . $this->getName() - . mt_rand(1,1000000) - ); - $this->setValue($this->_hash); - } -} diff --git a/library/vendor/Zend/Http/Client.php b/library/vendor/Zend/Http/Client.php deleted file mode 100644 index 44f3c0961..000000000 --- a/library/vendor/Zend/Http/Client.php +++ /dev/null @@ -1,1582 +0,0 @@ - 5, - 'strictredirects' => false, - 'useragent' => 'Zend_Http_Client', - 'timeout' => 10, - 'adapter' => 'Zend_Http_Client_Adapter_Socket', - '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 = null; - - /** - * Request URI - * - * @var Zend_Uri_Http - */ - protected $uri = null; - - /** - * Associative array of request headers - * - * @var array - */ - protected $headers = array(); - - /** - * HTTP request method - * - * @var string - */ - protected $method = self::GET; - - /** - * Associative array of GET parameters - * - * @var array - */ - protected $paramsGet = array(); - - /** - * Associative array of POST parameters - * - * @var array - */ - protected $paramsPost = array(); - - /** - * Request body content type (for POST requests) - * - * @var string - */ - protected $enctype = null; - - /** - * The raw post data to send. Could be set by setRawData($data, $enctype). - * - * @var string - */ - protected $raw_post_data = null; - - /** - * 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 array|null - */ - 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 = array(); - - /** - * 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 = array(); - - /** - * The client's cookie jar - * - * @var Zend_Http_CookieJar - */ - protected $cookiejar = null; - - /** - * The last HTTP request sent by the client, as string - * - * @var string - */ - protected $last_request = null; - - /** - * The last HTTP response received by the client - * - * @var Zend_Http_Response - */ - protected $last_response = null; - - /** - * Redirection counter - * - * @var int - */ - protected $redirectCounter = 0; - - /** - * Status for unmasking GET array params - * - * @var boolean - */ - protected $_unmaskStatus = false; - - /** - * Status if the http_build_query function escapes brackets - * - * @var boolean - */ - 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 = null; - - /** - * Constructor method. Will create a new HTTP client. Accepts the target - * URL and optionally configuration array. - * - * @param Zend_Uri_Http|string $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 Zend_Uri_Http|string $uri - * @return Zend_Http_Client - * @throws Zend_Http_Client_Exception - */ - 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) { - /** @see Zend_Http_Client_Exception */ - 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 boolean $as_string If true, will return the URI as a string - * @return Zend_Uri_Http|string - */ - public function getUri($as_string = false) - { - if ($as_string && $this->uri instanceof Zend_Uri_Http) { - return $this->uri->__toString(); - } else { - return $this->uri; - } - } - - /** - * Set configuration parameters for this HTTP client - * - * @param Zend_Config | array $config - * @return Zend_Http_Client - * @throws Zend_Http_Client_Exception - */ - public function setConfig($config = array()) - { - if ($config instanceof Zend_Config) { - $config = $config->toArray(); - - } elseif (! is_array($config)) { - /** @see Zend_Http_Client_Exception */ - 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 - * @throws Zend_Http_Client_Exception - */ - 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 string|array $name Header name, full header string ('Header: value') - * or an array of headers - * @param mixed $value Header value or null - * @return Zend_Http_Client - * @throws Zend_Http_Client_Exception - */ - 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)) { - list($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] = array($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 string|array|null 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]; - } else { - return null; - } - } - - /** - * Set a GET parameter for the request. Wrapper around _setParameter - * - * @param string|array $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 string|array $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 - * @return null - */ - protected function _setParameter($type, $name, $value) - { - $parray = array(); - $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 string|false $user User name or false disable authentication - * @param string $password Password - * @param string $type Authentication type - * @return Zend_Http_Client - * @throws Zend_Http_Client_Exception - */ - 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))) { - /** @see Zend_Http_Client_Exception */ - throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '$type'"); - } - - $this->auth = array( - '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 Zend_Http_CookieJar|boolean $cookiejar Existing cookiejar object, true to create a new one, false to disable - * @return Zend_Http_Client - * @throws Zend_Http_Client_Exception - */ - public function setCookieJar($cookiejar = true) - { - Zend_Loader::loadClass('Zend_Http_CookieJar'); - - if ($cookiejar instanceof Zend_Http_CookieJar) { - $this->cookiejar = $cookiejar; - } elseif ($cookiejar === true) { - $this->cookiejar = new Zend_Http_CookieJar(); - } elseif (! $cookiejar) { - $this->cookiejar = null; - } else { - /** @see Zend_Http_Client_Exception */ - throw new Zend_Http_Client_Exception('Invalid parameter type passed as CookieJar'); - } - - return $this; - } - - /** - * Return the current cookie jar or null if none. - * - * @return Zend_Http_CookieJar|null - */ - 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 Zend_Http_Cookie|string $cookie - * @param string|null $value If "cookie" is a string, this is the cookie value. - * @return Zend_Http_Client - * @throws Zend_Http_Client_Exception - */ - public function setCookie($cookie, $value = null) - { - Zend_Loader::loadClass('Zend_Http_Cookie'); - - 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)) { - /** @see Zend_Http_Client_Exception */ - 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'] = array('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 - * @throws Zend_Http_Client_Exception - */ - public function setFileUpload($filename, $formname, $data = null, $ctype = null) - { - if ($data === null) { - if (($data = @file_get_contents($filename)) === false) { - /** @see Zend_Http_Client_Exception */ - 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[] = array( - '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 string|resource $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 boolean $status - * @return Zend_Http_Client - */ - public function setUnmaskStatus($status = true) - { - $this->_unmaskStatus = (BOOL)$status; - return $this; - } - - /** - * Returns the currently configured unmask status - * - * @return boolean - */ - 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 = array(); - $this->paramsPost = array(); - $this->files = array(); - $this->raw_post_data = null; - $this->enctype = null; - - if($clearAll) { - $this->headers = array(); - $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 Zend_Http_Client_Adapter_Interface|string $adapter - * @return null - * @throws Zend_Http_Client_Exception - */ - public function setAdapter($adapter) - { - if (is_string($adapter)) { - try { - Zend_Loader::loadClass($adapter); - } catch (Zend_Exception $e) { - /** @see Zend_Http_Client_Exception */ - 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) { - /** @see Zend_Http_Client_Exception */ - 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 string|boolean $streamfile Stream file, true for temp file, false/null for no streaming - * @return Zend_Http_Client - */ - public function setStream($streamfile = true) - { - $this->setConfig(array("output_stream" => $streamfile)); - return $this; - } - - /** - * Get status of streaming for received data - * @return boolean|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(isset($this->config['stream_tmp_dir'])?$this->config['stream_tmp_dir']:sys_get_temp_dir(), - 'Zend_Http_Client'); - } - - 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 - * @throws Zend_Http_Client_Exception - */ - public function request($method = null) - { - if (! $this->uri instanceof Zend_Uri_Http) { - /** @see Zend_Http_Client_Exception */ - 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, null, '&'); - 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)) { - /** @see Zend_Http_Client_Exception */ - 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 { - /** @see Zend_Http_Client_Exception */ - 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) { - /** @see Zend_Http_Client_Exception */ - 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) { - list($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 = array(); - - // 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) { - list($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 - * @throws Zend_Http_Client_Exception - */ - 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 = array(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); - } - - /** @see Zend_Http_Client_Exception */ - 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 = array(); - - 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[] = array($name, $subval); - } - } else { - if ($urlencode) { - $value = urlencode($value); - } - $parameters[] = array($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 = array()) - { - $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 - * @throws Zend_Http_Client_Exception - */ - 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) { - /** @see Zend_Http_Client_Exception */ - 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: - /** @see Zend_Http_Client_Exception */ - 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 = array(); - - 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[] = array($key, $value); - } - } - - return $parameters; - } - - /** - * Ensure a header value is valid per RFC 7230. - * - * @see http://tools.ietf.org/html/rfc7230#section-3.2 - * @param string|object|array $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/vendor/Zend/Http/Client/Adapter/Curl.php b/library/vendor/Zend/Http/Client/Adapter/Curl.php deleted file mode 100644 index 1cf59e8da..000000000 --- a/library/vendor/Zend/Http/Client/Adapter/Curl.php +++ /dev/null @@ -1,526 +0,0 @@ -_invalidOverwritableCurlOptions = array( - 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 - * - * @throws Zend_Http_Client_Adapter_Exception - * @param Zend_Config | array $config - * @return Zend_Http_Client_Adapter_Curl - */ - public function setConfig($config = array()) - { - 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']) && isset($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 string|int $option - * @param mixed $value - * @return Zend_Http_Adapter_Curl - */ - public function setCurlOption($option, $value) - { - if (!isset($this->_config['curloptions'])) { - $this->_config['curloptions'] = array(); - } - $this->_config['curloptions'][$option] = $value; - return $this; - } - - /** - * Initialize curl - * - * @param string $host - * @param int $port - * @param boolean $secure - * @return void - * @throws Zend_Http_Client_Adapter_Exception if unable to connect - */ - 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 = array($host, $port); - } - - /** - * Send request to the remote server - * - * @param string $method - * @param Zend_Uri_Http $uri - * @param float $http_ver - * @param array $headers - * @param string $body - * @return string $request - * @throws Zend_Http_Client_Adapter_Exception If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option - */ - public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $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, array($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]); - unset($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 = array(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/vendor/Zend/Http/Client/Adapter/Exception.php b/library/vendor/Zend/Http/Client/Adapter/Exception.php deleted file mode 100644 index 3a10a0f31..000000000 --- a/library/vendor/Zend/Http/Client/Adapter/Exception.php +++ /dev/null @@ -1,37 +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 boolean - */ - 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 boolean $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 - * @throws Zend_Http_Client_Adapter_Exception - */ - public function write( - $method, $uri, $http_ver = '1.1', $headers = array(), $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 integer $port - * @param string $http_ver - * @param array $headers - * @return void - * @throws Zend_Http_Client_Adapter_Exception - */ - protected function connectHandshake( - $host, $port = 443, $http_ver = '1.1', array &$headers = array() - ) - { - $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 = array( - 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/vendor/Zend/Http/Client/Adapter/Socket.php b/library/vendor/Zend/Http/Client/Adapter/Socket.php deleted file mode 100644 index 5122fc8aa..000000000 --- a/library/vendor/Zend/Http/Client/Adapter/Socket.php +++ /dev/null @@ -1,527 +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 = null; - - /** - * Stream context - * - * @var resource - */ - protected $_context = null; - - /** - * Adapter constructor, currently empty. Config is set using setConfig() - * - */ - public function __construct() - { - } - - /** - * Set the configuration array for the adapter - * - * @param Zend_Config | array $config - */ - public function setConfig($config = array()) - { - 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 boolean $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 = array($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 = array(), $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; - } else { - $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 = array(null, null); - } - - /** - * Check if the socket has timed out - if so close connection and throw - * an exception - * - * @throws Zend_Http_Client_Adapter_Exception with READ_TIMEOUT code - */ - 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/vendor/Zend/Http/Client/Adapter/Stream.php b/library/vendor/Zend/Http/Client/Adapter/Stream.php deleted file mode 100644 index f0eb17823..000000000 --- a/library/vendor/Zend/Http/Client/Adapter/Stream.php +++ /dev/null @@ -1,46 +0,0 @@ -_nextRequestWillFail = (bool) $flag; - - return $this; - } - - /** - * Set the configuration array for the adapter - * - * @param Zend_Config | array $config - */ - public function setConfig($config = array()) - { - 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 boolean $secure - * @param int $timeout - * @throws Zend_Http_Client_Adapter_Exception - */ - 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 = array(), $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 Zend_Http_Response|array|string $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 integer $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/vendor/Zend/Http/Client/Exception.php b/library/vendor/Zend/Http/Client/Exception.php deleted file mode 100644 index 893f32cb6..000000000 --- a/library/vendor/Zend/Http/Client/Exception.php +++ /dev/null @@ -1,35 +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 ? $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 int|null - */ - public function getExpiryTime() - { - return $this->expires; - } - - /** - * Check whether the cookie should only be sent over secure connections - * - * @return boolean - */ - 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 boolean - */ - public function isExpired($now = null) - { - if ($now === null) $now = time(); - if (is_int($this->expires) && $this->expires < $now) { - return true; - } else { - return false; - } - } - - /** - * Check whether the cookie is a session cookie (has no expiry time set) - * - * @return boolean - */ - 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 boolean $matchSessionCookies Whether to send session cookies - * @param int $now Override the current time when checking for expiry time - * @return boolean - */ - 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 Zend_Uri_Http|string $refUri Reference URI for default values (domain, path) - * @param boolean $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 - list($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) { - list($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; - } else { - 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 boolean - */ - 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 boolean - */ - 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/vendor/Zend/Http/CookieJar.php b/library/vendor/Zend/Http/CookieJar.php deleted file mode 100644 index 004ae9eba..000000000 --- a/library/vendor/Zend/Http/CookieJar.php +++ /dev/null @@ -1,420 +0,0 @@ -getDomain(); - $path = $cookie->getPath(); - if (! isset($this->cookies[$domain])) $this->cookies[$domain] = array(); - if (! isset($this->cookies[$domain][$path])) $this->cookies[$domain][$path] = array(); - $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 Zend_Uri_Http|string $ref_uri Requested URI - * @param boolean $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 boolean $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 = array(); - 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 Zend_Uri_Http|string $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 Zend_Http_Cookie|string - */ - 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 Zend_Http_Cookie|array $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) ? '' : array(); - 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; - } elseif ($ptr instanceof Zend_Http_Cookie) { - switch ($ret_as) { - case self::COOKIE_STRING_ARRAY: - return array($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 array($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 = array(); - - 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 array $dom_array - * @param string $path - * @return array - */ - protected function _matchPath($domains, $path) - { - $ret = array(); - - 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] = array(); - } - - $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 Zend_Uri_Http|string $uri The requested 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 - * - * @return int - */ - public function count() - { - return count($this->_rawCookies); - } - - /** - * Required by IteratorAggregate interface - * - * @return ArrayIterator - */ - public function getIterator() - { - 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 = array(); - return $this; - } -} diff --git a/library/vendor/Zend/Http/Exception.php b/library/vendor/Zend/Http/Exception.php deleted file mode 100644 index ece1891ac..000000000 --- a/library/vendor/Zend/Http/Exception.php +++ /dev/null @@ -1,35 +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 += 1) { - $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 - * @throws Exception\RuntimeException for invalid values - * @return void - */ - public static function assertValid($value) - { - if (! self::isValid($value)) { - throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid header value'); - } - } -} diff --git a/library/vendor/Zend/Http/Header/SetCookie.php b/library/vendor/Zend/Http/Header/SetCookie.php deleted file mode 100644 index 99102ba74..000000000 --- a/library/vendor/Zend/Http/Header/SetCookie.php +++ /dev/null @@ -1,551 +0,0 @@ -getName() === NULL) { - $header->setName($headerKey); - $header->setValue($headerValue); - continue; - } - - // Process the remanining elements - switch (str_replace(array('-', '_'), '', 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'; - } - - /** - * @throws Zend_Http_Header_Exception_RuntimeException - * @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 integer $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 integer - */ - public function getVersion() - { - return $this->version; - } - - /** - * Set Max-Age - * - * @param integer $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 integer - */ - 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; - } - - /** - * @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 boolean $secure - */ - public function setSecure($secure) - { - $this->secure = $secure; - return $this; - } - - /** - * @return boolean - */ - 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 boolean - */ - public function isExpired($now = null) - { - if ($now === null) { - $now = time(); - } - - if (is_int($this->expires) && $this->expires < $now) { - return true; - } else { - return false; - } - } - - /** - * Check whether the cookie is a session cookie (has no expiry time set) - * - * @return boolean - */ - 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/vendor/Zend/Http/Response.php b/library/vendor/Zend/Http/Response.php deleted file mode 100644 index a2b422067..000000000 --- a/library/vendor/Zend/Http/Response.php +++ /dev/null @@ -1,695 +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 = array(); - - /** - * 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 - * @throws Zend_Http_Exception - */ - 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 boolean - */ - public function isError() - { - $restype = floor($this->code / 100); - if ($restype == 4 || $restype == 5) { - return true; - } - - return false; - } - - /** - * Check whether the response in successful - * - * @return boolean - */ - 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 boolean - */ - 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 string|array|null - */ - 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 boolean $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 boolean $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; - } elseif (isset($messages[$code])) { - return $messages[$code]; - } else { - 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]; - } else { - 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]; - } else { - 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]; - } else { - return false; - } - } - - /** - * Extract the headers from a response string - * - * @param string $response_str - * @return array - */ - public static function extractHeaders($response_str) - { - $headers = array(); - - // 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] = array($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])) { - end($headers[$last_header]); - $last_header_key = key($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 - * - * @link 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]), array(0x01, 0x5e, 0x9c, 0xda))) { - return gzuncompress($body); - } else { - 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/vendor/Zend/Http/Response/Stream.php b/library/vendor/Zend/Http/Response/Stream.php deleted file mode 100644 index 0a154c4ee..000000000 --- a/library/vendor/Zend/Http/Response/Stream.php +++ /dev/null @@ -1,235 +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 boolean - */ - 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 - * @throws Zend_Http_Exception - */ - 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() - { - 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/vendor/Zend/Http/UserAgent.php b/library/vendor/Zend/Http/UserAgent.php deleted file mode 100644 index 84b4fc3aa..000000000 --- a/library/vendor/Zend/Http/UserAgent.php +++ /dev/null @@ -1,840 +0,0 @@ - self::DEFAULT_IDENTIFICATION_SEQUENCE, - 'storage' => array( - '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 = array(); - - /** - * Valid plugin loader types - * @var array - */ - protected $_loaderTypes = array('storage', 'device'); - - /** - * Trace of items matched to identify the browser type - * - * @var array - */ - protected $_matchLog = array(); - - /** - * Server variable - * - * @var array - */ - protected $_server; - - /** - * Persistent storage handler - * - * @var Zend_Http_UserAgent_Storage - */ - protected $_storage; - - /** - * Constructor - * - * @param null|array|Zend_Config|ArrayAccess $options - * @return void - */ - public function __construct($options = null) - { - if (null !== $options) { - $this->setOptions($options); - } - } - - /** - * Serialized representation of the object - * - * @return string - */ - public function serialize() - { - $device = $this->getDevice(); - $spec = array( - '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'), - ); - return serialize($spec); - } - - /** - * Unserialize a previous representation of the object - * - * @param string $serialized - * @return void - */ - public function unserialize($serialized) - { - $spec = unserialize($serialized); - - $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|Zend_Config|ArrayAccess $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_array($plConfig) || $plConfig instanceof Traversable) { - foreach ($plConfig as $type => $class) { - $this->setPluginLoader($type, $class); - } - } - unset($plConfig, $options['plugin_loader']); - } - - // And then loop through the remaining options - $config = array(); - 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')) { - 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( - array($deviceClass, 'match'), - $userAgent, - $this->getServer() - ); - } - - /** - * Loads class for a user agent device - * - * @param string $browserType Browser type - * @return string - * @throws Zend_Loader_PluginLoader_Exception if unable to load UA device - */ - protected function _getUserAgentDevice($browserType) - { - $browserType = strtolower($browserType); - if (isset($this->_browserTypeClass[$browserType])) { - return $this->_browserTypeClass[$browserType]; - } - - if (isset($this->_config[$browserType]) - && isset($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 = isset($deviceConfig['prefix']) ? $deviceConfig['prefix'] : 'Zend_Http_UserAgent'; - $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 = array('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 - * - * @param Zend_Http_UserAgent_Storage $storage - * @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) - * @return void - */ - 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 = array()) - { - 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 = array(); - 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 - * @return void - * @throws Zend_Http_UserAgent_Exception on invalid parameter - */ - 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 = array(); - 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 string|int|float $key - * @param mixed $value - * @return void - */ - 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) - { - $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 - * @throws Zend_Http_UserAgent_Exception on invalid type - */ - 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 - * - * @return void - */ - protected function _createDevice() - { - $browserType = $this->getBrowserType(); - $classname = $this->_getUserAgentDevice($browserType); - $this->_device = new $classname($this->getUserAgent(), $this->getServer(), $this->getConfig()); - } -} diff --git a/library/vendor/Zend/Http/UserAgent/AbstractDevice.php b/library/vendor/Zend/Http/UserAgent/AbstractDevice.php deleted file mode 100644 index 1b0a984bc..000000000 --- a/library/vendor/Zend/Http/UserAgent/AbstractDevice.php +++ /dev/null @@ -1,993 +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 = array( - '_aFeatures' => $this->_aFeatures, - '_aGroup' => $this->_aGroup, - '_browser' => $this->_browser, - '_browserVersion' => $this->_browserVersion, - '_userAgent' => $this->_userAgent, - '_images' => $this->_images, - ); - return serialize($spec); - } - - /** - * Unserialize - * - * @param string $serialized - * @return void - */ - public function unserialize($serialized) - { - $spec = unserialize($serialized); - $this->_restoreFromArray($spec); - } - - /** - * Restore object state from array - * - * @param array $spec - * @return void - */ - protected function _restoreFromArray(array $spec) - { - foreach ($spec as $key => $value) { - if (property_exists($this, $key)) { - $this->{$key} = $value; - } - } - } - - /** - * Look for features - * - * @return array|null - */ - 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 string|null - */ - 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] = array(); - } - 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 - * - * @return void - */ - protected function _getDefaultFeatures() - { - $server = array(); - - // gets info from user agent chain - $uaExtract = $this->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, $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) - { - $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 = array(); - 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 = array(); - 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 = count($match2[0]); - for ($i = 0; $i < $max; $i ++) { - if (!empty($match2[0][$i])) { - $result['others']['detail'][] = array( - $match2[0][$i], - $match2[2][$i], - $match2[4][$i], - ); - } - } - } - - /** Security level */ - $security = array( - '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']) && isset($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 = array( - '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 = array( - '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'][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 = array( - 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], array( - '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']) && isset($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']) && isset($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 - * - * @param string $browserType Browser type - * @return array - */ - protected function _loadFeaturesAdapter() - { - $config = $this->_config; - $browserType = $this->getType(); - if (!isset($config[$browserType]) || !isset($config[$browserType]['features'])) { - return array(); - } - $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(array($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, $signature) !== false) { - // Browser signature was found in user agent string - return true; - } - } - } - return false; - } -} diff --git a/library/vendor/Zend/Http/UserAgent/Bot.php b/library/vendor/Zend/Http/UserAgent/Bot.php deleted file mode 100644 index 30e06b23e..000000000 --- a/library/vendor/Zend/Http/UserAgent/Bot.php +++ /dev/null @@ -1,128 +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/vendor/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php b/library/vendor/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php deleted file mode 100644 index 5fa64f6cf..000000000 --- a/library/vendor/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php +++ /dev/null @@ -1,73 +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) - { - - foreach ($wurflObj->capabilities as $group) { - if (!is_array($group)) { - continue; - } - while (list ($key, $value) = each($group)) { - 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/vendor/Zend/Http/UserAgent/Features/Exception.php b/library/vendor/Zend/Http/UserAgent/Features/Exception.php deleted file mode 100644 index a5d55c2e9..000000000 --- a/library/vendor/Zend/Http/UserAgent/Features/Exception.php +++ /dev/null @@ -1,35 +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/vendor/Zend/Http/UserAgent/Mobile.php b/library/vendor/Zend/Http/UserAgent/Mobile.php deleted file mode 100644 index 8078f4dc4..000000000 --- a/library/vendor/Zend/Http/UserAgent/Mobile.php +++ /dev/null @@ -1,535 +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 = array(); - - 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 - * - * @access public - * @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" - 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 - 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'; - 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/vendor/Zend/Http/UserAgent/Offline.php b/library/vendor/Zend/Http/UserAgent/Offline.php deleted file mode 100644 index caba8a38e..000000000 --- a/library/vendor/Zend/Http/UserAgent/Offline.php +++ /dev/null @@ -1,69 +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/vendor/Zend/Http/UserAgent/Spam.php b/library/vendor/Zend/Http/UserAgent/Spam.php deleted file mode 100644 index 782436ffc..000000000 --- a/library/vendor/Zend/Http/UserAgent/Spam.php +++ /dev/null @@ -1,78 +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/vendor/Zend/Http/UserAgent/Storage.php b/library/vendor/Zend/Http/UserAgent/Storage.php deleted file mode 100644 index d28211a91..000000000 --- a/library/vendor/Zend/Http/UserAgent/Storage.php +++ /dev/null @@ -1,65 +0,0 @@ -_data); - } - - /** - * Returns the contents of storage - * - * Behavior is undefined when storage is empty. - * - * @throws Zend_Http_UserAgent_Storage_Exception If reading contents from storage is impossible - * @return mixed - */ - public function read() - { - return $this->_data; - } - - /** - * Writes $contents to storage - * - * @param mixed $contents - * @throws Zend_Http_UserAgent_Storage_Exception If writing $contents to storage is impossible - * @return void - */ - public function write($contents) - { - $this->_data = $contents; - } - - /** - * Clears contents from storage - * - * @throws Zend_Http_UserAgent_Storage_Exception If clearing contents from storage is impossible - * @return void - */ - public function clear() - { - $this->_data = null; - } -} diff --git a/library/vendor/Zend/Http/UserAgent/Storage/Session.php b/library/vendor/Zend/Http/UserAgent/Storage/Session.php deleted file mode 100644 index 5b449b7cd..000000000 --- a/library/vendor/Zend/Http/UserAgent/Storage/Session.php +++ /dev/null @@ -1,163 +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 = '.' - . (isset($options['browser_type']) - ? $options['browser_type'] - : self::NAMESPACE_DEFAULT); - $this->_member = isset($options['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 boolean - */ - 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 $contents - * @return void - */ - public function write($content) - { - $this->_session->{$this->_member} = $content; - } - - /** - * Defined by Zend_Http_UserAgent_Storage - * - * @return void - */ - public function clear() - { - unset($this->_session->{$this->_member}); - } -} diff --git a/library/vendor/Zend/Http/UserAgent/Text.php b/library/vendor/Zend/Http/UserAgent/Text.php deleted file mode 100644 index b89a0d1e0..000000000 --- a/library/vendor/Zend/Http/UserAgent/Text.php +++ /dev/null @@ -1,131 +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 - * - * @return null - */ - 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/vendor/Zend/Http/UserAgent/Validator.php b/library/vendor/Zend/Http/UserAgent/Validator.php deleted file mode 100644 index 76b84f912..000000000 --- a/library/vendor/Zend/Http/UserAgent/Validator.php +++ /dev/null @@ -1,72 +0,0 @@ - count($function)))) { - throw new Zend_Json_Server_Exception('Unable to attach function; invalid'); - } - - if (!is_callable($function)) { - throw new Zend_Json_Server_Exception('Unable to attach function; does not exist'); - } - - $argv = null; - if (2 < func_num_args()) { - $argv = func_get_args(); - $argv = array_slice($argv, 2); - } - - if (is_string($function)) { - $method = Zend_Server_Reflection::reflectFunction($function, $argv, $namespace); - } else { - $class = array_shift($function); - $action = array_shift($function); - $reflection = Zend_Server_Reflection::reflectClass($class, $argv, $namespace); - $methods = $reflection->getMethods(); - $found = false; - foreach ($methods as $method) { - if ($action == $method->getName()) { - $found = true; - break; - } - } - if (!$found) { - $this->fault('Method not found', -32601); - return $this; - } - } - - $definition = $this->_buildSignature($method); - $this->_addMethodServiceMap($definition); - - return $this; - } - - /** - * Register a class with the server - * - * @param string $class - * @param string $namespace Ignored - * @param mixed $argv Ignored - * @return Zend_Json_Server - */ - public function setClass($class, $namespace = '', $argv = null) - { - $argv = null; - if (3 < func_num_args()) { - $argv = func_get_args(); - $argv = array_slice($argv, 3); - } - - $reflection = Zend_Server_Reflection::reflectClass($class, $argv, $namespace); - - foreach ($reflection->getMethods() as $method) { - $definition = $this->_buildSignature($method, $class); - $this->_addMethodServiceMap($definition); - } - return $this; - } - - /** - * Indicate fault response - * - * @param string $fault - * @param int $code - * @return false - */ - public function fault($fault = null, $code = 404, $data = null) - { - $error = new Zend_Json_Server_Error($fault, $code, $data); - $this->getResponse()->setError($error); - return $error; - } - - /** - * Handle request - * - * @param Zend_Json_Server_Request $request - * @return null|Zend_Json_Server_Response - */ - public function handle($request = false) - { - if ((false !== $request) && (!$request instanceof Zend_Json_Server_Request)) { - throw new Zend_Json_Server_Exception('Invalid request type provided; cannot handle'); - } elseif ($request) { - $this->setRequest($request); - } - - // Handle request - $this->_handle(); - - // Get response - $response = $this->_getReadyResponse(); - - // Emit response? - if ($this->autoEmitResponse()) { - echo $response; - return; - } - - // or return it? - return $response; - } - - /** - * Load function definitions - * - * @param array|Zend_Server_Definition $definition - * @return void - */ - public function loadFunctions($definition) - { - if (!is_array($definition) && (!$definition instanceof Zend_Server_Definition)) { - throw new Zend_Json_Server_Exception('Invalid definition provided to loadFunctions()'); - } - - foreach ($definition as $key => $method) { - $this->_table->addMethod($method, $key); - $this->_addMethodServiceMap($method); - } - } - - public function setPersistence($mode) - { - } - - /** - * Set request object - * - * @param Zend_Json_Server_Request $request - * @return Zend_Json_Server - */ - public function setRequest(Zend_Json_Server_Request $request) - { - $this->_request = $request; - return $this; - } - - /** - * Get JSON-RPC request object - * - * @return Zend_Json_Server_Request - */ - public function getRequest() - { - if (null === ($request = $this->_request)) { - $this->setRequest(new Zend_Json_Server_Request_Http()); - } - return $this->_request; - } - - /** - * Set response object - * - * @param Zend_Json_Server_Response $response - * @return Zend_Json_Server - */ - public function setResponse(Zend_Json_Server_Response $response) - { - $this->_response = $response; - return $this; - } - - /** - * Get response object - * - * @return Zend_Json_Server_Response - */ - public function getResponse() - { - if (null === ($response = $this->_response)) { - $this->setResponse(new Zend_Json_Server_Response_Http()); - } - return $this->_response; - } - - /** - * Set flag indicating whether or not to auto-emit response - * - * @param bool $flag - * @return Zend_Json_Server - */ - public function setAutoEmitResponse($flag) - { - $this->_autoEmitResponse = (bool) $flag; - return $this; - } - - /** - * Will we auto-emit the response? - * - * @return bool - */ - public function autoEmitResponse() - { - return $this->_autoEmitResponse; - } - - // overloading for SMD metadata - /** - * Overload to accessors of SMD object - * - * @param string $method - * @param array $args - * @return mixed - */ - public function __call($method, $args) - { - if (preg_match('/^(set|get)/', $method, $matches)) { - if (in_array($method, $this->_getSmdMethods())) { - if ('set' == $matches[1]) { - $value = array_shift($args); - $this->getServiceMap()->$method($value); - return $this; - } else { - return $this->getServiceMap()->$method(); - } - } - } - return null; - } - - /** - * Retrieve SMD object - * - * @return Zend_Json_Server_Smd - */ - public function getServiceMap() - { - if (null === $this->_serviceMap) { - $this->_serviceMap = new Zend_Json_Server_Smd(); - } - return $this->_serviceMap; - } - - /** - * Add service method to service map - * - * @param Zend_Server_Reflection_Function $method - * @return void - */ - protected function _addMethodServiceMap(Zend_Server_Method_Definition $method) - { - $serviceInfo = array( - 'name' => $method->getName(), - 'return' => $this->_getReturnType($method), - ); - $params = $this->_getParams($method); - $serviceInfo['params'] = $params; - $serviceMap = $this->getServiceMap(); - if (false !== $serviceMap->getService($serviceInfo['name'])) { - $serviceMap->removeService($serviceInfo['name']); - } - $serviceMap->addService($serviceInfo); - } - - /** - * Translate PHP type to JSON type - * - * @param string $type - * @return string - */ - protected function _fixType($type) - { - return $type; - } - - /** - * Get default params from signature - * - * @param array $args - * @param array $params - * @return array - */ - protected function _getDefaultParams(array $args, array $params) - { - $defaultParams = array_slice($params, count($args)); - foreach ($defaultParams as $param) { - $value = null; - if (array_key_exists('default', $param)) { - $value = $param['default']; - } - array_push($args, $value); - } - return $args; - } - - /** - * Get method param type - * - * @param Zend_Server_Reflection_Function_Abstract $method - * @return string|array - */ - protected function _getParams(Zend_Server_Method_Definition $method) - { - $params = array(); - foreach ($method->getPrototypes() as $prototype) { - foreach ($prototype->getParameterObjects() as $key => $parameter) { - if (!isset($params[$key])) { - $params[$key] = array( - 'type' => $parameter->getType(), - 'name' => $parameter->getName(), - 'optional' => $parameter->isOptional(), - ); - if (null !== ($default = $parameter->getDefaultValue())) { - $params[$key]['default'] = $default; - } - $description = $parameter->getDescription(); - if (!empty($description)) { - $params[$key]['description'] = $description; - } - continue; - } - $newType = $parameter->getType(); - if (!is_array($params[$key]['type'])) { - if ($params[$key]['type'] == $newType) { - continue; - } - $params[$key]['type'] = (array) $params[$key]['type']; - } elseif (in_array($newType, $params[$key]['type'])) { - continue; - } - array_push($params[$key]['type'], $parameter->getType()); - } - } - return $params; - } - - /** - * Set response state - * - * @return Zend_Json_Server_Response - */ - protected function _getReadyResponse() - { - $request = $this->getRequest(); - $response = $this->getResponse(); - - $response->setServiceMap($this->getServiceMap()); - if (null !== ($id = $request->getId())) { - $response->setId($id); - } - if (null !== ($version = $request->getVersion())) { - $response->setVersion($version); - } - - return $response; - } - - /** - * Get method return type - * - * @param Zend_Server_Reflection_Function_Abstract $method - * @return string|array - */ - protected function _getReturnType(Zend_Server_Method_Definition $method) - { - $return = array(); - foreach ($method->getPrototypes() as $prototype) { - $return[] = $prototype->getReturnType(); - } - if (1 == count($return)) { - return $return[0]; - } - return $return; - } - - /** - * Retrieve list of allowed SMD methods for proxying - * - * @return array - */ - protected function _getSmdMethods() - { - if (null === $this->_smdMethods) { - $this->_smdMethods = array(); - $methods = get_class_methods('Zend_Json_Server_Smd'); - foreach ($methods as $key => $method) { - if (!preg_match('/^(set|get)/', $method)) { - continue; - } - if (strstr($method, 'Service')) { - continue; - } - $this->_smdMethods[] = $method; - } - } - return $this->_smdMethods; - } - - /** - * Internal method for handling request - * - * @return void - */ - protected function _handle() - { - $request = $this->getRequest(); - - if (!$request->isMethodError() && (null === $request->getMethod())) { - return $this->fault('Invalid Request', -32600); - } - - if ($request->isMethodError()) { - return $this->fault('Invalid Request', -32600); - } - - $method = $request->getMethod(); - if (!$this->_table->hasMethod($method)) { - return $this->fault('Method not found', -32601); - } - - $params = $request->getParams(); - $invocable = $this->_table->getMethod($method); - $serviceMap = $this->getServiceMap(); - $service = $serviceMap->getService($method); - $serviceParams = $service->getParams(); - - if (count($params) < count($serviceParams)) { - $params = $this->_getDefaultParams($params, $serviceParams); - } - - //Make sure named parameters are passed in correct order - if ( is_string( key( $params ) ) ) { - - $callback = $invocable->getCallback(); - if ('function' == $callback->getType()) { - $reflection = new ReflectionFunction( $callback->getFunction() ); - $refParams = $reflection->getParameters(); - } else { - - $reflection = new ReflectionMethod( - $callback->getClass(), - $callback->getMethod() - ); - $refParams = $reflection->getParameters(); - } - - $orderedParams = array(); - foreach( $reflection->getParameters() as $refParam ) { - if( isset( $params[ $refParam->getName() ] ) ) { - $orderedParams[ $refParam->getName() ] = $params[ $refParam->getName() ]; - } elseif( $refParam->isOptional() ) { - $orderedParams[ $refParam->getName() ] = $refParam->getDefaultValue(); - } else { - throw new Zend_Server_Exception( - 'Method ' . $request->getMethod() . ' is missing required parameter: ' . $refParam->getName() - ); - } - } - $params = $orderedParams; - } - - try { - $result = $this->_dispatch($invocable, $params); - } catch (Exception $e) { - return $this->fault($e->getMessage(), $e->getCode(), $e); - } - - $this->getResponse()->setResult($result); - } -} diff --git a/library/vendor/Zend/Json/Server/Cache.php b/library/vendor/Zend/Json/Server/Cache.php deleted file mode 100644 index d1dae32ed..000000000 --- a/library/vendor/Zend/Json/Server/Cache.php +++ /dev/null @@ -1,101 +0,0 @@ -getServiceMap()->toJson())) { - return false; - } - - return true; - } - - /** - * Retrieve a cached SMD - * - * On success, returns the cached SMD (a JSON string); an failure, returns - * boolean false. - * - * @param string $filename - * @return string|false - */ - public static function getSmd($filename) - { - if (!is_string($filename) - || !file_exists($filename) - || !is_readable($filename)) - { - return false; - } - - - if (false === ($smd = @file_get_contents($filename))) { - return false; - } - - return $smd; - } - - /** - * Delete a file containing a cached SMD - * - * @param string $filename - * @return bool - */ - public static function deleteSmd($filename) - { - if (is_string($filename) && file_exists($filename)) { - unlink($filename); - return true; - } - - return false; - } -} diff --git a/library/vendor/Zend/Json/Server/Error.php b/library/vendor/Zend/Json/Server/Error.php deleted file mode 100644 index a793944df..000000000 --- a/library/vendor/Zend/Json/Server/Error.php +++ /dev/null @@ -1,197 +0,0 @@ -setMessage($message) - ->setCode($code) - ->setData($data); - } - - /** - * Set error code - * - * @param int $code - * @return Zend_Json_Server_Error - */ - public function setCode($code) - { - if (!is_scalar($code)) { - return $this; - } - - $code = (int) $code; - if (in_array($code, $this->_allowedCodes)) { - $this->_code = $code; - } elseif (in_array($code, range(-32099, -32000))) { - $this->_code = $code; - } - - return $this; - } - - /** - * Get error code - * - * @return int|null - */ - public function getCode() - { - return $this->_code; - } - - /** - * Set error message - * - * @param string $message - * @return Zend_Json_Server_Error - */ - public function setMessage($message) - { - if (!is_scalar($message)) { - return $this; - } - - $this->_message = (string) $message; - return $this; - } - - /** - * Get error message - * - * @return string - */ - public function getMessage() - { - return $this->_message; - } - - /** - * Set error data - * - * @param mixed $data - * @return Zend_Json_Server_Error - */ - public function setData($data) - { - $this->_data = $data; - return $this; - } - - /** - * Get error data - * - * @return mixed - */ - public function getData() - { - return $this->_data; - } - - /** - * Cast error to array - * - * @return array - */ - public function toArray() - { - return array( - 'code' => $this->getCode(), - 'message' => $this->getMessage(), - 'data' => $this->getData(), - ); - } - - /** - * Cast error to JSON - * - * @return string - */ - public function toJson() - { - return Zend_Json::encode($this->toArray()); - } - - /** - * Cast to string (JSON) - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } -} - diff --git a/library/vendor/Zend/Json/Server/Exception.php b/library/vendor/Zend/Json/Server/Exception.php deleted file mode 100644 index fce74b4c0..000000000 --- a/library/vendor/Zend/Json/Server/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ - $value) { - $method = 'set' . ucfirst($key); - if (in_array($method, $methods)) { - $this->$method($value); - } elseif ($key == 'jsonrpc') { - $this->setVersion($value); - } - } - return $this; - } - - /** - * Add a parameter to the request - * - * @param mixed $value - * @param string $key - * @return Zend_Json_Server_Request - */ - public function addParam($value, $key = null) - { - if ((null === $key) || !is_string($key)) { - $index = count($this->_params); - $this->_params[$index] = $value; - } else { - $this->_params[$key] = $value; - } - - return $this; - } - - /** - * Add many params - * - * @param array $params - * @return Zend_Json_Server_Request - */ - public function addParams(array $params) - { - foreach ($params as $key => $value) { - $this->addParam($value, $key); - } - return $this; - } - - /** - * Overwrite params - * - * @param array $params - * @return Zend_Json_Server_Request - */ - public function setParams(array $params) - { - $this->_params = array(); - return $this->addParams($params); - } - - /** - * Retrieve param by index or key - * - * @param int|string $index - * @return mixed|null Null when not found - */ - public function getParam($index) - { - if (array_key_exists($index, $this->_params)) { - return $this->_params[$index]; - } - - return null; - } - - /** - * Retrieve parameters - * - * @return array - */ - public function getParams() - { - return $this->_params; - } - - /** - * Set request method - * - * @param string $name - * @return Zend_Json_Server_Request - */ - public function setMethod($name) - { - if (!preg_match($this->_methodRegex, $name)) { - $this->_isMethodError = true; - } else { - $this->_method = $name; - } - return $this; - } - - /** - * Get request method name - * - * @return string - */ - public function getMethod() - { - return $this->_method; - } - - /** - * Was a bad method provided? - * - * @return bool - */ - public function isMethodError() - { - return $this->_isMethodError; - } - - /** - * Set request identifier - * - * @param mixed $name - * @return Zend_Json_Server_Request - */ - public function setId($name) - { - $this->_id = (string) $name; - return $this; - } - - /** - * Retrieve request identifier - * - * @return mixed - */ - public function getId() - { - return $this->_id; - } - - /** - * Set JSON-RPC version - * - * @param string $version - * @return Zend_Json_Server_Request - */ - public function setVersion($version) - { - if ('2.0' == $version) { - $this->_version = '2.0'; - } else { - $this->_version = '1.0'; - } - return $this; - } - - /** - * Retrieve JSON-RPC version - * - * @return string - */ - public function getVersion() - { - return $this->_version; - } - - /** - * Set request state based on JSON - * - * @param string $json - * @return void - */ - public function loadJson($json) - { - $options = Zend_Json::decode($json); - $this->setOptions($options); - } - - /** - * Cast request to JSON - * - * @return string - */ - public function toJson() - { - $jsonArray = array( - 'method' => $this->getMethod() - ); - if (null !== ($id = $this->getId())) { - $jsonArray['id'] = $id; - } - $params = $this->getParams(); - if (!empty($params)) { - $jsonArray['params'] = $params; - } - if ('2.0' == $this->getVersion()) { - $jsonArray['jsonrpc'] = '2.0'; - } - - return Zend_Json::encode($jsonArray); - } - - /** - * Cast request to string (JSON) - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } -} diff --git a/library/vendor/Zend/Json/Server/Request/Http.php b/library/vendor/Zend/Json/Server/Request/Http.php deleted file mode 100644 index a5126cfa4..000000000 --- a/library/vendor/Zend/Json/Server/Request/Http.php +++ /dev/null @@ -1,65 +0,0 @@ -_rawJson = $json; - if (!empty($json)) { - $this->loadJson($json); - } - } - - /** - * Get JSON from raw POST body - * - * @return string - */ - public function getRawJson() - { - return $this->_rawJson; - } -} diff --git a/library/vendor/Zend/Json/Server/Response.php b/library/vendor/Zend/Json/Server/Response.php deleted file mode 100644 index 0f5302ad8..000000000 --- a/library/vendor/Zend/Json/Server/Response.php +++ /dev/null @@ -1,248 +0,0 @@ -_result = $value; - return $this; - } - - /** - * Get result - * - * @return mixed - */ - public function getResult() - { - return $this->_result; - } - - // RPC error, if response results in fault - /** - * Set result error - * - * @param Zend_Json_Server_Error $error - * @return Zend_Json_Server_Response - */ - public function setError(Zend_Json_Server_Error $error) - { - $this->_error = $error; - return $this; - } - - /** - * Get response error - * - * @return null|Zend_Json_Server_Error - */ - public function getError() - { - return $this->_error; - } - - /** - * Is the response an error? - * - * @return bool - */ - public function isError() - { - return $this->getError() instanceof Zend_Json_Server_Error; - } - - /** - * Set request ID - * - * @param mixed $name - * @return Zend_Json_Server_Response - */ - public function setId($name) - { - $this->_id = $name; - return $this; - } - - /** - * Get request ID - * - * @return mixed - */ - public function getId() - { - return $this->_id; - } - - /** - * Set JSON-RPC version - * - * @param string $version - * @return Zend_Json_Server_Response - */ - public function setVersion($version) - { - $version = is_array($version) - ? implode(' ', $version) - : $version; - if ((string)$version == '2.0') { - $this->_version = '2.0'; - } else { - $this->_version = null; - } - return $this; - } - - /** - * Retrieve JSON-RPC version - * - * @return string - */ - public function getVersion() - { - return $this->_version; - } - - /** - * Cast to JSON - * - * @return string - */ - public function toJson() - { - if ($this->isError()) { - $response = array( - 'error' => $this->getError()->toArray(), - 'id' => $this->getId(), - ); - } else { - $response = array( - 'result' => $this->getResult(), - 'id' => $this->getId(), - ); - } - - if (null !== ($version = $this->getVersion())) { - $response['jsonrpc'] = $version; - } - - return Zend_Json::encode($response); - } - - /** - * Retrieve args - * - * @return mixed - */ - public function getArgs() - { - return $this->_args; - } - - /** - * Set args - * - * @param mixed $args - * @return self - */ - public function setArgs($args) - { - $this->_args = $args; - return $this; - } - - /** - * Set service map object - * - * @param Zend_Json_Server_Smd $serviceMap - * @return Zend_Json_Server_Response - */ - public function setServiceMap($serviceMap) - { - $this->_serviceMap = $serviceMap; - return $this; - } - - /** - * Retrieve service map - * - * @return Zend_Json_Server_Smd|null - */ - public function getServiceMap() - { - return $this->_serviceMap; - } - - /** - * Cast to string (JSON) - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } -} - diff --git a/library/vendor/Zend/Json/Server/Response/Http.php b/library/vendor/Zend/Json/Server/Response/Http.php deleted file mode 100644 index 8db969609..000000000 --- a/library/vendor/Zend/Json/Server/Response/Http.php +++ /dev/null @@ -1,80 +0,0 @@ -sendHeaders(); - if (!$this->isError() && null === $this->getId()) { - return ''; - } - - return parent::toJson(); - } - - /** - * Send headers - * - * If headers are already sent, do nothing. If null ID, send HTTP 204 - * header. Otherwise, send content type header based on content type of - * service map. - * - * @return void - */ - public function sendHeaders() - { - if (headers_sent()) { - return; - } - - if (!$this->isError() && (null === $this->getId())) { - header('HTTP/1.1 204 No Content'); - return; - } - - if (null === ($smd = $this->getServiceMap())) { - return; - } - - $contentType = $smd->getContentType(); - if (!empty($contentType)) { - header('Content-Type: ' . $contentType); - } - } -} diff --git a/library/vendor/Zend/Json/Server/Smd.php b/library/vendor/Zend/Json/Server/Smd.php deleted file mode 100644 index 534d4c769..000000000 --- a/library/vendor/Zend/Json/Server/Smd.php +++ /dev/null @@ -1,473 +0,0 @@ - $value) { - $method = 'set' . ucfirst($key); - if (in_array($method, $methods)) { - $this->$method($value); - } - } - return $this; - } - - /** - * Set transport - * - * @param string $transport - * @return Zend_Json_Server_Smd - */ - public function setTransport($transport) - { - if (!in_array($transport, $this->_transportTypes)) { - throw new Zend_Json_Server_Exception(sprintf('Invalid transport "%s" specified', $transport)); - } - $this->_transport = $transport; - return $this; - } - - /** - * Get transport - * - * @return string - */ - public function getTransport() - { - return $this->_transport; - } - - /** - * Set envelope - * - * @param string $envelopeType - * @return Zend_Json_Server_Smd - */ - public function setEnvelope($envelopeType) - { - if (!in_array($envelopeType, $this->_envelopeTypes)) { - throw new Zend_Json_Server_Exception(sprintf('Invalid envelope type "%s"', $envelopeType)); - } - $this->_envelope = $envelopeType; - return $this; - } - - /** - * Retrieve envelope - * - * @return string - */ - public function getEnvelope() - { - return $this->_envelope; - } - - // Content-Type of response; default to application/json - /** - * Set content type - * - * @param string $type - * @return Zend_Json_Server_Smd - */ - public function setContentType($type) - { - if (!preg_match($this->_contentTypeRegex, $type)) { - throw new Zend_Json_Server_Exception(sprintf('Invalid content type "%s" specified', $type)); - } - $this->_contentType = $type; - return $this; - } - - /** - * Retrieve content type - * - * @return string - */ - public function getContentType() - { - return $this->_contentType; - } - - /** - * Set service target - * - * @param string $target - * @return Zend_Json_Server_Smd - */ - public function setTarget($target) - { - $this->_target = (string) $target; - return $this; - } - - /** - * Retrieve service target - * - * @return string - */ - public function getTarget() - { - return $this->_target; - } - - /** - * Set service ID - * - * @param string $Id - * @return Zend_Json_Server_Smd - */ - public function setId($id) - { - $this->_id = (string) $id; - return $this->_id; - } - - /** - * Get service id - * - * @return string - */ - public function getId() - { - return $this->_id; - } - - /** - * Set service description - * - * @param string $description - * @return Zend_Json_Server_Smd - */ - public function setDescription($description) - { - $this->_description = (string) $description; - return $this->_description; - } - - /** - * Get service description - * - * @return string - */ - public function getDescription() - { - return $this->_description; - } - - /** - * Indicate whether or not to generate Dojo-compatible SMD - * - * @param bool $flag - * @return Zend_Json_Server_Smd - */ - public function setDojoCompatible($flag) - { - $this->_dojoCompatible = (bool) $flag; - return $this; - } - - /** - * Is this a Dojo compatible SMD? - * - * @return bool - */ - public function isDojoCompatible() - { - return $this->_dojoCompatible; - } - - /** - * Add Service - * - * @param Zend_Json_Server_Smd_Service|array $service - * @return void - */ - public function addService($service) - { - - if ($service instanceof Zend_Json_Server_Smd_Service) { - $name = $service->getName(); - } elseif (is_array($service)) { - $service = new Zend_Json_Server_Smd_Service($service); - $name = $service->getName(); - } else { - throw new Zend_Json_Server_Exception('Invalid service passed to addService()'); - } - - if (array_key_exists($name, $this->_services)) { - throw new Zend_Json_Server_Exception('Attempt to register a service already registered detected'); - } - $this->_services[$name] = $service; - return $this; - } - - /** - * Add many services - * - * @param array $services - * @return Zend_Json_Server_Smd - */ - public function addServices(array $services) - { - foreach ($services as $service) { - $this->addService($service); - } - return $this; - } - - /** - * Overwrite existing services with new ones - * - * @param array $services - * @return Zend_Json_Server_Smd - */ - public function setServices(array $services) - { - $this->_services = array(); - return $this->addServices($services); - } - - /** - * Get service object - * - * @param string $name - * @return false|Zend_Json_Server_Smd_Service - */ - public function getService($name) - { - if (array_key_exists($name, $this->_services)) { - return $this->_services[$name]; - } - return false; - } - - /** - * Return services - * - * @return array - */ - public function getServices() - { - return $this->_services; - } - - /** - * Remove service - * - * @param string $name - * @return boolean - */ - public function removeService($name) - { - if (array_key_exists($name, $this->_services)) { - unset($this->_services[$name]); - return true; - } - return false; - } - - /** - * Cast to array - * - * @return array - */ - public function toArray() - { - if ($this->isDojoCompatible()) { - return $this->toDojoArray(); - } - - $transport = $this->getTransport(); - $envelope = $this->getEnvelope(); - $contentType = $this->getContentType(); - $SMDVersion = self::SMD_VERSION; - $service = compact('transport', 'envelope', 'contentType', 'SMDVersion'); - - if (null !== ($target = $this->getTarget())) { - $service['target'] = $target; - } - if (null !== ($id = $this->getId())) { - $service['id'] = $id; - } - - $services = $this->getServices(); - if (!empty($services)) { - $service['services'] = array(); - foreach ($services as $name => $svc) { - $svc->setEnvelope($envelope); - $service['services'][$name] = $svc->toArray(); - } - $service['methods'] = $service['services']; - } - - return $service; - } - - /** - * Export to DOJO-compatible SMD array - * - * @return array - */ - public function toDojoArray() - { - $SMDVersion = '.1'; - $serviceType = 'JSON-RPC'; - $service = compact('SMDVersion', 'serviceType'); - - $target = $this->getTarget(); - - $services = $this->getServices(); - if (!empty($services)) { - $service['methods'] = array(); - foreach ($services as $name => $svc) { - $method = array( - 'name' => $name, - 'serviceURL' => $target, - ); - $params = array(); - foreach ($svc->getParams() as $param) { - $paramName = array_key_exists('name', $param) ? $param['name'] : $param['type']; - $params[] = array( - 'name' => $paramName, - 'type' => $param['type'], - ); - } - if (!empty($params)) { - $method['parameters'] = $params; - } - $service['methods'][] = $method; - } - } - - return $service; - } - - /** - * Cast to JSON - * - * @return string - */ - public function toJson() - { - return Zend_Json::encode($this->toArray()); - } - - /** - * Cast to string (JSON) - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } -} - diff --git a/library/vendor/Zend/Json/Server/Smd/Service.php b/library/vendor/Zend/Json/Server/Smd/Service.php deleted file mode 100644 index 6d01412a7..000000000 --- a/library/vendor/Zend/Json/Server/Smd/Service.php +++ /dev/null @@ -1,463 +0,0 @@ - 'is_string', - 'optional' => 'is_bool', - 'default' => null, - 'description' => 'is_string', - ); - - /** - * Service params - * @var array - */ - protected $_params = array(); - - /** - * Mapping of parameter types to JSON-RPC types - * @var array - */ - protected $_paramMap = array( - 'any' => 'any', - 'arr' => 'array', - 'array' => 'array', - 'assoc' => 'object', - 'bool' => 'boolean', - 'boolean' => 'boolean', - 'dbl' => 'float', - 'double' => 'float', - 'false' => 'boolean', - 'float' => 'float', - 'hash' => 'object', - 'integer' => 'integer', - 'int' => 'integer', - 'mixed' => 'any', - 'nil' => 'null', - 'null' => 'null', - 'object' => 'object', - 'string' => 'string', - 'str' => 'string', - 'struct' => 'object', - 'true' => 'boolean', - 'void' => 'null', - ); - - /** - * Allowed transport types - * @var array - */ - protected $_transportTypes = array( - 'POST', - ); - - /** - * Constructor - * - * @param string|array $spec - * @return void - * @throws Zend_Json_Server_Exception if no name provided - */ - public function __construct($spec) - { - if (is_string($spec)) { - $this->setName($spec); - } elseif (is_array($spec)) { - $this->setOptions($spec); - } - - if (null == $this->getName()) { - throw new Zend_Json_Server_Exception('SMD service description requires a name; none provided'); - } - } - - /** - * Set object state - * - * @param array $options - * @return Zend_Json_Server_Smd_Service - */ - public function setOptions(array $options) - { - $methods = get_class_methods($this); - foreach ($options as $key => $value) { - if ('options' == strtolower($key)) { - continue; - } - $method = 'set' . ucfirst($key); - if (in_array($method, $methods)) { - $this->$method($value); - } - } - return $this; - } - - /** - * Set service name - * - * @param string $name - * @return Zend_Json_Server_Smd_Service - * @throws Zend_Json_Server_Exception - */ - public function setName($name) - { - $name = (string) $name; - if (!preg_match($this->_nameRegex, $name)) { - throw new Zend_Json_Server_Exception(sprintf('Invalid name "%s" provided for service; must follow PHP method naming conventions', $name)); - } - $this->_name = $name; - return $this; - } - - /** - * Retrieve name - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * Set Transport - * - * Currently limited to POST - * - * @param string $transport - * @return Zend_Json_Server_Smd_Service - */ - public function setTransport($transport) - { - if (!in_array($transport, $this->_transportTypes)) { - throw new Zend_Json_Server_Exception(sprintf('Invalid transport "%s"; please select one of (%s)', $transport, implode(', ', $this->_transportTypes))); - } - - $this->_transport = $transport; - return $this; - } - - /** - * Get transport - * - * @return string - */ - public function getTransport() - { - return $this->_transport; - } - - /** - * Set service target - * - * @param string $target - * @return Zend_Json_Server_Smd_Service - */ - public function setTarget($target) - { - $this->_target = (string) $target; - return $this; - } - - /** - * Get service target - * - * @return string - */ - public function getTarget() - { - return $this->_target; - } - - /** - * Set envelope type - * - * @param string $envelopeType - * @return Zend_Json_Server_Smd_Service - */ - public function setEnvelope($envelopeType) - { - if (!in_array($envelopeType, $this->_envelopeTypes)) { - throw new Zend_Json_Server_Exception(sprintf('Invalid envelope type "%s"; please specify one of (%s)', $envelopeType, implode(', ', $this->_envelopeTypes))); - } - - $this->_envelope = $envelopeType; - return $this; - } - - /** - * Get envelope type - * - * @return string - */ - public function getEnvelope() - { - return $this->_envelope; - } - - /** - * Add a parameter to the service - * - * @param string|array $type - * @param array $options - * @param int|null $order - * @return Zend_Json_Server_Smd_Service - */ - public function addParam($type, array $options = array(), $order = null) - { - if (is_string($type)) { - $type = $this->_validateParamType($type); - } elseif (is_array($type)) { - foreach ($type as $key => $paramType) { - $type[$key] = $this->_validateParamType($paramType); - } - } else { - throw new Zend_Json_Server_Exception('Invalid param type provided'); - } - - $paramOptions = array( - 'type' => $type, - ); - foreach ($options as $key => $value) { - if (in_array($key, array_keys($this->_paramOptionTypes))) { - if (null !== ($callback = $this->_paramOptionTypes[$key])) { - if (!$callback($value)) { - continue; - } - } - $paramOptions[$key] = $value; - } - } - - $this->_params[] = array( - 'param' => $paramOptions, - 'order' => $order, - ); - - return $this; - } - - /** - * Add params - * - * Each param should be an array, and should include the key 'type'. - * - * @param array $params - * @return Zend_Json_Server_Smd_Service - */ - public function addParams(array $params) - { - ksort($params); - foreach ($params as $options) { - if (!is_array($options)) { - continue; - } - if (!array_key_exists('type', $options)) { - continue; - } - $type = $options['type']; - $order = (array_key_exists('order', $options)) ? $options['order'] : null; - $this->addParam($type, $options, $order); - } - return $this; - } - - /** - * Overwrite all parameters - * - * @param array $params - * @return Zend_Json_Server_Smd_Service - */ - public function setParams(array $params) - { - $this->_params = array(); - return $this->addParams($params); - } - - /** - * Get all parameters - * - * Returns all params in specified order. - * - * @return array - */ - public function getParams() - { - $params = array(); - $index = 0; - foreach ($this->_params as $param) { - if (null === $param['order']) { - if (array_search($index, array_keys($params), true)) { - ++$index; - } - $params[$index] = $param['param']; - ++$index; - } else { - $params[$param['order']] = $param['param']; - } - } - ksort($params); - return $params; - } - - /** - * Set return type - * - * @param string|array $type - * @return Zend_Json_Server_Smd_Service - */ - public function setReturn($type) - { - if (is_string($type)) { - $type = $this->_validateParamType($type, true); - } elseif (is_array($type)) { - foreach ($type as $key => $returnType) { - $type[$key] = $this->_validateParamType($returnType, true); - } - } else { - throw new Zend_Json_Server_Exception('Invalid param type provided ("' . gettype($type) .'")'); - } - $this->_return = $type; - return $this; - } - - /** - * Get return type - * - * @return string|array - */ - public function getReturn() - { - return $this->_return; - } - - /** - * Cast service description to array - * - * @return array - */ - public function toArray() - { - $name = $this->getName(); - $envelope = $this->getEnvelope(); - $target = $this->getTarget(); - $transport = $this->getTransport(); - $parameters = $this->getParams(); - $returns = $this->getReturn(); - - if (empty($target)) { - return compact('envelope', 'transport', 'parameters', 'returns'); - } - - return $paramInfo = compact('envelope', 'target', 'transport', 'parameters', 'returns'); - } - - /** - * Return JSON encoding of service - * - * @return string - */ - public function toJson() - { - $service = array($this->getName() => $this->toArray()); - - return Zend_Json::encode($service); - } - - /** - * Cast to string - * - * @return string - */ - public function __toString() - { - return $this->toJson(); - } - - /** - * Validate parameter type - * - * @param string $type - * @return true - * @throws Zend_Json_Server_Exception - */ - protected function _validateParamType($type, $isReturn = false) - { - if (!is_string($type)) { - throw new Zend_Json_Server_Exception('Invalid param type provided ("' . $type .'")'); - } - - if (!array_key_exists($type, $this->_paramMap)) { - $type = 'object'; - } - - $paramType = $this->_paramMap[$type]; - if (!$isReturn && ('null' == $paramType)) { - throw new Zend_Json_Server_Exception('Invalid param type provided ("' . $type . '")'); - } - - return $paramType; - } -} diff --git a/library/vendor/Zend/LICENSE.txt b/library/vendor/Zend/LICENSE.txt new file mode 100644 index 000000000..6eab5aa14 --- /dev/null +++ b/library/vendor/Zend/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2005-2015, Zend Technologies USA, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Zend Technologies USA, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/library/vendor/Zend/Ldap.php b/library/vendor/Zend/Ldap.php deleted file mode 100644 index 68cf2c47c..000000000 --- a/library/vendor/Zend/Ldap.php +++ /dev/null @@ -1,1560 +0,0 @@ -setOptions($options); - } - - /** - * Destructor. - * - * @return void - */ - public function __destruct() - { - $this->disconnect(); - } - - /** - * @return resource The raw LDAP extension resource. - */ - public function getResource() - { - if (!is_resource($this->_resource) || $this->_boundUser === false) { - $this->bind(); - } - return $this->_resource; - } - - /** - * Return the LDAP error number of the last LDAP command - * - * @return int - */ - public function getLastErrorCode() - { - $ret = @ldap_get_option($this->_resource, LDAP_OPT_ERROR_NUMBER, $err); - if ($ret === true) { - if ($err <= -1 && $err >= -17) { - /** - * @see Zend_Ldap_Exception - */ - /* For some reason draft-ietf-ldapext-ldap-c-api-xx.txt error - * codes in OpenLDAP are negative values from -1 to -17. - */ - $err = Zend_Ldap_Exception::LDAP_SERVER_DOWN + (-$err - 1); - } - return $err; - } - return 0; - } - - /** - * Return the LDAP error message of the last LDAP command - * - * @param int $errorCode - * @param array $errorMessages - * @return string - */ - public function getLastError(&$errorCode = null, array &$errorMessages = null) - { - $errorCode = $this->getLastErrorCode(); - $errorMessages = array(); - - /* The various error retrieval functions can return - * different things so we just try to collect what we - * can and eliminate dupes. - */ - $estr1 = @ldap_error($this->_resource); - if ($errorCode !== 0 && $estr1 === 'Success') { - $estr1 = @ldap_err2str($errorCode); - } - if (!empty($estr1)) { - $errorMessages[] = $estr1; - } - - @ldap_get_option($this->_resource, LDAP_OPT_ERROR_STRING, $estr2); - if (!empty($estr2) && !in_array($estr2, $errorMessages)) { - $errorMessages[] = $estr2; - } - - $message = ''; - if ($errorCode > 0) { - $message = '0x' . dechex($errorCode) . ' '; - } else { - $message = ''; - } - if (count($errorMessages) > 0) { - $message .= '(' . implode('; ', $errorMessages) . ')'; - } else { - $message .= '(no error message from LDAP)'; - } - return $message; - } - - /** - * Get the currently bound user - * - * FALSE if no user is bound to the LDAP resource - * NULL if there has been an anonymous bind - * username of the currently bound user - * - * @return false|null|string - */ - public function getBoundUser() - { - return $this->_boundUser; - } - - /** - * Sets the options used in connecting, binding, etc. - * - * Valid option keys: - * host - * port - * useSsl - * username - * password - * bindRequiresDn - * baseDn - * accountCanonicalForm - * accountDomainName - * accountDomainNameShort - * accountFilterFormat - * allowEmptyPassword - * useStartTls - * optRefferals - * tryUsernameSplit - * - * @param array|Zend_Config $options Options used in connecting, binding, etc. - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function setOptions($options) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - - $permittedOptions = array( - 'host' => null, - 'port' => 0, - 'useSsl' => false, - 'username' => null, - 'password' => null, - 'bindRequiresDn' => false, - 'baseDn' => null, - 'accountCanonicalForm' => null, - 'accountDomainName' => null, - 'accountDomainNameShort' => null, - 'accountFilterFormat' => null, - 'allowEmptyPassword' => false, - 'useStartTls' => false, - 'optReferrals' => false, - 'tryUsernameSplit' => true, - ); - - foreach ($permittedOptions as $key => $val) { - if (array_key_exists($key, $options)) { - $val = $options[$key]; - unset($options[$key]); - /* Enforce typing. This eliminates issues like Zend_Config_Ini - * returning '1' as a string (ZF-3163). - */ - switch ($key) { - case 'port': - case 'accountCanonicalForm': - $permittedOptions[$key] = (int)$val; - break; - case 'useSsl': - case 'bindRequiresDn': - case 'allowEmptyPassword': - case 'useStartTls': - case 'optReferrals': - case 'tryUsernameSplit': - $permittedOptions[$key] = ($val === true || - $val === '1' || strcasecmp($val, 'true') == 0); - break; - default: - $permittedOptions[$key] = trim($val); - break; - } - } - } - if (count($options) > 0) { - $key = key($options); - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, "Unknown Zend_Ldap option: $key"); - } - $this->_options = $permittedOptions; - return $this; - } - - /** - * @return array The current options. - */ - public function getOptions() - { - return $this->_options; - } - - /** - * @return string The hostname of the LDAP server being used to authenticate accounts - */ - protected function _getHost() - { - return $this->_options['host']; - } - - /** - * @return int The port of the LDAP server or 0 to indicate that no port value is set - */ - protected function _getPort() - { - return $this->_options['port']; - } - - /** - * @return boolean The default SSL / TLS encrypted transport control - */ - protected function _getUseSsl() - { - return $this->_options['useSsl']; - } - - /** - * @return string The default acctname for binding - */ - protected function _getUsername() - { - return $this->_options['username']; - } - - /** - * @return string The default password for binding - */ - protected function _getPassword() - { - return $this->_options['password']; - } - - /** - * @return boolean Bind requires DN - */ - protected function _getBindRequiresDn() - { - return $this->_options['bindRequiresDn']; - } - - /** - * Gets the base DN under which objects of interest are located - * - * @return string - */ - public function getBaseDn() - { - return $this->_options['baseDn']; - } - - /** - * @return integer Either ACCTNAME_FORM_BACKSLASH, ACCTNAME_FORM_PRINCIPAL or - * ACCTNAME_FORM_USERNAME indicating the form usernames should be canonicalized to. - */ - protected function _getAccountCanonicalForm() - { - /* Account names should always be qualified with a domain. In some scenarios - * using non-qualified account names can lead to security vulnerabilities. If - * no account canonical form is specified, we guess based in what domain - * names have been supplied. - */ - - $accountCanonicalForm = $this->_options['accountCanonicalForm']; - if (!$accountCanonicalForm) { - $accountDomainName = $this->_getAccountDomainName(); - $accountDomainNameShort = $this->_getAccountDomainNameShort(); - if ($accountDomainNameShort) { - $accountCanonicalForm = Zend_Ldap::ACCTNAME_FORM_BACKSLASH; - } else if ($accountDomainName) { - $accountCanonicalForm = Zend_Ldap::ACCTNAME_FORM_PRINCIPAL; - } else { - $accountCanonicalForm = Zend_Ldap::ACCTNAME_FORM_USERNAME; - } - } - - return $accountCanonicalForm; - } - - /** - * @return string The account domain name - */ - protected function _getAccountDomainName() - { - return $this->_options['accountDomainName']; - } - - /** - * @return string The short account domain name - */ - protected function _getAccountDomainNameShort() - { - return $this->_options['accountDomainNameShort']; - } - - /** - * @return string A format string for building an LDAP search filter to match - * an account - */ - protected function _getAccountFilterFormat() - { - return $this->_options['accountFilterFormat']; - } - - /** - * @return boolean Allow empty passwords - */ - protected function _getAllowEmptyPassword() - { - return $this->_options['allowEmptyPassword']; - } - - /** - * @return boolean The default SSL / TLS encrypted transport control - */ - protected function _getUseStartTls() - { - return $this->_options['useStartTls']; - } - - /** - * @return boolean Opt. Referrals - */ - protected function _getOptReferrals() - { - return $this->_options['optReferrals']; - } - - /** - * @return boolean Try splitting the username into username and domain - */ - protected function _getTryUsernameSplit() - { - return $this->_options['tryUsernameSplit']; - } - - /** - * @return string The LDAP search filter for matching directory accounts - */ - protected function _getAccountFilter($acctname) - { - /** - * @see Zend_Ldap_Filter_Abstract - */ - $this->_splitName($acctname, $dname, $aname); - $accountFilterFormat = $this->_getAccountFilterFormat(); - $aname = Zend_Ldap_Filter_Abstract::escapeValue($aname); - if ($accountFilterFormat) { - return sprintf($accountFilterFormat, $aname); - } - if (!$this->_getBindRequiresDn()) { - // is there a better way to detect this? - return sprintf("(&(objectClass=user)(sAMAccountName=%s))", $aname); - } - return sprintf("(&(objectClass=posixAccount)(uid=%s))", $aname); - } - - /** - * @param string $name The name to split - * @param string $dname The resulting domain name (this is an out parameter) - * @param string $aname The resulting account name (this is an out parameter) - * @return void - */ - protected function _splitName($name, &$dname, &$aname) - { - $dname = null; - $aname = $name; - - if (!$this->_getTryUsernameSplit()) { - return; - } - - $pos = strpos($name, '@'); - if ($pos) { - $dname = substr($name, $pos + 1); - $aname = substr($name, 0, $pos); - } else { - $pos = strpos($name, '\\'); - if ($pos) { - $dname = substr($name, 0, $pos); - $aname = substr($name, $pos + 1); - } - } - } - - /** - * @param string $acctname The name of the account - * @return string The DN of the specified account - * @throws Zend_Ldap_Exception - */ - protected function _getAccountDn($acctname) - { - /** - * @see Zend_Ldap_Dn - */ - if (Zend_Ldap_Dn::checkDn($acctname)) return $acctname; - $acctname = $this->getCanonicalAccountName($acctname, Zend_Ldap::ACCTNAME_FORM_USERNAME); - $acct = $this->_getAccount($acctname, array('dn')); - return $acct['dn']; - } - - /** - * @param string $dname The domain name to check - * @return boolean - */ - protected function _isPossibleAuthority($dname) - { - if ($dname === null) { - return true; - } - $accountDomainName = $this->_getAccountDomainName(); - $accountDomainNameShort = $this->_getAccountDomainNameShort(); - if ($accountDomainName === null && $accountDomainNameShort === null) { - return true; - } - if (strcasecmp($dname, $accountDomainName) == 0) { - return true; - } - if (strcasecmp($dname, $accountDomainNameShort) == 0) { - return true; - } - return false; - } - - /** - * @param string $acctname The name to canonicalize - * @param int $type The desired form of canonicalization - * @return string The canonicalized name in the desired form - * @throws Zend_Ldap_Exception - */ - public function getCanonicalAccountName($acctname, $form = 0) - { - $this->_splitName($acctname, $dname, $uname); - - if (!$this->_isPossibleAuthority($dname)) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, - "Binding domain is not an authority for user: $acctname", - Zend_Ldap_Exception::LDAP_X_DOMAIN_MISMATCH); - } - - if (!$uname) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, "Invalid account name syntax: $acctname"); - } - - if (function_exists('mb_strtolower')) { - $uname = mb_strtolower($uname, 'UTF-8'); - } else { - $uname = strtolower($uname); - } - - if ($form === 0) { - $form = $this->_getAccountCanonicalForm(); - } - - switch ($form) { - case Zend_Ldap::ACCTNAME_FORM_DN: - return $this->_getAccountDn($acctname); - case Zend_Ldap::ACCTNAME_FORM_USERNAME: - return $uname; - case Zend_Ldap::ACCTNAME_FORM_BACKSLASH: - $accountDomainNameShort = $this->_getAccountDomainNameShort(); - if (!$accountDomainNameShort) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Option required: accountDomainNameShort'); - } - return "$accountDomainNameShort\\$uname"; - case Zend_Ldap::ACCTNAME_FORM_PRINCIPAL: - $accountDomainName = $this->_getAccountDomainName(); - if (!$accountDomainName) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Option required: accountDomainName'); - } - return "$uname@$accountDomainName"; - default: - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, "Unknown canonical name form: $form"); - } - } - - /** - * @param array $attrs An array of names of desired attributes - * @return array An array of the attributes representing the account - * @throws Zend_Ldap_Exception - */ - protected function _getAccount($acctname, array $attrs = null) - { - $baseDn = $this->getBaseDn(); - if (!$baseDn) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Base DN not set'); - } - - $accountFilter = $this->_getAccountFilter($acctname); - if (!$accountFilter) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Invalid account filter'); - } - - if (!is_resource($this->getResource())) { - $this->bind(); - } - - $accounts = $this->search($accountFilter, $baseDn, self::SEARCH_SCOPE_SUB, $attrs); - $count = $accounts->count(); - if ($count === 1) { - $acct = $accounts->getFirst(); - $accounts->close(); - return $acct; - } else if ($count === 0) { - /** - * @see Zend_Ldap_Exception - */ - $code = Zend_Ldap_Exception::LDAP_NO_SUCH_OBJECT; - $str = "No object found for: $accountFilter"; - } else { - /** - * @see Zend_Ldap_Exception - */ - $code = Zend_Ldap_Exception::LDAP_OPERATIONS_ERROR; - $str = "Unexpected result count ($count) for: $accountFilter"; - } - $accounts->close(); - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this, $str, $code); - } - - /** - * @return Zend_Ldap Provides a fluent interface - */ - public function disconnect() - { - if (is_resource($this->_resource)) { - @ldap_unbind($this->_resource); - } - $this->_resource = null; - $this->_boundUser = false; - return $this; - } - - /** - * To connect using SSL it seems the client tries to verify the server - * certificate by default. One way to disable this behavior is to set - * 'TLS_REQCERT never' in OpenLDAP's ldap.conf and restarting Apache. Or, - * if you really care about the server's cert you can put a cert on the - * web server. - * - * @param string $host The hostname of the LDAP server to connect to - * @param int $port The port number of the LDAP server to connect to - * @param boolean $useSsl Use SSL - * @param boolean $useStartTls Use STARTTLS - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function connect($host = null, $port = null, $useSsl = null, $useStartTls = null) - { - if ($host === null) { - $host = $this->_getHost(); - } - if ($port === null) { - $port = $this->_getPort(); - } else { - $port = (int)$port; - } - if ($useSsl === null) { - $useSsl = $this->_getUseSsl(); - } else { - $useSsl = (bool)$useSsl; - } - if ($useStartTls === null) { - $useStartTls = $this->_getUseStartTls(); - } else { - $useStartTls = (bool)$useStartTls; - } - - if (!$host) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'A host parameter is required'); - } - - $useUri = false; - /* Because ldap_connect doesn't really try to connect, any connect error - * will actually occur during the ldap_bind call. Therefore, we save the - * connect string here for reporting it in error handling in bind(). - */ - $hosts = array(); - if (preg_match_all('~ldap(?:i|s)?://~', $host, $hosts, PREG_SET_ORDER) > 0) { - $this->_connectString = $host; - $useUri = true; - $useSsl = false; - } else { - if ($useSsl) { - $this->_connectString = 'ldaps://' . $host; - $useUri = true; - } else { - $this->_connectString = 'ldap://' . $host; - } - if ($port) { - $this->_connectString .= ':' . $port; - } - } - - $this->disconnect(); - - /* Only OpenLDAP 2.2 + supports URLs so if SSL is not requested, just - * use the old form. - */ - $resource = ($useUri) ? @ldap_connect($this->_connectString) : @ldap_connect($host, $port); - - if (is_resource($resource) === true) { - $this->_resource = $resource; - $this->_boundUser = false; - - $optReferrals = ($this->_getOptReferrals()) ? 1 : 0; - if (@ldap_set_option($resource, LDAP_OPT_PROTOCOL_VERSION, 3) && - @ldap_set_option($resource, LDAP_OPT_REFERRALS, $optReferrals)) { - if ($useSsl || !$useStartTls || @ldap_start_tls($resource)) { - return $this; - } - } - - /** - * @see Zend_Ldap_Exception - */ - $zle = new Zend_Ldap_Exception($this, "$host:$port"); - $this->disconnect(); - throw $zle; - } - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, "Failed to connect to LDAP server: $host:$port"); - } - - /** - * @param string $username The username for authenticating the bind - * @param string $password The password for authenticating the bind - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function bind($username = null, $password = null) - { - $moreCreds = true; - - // Security check: remove null bytes in password - // @see https://net.educause.edu/ir/library/pdf/csd4875.pdf - $password = str_replace("\0", '', $password); - - if ($username === null) { - $username = $this->_getUsername(); - $password = $this->_getPassword(); - $moreCreds = false; - } - - if (empty($username)) { - /* Perform anonymous bind - */ - $username = null; - $password = null; - } else { - /* Check to make sure the username is in DN form. - */ - /** - * @see Zend_Ldap_Dn - */ - if (!Zend_Ldap_Dn::checkDn($username)) { - if ($this->_getBindRequiresDn()) { - /* moreCreds stops an infinite loop if _getUsername does not - * return a DN and the bind requires it - */ - if ($moreCreds) { - try { - $username = $this->_getAccountDn($username); - } catch (Zend_Ldap_Exception $zle) { - switch ($zle->getCode()) { - case Zend_Ldap_Exception::LDAP_NO_SUCH_OBJECT: - case Zend_Ldap_Exception::LDAP_X_DOMAIN_MISMATCH: - case Zend_Ldap_Exception::LDAP_X_EXTENSION_NOT_LOADED: - throw $zle; - } - throw new Zend_Ldap_Exception(null, - 'Failed to retrieve DN for account: ' . $username . - ' [' . $zle->getMessage() . ']', - Zend_Ldap_Exception::LDAP_OPERATIONS_ERROR); - } - } else { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Binding requires username in DN form'); - } - } else { - $username = $this->getCanonicalAccountName($username, - $this->_getAccountCanonicalForm()); - } - } - } - - if (!is_resource($this->_resource)) { - $this->connect(); - } - - if ($username !== null && $password === '' && $this->_getAllowEmptyPassword() !== true) { - /** - * @see Zend_Ldap_Exception - */ - $zle = new Zend_Ldap_Exception(null, - 'Empty password not allowed - see allowEmptyPassword option.'); - } else { - if (@ldap_bind($this->_resource, $username, $password)) { - $this->_boundUser = $username; - return $this; - } - - $message = ($username === null) ? $this->_connectString : $username; - /** - * @see Zend_Ldap_Exception - */ - switch ($this->getLastErrorCode()) { - case Zend_Ldap_Exception::LDAP_SERVER_DOWN: - /* If the error is related to establishing a connection rather than binding, - * the connect string is more informative than the username. - */ - $message = $this->_connectString; - } - - $zle = new Zend_Ldap_Exception($this, $message); - } - $this->disconnect(); - throw $zle; - } - - /** - * A global LDAP search routine for finding information. - * - * Options can be either passed as single parameters according to the - * method signature or as an array with one or more of the following keys - * - filter - * - baseDn - * - scope - * - attributes - * - sort - * - collectionClass - * - sizelimit - * - timelimit - * - * @param string|Zend_Ldap_Filter_Abstract|array $filter - * @param string|Zend_Ldap_Dn|null $basedn - * @param integer $scope - * @param array $attributes - * @param string|null $sort - * @param string|null $collectionClass - * @param integer $sizelimit - * @param integer $timelimit - * @return Zend_Ldap_Collection - * @throws Zend_Ldap_Exception - */ - public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, array $attributes = array(), - $sort = null, $collectionClass = null, $sizelimit = 0, $timelimit = 0) - { - if (is_array($filter)) { - $options = array_change_key_case($filter, CASE_LOWER); - foreach ($options as $key => $value) { - switch ($key) { - case 'filter': - case 'basedn': - case 'scope': - case 'sort': - $$key = $value; - break; - case 'attributes': - if (is_array($value)) { - $attributes = $value; - } - break; - case 'collectionclass': - $collectionClass = $value; - break; - case 'sizelimit': - case 'timelimit': - $$key = (int)$value; - } - } - } - - if ($basedn === null) { - $basedn = $this->getBaseDn(); - } - else if ($basedn instanceof Zend_Ldap_Dn) { - $basedn = $basedn->toString(); - } - - if ($filter instanceof Zend_Ldap_Filter_Abstract) { - $filter = $filter->toString(); - } - - switch ($scope) { - case self::SEARCH_SCOPE_ONE: - $search = @ldap_list($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); - break; - case self::SEARCH_SCOPE_BASE: - $search = @ldap_read($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); - break; - case self::SEARCH_SCOPE_SUB: - default: - $search = @ldap_search($this->getResource(), $basedn, $filter, $attributes, 0, $sizelimit, $timelimit); - break; - } - - if($search === false) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this, 'searching: ' . $filter); - } - if ($sort !== null && is_string($sort)) { - $isSorted = @ldap_sort($this->getResource(), $search, $sort); - if($isSorted === false) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this, 'sorting: ' . $sort); - } - } - - /** - * Zend_Ldap_Collection_Iterator_Default - */ - $iterator = new Zend_Ldap_Collection_Iterator_Default($this, $search); - return $this->_createCollection($iterator, $collectionClass); - } - - /** - * Extension point for collection creation - * - * @param Zend_Ldap_Collection_Iterator_Default $iterator - * @param string|null $collectionClass - * @return Zend_Ldap_Collection - * @throws Zend_Ldap_Exception - */ - protected function _createCollection(Zend_Ldap_Collection_Iterator_Default $iterator, $collectionClass) - { - if ($collectionClass === null) { - /** - * Zend_Ldap_Collection - */ - return new Zend_Ldap_Collection($iterator); - } else { - $collectionClass = (string)$collectionClass; - if (!class_exists($collectionClass)) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, - "Class '$collectionClass' can not be found"); - } - if (!is_subclass_of($collectionClass, 'Zend_Ldap_Collection')) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, - "Class '$collectionClass' must subclass 'Zend_Ldap_Collection'"); - } - return new $collectionClass($iterator); - } - } - - /** - * Count items found by given filter. - * - * @param string|Zend_Ldap_Filter_Abstract $filter - * @param string|Zend_Ldap_Dn|null $basedn - * @param integer $scope - * @return integer - * @throws Zend_Ldap_Exception - */ - public function count($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB) - { - try { - $result = $this->search($filter, $basedn, $scope, array('dn'), null); - } catch (Zend_Ldap_Exception $e) { - if ($e->getCode() === Zend_Ldap_Exception::LDAP_NO_SUCH_OBJECT) return 0; - else throw $e; - } - return $result->count(); - } - - /** - * Count children for a given DN. - * - * @param string|Zend_Ldap_Dn $dn - * @return integer - * @throws Zend_Ldap_Exception - */ - public function countChildren($dn) - { - return $this->count('(objectClass=*)', $dn, self::SEARCH_SCOPE_ONE); - } - - /** - * Check if a given DN exists. - * - * @param string|Zend_Ldap_Dn $dn - * @return boolean - * @throws Zend_Ldap_Exception - */ - public function exists($dn) - { - return ($this->count('(objectClass=*)', $dn, self::SEARCH_SCOPE_BASE) == 1); - } - - /** - * Search LDAP registry for entries matching filter and optional attributes - * - * Options can be either passed as single parameters according to the - * method signature or as an array with one or more of the following keys - * - filter - * - baseDn - * - scope - * - attributes - * - sort - * - reverseSort - * - sizelimit - * - timelimit - * - * @param string|Zend_Ldap_Filter_Abstract|array $filter - * @param string|Zend_Ldap_Dn|null $basedn - * @param integer $scope - * @param array $attributes - * @param string|null $sort - * @param boolean $reverseSort - * @param integer $sizelimit - * @param integer $timelimit - * @return array - * @throws Zend_Ldap_Exception - */ - public function searchEntries($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, - array $attributes = array(), $sort = null, $reverseSort = false, $sizelimit = 0, $timelimit = 0) - { - if (is_array($filter)) { - $filter = array_change_key_case($filter, CASE_LOWER); - if (isset($filter['collectionclass'])) { - unset($filter['collectionclass']); - } - if (isset($filter['reversesort'])) { - $reverseSort = $filter['reversesort']; - unset($filter['reversesort']); - } - } - $result = $this->search($filter, $basedn, $scope, $attributes, $sort, null, $sizelimit, $timelimit); - $items = $result->toArray(); - if ((bool)$reverseSort === true) { - $items = array_reverse($items, false); - } - return $items; - } - - /** - * Get LDAP entry by DN - * - * @param string|Zend_Ldap_Dn $dn - * @param array $attributes - * @param boolean $throwOnNotFound - * @return array - * @throws Zend_Ldap_Exception - */ - public function getEntry($dn, array $attributes = array(), $throwOnNotFound = false) - { - try { - $result = $this->search("(objectClass=*)", $dn, self::SEARCH_SCOPE_BASE, - $attributes, null); - return $result->getFirst(); - } catch (Zend_Ldap_Exception $e){ - if ($throwOnNotFound !== false) throw $e; - } - return null; - } - - /** - * Prepares an ldap data entry array for insert/update operation - * - * @param array $entry - * @return void - * @throws InvalidArgumentException - */ - public static function prepareLdapEntryArray(array &$entry) - { - if (array_key_exists('dn', $entry)) unset($entry['dn']); - foreach ($entry as $key => $value) { - if (is_array($value)) { - foreach ($value as $i => $v) { - if ($v === null) unset($value[$i]); - else if (!is_scalar($v)) { - throw new InvalidArgumentException('Only scalar values allowed in LDAP data'); - } else { - $v = (string)$v; - if (strlen($v) == 0) { - unset($value[$i]); - } else { - $value[$i] = $v; - } - } - } - $entry[$key] = array_values($value); - } else { - if ($value === null) $entry[$key] = array(); - else if (!is_scalar($value)) { - throw new InvalidArgumentException('Only scalar values allowed in LDAP data'); - } else { - $value = (string)$value; - if (strlen($value) == 0) { - $entry[$key] = array(); - } else { - $entry[$key] = array($value); - } - } - } - } - $entry = array_change_key_case($entry, CASE_LOWER); - } - - /** - * Add new information to the LDAP repository - * - * @param string|Zend_Ldap_Dn $dn - * @param array $entry - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function add($dn, array $entry) - { - if (!($dn instanceof Zend_Ldap_Dn)) { - $dn = Zend_Ldap_Dn::factory($dn, null); - } - self::prepareLdapEntryArray($entry); - foreach ($entry as $key => $value) { - if (is_array($value) && count($value) === 0) { - unset($entry[$key]); - } - } - - $rdnParts = $dn->getRdn(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER); - foreach ($rdnParts as $key => $value) { - $value = Zend_Ldap_Dn::unescapeValue($value); - if (!array_key_exists($key, $entry)) { - $entry[$key] = array($value); - } else if (!in_array($value, $entry[$key])) { - $entry[$key] = array_merge(array($value), $entry[$key]); - } - } - $adAttributes = array('distinguishedname', 'instancetype', 'name', 'objectcategory', - 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated'); - foreach ($adAttributes as $attr) { - if (array_key_exists($attr, $entry)) { - unset($entry[$attr]); - } - } - - $isAdded = @ldap_add($this->getResource(), $dn->toString(), $entry); - if($isAdded === false) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this, 'adding: ' . $dn->toString()); - } - return $this; - } - - /** - * Update LDAP registry - * - * @param string|Zend_Ldap_Dn $dn - * @param array $entry - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function update($dn, array $entry) - { - if (!($dn instanceof Zend_Ldap_Dn)) { - $dn = Zend_Ldap_Dn::factory($dn, null); - } - self::prepareLdapEntryArray($entry); - - $rdnParts = $dn->getRdn(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER); - foreach ($rdnParts as $key => $value) { - $value = Zend_Ldap_Dn::unescapeValue($value); - if (array_key_exists($key, $entry) && !in_array($value, $entry[$key])) { - $entry[$key] = array_merge(array($value), $entry[$key]); - } - } - - $adAttributes = array('distinguishedname', 'instancetype', 'name', 'objectcategory', - 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated'); - foreach ($adAttributes as $attr) { - if (array_key_exists($attr, $entry)) { - unset($entry[$attr]); - } - } - - if (count($entry) > 0) { - $isModified = @ldap_modify($this->getResource(), $dn->toString(), $entry); - if($isModified === false) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this, 'updating: ' . $dn->toString()); - } - } - return $this; - } - - /** - * Save entry to LDAP registry. - * - * Internally decides if entry will be updated to added by calling - * {@link exists()}. - * - * @param string|Zend_Ldap_Dn $dn - * @param array $entry - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function save($dn, array $entry) - { - if ($dn instanceof Zend_Ldap_Dn) { - $dn = $dn->toString(); - } - if ($this->exists($dn)) $this->update($dn, $entry); - else $this->add($dn, $entry); - return $this; - } - - /** - * Delete an LDAP entry - * - * @param string|Zend_Ldap_Dn $dn - * @param boolean $recursively - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function delete($dn, $recursively = false) - { - if ($dn instanceof Zend_Ldap_Dn) { - $dn = $dn->toString(); - } - if ($recursively === true) { - if ($this->countChildren($dn)>0) { - $children = $this->_getChildrenDns($dn); - foreach ($children as $c) { - $this->delete($c, true); - } - } - } - $isDeleted = @ldap_delete($this->getResource(), $dn); - if($isDeleted === false) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this, 'deleting: ' . $dn); - } - return $this; - } - - /** - * Retrieve the immediate children DNs of the given $parentDn - * - * This method is used in recursive methods like {@see delete()} - * or {@see copy()} - * - * @param string|Zend_Ldap_Dn $parentDn - * @return array of DNs - */ - protected function _getChildrenDns($parentDn) - { - if ($parentDn instanceof Zend_Ldap_Dn) { - $parentDn = $parentDn->toString(); - } - $children = array(); - $search = @ldap_list($this->getResource(), $parentDn, '(objectClass=*)', array('dn')); - for ($entry = @ldap_first_entry($this->getResource(), $search); - $entry !== false; - $entry = @ldap_next_entry($this->getResource(), $entry)) { - $childDn = @ldap_get_dn($this->getResource(), $entry); - if ($childDn === false) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this, 'getting dn'); - } - $children[] = $childDn; - } - @ldap_free_result($search); - return $children; - } - - /** - * Moves a LDAP entry from one DN to another subtree. - * - * @param string|Zend_Ldap_Dn $from - * @param string|Zend_Ldap_Dn $to - * @param boolean $recursively - * @param boolean $alwaysEmulate - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function moveToSubtree($from, $to, $recursively = false, $alwaysEmulate = false) - { - if ($from instanceof Zend_Ldap_Dn) { - $orgDnParts = $from->toArray(); - } else { - $orgDnParts = Zend_Ldap_Dn::explodeDn($from); - } - - if ($to instanceof Zend_Ldap_Dn) { - $newParentDnParts = $to->toArray(); - } else { - $newParentDnParts = Zend_Ldap_Dn::explodeDn($to); - } - - $newDnParts = array_merge(array(array_shift($orgDnParts)), $newParentDnParts); - $newDn = Zend_Ldap_Dn::fromArray($newDnParts); - return $this->rename($from, $newDn, $recursively, $alwaysEmulate); - } - - /** - * Moves a LDAP entry from one DN to another DN. - * - * This is an alias for {@link rename()} - * - * @param string|Zend_Ldap_Dn $from - * @param string|Zend_Ldap_Dn $to - * @param boolean $recursively - * @param boolean $alwaysEmulate - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function move($from, $to, $recursively = false, $alwaysEmulate = false) - { - return $this->rename($from, $to, $recursively, $alwaysEmulate); - } - - /** - * Renames a LDAP entry from one DN to another DN. - * - * This method implicitely moves the entry to another location within the tree. - * - * @param string|Zend_Ldap_Dn $from - * @param string|Zend_Ldap_Dn $to - * @param boolean $recursively - * @param boolean $alwaysEmulate - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function rename($from, $to, $recursively = false, $alwaysEmulate = false) - { - $emulate = (bool)$alwaysEmulate; - if (!function_exists('ldap_rename')) $emulate = true; - else if ($recursively) $emulate = true; - - if ($emulate === false) { - if ($from instanceof Zend_Ldap_Dn) { - $from = $from->toString(); - } - - if ($to instanceof Zend_Ldap_Dn) { - $newDnParts = $to->toArray(); - } else { - $newDnParts = Zend_Ldap_Dn::explodeDn($to); - } - - $newRdn = Zend_Ldap_Dn::implodeRdn(array_shift($newDnParts)); - $newParent = Zend_Ldap_Dn::implodeDn($newDnParts); - $isOK = @ldap_rename($this->getResource(), $from, $newRdn, $newParent, true); - if($isOK === false) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this, 'renaming ' . $from . ' to ' . $to); - } - else if (!$this->exists($to)) $emulate = true; - } - if ($emulate) { - $this->copy($from, $to, $recursively); - $this->delete($from, $recursively); - } - return $this; - } - - /** - * Copies a LDAP entry from one DN to another subtree. - * - * @param string|Zend_Ldap_Dn $from - * @param string|Zend_Ldap_Dn $to - * @param boolean $recursively - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function copyToSubtree($from, $to, $recursively = false) - { - if ($from instanceof Zend_Ldap_Dn) { - $orgDnParts = $from->toArray(); - } else { - $orgDnParts = Zend_Ldap_Dn::explodeDn($from); - } - - if ($to instanceof Zend_Ldap_Dn) { - $newParentDnParts = $to->toArray(); - } else { - $newParentDnParts = Zend_Ldap_Dn::explodeDn($to); - } - - $newDnParts = array_merge(array(array_shift($orgDnParts)), $newParentDnParts); - $newDn = Zend_Ldap_Dn::fromArray($newDnParts); - return $this->copy($from, $newDn, $recursively); - } - - /** - * Copies a LDAP entry from one DN to another DN. - * - * @param string|Zend_Ldap_Dn $from - * @param string|Zend_Ldap_Dn $to - * @param boolean $recursively - * @return Zend_Ldap Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function copy($from, $to, $recursively = false) - { - $entry = $this->getEntry($from, array(), true); - - if ($to instanceof Zend_Ldap_Dn) { - $toDnParts = $to->toArray(); - } else { - $toDnParts = Zend_Ldap_Dn::explodeDn($to); - } - $this->add($to, $entry); - - if ($recursively === true && $this->countChildren($from)>0) { - $children = $this->_getChildrenDns($from); - foreach ($children as $c) { - $cDnParts = Zend_Ldap_Dn::explodeDn($c); - $newChildParts = array_merge(array(array_shift($cDnParts)), $toDnParts); - $newChild = Zend_Ldap_Dn::implodeDn($newChildParts); - $this->copy($c, $newChild, true); - } - } - return $this; - } - - /** - * Returns the specified DN as a Zend_Ldap_Node - * - * @param string|Zend_Ldap_Dn $dn - * @return Zend_Ldap_Node|null - * @throws Zend_Ldap_Exception - */ - public function getNode($dn) - { - /** - * Zend_Ldap_Node - */ - return Zend_Ldap_Node::fromLdap($dn, $this); - } - - /** - * Returns the base node as a Zend_Ldap_Node - * - * @return Zend_Ldap_Node - * @throws Zend_Ldap_Exception - */ - public function getBaseNode() - { - return $this->getNode($this->getBaseDn(), $this); - } - - /** - * Returns the RootDSE - * - * @return Zend_Ldap_Node_RootDse - * @throws Zend_Ldap_Exception - */ - public function getRootDse() - { - if ($this->_rootDse === null) { - /** - * @see Zend_Ldap_Node_Schema - */ - $this->_rootDse = Zend_Ldap_Node_RootDse::create($this); - } - return $this->_rootDse; - } - - /** - * Returns the schema - * - * @return Zend_Ldap_Node_Schema - * @throws Zend_Ldap_Exception - */ - public function getSchema() - { - if ($this->_schema === null) { - /** - * @see Zend_Ldap_Node_Schema - */ - $this->_schema = Zend_Ldap_Node_Schema::create($this); - } - return $this->_schema; - } -} diff --git a/library/vendor/Zend/Ldap/Attribute.php b/library/vendor/Zend/Ldap/Attribute.php deleted file mode 100644 index 6210d7bba..000000000 --- a/library/vendor/Zend/Ldap/Attribute.php +++ /dev/null @@ -1,416 +0,0 @@ -= 0 && $indexformat('U'); - } else if (is_string($value)) { - try { - return Zend_Ldap_Converter::fromLdapDateTime($value, false)->format('U'); - } catch (InvalidArgumentException $e) { - return null; - } - } else return null; - } -} diff --git a/library/vendor/Zend/Ldap/Collection.php b/library/vendor/Zend/Ldap/Collection.php deleted file mode 100644 index f23c4cebc..000000000 --- a/library/vendor/Zend/Ldap/Collection.php +++ /dev/null @@ -1,239 +0,0 @@ -_iterator = $iterator; - } - - public function __destruct() - { - $this->close(); - } - - /** - * Closes the current result set - * - * @return boolean - */ - public function close() - { - return $this->_iterator->close(); - } - - /** - * Get all entries as an array - * - * @return array - */ - public function toArray() - { - $data = array(); - foreach ($this as $item) { - $data[] = $item; - } - return $data; - } - - /** - * Get first entry - * - * @return array - */ - public function getFirst() - { - if ($this->count() > 0) { - $this->rewind(); - return $this->current(); - } else { - return null; - } - } - - /** - * Returns the underlying iterator - * - * @return Zend_Ldap_Collection_Iterator_Default - */ - public function getInnerIterator() - { - return $this->_iterator; - } - - /** - * Returns the number of items in current result - * Implements Countable - * - * @return int - */ - public function count() - { - return $this->_iterator->count(); - } - - /** - * Return the current result item - * Implements Iterator - * - * @return array|null - * @throws Zend_Ldap_Exception - */ - public function current() - { - if ($this->count() > 0) { - if ($this->_current < 0) { - $this->rewind(); - } - if (!array_key_exists($this->_current, $this->_cache)) { - $current = $this->_iterator->current(); - if ($current === null) { - return null; - } - $this->_cache[$this->_current] = $this->_createEntry($current); - } - return $this->_cache[$this->_current]; - } else { - return null; - } - } - - /** - * Creates the data structure for the given entry data - * - * @param array $data - * @return array - */ - protected function _createEntry(array $data) - { - return $data; - } - - /** - * Return the current result item DN - * - * @return string|null - */ - public function dn() - { - if ($this->count() > 0) { - if ($this->_current < 0) { - $this->rewind(); - } - return $this->_iterator->key(); - } else { - return null; - } - } - - /** - * Return the current result item key - * Implements Iterator - * - * @return int|null - */ - public function key() - { - if ($this->count() > 0) { - if ($this->_current < 0) { - $this->rewind(); - } - return $this->_current; - } else { - return null; - } - } - - /** - * Move forward to next result item - * Implements Iterator - * - * @throws Zend_Ldap_Exception - */ - public function next() - { - $this->_iterator->next(); - $this->_current++; - } - - /** - * Rewind the Iterator to the first result item - * Implements Iterator - * - * @throws Zend_Ldap_Exception - */ - public function rewind() - { - $this->_iterator->rewind(); - $this->_current = 0; - } - - /** - * Check if there is a current result item - * after calls to rewind() or next() - * Implements Iterator - * - * @return boolean - */ - public function valid() - { - if (isset($this->_cache[$this->_current])) { - return true; - } else { - return $this->_iterator->valid(); - } - } -} diff --git a/library/vendor/Zend/Ldap/Collection/Iterator/Default.php b/library/vendor/Zend/Ldap/Collection/Iterator/Default.php deleted file mode 100644 index 8fb7a3489..000000000 --- a/library/vendor/Zend/Ldap/Collection/Iterator/Default.php +++ /dev/null @@ -1,308 +0,0 @@ -_ldap = $ldap; - $this->_resultId = $resultId; - $this->_itemCount = @ldap_count_entries($ldap->getResource(), $resultId); - if ($this->_itemCount === false) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception($this->_ldap, 'counting entries'); - } - } - - public function __destruct() - { - $this->close(); - } - - /** - * Closes the current result set - * - * @return bool - */ - public function close() - { - $isClosed = false; - if (is_resource($this->_resultId)) { - $isClosed = @ldap_free_result($this->_resultId); - $this->_resultId = null; - $this->_current = null; - } - return $isClosed; - } - - /** - * Gets the current LDAP connection. - * - * @return Zend_Ldap - */ - public function getLdap() - { - return $this->_ldap; - } - - /** - * Sets the attribute name treatment. - * - * Can either be one of the following constants - * - Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_TO_LOWER - * - Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_TO_UPPER - * - Zend_Ldap_Collection_Iterator_Default::ATTRIBUTE_NATIVE - * or a valid callback accepting the attribute's name as it's only - * argument and returning the new attribute's name. - * - * @param integer|callback $attributeNameTreatment - * @return Zend_Ldap_Collection_Iterator_Default Provides a fluent interface - */ - public function setAttributeNameTreatment($attributeNameTreatment) - { - if (is_callable($attributeNameTreatment)) { - if (is_string($attributeNameTreatment) && !function_exists($attributeNameTreatment)) { - $this->_attributeNameTreatment = self::ATTRIBUTE_TO_LOWER; - } else if (is_array($attributeNameTreatment) && - !method_exists($attributeNameTreatment[0], $attributeNameTreatment[1])) { - $this->_attributeNameTreatment = self::ATTRIBUTE_TO_LOWER; - } else { - $this->_attributeNameTreatment = $attributeNameTreatment; - } - } else { - $attributeNameTreatment = (int)$attributeNameTreatment; - switch ($attributeNameTreatment) { - case self::ATTRIBUTE_TO_LOWER: - case self::ATTRIBUTE_TO_UPPER: - case self::ATTRIBUTE_NATIVE: - $this->_attributeNameTreatment = $attributeNameTreatment; - break; - default: - $this->_attributeNameTreatment = self::ATTRIBUTE_TO_LOWER; - break; - } - } - return $this; - } - - /** - * Returns the currently set attribute name treatment - * - * @return integer|callback - */ - public function getAttributeNameTreatment() - { - return $this->_attributeNameTreatment; - } - - /** - * Returns the number of items in current result - * Implements Countable - * - * @return int - */ - public function count() - { - return $this->_itemCount; - } - - /** - * Return the current result item - * Implements Iterator - * - * @return array|null - * @throws Zend_Ldap_Exception - */ - public function current() - { - if (!is_resource($this->_current)) { - $this->rewind(); - } - if (!is_resource($this->_current)) { - return null; - } - - $entry = array('dn' => $this->key()); - $ber_identifier = null; - $name = @ldap_first_attribute($this->_ldap->getResource(), $this->_current, - $ber_identifier); - while ($name) { - $data = @ldap_get_values_len($this->_ldap->getResource(), $this->_current, $name); - unset($data['count']); - - switch($this->_attributeNameTreatment) { - case self::ATTRIBUTE_TO_LOWER: - $attrName = strtolower($name); - break; - case self::ATTRIBUTE_TO_UPPER: - $attrName = strtoupper($name); - break; - case self::ATTRIBUTE_NATIVE: - $attrName = $name; - break; - default: - $attrName = call_user_func($this->_attributeNameTreatment, $name); - break; - } - $entry[$attrName] = $data; - $name = @ldap_next_attribute($this->_ldap->getResource(), $this->_current, - $ber_identifier); - } - ksort($entry, SORT_LOCALE_STRING); - return $entry; - } - - /** - * Return the result item key - * Implements Iterator - * - * @return string|null - */ - public function key() - { - if (!is_resource($this->_current)) { - $this->rewind(); - } - if (is_resource($this->_current)) { - $currentDn = @ldap_get_dn($this->_ldap->getResource(), $this->_current); - if ($currentDn === false) { - /** @see Zend_Ldap_Exception */ - throw new Zend_Ldap_Exception($this->_ldap, 'getting dn'); - } - return $currentDn; - } else { - return null; - } - } - - /** - * Move forward to next result item - * Implements Iterator - * - * @throws Zend_Ldap_Exception - */ - public function next() - { - if (is_resource($this->_current) && $this->_itemCount > 0) { - $this->_current = @ldap_next_entry($this->_ldap->getResource(), $this->_current); - /** @see Zend_Ldap_Exception */ - if ($this->_current === false) { - $msg = $this->_ldap->getLastError($code); - if ($code === Zend_Ldap_Exception::LDAP_SIZELIMIT_EXCEEDED) { - // we have reached the size limit enforced by the server - return; - } else if ($code > Zend_Ldap_Exception::LDAP_SUCCESS) { - throw new Zend_Ldap_Exception($this->_ldap, 'getting next entry (' . $msg . ')'); - } - } - } else { - $this->_current = false; - } - } - - /** - * Rewind the Iterator to the first result item - * Implements Iterator - * - * @throws Zend_Ldap_Exception - */ - public function rewind() - { - if (is_resource($this->_resultId)) { - $this->_current = @ldap_first_entry($this->_ldap->getResource(), $this->_resultId); - /** @see Zend_Ldap_Exception */ - if ($this->_current === false && - $this->_ldap->getLastErrorCode() > Zend_Ldap_Exception::LDAP_SUCCESS) { - throw new Zend_Ldap_Exception($this->_ldap, 'getting first entry'); - } - } - } - - /** - * Check if there is a current result item - * after calls to rewind() or next() - * Implements Iterator - * - * @return boolean - */ - public function valid() - { - return (is_resource($this->_current)); - } - -} diff --git a/library/vendor/Zend/Ldap/Converter.php b/library/vendor/Zend/Ldap/Converter.php deleted file mode 100644 index e8677e1f1..000000000 --- a/library/vendor/Zend/Ldap/Converter.php +++ /dev/null @@ -1,410 +0,0 @@ - - * @link http://pear.php.net/package/Net_LDAP2 - * @author Benedikt Hallinger - * - * @param string $string String to convert - * @return string - */ - public static function ascToHex32($string) - { - for ($i = 0; $i, - * heavily based on work from DavidSmith@byu.net - * @link http://pear.php.net/package/Net_LDAP2 - * @author Benedikt Hallinger , heavily based on work from DavidSmith@byu.net - * - * @param string $string String to convert - * @return string - */ - public static function hex32ToAsc($string) - { - // Using a callback, since PHP 5.5 has deprecated the /e modifier in preg_replace. - $string = preg_replace_callback("/\\\([0-9A-Fa-f]{2})/", array('Zend_Ldap_Converter', '_charHex32ToAsc'), $string); - return $string; - } - - /** - * Convert a single slash-prefixed character from Hex32 to ASCII. - * Used as a callback in @see hex32ToAsc() - * @param array $matches - * - * @return string - */ - private static function _charHex32ToAsc(array $matches) - { - return chr(hexdec($matches[0])); - } - - /** - * Convert any value to an LDAP-compatible value. - * - * By setting the $type-parameter the conversion of a certain - * type can be forced - * - * @todo write more tests - * - * @param mixed $value The value to convert - * @param int $ytpe The conversion type to use - * @return string - * @throws Zend_Ldap_Converter_Exception - */ - public static function toLdap($value, $type = self::STANDARD) - { - try { - switch ($type) { - case self::BOOLEAN: - return self::toldapBoolean($value); - break; - case self::GENERALIZED_TIME: - return self::toLdapDatetime($value); - break; - default: - if (is_string($value)) { - return $value; - } else if (is_int($value) || is_float($value)) { - return (string)$value; - } else if (is_bool($value)) { - return self::toldapBoolean($value); - } else if (is_object($value)) { - if ($value instanceof DateTime) { - return self::toLdapDatetime($value); - } else if ($value instanceof Zend_Date) { - return self::toLdapDatetime($value); - } else { - return self::toLdapSerialize($value); - } - } else if (is_array($value)) { - return self::toLdapSerialize($value); - } else if (is_resource($value) && get_resource_type($value) === 'stream') { - return stream_get_contents($value); - } else { - return null; - } - break; - } - } catch (Exception $e) { - throw new Zend_Ldap_Converter_Exception($e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Converts a date-entity to an LDAP-compatible date-string - * - * The date-entity $date can be either a timestamp, a - * DateTime Object, a string that is parseable by strtotime() or a Zend_Date - * Object. - * - * @param integer|string|DateTimt|Zend_Date $date The date-entity - * @param boolean $asUtc Whether to return the LDAP-compatible date-string - * as UTC or as local value - * @return string - * @throws InvalidArgumentException - */ - public static function toLdapDateTime($date, $asUtc = true) - { - if (!($date instanceof DateTime)) { - if (is_int($date)) { - $date = new DateTime('@' . $date); - $date->setTimezone(new DateTimeZone(date_default_timezone_get())); - } else if (is_string($date)) { - $date = new DateTime($date); - } else if ($date instanceof Zend_Date) { - $date = new DateTime($date->get(Zend_Date::ISO_8601)); - } else { - throw new InvalidArgumentException('Parameter $date is not of the expected type'); - } - } - $timezone = $date->format('O'); - if (true === $asUtc) { - $date->setTimezone(new DateTimeZone('UTC')); - $timezone = 'Z'; - } - if ( '+0000' === $timezone ) { - $timezone = 'Z'; - } - return $date->format('YmdHis') . $timezone; - } - - /** - * Convert a boolean value to an LDAP-compatible string - * - * This converts a boolean value of TRUE, an integer-value of 1 and a - * case-insensitive string 'true' to an LDAP-compatible 'TRUE'. All other - * other values are converted to an LDAP-compatible 'FALSE'. - * - * @param boolean|integer|string $value The boolean value to encode - * @return string - */ - public static function toLdapBoolean($value) - { - $return = 'FALSE'; - if (!is_scalar($value)) { - return $return; - } - if (true === $value || 'true' === strtolower($value) || 1 === $value) { - $return = 'TRUE'; - } - return $return; - } - - /** - * Serialize any value for storage in LDAP - * - * @param mixed $value The value to serialize - * @return string - */ - public static function toLdapSerialize($value) - { - return serialize($value); - } - - /** - * Convert an LDAP-compatible value to a corresponding PHP-value. - * - * By setting the $type-parameter the conversion of a certain - * type can be forced - * . - * @param string $value The value to convert - * @param int $ytpe The conversion type to use - * @param boolean $dateTimeAsUtc Return DateTime values in UTC timezone - * @return mixed - * @throws Zend_Ldap_Converter_Exception - */ - public static function fromLdap($value, $type = self::STANDARD, $dateTimeAsUtc = true) - { - switch ($type) { - case self::BOOLEAN: - return self::fromldapBoolean($value); - break; - case self::GENERALIZED_TIME: - return self::fromLdapDateTime($value); - break; - default: - if (is_numeric($value)) { - // prevent numeric values to be treated as date/time - return $value; - } else if ('TRUE' === $value || 'FALSE' === $value) { - return self::fromLdapBoolean($value); - } - if (preg_match('/^\d{4}[\d\+\-Z\.]*$/', $value)) { - return self::fromLdapDateTime($value, $dateTimeAsUtc); - } - try { - return self::fromLdapUnserialize($value); - } catch (UnexpectedValueException $e) { } - break; - } - return $value; - } - - /** - * Convert an LDAP-Generalized-Time-entry into a DateTime-Object - * - * CAVEAT: The DateTime-Object returned will alwasy be set to UTC-Timezone. - * - * @param string $date The generalized-Time - * @param boolean $asUtc Return the DateTime with UTC timezone - * @return DateTime - * @throws InvalidArgumentException if a non-parseable-format is given - */ - public static function fromLdapDateTime($date, $asUtc = true) - { - $datepart = array (); - if (!preg_match('/^(\d{4})/', $date, $datepart) ) { - throw new InvalidArgumentException('Invalid date format found'); - } - - if ($datepart[1] < 4) { - throw new InvalidArgumentException('Invalid date format found (too short)'); - } - - $time = array ( - // The year is mandatory! - 'year' => $datepart[1], - 'month' => 1, - 'day' => 1, - 'hour' => 0, - 'minute' => 0, - 'second' => 0, - 'offdir' => '+', - 'offsethours' => 0, - 'offsetminutes' => 0 - ); - - $length = strlen($date); - - // Check for month. - if ($length >= 6) { - $month = substr($date, 4, 2); - if ($month < 1 || $month > 12) { - throw new InvalidArgumentException('Invalid date format found (invalid month)'); - } - $time['month'] = $month; - } - - // Check for day - if ($length >= 8) { - $day = substr($date, 6, 2); - if ($day < 1 || $day > 31) { - throw new InvalidArgumentException('Invalid date format found (invalid day)'); - } - $time['day'] = $day; - } - - // Check for Hour - if ($length >= 10) { - $hour = substr($date, 8, 2); - if ($hour < 0 || $hour > 23) { - throw new InvalidArgumentException('Invalid date format found (invalid hour)'); - } - $time['hour'] = $hour; - } - - // Check for minute - if ($length >= 12) { - $minute = substr($date, 10, 2); - if ($minute < 0 || $minute > 59) { - throw new InvalidArgumentException('Invalid date format found (invalid minute)'); - } - $time['minute'] = $minute; - } - - // Check for seconds - if ($length >= 14) { - $second = substr($date, 12, 2); - if ($second < 0 || $second > 59) { - throw new InvalidArgumentException('Invalid date format found (invalid second)'); - } - $time['second'] = $second; - } - - // Set Offset - $offsetRegEx = '/([Z\-\+])(\d{2}\'?){0,1}(\d{2}\'?){0,1}$/'; - $off = array (); - if (preg_match($offsetRegEx, $date, $off)) { - $offset = $off[1]; - if ($offset == '+' || $offset == '-') { - $time['offdir'] = $offset; - // we have an offset, so lets calculate it. - if (isset($off[2])) { - $offsetHours = substr($off[2], 0, 2); - if ($offsetHours < 0 || $offsetHours > 12) { - throw new InvalidArgumentException('Invalid date format found (invalid offset hour)'); - } - $time['offsethours'] = $offsetHours; - } - if (isset($off[3])) { - $offsetMinutes = substr($off[3], 0, 2); - if ($offsetMinutes < 0 || $offsetMinutes > 59) { - throw new InvalidArgumentException('Invalid date format found (invalid offset minute)'); - } - $time['offsetminutes'] = $offsetMinutes; - } - } - } - - // Raw-Data is present, so lets create a DateTime-Object from it. - $offset = $time['offdir'] - . str_pad($time['offsethours'],2,'0',STR_PAD_LEFT) - . str_pad($time['offsetminutes'],2,'0',STR_PAD_LEFT); - $timestring = $time['year'] . '-' - . str_pad($time['month'], 2, '0', STR_PAD_LEFT) . '-' - . str_pad($time['day'], 2, '0', STR_PAD_LEFT) . ' ' - . str_pad($time['hour'], 2, '0', STR_PAD_LEFT) . ':' - . str_pad($time['minute'], 2, '0', STR_PAD_LEFT) . ':' - . str_pad($time['second'], 2, '0', STR_PAD_LEFT) - . $time['offdir'] - . str_pad($time['offsethours'], 2, '0', STR_PAD_LEFT) - . str_pad($time['offsetminutes'], 2, '0', STR_PAD_LEFT); - $date = new DateTime($timestring); - if ($asUtc) { - $date->setTimezone(new DateTimeZone('UTC')); - } - return $date; - } - - /** - * Convert an LDAP-compatible boolean value into a PHP-compatible one - * - * @param string $value The value to convert - * @return boolean - * @throws InvalidArgumentException - */ - public static function fromLdapBoolean($value) - { - if ( 'TRUE' === $value ) { - return true; - } else if ( 'FALSE' === $value ) { - return false; - } else { - throw new InvalidArgumentException('The given value is not a boolean value'); - } - } - - /** - * Unserialize a serialized value to return the corresponding object - * - * @param string $value The value to convert - * @return mixed - * @throws UnexpectedValueException - */ - public static function fromLdapUnserialize($value) - { - $v = @unserialize($value); - if (false===$v && $value != 'b:0;') { - throw new UnexpectedValueException('The given value could not be unserialized'); - } - return $v; - } -} diff --git a/library/vendor/Zend/Ldap/Converter/Exception.php b/library/vendor/Zend/Ldap/Converter/Exception.php deleted file mode 100644 index 091018efa..000000000 --- a/library/vendor/Zend/Ldap/Converter/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ -_dn = $dn; - $this->setCaseFold($caseFold); - } - - /** - * Gets the RDN of the current DN - * - * @param string $caseFold - * @return array - * @throws Zend_Ldap_Exception if DN has no RDN (empty array) - */ - public function getRdn($caseFold = null) - { - $caseFold = self::_sanitizeCaseFold($caseFold, $this->_caseFold); - return self::_caseFoldRdn($this->get(0, 1, $caseFold), null); - } - - /** - * Gets the RDN of the current DN as a string - * - * @param string $caseFold - * @return string - * @throws Zend_Ldap_Exception if DN has no RDN (empty array) - */ - public function getRdnString($caseFold = null) - { - $caseFold = self::_sanitizeCaseFold($caseFold, $this->_caseFold); - return self::implodeRdn($this->getRdn(), $caseFold); - } - - /** - * Get the parent DN $levelUp levels up the tree - * - * @param int $levelUp - * @return Zend_Ldap_Dn - */ - public function getParentDn($levelUp = 1) - { - $levelUp = (int)$levelUp; - if ($levelUp < 1 || $levelUp >= count($this->_dn)) { - /** - * Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Cannot retrieve parent DN with given $levelUp'); - } - $newDn = array_slice($this->_dn, $levelUp); - return new self($newDn, $this->_caseFold); - } - - /** - * Get a DN part - * - * @param int $index - * @param int $length - * @param string $caseFold - * @return array - * @throws Zend_Ldap_Exception if index is illegal - */ - public function get($index, $length = 1, $caseFold = null) - { - $caseFold = self::_sanitizeCaseFold($caseFold, $this->_caseFold); - $this->_assertIndex($index); - $length = (int)$length; - if ($length <= 0) { - $length = 1; - } - if ($length === 1) { - return self::_caseFoldRdn($this->_dn[$index], $caseFold); - } - else { - return self::_caseFoldDn(array_slice($this->_dn, $index, $length, false), $caseFold); - } - } - - /** - * Set a DN part - * - * @param int $index - * @param array $value - * @return Zend_Ldap_Dn Provides a fluent interface - * @throws Zend_Ldap_Exception if index is illegal - */ - public function set($index, array $value) - { - $this->_assertIndex($index); - self::_assertRdn($value); - $this->_dn[$index] = $value; - return $this; - } - - /** - * Remove a DN part - * - * @param int $index - * @param int $length - * @return Zend_Ldap_Dn Provides a fluent interface - * @throws Zend_Ldap_Exception if index is illegal - */ - public function remove($index, $length = 1) - { - $this->_assertIndex($index); - $length = (int)$length; - if ($length <= 0) { - $length = 1; - } - array_splice($this->_dn, $index, $length, null); - return $this; - } - - /** - * Append a DN part - * - * @param array $value - * @return Zend_Ldap_Dn Provides a fluent interface - */ - public function append(array $value) - { - self::_assertRdn($value); - $this->_dn[] = $value; - return $this; - } - - /** - * Prepend a DN part - * - * @param array $value - * @return Zend_Ldap_Dn Provides a fluent interface - */ - public function prepend(array $value) - { - self::_assertRdn($value); - array_unshift($this->_dn, $value); - return $this; - } - - /** - * Insert a DN part - * - * @param int $index - * @param array $value - * @return Zend_Ldap_Dn Provides a fluent interface - * @throws Zend_Ldap_Exception if index is illegal - */ - public function insert($index, array $value) - { - $this->_assertIndex($index); - self::_assertRdn($value); - $first = array_slice($this->_dn, 0, $index + 1); - $second = array_slice($this->_dn, $index + 1); - $this->_dn = array_merge($first, array($value), $second); - return $this; - } - - /** - * Assert index is correct and usable - * - * @param mixed $index - * @return boolean - * @throws Zend_Ldap_Exception - */ - protected function _assertIndex($index) - { - if (!is_int($index)) { - /** - * Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Parameter $index must be an integer'); - } - if ($index < 0 || $index >= count($this->_dn)) { - /** - * Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Parameter $index out of bounds'); - } - return true; - } - - /** - * Assert if value is in a correct RDN format - * - * @param array $value - * @return boolean - * @throws Zend_Ldap_Exception - */ - protected static function _assertRdn(array $value) - { - if (count($value)<1) { - /** - * Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'RDN Array is malformed: it must have at least one item'); - } - - foreach (array_keys($value) as $key) { - if (!is_string($key)) { - /** - * Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'RDN Array is malformed: it must use string keys'); - } - } - } - - /** - * Sets the case fold - * - * @param string|null $caseFold - */ - public function setCaseFold($caseFold) - { - $this->_caseFold = self::_sanitizeCaseFold($caseFold, self::$_defaultCaseFold); - } - - /** - * Return DN as a string - * - * @param string $caseFold - * @return string - * @throws Zend_Ldap_Exception - */ - public function toString($caseFold = null) - { - $caseFold = self::_sanitizeCaseFold($caseFold, $this->_caseFold); - return self::implodeDn($this->_dn, $caseFold); - } - - /** - * Return DN as an array - * - * @param string $caseFold - * @return array - */ - public function toArray($caseFold = null) - { - $caseFold = self::_sanitizeCaseFold($caseFold, $this->_caseFold); - - if ($caseFold === self::ATTR_CASEFOLD_NONE) { - return $this->_dn; - } else { - return self::_caseFoldDn($this->_dn, $caseFold); - } - } - - /** - * Do a case folding on a RDN - * - * @param array $part - * @param string $caseFold - * @return array - */ - protected static function _caseFoldRdn(array $part, $caseFold) - { - switch ($caseFold) { - case self::ATTR_CASEFOLD_UPPER: - return array_change_key_case($part, CASE_UPPER); - case self::ATTR_CASEFOLD_LOWER: - return array_change_key_case($part, CASE_LOWER); - case self::ATTR_CASEFOLD_NONE: - default: - return $part; - } - } - - /** - * Do a case folding on a DN ort part of it - * - * @param array $dn - * @param string $caseFold - * @return array - */ - protected static function _caseFoldDn(array $dn, $caseFold) - { - $return = array(); - foreach ($dn as $part) { - $return[] = self::_caseFoldRdn($part, $caseFold); - } - return $return; - } - - /** - * Cast to string representation {@see toString()} - * - * @return string - */ - public function __toString() - { - return $this->toString(); - } - - /** - * Required by the ArrayAccess implementation - * - * @param int $offset - * @return boolean - */ - public function offsetExists($offset) - { - $offset = (int)$offset; - if ($offset < 0 || $offset >= count($this->_dn)) { - return false; - } else { - return true; - } - } - - /** - * Proxy to {@see get()} - * Required by the ArrayAccess implementation - * - * @param int $offset - * @return array - */ - public function offsetGet($offset) - { - return $this->get($offset, 1, null); - } - - /** - * Proxy to {@see set()} - * Required by the ArrayAccess implementation - * - * @param int $offset - * @param array $value - */ - public function offsetSet($offset, $value) - { - $this->set($offset, $value); - } - - /** - * Proxy to {@see remove()} - * Required by the ArrayAccess implementation - * - * @param int $offset - */ - public function offsetUnset($offset) - { - $this->remove($offset, 1); - } - - /** - * Sets the default case fold - * - * @param string $caseFold - */ - public static function setDefaultCaseFold($caseFold) - { - self::$_defaultCaseFold = self::_sanitizeCaseFold($caseFold, self::ATTR_CASEFOLD_NONE); - } - - /** - * Sanitizes the case fold - * - * @param string $caseFold - * @return string - */ - protected static function _sanitizeCaseFold($caseFold, $default) - { - switch ($caseFold) { - case self::ATTR_CASEFOLD_NONE: - case self::ATTR_CASEFOLD_UPPER: - case self::ATTR_CASEFOLD_LOWER: - return $caseFold; - break; - default: - return $default; - break; - } - } - - /** - * Escapes a DN value according to RFC 2253 - * - * Escapes the given VALUES according to RFC 2253 so that they can be safely used in LDAP DNs. - * The characters ",", "+", """, "\", "<", ">", ";", "#", " = " with a special meaning in RFC 2252 - * are preceeded by ba backslash. Control characters with an ASCII code < 32 are represented as \hexpair. - * Finally all leading and trailing spaces are converted to sequences of \20. - * @see Net_LDAP2_Util::escape_dn_value() from Benedikt Hallinger - * @link http://pear.php.net/package/Net_LDAP2 - * @author Benedikt Hallinger - * - * @param string|array $values An array containing the DN values that should be escaped - * @return array The array $values, but escaped - */ - public static function escapeValue($values = array()) - { - /** - * @see Zend_Ldap_Converter - */ - - if (!is_array($values)) $values = array($values); - foreach ($values as $key => $val) { - // Escaping of filter meta characters - $val = str_replace(array('\\', ',', '+', '"', '<', '>', ';', '#', '=', ), - array('\\\\', '\,', '\+', '\"', '\<', '\>', '\;', '\#', '\='), $val); - $val = Zend_Ldap_Converter::ascToHex32($val); - - // Convert all leading and trailing spaces to sequences of \20. - if (preg_match('/^(\s*)(.+?)(\s*)$/', $val, $matches)) { - $val = $matches[2]; - for ($i = 0; $i - * @link http://pear.php.net/package/Net_LDAP2 - * @author Benedikt Hallinger - * - * @param string|array $values Array of DN Values - * @return array Same as $values, but unescaped - */ - public static function unescapeValue($values = array()) - { - /** - * @see Zend_Ldap_Converter - */ - - if (!is_array($values)) $values = array($values); - foreach ($values as $key => $val) { - // strip slashes from special chars - $val = str_replace(array('\\\\', '\,', '\+', '\"', '\<', '\>', '\;', '\#', '\='), - array('\\', ',', '+', '"', '<', '>', ';', '#', '=', ), $val); - $values[$key] = Zend_Ldap_Converter::hex32ToAsc($val); - } - return (count($values) == 1) ? $values[0] : $values; - } - - /** - * Creates an array containing all parts of the given DN. - * - * Array will be of type - * array( - * array("cn" => "name1", "uid" => "user"), - * array("cn" => "name2"), - * array("dc" => "example"), - * array("dc" => "org") - * ) - * for a DN of cn=name1+uid=user,cn=name2,dc=example,dc=org. - * - * @param string $dn - * @param array $keys An optional array to receive DN keys (e.g. CN, OU, DC, ...) - * @param array $vals An optional array to receive DN values - * @param string $caseFold - * @return array - * @throws Zend_Ldap_Exception - */ - public static function explodeDn($dn, array &$keys = null, array &$vals = null, - $caseFold = self::ATTR_CASEFOLD_NONE) - { - $k = array(); - $v = array(); - if (!self::checkDn($dn, $k, $v, $caseFold)) { - /** - * Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'DN is malformed'); - } - $ret = array(); - for ($i = 0; $i < count($k); $i++) { - if (is_array($k[$i]) && is_array($v[$i]) && (count($k[$i]) === count($v[$i]))) { - $multi = array(); - for ($j = 0; $j < count($k[$i]); $j++) { - $key=$k[$i][$j]; - $val=$v[$i][$j]; - $multi[$key] = $val; - } - $ret[] = $multi; - } else if (is_string($k[$i]) && is_string($v[$i])) { - $ret[] = array($k[$i] => $v[$i]); - } - } - if ($keys !== null) $keys = $k; - if ($vals !== null) $vals = $v; - return $ret; - } - - /** - * @param string $dn The DN to parse - * @param array $keys An optional array to receive DN keys (e.g. CN, OU, DC, ...) - * @param array $vals An optional array to receive DN values - * @param string $caseFold - * @return boolean True if the DN was successfully parsed or false if the string is not a valid DN. - */ - public static function checkDn($dn, array &$keys = null, array &$vals = null, - $caseFold = self::ATTR_CASEFOLD_NONE) - { - /* This is a classic state machine parser. Each iteration of the - * loop processes one character. State 1 collects the key. When equals ( = ) - * is encountered the state changes to 2 where the value is collected - * until a comma (,) or semicolon (;) is encountered after which we switch back - * to state 1. If a backslash (\) is encountered, state 3 is used to collect the - * following character without engaging the logic of other states. - */ - $key = null; - $value = null; - $slen = strlen($dn); - $state = 1; - $ko = $vo = 0; - $multi = false; - $ka = array(); - $va = array(); - for ($di = 0; $di <= $slen; $di++) { - $ch = ($di == $slen) ? 0 : $dn[$di]; - switch ($state) { - case 1: // collect key - if ($ch === '=') { - $key = trim(substr($dn, $ko, $di - $ko)); - if ($caseFold == self::ATTR_CASEFOLD_LOWER) $key = strtolower($key); - else if ($caseFold == self::ATTR_CASEFOLD_UPPER) $key = strtoupper($key); - if (is_array($multi)) { - $keyId = strtolower($key); - if (in_array($keyId, $multi)) { - return false; - } - $ka[count($ka)-1][] = $key; - $multi[] = $keyId; - } else { - $ka[] = $key; - } - $state = 2; - $vo = $di + 1; - } else if ($ch === ',' || $ch === ';' || $ch === '+') { - return false; - } - break; - case 2: // collect value - if ($ch === '\\') { - $state = 3; - } else if ($ch === ',' || $ch === ';' || $ch === 0 || $ch === '+') { - $value = self::unescapeValue(trim(substr($dn, $vo, $di - $vo))); - if (is_array($multi)) { - $va[count($va)-1][] = $value; - } else { - $va[] = $value; - } - $state = 1; - $ko = $di + 1; - if ($ch === '+' && $multi === false) { - $lastKey = array_pop($ka); - $lastVal = array_pop($va); - $ka[] = array($lastKey); - $va[] = array($lastVal); - $multi = array(strtolower($lastKey)); - } else if ($ch === ','|| $ch === ';' || $ch === 0) { - $multi = false; - } - } else if ($ch === '=') { - return false; - } - break; - case 3: // escaped - $state = 2; - break; - } - } - - if ($keys !== null) { - $keys = $ka; - } - if ($vals !== null) { - $vals = $va; - } - - return ($state === 1 && $ko > 0); - } - - /** - * Returns a DN part in the form $attribute = $value - * - * This method supports the creation of multi-valued RDNs - * $part must contain an even number of elemets. - * - * @param array $attribute - * @param string $caseFold - * @return string - * @throws Zend_Ldap_Exception - */ - public static function implodeRdn(array $part, $caseFold = null) - { - self::_assertRdn($part); - $part = self::_caseFoldRdn($part, $caseFold); - $rdnParts = array(); - foreach ($part as $key => $value) { - $value = self::escapeValue($value); - $keyId = strtolower($key); - $rdnParts[$keyId] = implode('=', array($key, $value)); - } - ksort($rdnParts, SORT_STRING); - return implode('+', $rdnParts); - } - - /** - * Implodes an array in the form delivered by {@link explodeDn()} - * to a DN string. - * - * $dnArray must be of type - * array( - * array("cn" => "name1", "uid" => "user"), - * array("cn" => "name2"), - * array("dc" => "example"), - * array("dc" => "org") - * ) - * - * @param array $dnArray - * @param string $caseFold - * @param string $separator - * @return string - * @throws Zend_Ldap_Exception - */ - public static function implodeDn(array $dnArray, $caseFold = null, $separator = ',') - { - $parts = array(); - foreach ($dnArray as $p) { - $parts[] = self::implodeRdn($p, $caseFold); - } - return implode($separator, $parts); - } - - /** - * Checks if given $childDn is beneath $parentDn subtree. - * - * @param string|Zend_Ldap_Dn $childDn - * @param string|Zend_Ldap_Dn $parentDn - * @return boolean - */ - public static function isChildOf($childDn, $parentDn) - { - try { - $keys = array(); - $vals = array(); - if ($childDn instanceof Zend_Ldap_Dn) { - $cdn = $childDn->toArray(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER); - } else { - $cdn = self::explodeDn($childDn, $keys, $vals, Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER); - } - if ($parentDn instanceof Zend_Ldap_Dn) { - $pdn = $parentDn->toArray(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER); - } else { - $pdn = self::explodeDn($parentDn, $keys, $vals, Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER); - } - } - catch (Zend_Ldap_Exception $e) { - return false; - } - - $startIndex = count($cdn)-count($pdn); - if ($startIndex<0) return false; - for ($i = 0; $igetLastError($code, $errorMessages) . ': '; - if ($code === 0) { - $message = ''; - $code = $oldCode; - } - } - if (empty($message)) { - if ($code > 0) { - $message = '0x' . dechex($code) . ': '; - } - } - - if (!empty($str)) { - $message .= $str; - } else { - $message .= 'no exception message'; - } - - parent::__construct($message, $code); - } - - - /** - * @deprecated not necessary any more - will be removed - * @param Zend_Ldap $ldap A Zend_Ldap object - * @return int The current error code for the resource - */ - public static function getLdapCode(Zend_Ldap $ldap = null) - { - if ($ldap !== null) { - return $ldap->getLastErrorCode(); - } - return 0; - } - - /** - * @deprecated will be removed - * @return int The current error code for this exception - */ - public function getErrorCode() - { - return $this->getCode(); - } -} diff --git a/library/vendor/Zend/Ldap/Filter.php b/library/vendor/Zend/Ldap/Filter.php deleted file mode 100644 index 01fba8ab0..000000000 --- a/library/vendor/Zend/Ldap/Filter.php +++ /dev/null @@ -1,261 +0,0 @@ -'; - const TYPE_GREATEROREQUAL = '>='; - const TYPE_LESS = '<'; - const TYPE_LESSOREQUAL = '<='; - const TYPE_APPROX = '~='; - - /** - * Creates an 'equals' filter. - * (attr=value) - * - * @param string $attr - * @param string $value - * @return Zend_Ldap_Filter - */ - public static function equals($attr, $value) - { - return new self($attr, $value, self::TYPE_EQUALS, null, null); - } - - /** - * Creates a 'begins with' filter. - * (attr=value*) - * - * @param string $attr - * @param string $value - * @return Zend_Ldap_Filter - */ - public static function begins($attr, $value) - { - return new self($attr, $value, self::TYPE_EQUALS, null, '*'); - } - - /** - * Creates an 'ends with' filter. - * (attr=*value) - * - * @param string $attr - * @param string $value - * @return Zend_Ldap_Filter - */ - public static function ends($attr, $value) - { - return new self($attr, $value, self::TYPE_EQUALS, '*', null); - } - - /** - * Creates a 'contains' filter. - * (attr=*value*) - * - * @param string $attr - * @param string $value - * @return Zend_Ldap_Filter - */ - public static function contains($attr, $value) - { - return new self($attr, $value, self::TYPE_EQUALS, '*', '*'); - } - - /** - * Creates a 'greater' filter. - * (attr>value) - * - * @param string $attr - * @param string $value - * @return Zend_Ldap_Filter - */ - public static function greater($attr, $value) - { - return new self($attr, $value, self::TYPE_GREATER, null, null); - } - - /** - * Creates a 'greater or equal' filter. - * (attr>=value) - * - * @param string $attr - * @param string $value - * @return Zend_Ldap_Filter - */ - public static function greaterOrEqual($attr, $value) - { - return new self($attr, $value, self::TYPE_GREATEROREQUAL, null, null); - } - - /** - * Creates a 'less' filter. - * (attrtoString(); - } - - /** - * Negates the filter. - * - * @return Zend_Ldap_Filter_Abstract - */ - public function negate() - { - /** - * Zend_Ldap_Filter_Not - */ - return new Zend_Ldap_Filter_Not($this); - } - - /** - * Creates an 'and' filter. - * - * @param Zend_Ldap_Filter_Abstract $filter,... - * @return Zend_Ldap_Filter_And - */ - public function addAnd($filter) - { - /** - * Zend_Ldap_Filter_And - */ - $fa = func_get_args(); - $args = array_merge(array($this), $fa); - return new Zend_Ldap_Filter_And($args); - } - - /** - * Creates an 'or' filter. - * - * @param Zend_Ldap_Filter_Abstract $filter,... - * @return Zend_Ldap_Filter_Or - */ - public function addOr($filter) - { - /** - * Zend_Ldap_Filter_Or - */ - $fa = func_get_args(); - $args = array_merge(array($this), $fa); - return new Zend_Ldap_Filter_Or($args); - } - - /** - * Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters. - * - * Any control characters with an ACII code < 32 as well as the characters with special meaning in - * LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a - * backslash followed by two hex digits representing the hexadecimal value of the character. - * @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger - * @link http://pear.php.net/package/Net_LDAP2 - * @author Benedikt Hallinger - * - * @param string|array $values Array of values to escape - * @return array Array $values, but escaped - */ - public static function escapeValue($values = array()) - { - /** - * @see Zend_Ldap_Converter - */ - - if (!is_array($values)) $values = array($values); - foreach ($values as $key => $val) { - // Escaping of filter meta characters - $val = str_replace(array('\\', '*', '(', ')'), array('\5c', '\2a', '\28', '\29'), $val); - // ASCII < 32 escaping - $val = Zend_Ldap_Converter::ascToHex32($val); - if (null === $val) $val = '\0'; // apply escaped "null" if string is empty - $values[$key] = $val; - } - return (count($values) == 1) ? $values[0] : $values; - } - - /** - * Undoes the conversion done by {@link escapeValue()}. - * - * Converts any sequences of a backslash followed by two hex digits into the corresponding character. - * @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger - * @link http://pear.php.net/package/Net_LDAP2 - * @author Benedikt Hallinger - * - * @param string|array $values Array of values to escape - * @return array Array $values, but unescaped - */ - public static function unescapeValue($values = array()) - { - /** - * @see Zend_Ldap_Converter - */ - - if (!is_array($values)) $values = array($values); - foreach ($values as $key => $value) { - // Translate hex code into ascii - $values[$key] = Zend_Ldap_Converter::hex32ToAsc($value); - } - return (count($values) == 1) ? $values[0] : $values; - } -} diff --git a/library/vendor/Zend/Ldap/Filter/And.php b/library/vendor/Zend/Ldap/Filter/And.php deleted file mode 100644 index 4136632f6..000000000 --- a/library/vendor/Zend/Ldap/Filter/And.php +++ /dev/null @@ -1,47 +0,0 @@ - $s) { - if (is_string($s)) $subfilters[$key] = new Zend_Ldap_Filter_String($s); - else if (!($s instanceof Zend_Ldap_Filter_Abstract)) { - /** - * @see Zend_Ldap_Filter_Exception - */ - throw new Zend_Ldap_Filter_Exception('Only strings or Zend_Ldap_Filter_Abstract allowed.'); - } - } - $this->_subfilters = $subfilters; - $this->_symbol = $symbol; - } - - /** - * Adds a filter to this grouping filter. - * - * @param Zend_Ldap_Filter_Abstract $filter - * @return Zend_Ldap_Filter_Logical - */ - public function addFilter(Zend_Ldap_Filter_Abstract $filter) - { - $new = clone $this; - $new->_subfilters[] = $filter; - return $new; - } - - /** - * Returns a string representation of the filter. - * - * @return string - */ - public function toString() - { - $return = '(' . $this->_symbol; - foreach ($this->_subfilters as $sub) $return .= $sub->toString(); - $return .= ')'; - return $return; - } -} diff --git a/library/vendor/Zend/Ldap/Filter/Mask.php b/library/vendor/Zend/Ldap/Filter/Mask.php deleted file mode 100644 index ca57fd4d0..000000000 --- a/library/vendor/Zend/Ldap/Filter/Mask.php +++ /dev/null @@ -1,65 +0,0 @@ -_filter; - } -} diff --git a/library/vendor/Zend/Ldap/Filter/Not.php b/library/vendor/Zend/Ldap/Filter/Not.php deleted file mode 100644 index a45200fea..000000000 --- a/library/vendor/Zend/Ldap/Filter/Not.php +++ /dev/null @@ -1,74 +0,0 @@ -_filter = $filter; - } - - /** - * Negates the filter. - * - * @return Zend_Ldap_Filter_Abstract - */ - public function negate() - { - return $this->_filter; - } - - /** - * Returns a string representation of the filter. - * - * @return string - */ - public function toString() - { - return '(!' . $this->_filter->toString() . ')'; - } -} diff --git a/library/vendor/Zend/Ldap/Filter/Or.php b/library/vendor/Zend/Ldap/Filter/Or.php deleted file mode 100644 index f9c13199a..000000000 --- a/library/vendor/Zend/Ldap/Filter/Or.php +++ /dev/null @@ -1,47 +0,0 @@ -_filter = $filter; - } - - /** - * Returns a string representation of the filter. - * - * @return string - */ - public function toString() - { - return '(' . $this->_filter . ')'; - } -} diff --git a/library/vendor/Zend/Ldap/Ldif/Encoder.php b/library/vendor/Zend/Ldap/Ldif/Encoder.php deleted file mode 100644 index d8e04cb9f..000000000 --- a/library/vendor/Zend/Ldap/Ldif/Encoder.php +++ /dev/null @@ -1,304 +0,0 @@ - true, - 'version' => 1, - 'wrap' => 78 - ); - - /** - * @var boolean - */ - protected $_versionWritten = false; - - /** - * Constructor. - * - * @param array $options Additional options used during encoding - * @return void - */ - protected function __construct(array $options = array()) - { - $this->_options = array_merge($this->_options, $options); - } - - /** - * Decodes the string $string into an array of LDIF items - * - * @param string $string - * @return array - */ - public static function decode($string) - { - $encoder = new self(array()); - return $encoder->_decode($string); - } - - /** - * Decodes the string $string into an array of LDIF items - * - * @param string $string - * @return array - */ - protected function _decode($string) - { - $items = array(); - $item = array(); - $last = null; - foreach (explode("\n", $string) as $line) { - $line = rtrim($line, "\x09\x0A\x0D\x00\x0B"); - $matches = array(); - if (substr($line, 0, 1) === ' ' && $last !== null) { - $last[2] .= substr($line, 1); - } else if (substr($line, 0, 1) === '#') { - continue; - } else if (preg_match('/^([a-z0-9;-]+)(:[:<]?\s*)([^:<]*)$/i', $line, $matches)) { - $name = strtolower($matches[1]); - $type = trim($matches[2]); - $value = $matches[3]; - if ($last !== null) { - $this->_pushAttribute($last, $item); - } - if ($name === 'version') { - continue; - } else if (count($item) > 0 && $name === 'dn') { - $items[] = $item; - $item = array(); - $last = null; - } - $last = array($name, $type, $value); - } else if (trim($line) === '') { - continue; - } - } - if ($last !== null) { - $this->_pushAttribute($last, $item); - } - $items[] = $item; - return (count($items)>1) ? $items : $items[0]; - } - - /** - * Pushes a decoded attribute to the stack - * - * @param array $attribute - * @param array $entry - */ - protected function _pushAttribute(array $attribute, array &$entry) - { - $name = $attribute[0]; - $type = $attribute[1]; - $value = $attribute[2]; - if ($type === '::') { - $value = base64_decode($value); - } - if ($name === 'dn') { - $entry[$name] = $value; - } else if (isset($entry[$name]) && $value !== '') { - $entry[$name][] = $value; - } else { - $entry[$name] = ($value !== '') ? array($value) : array(); - } - } - - /** - * Encode $value into a LDIF representation - * - * @param mixed $value The value to be encoded - * @param array $options Additional options used during encoding - * @return string The encoded value - */ - public static function encode($value, array $options = array()) - { - $encoder = new self($options); - return $encoder->_encode($value); - } - - /** - * Recursive driver which determines the type of value to be encoded - * and then dispatches to the appropriate method. - * - * @param mixed $value The value to be encoded - * @return string Encoded value - */ - protected function _encode($value) - { - if (is_scalar($value)) { - return $this->_encodeString($value); - } else if (is_array($value)) { - return $this->_encodeAttributes($value); - } else if ($value instanceof Zend_Ldap_Node) { - return $value->toLdif($this->_options); - } - return null; - } - - /** - * Encodes $string according to RFC2849 - * - * @link http://www.faqs.org/rfcs/rfc2849.html - * - * @param string $string - * @param boolen $base64 - * @return string - */ - protected function _encodeString($string, &$base64 = null) - { - $string = (string)$string; - if (!is_numeric($string) && empty($string)) { - return ''; - } - - /* - * SAFE-INIT-CHAR = %x01-09 / %x0B-0C / %x0E-1F / - * %x21-39 / %x3B / %x3D-7F - * ; any value <= 127 except NUL, LF, CR, - * ; SPACE, colon (":", ASCII 58 decimal) - * ; and less-than ("<" , ASCII 60 decimal) - * - */ - $unsafe_init_char = array(0, 10, 13, 32, 58, 60); - /* - * SAFE-CHAR = %x01-09 / %x0B-0C / %x0E-7F - * ; any value <= 127 decimal except NUL, LF, - * ; and CR - */ - $unsafe_char = array(0, 10, 13); - - $base64 = false; - for ($i = 0; $i < strlen($string); $i++) { - $char = ord(substr($string, $i, 1)); - if ($char >= 127) { - $base64 = true; - break; - } else if ($i === 0 && in_array($char, $unsafe_init_char)) { - $base64 = true; - break; - } else if (in_array($char, $unsafe_char)) { - $base64 = true; - break; - } - } - // Test for ending space - if (substr($string, -1) == ' ') { - $base64 = true; - } - - if ($base64 === true) { - $string = base64_encode($string); - } - - return $string; - } - - /** - * Encodes an attribute with $name and $value according to RFC2849 - * - * @link http://www.faqs.org/rfcs/rfc2849.html - * - * @param string $name - * @param array|string $value - * @return string - */ - protected function _encodeAttribute($name, $value) - { - if (!is_array($value)) { - $value = array($value); - } - - $output = ''; - - if (count($value) < 1) { - return $name . ': '; - } - - foreach ($value as $v) { - $base64 = null; - $v = $this->_encodeString($v, $base64); - $attribute = $name . ':'; - if ($base64 === true) { - $attribute .= ': ' . $v; - } else { - $attribute .= ' ' . $v; - } - if (isset($this->_options['wrap']) && strlen($attribute) > $this->_options['wrap']) { - $attribute = trim(chunk_split($attribute, $this->_options['wrap'], PHP_EOL . ' ')); - } - $output .= $attribute . PHP_EOL; - } - return trim($output, PHP_EOL); - } - - /** - * Encodes a collection of attributes according to RFC2849 - * - * @link http://www.faqs.org/rfcs/rfc2849.html - * - * @param array $attributes - * @return string - */ - protected function _encodeAttributes(array $attributes) - { - $string = ''; - $attributes = array_change_key_case($attributes, CASE_LOWER); - if (!$this->_versionWritten && array_key_exists('dn', $attributes) && isset($this->_options['version']) - && array_key_exists('objectclass', $attributes)) { - $string .= sprintf('version: %d', $this->_options['version']) . PHP_EOL; - $this->_versionWritten = true; - } - - if (isset($this->_options['sort']) && $this->_options['sort'] === true) { - ksort($attributes, SORT_STRING); - if (array_key_exists('objectclass', $attributes)) { - $oc = $attributes['objectclass']; - unset($attributes['objectclass']); - $attributes = array_merge(array('objectclass' => $oc), $attributes); - } - if (array_key_exists('dn', $attributes)) { - $dn = $attributes['dn']; - unset($attributes['dn']); - $attributes = array_merge(array('dn' => $dn), $attributes); - } - } - foreach ($attributes as $key => $value) { - $string .= $this->_encodeAttribute($key, $value) . PHP_EOL; - } - return trim($string, PHP_EOL); - } -} diff --git a/library/vendor/Zend/Ldap/Node.php b/library/vendor/Zend/Ldap/Node.php deleted file mode 100644 index 350b6f786..000000000 --- a/library/vendor/Zend/Ldap/Node.php +++ /dev/null @@ -1,1170 +0,0 @@ -attachLdap($ldap); - else $this->detachLdap(); - } - - /** - * Serialization callback - * - * Only DN and attributes will be serialized. - * - * @return array - */ - public function __sleep() - { - return array('_dn', '_currentData', '_newDn', '_originalData', - '_new', '_delete', '_children'); - } - - /** - * Deserialization callback - * - * Enforces a detached node. - * - * @return null - */ - public function __wakeup() - { - $this->detachLdap(); - } - - /** - * Gets the current LDAP connection. - * - * @return Zend_Ldap - * @throws Zend_Ldap_Exception - */ - public function getLdap() - { - if ($this->_ldap === null) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'No LDAP connection specified.', Zend_Ldap_Exception::LDAP_OTHER); - } - else return $this->_ldap; - } - - /** - * Attach node to an LDAP connection - * - * This is an offline method. - * - * @uses Zend_Ldap_Dn::isChildOf() - * @param Zend_Ldap $ldap - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function attachLdap(Zend_Ldap $ldap) - { - if (!Zend_Ldap_Dn::isChildOf($this->_getDn(), $ldap->getBaseDn())) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'LDAP connection is not responsible for given node.', - Zend_Ldap_Exception::LDAP_OTHER); - } - - if ($ldap !== $this->_ldap) { - $this->_ldap = $ldap; - if (is_array($this->_children)) { - foreach ($this->_children as $child) { - /* @var Zend_Ldap_Node $child */ - $child->attachLdap($ldap); - } - } - } - return $this; - } - - /** - * Detach node from LDAP connection - * - * This is an offline method. - * - * @return Zend_Ldap_Node Provides a fluent interface - */ - public function detachLdap() - { - $this->_ldap = null; - if (is_array($this->_children)) { - foreach ($this->_children as $child) { - /* @var Zend_Ldap_Node $child */ - $child->detachLdap(); - } - } - return $this; - } - - /** - * Checks if the current node is attached to a LDAP server. - * - * This is an offline method. - * - * @return boolean - */ - public function isAttached() - { - return ($this->_ldap !== null); - } - - /** - * @param array $data - * @param boolean $fromDataSource - * @throws Zend_Ldap_Exception - */ - protected function _loadData(array $data, $fromDataSource) - { - parent::_loadData($data, $fromDataSource); - if ($fromDataSource === true) { - $this->_originalData = $data; - } else { - $this->_originalData = array(); - } - $this->_children = null; - $this->_markAsNew(($fromDataSource === true) ? false : true); - $this->_markAsToBeDeleted(false); - } - - /** - * Factory method to create a new detached Zend_Ldap_Node for a given DN. - * - * @param string|array|Zend_Ldap_Dn $dn - * @param array $objectClass - * @return Zend_Ldap_Node - * @throws Zend_Ldap_Exception - */ - public static function create($dn, array $objectClass = array()) - { - if (is_string($dn) || is_array($dn)) { - $dn = Zend_Ldap_Dn::factory($dn); - } else if ($dn instanceof Zend_Ldap_Dn) { - $dn = clone $dn; - } else { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, '$dn is of a wrong data type.'); - } - $new = new self($dn, array(), false, null); - $new->_ensureRdnAttributeValues(); - $new->setAttribute('objectClass', $objectClass); - return $new; - } - - /** - * Factory method to create an attached Zend_Ldap_Node for a given DN. - * - * @param string|array|Zend_Ldap_Dn $dn - * @param Zend_Ldap $ldap - * @return Zend_Ldap_Node|null - * @throws Zend_Ldap_Exception - */ - public static function fromLdap($dn, Zend_Ldap $ldap) - { - if (is_string($dn) || is_array($dn)) { - $dn = Zend_Ldap_Dn::factory($dn); - } else if ($dn instanceof Zend_Ldap_Dn) { - $dn = clone $dn; - } else { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, '$dn is of a wrong data type.'); - } - $data = $ldap->getEntry($dn, array('*', '+'), true); - if ($data === null) { - return null; - } - $entry = new self($dn, $data, true, $ldap); - return $entry; - } - - /** - * Factory method to create a detached Zend_Ldap_Node from array data. - * - * @param array $data - * @param boolean $fromDataSource - * @return Zend_Ldap_Node - * @throws Zend_Ldap_Exception - */ - public static function fromArray(array $data, $fromDataSource = false) - { - if (!array_key_exists('dn', $data)) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, '\'dn\' key is missing in array.'); - } - if (is_string($data['dn']) || is_array($data['dn'])) { - $dn = Zend_Ldap_Dn::factory($data['dn']); - } else if ($data['dn'] instanceof Zend_Ldap_Dn) { - $dn = clone $data['dn']; - } else { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, '\'dn\' key is of a wrong data type.'); - } - $fromDataSource = ($fromDataSource === true) ? true : false; - $new = new self($dn, $data, $fromDataSource, null); - $new->_ensureRdnAttributeValues(); - return $new; - } - - /** - * Ensures that teh RDN attributes are correctly set. - * - * @param boolean $overwrite True to overwrite the RDN attributes - * @return void - */ - protected function _ensureRdnAttributeValues($overwrite = false) - { - foreach ($this->getRdnArray() as $key => $value) { - if (!array_key_exists($key, $this->_currentData) || $overwrite) { - Zend_Ldap_Attribute::setAttribute($this->_currentData, $key, $value, false); - } else if (!in_array($value, $this->_currentData[$key])) { - Zend_Ldap_Attribute::setAttribute($this->_currentData, $key, $value, true); - } - } - } - - /** - * Marks this node as new. - * - * Node will be added (instead of updated) on calling update() if $new is true. - * - * @param boolean $new - */ - protected function _markAsNew($new) - { - $this->_new = ($new === false) ? false : true; - } - - /** - * Tells if the node is consiedered as new (not present on the server) - * - * Please note, that this doesn't tell you if the node is present on the server. - * Use {@link exits()} to see if a node is already there. - * - * @return boolean - */ - public function isNew() - { - return $this->_new; - } - - /** - * Marks this node as to be deleted. - * - * Node will be deleted on calling update() if $delete is true. - * - * @param boolean $delete - */ - protected function _markAsToBeDeleted($delete) - { - $this->_delete = ($delete === true) ? true : false; - } - - - /** - * Is this node going to be deleted once update() is called? - * - * @return boolean - */ - public function willBeDeleted() - { - return $this->_delete; - } - - /** - * Marks this node as to be deleted - * - * Node will be deleted on calling update() if $delete is true. - * - * @return Zend_Ldap_Node Provides a fluent interface - */ - public function delete() - { - $this->_markAsToBeDeleted(true); - return $this; - } - - /** - * Is this node going to be moved once update() is called? - * - * @return boolean - */ - public function willBeMoved() - { - if ($this->isNew() || $this->willBeDeleted()) { - return false; - } else if ($this->_newDn !== null) { - return ($this->_dn != $this->_newDn); - } else { - return false; - } - } - - /** - * Sends all pending changes to the LDAP server - * - * @param Zend_Ldap $ldap - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function update(Zend_Ldap $ldap = null) - { - if ($ldap !== null) { - $this->attachLdap($ldap); - } - $ldap = $this->getLdap(); - if (!($ldap instanceof Zend_Ldap)) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'No LDAP connection available'); - } - - if ($this->willBeDeleted()) { - if ($ldap->exists($this->_dn)) { - $this->_preDelete(); - $ldap->delete($this->_dn); - $this->_postDelete(); - } - return $this; - } - - if ($this->isNew()) { - $this->_preAdd(); - $data = $this->getData(); - $ldap->add($this->_getDn(), $data); - $this->_loadData($data, true); - $this->_postAdd(); - return $this; - } - - $changedData = $this->getChangedData(); - if ($this->willBeMoved()) { - $this->_preRename(); - $recursive = $this->hasChildren(); - $ldap->rename($this->_dn, $this->_newDn, $recursive, false); - foreach ($this->_newDn->getRdn() as $key => $value) { - if (array_key_exists($key, $changedData)) { - unset($changedData[$key]); - } - } - $this->_dn = $this->_newDn; - $this->_newDn = null; - $this->_postRename(); - } - if (count($changedData) > 0) { - $this->_preUpdate(); - $ldap->update($this->_getDn(), $changedData); - $this->_postUpdate(); - } - $this->_originalData = $this->_currentData; - return $this; - } - - /** - * Gets the DN of the current node as a Zend_Ldap_Dn. - * - * This is an offline method. - * - * @return Zend_Ldap_Dn - */ - protected function _getDn() - { - return ($this->_newDn === null) ? parent::_getDn() : $this->_newDn; - } - - /** - * Gets the current DN of the current node as a Zend_Ldap_Dn. - * The method returns a clone of the node's DN to prohibit modification. - * - * This is an offline method. - * - * @return Zend_Ldap_Dn - */ - public function getCurrentDn() - { - $dn = clone parent::_getDn(); - return $dn; - } - - /** - * Sets the new DN for this node - * - * This is an offline method. - * - * @param Zend_Ldap_Dn|string|array $newDn - * @throws Zend_Ldap_Exception - * @return Zend_Ldap_Node Provides a fluent interface - */ - public function setDn($newDn) - { - if ($newDn instanceof Zend_Ldap_Dn) { - $this->_newDn = clone $newDn; - } else { - $this->_newDn = Zend_Ldap_Dn::factory($newDn); - } - $this->_ensureRdnAttributeValues(true); - return $this; - } - - /** - * {@see setDn()} - * - * This is an offline method. - * - * @param Zend_Ldap_Dn|string|array $newDn - * @throws Zend_Ldap_Exception - * @return Zend_Ldap_Node Provides a fluent interface - */ - public function move($newDn) - { - return $this->setDn($newDn); - } - - /** - * {@see setDn()} - * - * This is an offline method. - * - * @param Zend_Ldap_Dn|string|array $newDn - * @throws Zend_Ldap_Exception - * @return Zend_Ldap_Node Provides a fluent interface - */ - public function rename($newDn) - { - return $this->setDn($newDn); - } - - /** - * Sets the objectClass. - * - * This is an offline method. - * - * @param array|string $value - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function setObjectClass($value) - { - $this->setAttribute('objectClass', $value); - return $this; - } - - /** - * Appends to the objectClass. - * - * This is an offline method. - * - * @param array|string $value - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function appendObjectClass($value) - { - $this->appendToAttribute('objectClass', $value); - return $this; - } - - /** - * Returns a LDIF representation of the current node - * - * @param array $options Additional options used during encoding - * @return string - */ - public function toLdif(array $options = array()) - { - $attributes = array_merge(array('dn' => $this->getDnString()), $this->getData(false)); - /** - * Zend_Ldap_Ldif_Encoder - */ - return Zend_Ldap_Ldif_Encoder::encode($attributes, $options); - } - - /** - * Gets changed node data. - * - * The array contains all changed attributes. - * This format can be used in {@link Zend_Ldap::add()} and {@link Zend_Ldap::update()}. - * - * This is an offline method. - * - * @return array - */ - public function getChangedData() - { - $changed = array(); - foreach ($this->_currentData as $key => $value) { - if (!array_key_exists($key, $this->_originalData) && !empty($value)) { - $changed[$key] = $value; - } else if ($this->_originalData[$key] !== $this->_currentData[$key]) { - $changed[$key] = $value; - } - } - return $changed; - } - - /** - * Returns all changes made. - * - * This is an offline method. - * - * @return array - */ - public function getChanges() - { - $changes = array( - 'add' => array(), - 'delete' => array(), - 'replace' => array()); - foreach ($this->_currentData as $key => $value) { - if (!array_key_exists($key, $this->_originalData) && !empty($value)) { - $changes['add'][$key] = $value; - } else if (count($this->_originalData[$key]) === 0 && !empty($value)) { - $changes['add'][$key] = $value; - } else if ($this->_originalData[$key] !== $this->_currentData[$key]) { - if (empty($value)) { - $changes['delete'][$key] = $value; - } else { - $changes['replace'][$key] = $value; - } - } - } - return $changes; - } - - /** - * Sets a LDAP attribute. - * - * This is an offline method. - * - * @param string $name - * @param mixed $value - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function setAttribute($name, $value) - { - $this->_setAttribute($name, $value, false); - return $this; - } - - /** - * Appends to a LDAP attribute. - * - * This is an offline method. - * - * @param string $name - * @param mixed $value - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function appendToAttribute($name, $value) - { - $this->_setAttribute($name, $value, true); - return $this; - } - - /** - * Checks if the attribute can be set and sets it accordingly. - * - * @param string $name - * @param mixed $value - * @param boolean $append - * @throws Zend_Ldap_Exception - */ - protected function _setAttribute($name, $value, $append) - { - $this->_assertChangeableAttribute($name); - Zend_Ldap_Attribute::setAttribute($this->_currentData, $name, $value, $append); - } - - /** - * Sets a LDAP date/time attribute. - * - * This is an offline method. - * - * @param string $name - * @param integer|array $value - * @param boolean $utc - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function setDateTimeAttribute($name, $value, $utc = false) - { - $this->_setDateTimeAttribute($name, $value, $utc, false); - return $this; - } - - /** - * Appends to a LDAP date/time attribute. - * - * This is an offline method. - * - * @param string $name - * @param integer|array $value - * @param boolean $utc - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function appendToDateTimeAttribute($name, $value, $utc = false) - { - $this->_setDateTimeAttribute($name, $value, $utc, true); - return $this; - } - - /** - * Checks if the attribute can be set and sets it accordingly. - * - * @param string $name - * @param integer|array $value - * @param boolean $utc - * @param boolean $append - * @throws Zend_Ldap_Exception - */ - protected function _setDateTimeAttribute($name, $value, $utc, $append) - { - $this->_assertChangeableAttribute($name); - Zend_Ldap_Attribute::setDateTimeAttribute($this->_currentData, $name, $value, $utc, $append); - } - - /** - * Sets a LDAP password. - * - * @param string $password - * @param string $hashType - * @param string $attribName - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function setPasswordAttribute($password, $hashType = Zend_Ldap_Attribute::PASSWORD_HASH_MD5, - $attribName = 'userPassword') - { - $this->_assertChangeableAttribute($attribName); - Zend_Ldap_Attribute::setPassword($this->_currentData, $password, $hashType, $attribName); - return $this; - } - - /** - * Deletes a LDAP attribute. - * - * This method deletes the attribute. - * - * This is an offline method. - * - * @param string $name - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function deleteAttribute($name) - { - if ($this->existsAttribute($name, true)) { - $this->_setAttribute($name, null, false); - } - return $this; - } - - /** - * Removes duplicate values from a LDAP attribute - * - * @param string $attribName - * @return void - */ - public function removeDuplicatesFromAttribute($attribName) - { - Zend_Ldap_Attribute::removeDuplicatesFromAttribute($this->_currentData, $attribName); - } - - /** - * Remove given values from a LDAP attribute - * - * @param string $attribName - * @param mixed|array $value - * @return void - */ - public function removeFromAttribute($attribName, $value) - { - Zend_Ldap_Attribute::removeFromAttribute($this->_currentData, $attribName, $value); - } - - /** - * @param string $name - * @return boolean - * @throws Zend_Ldap_Exception - */ - protected function _assertChangeableAttribute($name) - { - $name = strtolower($name); - $rdn = $this->getRdnArray(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER); - if ($name == 'dn') { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'DN cannot be changed.'); - } - else if (array_key_exists($name, $rdn)) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Cannot change attribute because it\'s part of the RDN'); - } else if (in_array($name, self::$_systemAttributes)) { - /** - * @see Zend_Ldap_Exception - */ - throw new Zend_Ldap_Exception(null, 'Cannot change attribute because it\'s read-only'); - } - else return true; - } - - /** - * Sets a LDAP attribute. - * - * This is an offline method. - * - * @param string $name - * @param mixed $value - * @return null - * @throws Zend_Ldap_Exception - */ - public function __set($name, $value) - { - $this->setAttribute($name, $value); - } - - /** - * Deletes a LDAP attribute. - * - * This method deletes the attribute. - * - * This is an offline method. - * - * @param string $name - * @return null - * @throws Zend_Ldap_Exception - */ - public function __unset($name) - { - $this->deleteAttribute($name); - } - - /** - * Sets a LDAP attribute. - * Implements ArrayAccess. - * - * This is an offline method. - * - * @param string $name - * @param mixed $value - * @return null - * @throws Zend_Ldap_Exception - */ - public function offsetSet($name, $value) - { - $this->setAttribute($name, $value); - } - - /** - * Deletes a LDAP attribute. - * Implements ArrayAccess. - * - * This method deletes the attribute. - * - * This is an offline method. - * - * @param string $name - * @return null - * @throws Zend_Ldap_Exception - */ - public function offsetUnset($name) - { - $this->deleteAttribute($name); - } - - /** - * Check if node exists on LDAP. - * - * This is an online method. - * - * @param Zend_Ldap $ldap - * @return boolean - * @throws Zend_Ldap_Exception - */ - public function exists(Zend_Ldap $ldap = null) - { - if ($ldap !== null) { - $this->attachLdap($ldap); - } - $ldap = $this->getLdap(); - return $ldap->exists($this->_getDn()); - } - - /** - * Reload node attributes from LDAP. - * - * This is an online method. - * - * @param Zend_Ldap $ldap - * @return Zend_Ldap_Node Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function reload(Zend_Ldap $ldap = null) - { - if ($ldap !== null) { - $this->attachLdap($ldap); - } - $ldap = $this->getLdap(); - parent::reload($ldap); - return $this; - } - - /** - * Search current subtree with given options. - * - * This is an online method. - * - * @param string|Zend_Ldap_Filter_Abstract $filter - * @param integer $scope - * @param string $sort - * @return Zend_Ldap_Node_Collection - * @throws Zend_Ldap_Exception - */ - public function searchSubtree($filter, $scope = Zend_Ldap::SEARCH_SCOPE_SUB, $sort = null) - { - /** - * @see Zend_Ldap_Node_Collection - */ - return $this->getLdap()->search($filter, $this->_getDn(), $scope, array('*', '+'), $sort, - 'Zend_Ldap_Node_Collection'); - } - - /** - * Count items in current subtree found by given filter. - * - * This is an online method. - * - * @param string|Zend_Ldap_Filter_Abstract $filter - * @param integer $scope - * @return integer - * @throws Zend_Ldap_Exception - */ - public function countSubtree($filter, $scope = Zend_Ldap::SEARCH_SCOPE_SUB) - { - return $this->getLdap()->count($filter, $this->_getDn(), $scope); - } - - /** - * Count children of current node. - * - * This is an online method. - * - * @return integer - * @throws Zend_Ldap_Exception - */ - public function countChildren() - { - return $this->countSubtree('(objectClass=*)', Zend_Ldap::SEARCH_SCOPE_ONE); - } - - /** - * Gets children of current node. - * - * This is an online method. - * - * @param string|Zend_Ldap_Filter_Abstract $filter - * @param string $sort - * @return Zend_Ldap_Node_Collection - * @throws Zend_Ldap_Exception - */ - public function searchChildren($filter, $sort = null) - { - return $this->searchSubtree($filter, Zend_Ldap::SEARCH_SCOPE_ONE, $sort); - } - - /** - * Checks if current node has children. - * Returns whether the current element has children. - * - * Can be used offline but returns false if children have not been retrieved yet. - * - * @return boolean - * @throws Zend_Ldap_Exception - */ - public function hasChildren() - { - if (!is_array($this->_children)) { - if ($this->isAttached()) { - return ($this->countChildren() > 0); - } else { - return false; - } - } else { - return (count($this->_children) > 0); - } - } - - /** - * Returns the children for the current node. - * - * Can be used offline but returns an empty array if children have not been retrieved yet. - * - * @return Zend_Ldap_Node_ChildrenIterator - * @throws Zend_Ldap_Exception - */ - public function getChildren() - { - if (!is_array($this->_children)) { - $this->_children = array(); - if ($this->isAttached()) { - $children = $this->searchChildren('(objectClass=*)', null); - foreach ($children as $child) { - /* @var Zend_Ldap_Node $child */ - $this->_children[$child->getRdnString(Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER)] = $child; - } - } - } - /** - * @see Zend_Ldap_Node_ChildrenIterator - */ - return new Zend_Ldap_Node_ChildrenIterator($this->_children); - } - - /** - * Returns the parent of the current node. - * - * @param Zend_Ldap $ldap - * @return Zend_Ldap_Node - * @throws Zend_Ldap_Exception - */ - public function getParent(Zend_Ldap $ldap = null) - { - if ($ldap !== null) { - $this->attachLdap($ldap); - } - $ldap = $this->getLdap(); - $parentDn = $this->_getDn()->getParentDn(1); - return self::fromLdap($parentDn, $ldap); - } - - /** - * Return the current attribute. - * Implements Iterator - * - * @return array - */ - public function current() - { - return $this; - } - - /** - * Return the attribute name. - * Implements Iterator - * - * @return string - */ - public function key() - { - return $this->getRdnString(); - } - - /** - * Move forward to next attribute. - * Implements Iterator - */ - public function next() - { - $this->_iteratorRewind = false; - } - - /** - * Rewind the Iterator to the first attribute. - * Implements Iterator - */ - public function rewind() - { - $this->_iteratorRewind = true; - } - - /** - * Check if there is a current attribute - * after calls to rewind() or next(). - * Implements Iterator - * - * @return boolean - */ - public function valid() - { - return $this->_iteratorRewind; - } - - #################################################### - # Empty method bodies for overriding in subclasses # - #################################################### - - /** - * Allows pre-delete logic to be applied to node. - * Subclasses may override this method. - * - * @return void - */ - protected function _preDelete() { } - - /** - * Allows post-delete logic to be applied to node. - * Subclasses may override this method. - * - * @return void - */ - protected function _postDelete() { } - - /** - * Allows pre-add logic to be applied to node. - * Subclasses may override this method. - * - * @return void - */ - protected function _preAdd() { } - - /** - * Allows post-add logic to be applied to node. - * Subclasses may override this method. - * - * @return void - */ - protected function _postAdd() { } - - /** - * Allows pre-rename logic to be applied to node. - * Subclasses may override this method. - * - * @return void - */ - protected function _preRename() { } - - /** - * Allows post-rename logic to be applied to node. - * Subclasses may override this method. - * - * @return void - */ - protected function _postRename() { } - - /** - * Allows pre-update logic to be applied to node. - * Subclasses may override this method. - * - * @return void - */ - protected function _preUpdate() { } - - /** - * Allows post-update logic to be applied to node. - * Subclasses may override this method. - * - * @return void - */ - protected function _postUpdate() { } -} diff --git a/library/vendor/Zend/Ldap/Node/Abstract.php b/library/vendor/Zend/Ldap/Node/Abstract.php deleted file mode 100644 index 85d13b859..000000000 --- a/library/vendor/Zend/Ldap/Node/Abstract.php +++ /dev/null @@ -1,483 +0,0 @@ -_dn = $dn; - $this->_loadData($data, $fromDataSource); - } - - /** - * @param array $data - * @param boolean $fromDataSource - * @throws Zend_Ldap_Exception - */ - protected function _loadData(array $data, $fromDataSource) - { - if (array_key_exists('dn', $data)) { - unset($data['dn']); - } - ksort($data, SORT_STRING); - $this->_currentData = $data; - } - - /** - * Reload node attributes from LDAP. - * - * This is an online method. - * - * @param Zend_Ldap $ldap - * @return Zend_Ldap_Node_Abstract Provides a fluent interface - * @throws Zend_Ldap_Exception - */ - public function reload(Zend_Ldap $ldap = null) - { - if ($ldap !== null) { - $data = $ldap->getEntry($this->_getDn(), array('*', '+'), true); - $this->_loadData($data, true); - } - return $this; - } - - /** - * Gets the DN of the current node as a Zend_Ldap_Dn. - * - * This is an offline method. - * - * @return Zend_Ldap_Dn - */ - protected function _getDn() - { - return $this->_dn; - } - - /** - * Gets the DN of the current node as a Zend_Ldap_Dn. - * The method returns a clone of the node's DN to prohibit modification. - * - * This is an offline method. - * - * @return Zend_Ldap_Dn - */ - public function getDn() - { - $dn = clone $this->_getDn(); - return $dn; - } - - /** - * Gets the DN of the current node as a string. - * - * This is an offline method. - * - * @param string $caseFold - * @return string - */ - public function getDnString($caseFold = null) - { - return $this->_getDn()->toString($caseFold); - } - - /** - * Gets the DN of the current node as an array. - * - * This is an offline method. - * - * @param string $caseFold - * @return array - */ - public function getDnArray($caseFold = null) - { - return $this->_getDn()->toArray($caseFold); - } - - /** - * Gets the RDN of the current node as a string. - * - * This is an offline method. - * - * @param string $caseFold - * @return string - */ - public function getRdnString($caseFold = null) - { - return $this->_getDn()->getRdnString($caseFold); - } - - /** - * Gets the RDN of the current node as an array. - * - * This is an offline method. - * - * @param string $caseFold - * @return array - */ - public function getRdnArray($caseFold = null) - { - return $this->_getDn()->getRdn($caseFold); - } - - /** - * Gets the objectClass of the node - * - * @return array - */ - public function getObjectClass() - { - return $this->getAttribute('objectClass', null); - } - - /** - * Gets all attributes of node. - * - * The collection contains all attributes. - * - * This is an offline method. - * - * @param boolean $includeSystemAttributes - * @return array - */ - public function getAttributes($includeSystemAttributes = true) - { - $data = array(); - foreach ($this->getData($includeSystemAttributes) as $name => $value) { - $data[$name] = $this->getAttribute($name, null); - } - return $data; - } - - /** - * Returns the DN of the current node. {@see getDnString()} - * - * @return string - */ - public function toString() - { - return $this->getDnString(); - } - - /** - * Cast to string representation {@see toString()} - * - * @return string - */ - public function __toString() - { - return $this->toString(); - } - - /** - * Returns an array representation of the current node - * - * @param boolean $includeSystemAttributes - * @return array - */ - public function toArray($includeSystemAttributes = true) - { - $attributes = $this->getAttributes($includeSystemAttributes); - return array_merge(array('dn' => $this->getDnString()), $attributes); - } - - /** - * Returns a JSON representation of the current node - * - * @param boolean $includeSystemAttributes - * @return string - */ - public function toJson($includeSystemAttributes = true) - { - return json_encode($this->toArray($includeSystemAttributes)); - } - - /** - * Gets node attributes. - * - * The array contains all attributes in its internal format (no conversion). - * - * This is an offline method. - * - * @param boolean $includeSystemAttributes - * @return array - */ - public function getData($includeSystemAttributes = true) - { - if ($includeSystemAttributes === false) { - $data = array(); - foreach ($this->_currentData as $key => $value) { - if (!in_array($key, self::$_systemAttributes)) { - $data[$key] = $value; - } - } - return $data; - } else { - return $this->_currentData; - } - } - - /** - * Checks whether a given attribute exists. - * - * If $emptyExists is false empty attributes (containing only array()) are - * treated as non-existent returning false. - * If $emptyExists is true empty attributes are treated as existent returning - * true. In this case method returns false only if the attribute name is - * missing in the key-collection. - * - * @param string $name - * @param boolean $emptyExists - * @return boolean - */ - public function existsAttribute($name, $emptyExists = false) - { - $name = strtolower($name); - if (isset($this->_currentData[$name])) { - if ($emptyExists) return true; - return count($this->_currentData[$name])>0; - } - else return false; - } - - /** - * Checks if the given value(s) exist in the attribute - * - * @param string $attribName - * @param mixed|array $value - * @return boolean - */ - public function attributeHasValue($attribName, $value) - { - return Zend_Ldap_Attribute::attributeHasValue($this->_currentData, $attribName, $value); - } - - /** - * Gets a LDAP attribute. - * - * This is an offline method. - * - * @param string $name - * @param integer $index - * @return mixed - * @throws Zend_Ldap_Exception - */ - public function getAttribute($name, $index = null) - { - if ($name == 'dn') { - return $this->getDnString(); - } - else { - return Zend_Ldap_Attribute::getAttribute($this->_currentData, $name, $index); - } - } - - /** - * Gets a LDAP date/time attribute. - * - * This is an offline method. - * - * @param string $name - * @param integer $index - * @return array|integer - * @throws Zend_Ldap_Exception - */ - public function getDateTimeAttribute($name, $index = null) - { - return Zend_Ldap_Attribute::getDateTimeAttribute($this->_currentData, $name, $index); - } - - /** - * Sets a LDAP attribute. - * - * This is an offline method. - * - * @param string $name - * @param mixed $value - * @return null - * @throws BadMethodCallException - */ - public function __set($name, $value) - { - throw new BadMethodCallException(); - } - - /** - * Gets a LDAP attribute. - * - * This is an offline method. - * - * @param string $name - * @return array - * @throws Zend_Ldap_Exception - */ - public function __get($name) - { - return $this->getAttribute($name, null); - } - - /** - * Deletes a LDAP attribute. - * - * This method deletes the attribute. - * - * This is an offline method. - * - * @param string $name - * @return null - * @throws BadMethodCallException - */ - public function __unset($name) - { - throw new BadMethodCallException(); - } - - /** - * Checks whether a given attribute exists. - * - * Empty attributes will be treated as non-existent. - * - * @param string $name - * @return boolean - */ - public function __isset($name) - { - return $this->existsAttribute($name, false); - } - - /** - * Sets a LDAP attribute. - * Implements ArrayAccess. - * - * This is an offline method. - * - * @param string $name - * @param mixed $value - * @return null - * @throws BadMethodCallException - */ - public function offsetSet($name, $value) - { - throw new BadMethodCallException(); - } - - /** - * Gets a LDAP attribute. - * Implements ArrayAccess. - * - * This is an offline method. - * - * @param string $name - * @return array - * @throws Zend_Ldap_Exception - */ - public function offsetGet($name) - { - return $this->getAttribute($name, null); - } - - /** - * Deletes a LDAP attribute. - * Implements ArrayAccess. - * - * This method deletes the attribute. - * - * This is an offline method. - * - * @param string $name - * @return null - * @throws BadMethodCallException - */ - public function offsetUnset($name) - { - throw new BadMethodCallException(); - } - - /** - * Checks whether a given attribute exists. - * Implements ArrayAccess. - * - * Empty attributes will be treated as non-existent. - * - * @param string $name - * @return boolean - */ - public function offsetExists($name) - { - return $this->existsAttribute($name, false); - } - - /** - * Returns the number of attributes in node. - * Implements Countable - * - * @return int - */ - public function count() - { - return count($this->_currentData); - } -} diff --git a/library/vendor/Zend/Ldap/Node/ChildrenIterator.php b/library/vendor/Zend/Ldap/Node/ChildrenIterator.php deleted file mode 100644 index f69a21078..000000000 --- a/library/vendor/Zend/Ldap/Node/ChildrenIterator.php +++ /dev/null @@ -1,208 +0,0 @@ -_data = $data; - } - - /** - * Returns the number of child nodes. - * Implements Countable - * - * @return int - */ - public function count() - { - return count($this->_data); - } - - /** - * Return the current child. - * Implements Iterator - * - * @return Zend_Ldap_Node - */ - public function current() - { - return current($this->_data); - } - - /** - * Return the child'd RDN. - * Implements Iterator - * - * @return string - */ - public function key() - { - return key($this->_data); - } - - /** - * Move forward to next child. - * Implements Iterator - */ - public function next() - { - next($this->_data); - } - - /** - * Rewind the Iterator to the first child. - * Implements Iterator - */ - public function rewind() - { - reset($this->_data); - } - - /** - * Check if there is a current child - * after calls to rewind() or next(). - * Implements Iterator - * - * @return boolean - */ - public function valid() - { - return (current($this->_data)!==false); - } - - /** - * Checks if current node has children. - * Returns whether the current element has children. - * - * @return boolean - */ - public function hasChildren() - { - if ($this->current() instanceof Zend_Ldap_Node) { - return $this->current()->hasChildren(); - } else { - return false; - } - } - - /** - * Returns the children for the current node. - * - * @return Zend_Ldap_Node_ChildrenIterator - */ - public function getChildren() - { - if ($this->current() instanceof Zend_Ldap_Node) { - return $this->current()->getChildren(); - } else { - return null; - } - } - - /** - * Returns a child with a given RDN. - * Implements ArrayAccess. - * - * @param string $rdn - * @return Zend_Ldap_node - */ - public function offsetGet($rdn) - { - if ($this->offsetExists($rdn)) { - return $this->_data[$rdn]; - } else { - return null; - } - } - - /** - * Checks whether a given rdn exists. - * Implements ArrayAccess. - * - * @param string $rdn - * @return boolean - */ - public function offsetExists($rdn) - { - return (array_key_exists($rdn, $this->_data)); - } - - /** - * Does nothing. - * Implements ArrayAccess. - * - * @param string $name - * @return null - */ - public function offsetUnset($name) { } - - /** - * Does nothing. - * Implements ArrayAccess. - * - * @param string $name - * @param mixed $value - * @return null - */ - public function offsetSet($name, $value) { } - - /** - * Get all children as an array - * - * @return array - */ - public function toArray() - { - $data = array(); - foreach ($this as $rdn => $node) { - $data[$rdn] = $node; - } - return $data; - } -} diff --git a/library/vendor/Zend/Ldap/Node/Collection.php b/library/vendor/Zend/Ldap/Node/Collection.php deleted file mode 100644 index 465204570..000000000 --- a/library/vendor/Zend/Ldap/Node/Collection.php +++ /dev/null @@ -1,65 +0,0 @@ -attachLdap($this->_iterator->getLdap()); - return $node; - } - - /** - * Return the child key (DN). - * Implements Iterator and RecursiveIterator - * - * @return string - */ - public function key() - { - return $this->_iterator->key(); - } -} diff --git a/library/vendor/Zend/Ldap/Node/RootDse.php b/library/vendor/Zend/Ldap/Node/RootDse.php deleted file mode 100644 index 68930cbf1..000000000 --- a/library/vendor/Zend/Ldap/Node/RootDse.php +++ /dev/null @@ -1,153 +0,0 @@ -getEntry($dn, array('*', '+'), true); - if (isset($data['domainfunctionality'])) { - /** - * @see Zend_Ldap_Node_RootDse_ActiveDirectory - */ - return new Zend_Ldap_Node_RootDse_ActiveDirectory($dn, $data); - } else if (isset($data['dsaname'])) { - /** - * @see Zend_Ldap_Node_RootDse_ActiveDirectory - */ - return new Zend_Ldap_Node_RootDse_eDirectory($dn, $data); - } else if (isset($data['structuralobjectclass']) && - $data['structuralobjectclass'][0] === 'OpenLDAProotDSE') { - /** - * @see Zend_Ldap_Node_RootDse_OpenLdap - */ - return new Zend_Ldap_Node_RootDse_OpenLdap($dn, $data); - } else { - return new self($dn, $data); - } - } - - /** - * Constructor. - * - * Constructor is protected to enforce the use of factory methods. - * - * @param Zend_Ldap_Dn $dn - * @param array $data - */ - protected function __construct(Zend_Ldap_Dn $dn, array $data) - { - parent::__construct($dn, $data, true); - } - - /** - * Gets the namingContexts. - * - * @return array - */ - public function getNamingContexts() - { - return $this->getAttribute('namingContexts', null); - } - - /** - * Gets the subschemaSubentry. - * - * @return string|null - */ - public function getSubschemaSubentry() - { - return $this->getAttribute('subschemaSubentry', 0); - } - - /** - * Determines if the version is supported - * - * @param string|int|array $versions version(s) to check - * @return boolean - */ - public function supportsVersion($versions) - { - return $this->attributeHasValue('supportedLDAPVersion', $versions); - } - - /** - * Determines if the sasl mechanism is supported - * - * @param string|array $mechlist SASL mechanisms to check - * @return boolean - */ - public function supportsSaslMechanism($mechlist) - { - return $this->attributeHasValue('supportedSASLMechanisms', $mechlist); - } - - /** - * Gets the server type - * - * @return int - */ - public function getServerType() - { - return self::SERVER_TYPE_GENERIC; - } - - /** - * Returns the schema DN - * - * @return Zend_Ldap_Dn - */ - public function getSchemaDn() - { - $schemaDn = $this->getSubschemaSubentry(); - /** - * @see Zend_Ldap_Dn - */ - return Zend_Ldap_Dn::fromString($schemaDn); - } -} diff --git a/library/vendor/Zend/Ldap/Node/RootDse/ActiveDirectory.php b/library/vendor/Zend/Ldap/Node/RootDse/ActiveDirectory.php deleted file mode 100644 index 6da3f165e..000000000 --- a/library/vendor/Zend/Ldap/Node/RootDse/ActiveDirectory.php +++ /dev/null @@ -1,245 +0,0 @@ -getAttribute('configurationNamingContext', 0); - } - - /** - * Gets the currentTime. - * - * @return string|null - */ - public function getCurrentTime() - { - return $this->getAttribute('currentTime', 0); - } - - /** - * Gets the defaultNamingContext. - * - * @return string|null - */ - public function getDefaultNamingContext() - { - return $this->getAttribute('defaultNamingContext', 0); - } - - /** - * Gets the dnsHostName. - * - * @return string|null - */ - public function getDnsHostName() - { - return $this->getAttribute('dnsHostName', 0); - } - - /** - * Gets the domainControllerFunctionality. - * - * @return string|null - */ - public function getDomainControllerFunctionality() - { - return $this->getAttribute('domainControllerFunctionality', 0); - } - - /** - * Gets the domainFunctionality. - * - * @return string|null - */ - public function getDomainFunctionality() - { - return $this->getAttribute('domainFunctionality', 0); - } - - /** - * Gets the dsServiceName. - * - * @return string|null - */ - public function getDsServiceName() - { - return $this->getAttribute('dsServiceName', 0); - } - - /** - * Gets the forestFunctionality. - * - * @return string|null - */ - public function getForestFunctionality() - { - return $this->getAttribute('forestFunctionality', 0); - } - - /** - * Gets the highestCommittedUSN. - * - * @return string|null - */ - public function getHighestCommittedUSN() - { - return $this->getAttribute('highestCommittedUSN', 0); - } - - /** - * Gets the isGlobalCatalogReady. - * - * @return string|null - */ - public function getIsGlobalCatalogReady() - { - return $this->getAttribute('isGlobalCatalogReady', 0); - } - - /** - * Gets the isSynchronized. - * - * @return string|null - */ - public function getIsSynchronized() - { - return $this->getAttribute('isSynchronized', 0); - } - - /** - * Gets the ldapServiceName. - * - * @return string|null - */ - public function getLdapServiceName() - { - return $this->getAttribute('ldapServiceName', 0); - } - - /** - * Gets the rootDomainNamingContext. - * - * @return string|null - */ - public function getRootDomainNamingContext() - { - return $this->getAttribute('rootDomainNamingContext', 0); - } - - /** - * Gets the schemaNamingContext. - * - * @return string|null - */ - public function getSchemaNamingContext() - { - return $this->getAttribute('schemaNamingContext', 0); - } - - /** - * Gets the serverName. - * - * @return string|null - */ - public function getServerName() - { - return $this->getAttribute('serverName', 0); - } - - /** - * Determines if the capability is supported - * - * @param string|string|array $oids capability(s) to check - * @return boolean - */ - public function supportsCapability($oids) - { - return $this->attributeHasValue('supportedCapabilities', $oids); - } - - /** - * Determines if the control is supported - * - * @param string|array $oids control oid(s) to check - * @return boolean - */ - public function supportsControl($oids) - { - return $this->attributeHasValue('supportedControl', $oids); - } - - /** - * Determines if the version is supported - * - * @param string|array $policies policy(s) to check - * @return boolean - */ - public function supportsPolicy($policies) - { - return $this->attributeHasValue('supportedLDAPPolicies', $policies); - } - - /** - * Gets the server type - * - * @return int - */ - public function getServerType() - { - return self::SERVER_TYPE_ACTIVEDIRECTORY; - } - - /** - * Returns the schema DN - * - * @return Zend_Ldap_Dn - */ - public function getSchemaDn() - { - $schemaDn = $this->getSchemaNamingContext(); - /** - * @see Zend_Ldap_Dn - */ - return Zend_Ldap_Dn::fromString($schemaDn); - } -} diff --git a/library/vendor/Zend/Ldap/Node/RootDse/OpenLdap.php b/library/vendor/Zend/Ldap/Node/RootDse/OpenLdap.php deleted file mode 100644 index 3f6cf20fa..000000000 --- a/library/vendor/Zend/Ldap/Node/RootDse/OpenLdap.php +++ /dev/null @@ -1,101 +0,0 @@ -getAttribute('configContext', 0); - } - - /** - * Gets the monitorContext. - * - * @return string|null - */ - public function getMonitorContext() - { - return $this->getAttribute('monitorContext', 0); - } - - /** - * Determines if the control is supported - * - * @param string|array $oids control oid(s) to check - * @return boolean - */ - public function supportsControl($oids) - { - return $this->attributeHasValue('supportedControl', $oids); - } - - /** - * Determines if the extension is supported - * - * @param string|array $oids oid(s) to check - * @return boolean - */ - public function supportsExtension($oids) - { - return $this->attributeHasValue('supportedExtension', $oids); - } - - /** - * Determines if the feature is supported - * - * @param string|array $oids feature oid(s) to check - * @return boolean - */ - public function supportsFeature($oids) - { - return $this->attributeHasValue('supportedFeatures', $oids); - } - - /** - * Gets the server type - * - * @return int - */ - public function getServerType() - { - return self::SERVER_TYPE_OPENLDAP; - } -} diff --git a/library/vendor/Zend/Ldap/Node/RootDse/eDirectory.php b/library/vendor/Zend/Ldap/Node/RootDse/eDirectory.php deleted file mode 100644 index 8fb45b7ae..000000000 --- a/library/vendor/Zend/Ldap/Node/RootDse/eDirectory.php +++ /dev/null @@ -1,159 +0,0 @@ -attributeHasValue('supportedExtension', $oids); - } - - /** - * Gets the vendorName. - * - * @return string|null - */ - public function getVendorName() - { - return $this->getAttribute('vendorName', 0); - } - - /** - * Gets the vendorVersion. - * - * @return string|null - */ - public function getVendorVersion() - { - return $this->getAttribute('vendorVersion', 0); - } - - /** - * Gets the dsaName. - * - * @return string|null - */ - public function getDsaName() - { - return $this->getAttribute('dsaName', 0); - } - - /** - * Gets the server statistics "errors". - * - * @return string|null - */ - public function getStatisticsErrors() - { - return $this->getAttribute('errors', 0); - } - - /** - * Gets the server statistics "securityErrors". - * - * @return string|null - */ - public function getStatisticsSecurityErrors() - { - return $this->getAttribute('securityErrors', 0); - } - - /** - * Gets the server statistics "chainings". - * - * @return string|null - */ - public function getStatisticsChainings() - { - return $this->getAttribute('chainings', 0); - } - - /** - * Gets the server statistics "referralsReturned". - * - * @return string|null - */ - public function getStatisticsReferralsReturned() - { - return $this->getAttribute('referralsReturned', 0); - } - - /** - * Gets the server statistics "extendedOps". - * - * @return string|null - */ - public function getStatisticsExtendedOps() - { - return $this->getAttribute('extendedOps', 0); - } - - /** - * Gets the server statistics "abandonOps". - * - * @return string|null - */ - public function getStatisticsAbandonOps() - { - return $this->getAttribute('abandonOps', 0); - } - - /** - * Gets the server statistics "wholeSubtreeSearchOps". - * - * @return string|null - */ - public function getStatisticsWholeSubtreeSearchOps() - { - return $this->getAttribute('wholeSubtreeSearchOps', 0); - } - - /** - * Gets the server type - * - * @return int - */ - public function getServerType() - { - return self::SERVER_TYPE_EDIRECTORY; - } -} diff --git a/library/vendor/Zend/Ldap/Node/Schema.php b/library/vendor/Zend/Ldap/Node/Schema.php deleted file mode 100644 index 1971a74b4..000000000 --- a/library/vendor/Zend/Ldap/Node/Schema.php +++ /dev/null @@ -1,117 +0,0 @@ -getRootDse()->getSchemaDn(); - $data = $ldap->getEntry($dn, array('*', '+'), true); - switch ($ldap->getRootDse()->getServerType()) { - case Zend_Ldap_Node_RootDse::SERVER_TYPE_ACTIVEDIRECTORY: - /** - * @see Zend_Ldap_Node_Schema_ActiveDirectory - */ - return new Zend_Ldap_Node_Schema_ActiveDirectory($dn, $data, $ldap); - case Zend_Ldap_Node_RootDse::SERVER_TYPE_OPENLDAP: - /** - * @see Zend_Ldap_Node_RootDse_ActiveDirectory - */ - return new Zend_Ldap_Node_Schema_OpenLdap($dn, $data, $ldap); - case Zend_Ldap_Node_RootDse::SERVER_TYPE_EDIRECTORY: - default: - return new self($dn, $data, $ldap); - } - } - - /** - * Constructor. - * - * Constructor is protected to enforce the use of factory methods. - * - * @param Zend_Ldap_Dn $dn - * @param array $data - * @param Zend_Ldap $ldap - */ - protected function __construct(Zend_Ldap_Dn $dn, array $data, Zend_Ldap $ldap) - { - parent::__construct($dn, $data, true); - $this->_parseSchema($dn, $ldap); - } - - /** - * Parses the schema - * - * @param Zend_Ldap_Dn $dn - * @param Zend_Ldap $ldap - * @return Zend_Ldap_Node_Schema Provides a fluent interface - */ - protected function _parseSchema(Zend_Ldap_Dn $dn, Zend_Ldap $ldap) - { - return $this; - } - - /** - * Gets the attribute Types - * - * @return array - */ - public function getAttributeTypes() - { - return array(); - } - - /** - * Gets the object classes - * - * @return array - */ - public function getObjectClasses() - { - return array(); - } -} diff --git a/library/vendor/Zend/Ldap/Node/Schema/ActiveDirectory.php b/library/vendor/Zend/Ldap/Node/Schema/ActiveDirectory.php deleted file mode 100644 index 63469e955..000000000 --- a/library/vendor/Zend/Ldap/Node/Schema/ActiveDirectory.php +++ /dev/null @@ -1,100 +0,0 @@ -search('(objectClass=classSchema)', $dn, - Zend_Ldap::SEARCH_SCOPE_ONE) as $node) { - $val = new Zend_Ldap_Node_Schema_ObjectClass_ActiveDirectory($node); - $this->_objectClasses[$val->getName()] = $val; - } - foreach ($ldap->search('(objectClass=attributeSchema)', $dn, - Zend_Ldap::SEARCH_SCOPE_ONE) as $node) { - $val = new Zend_Ldap_Node_Schema_AttributeType_ActiveDirectory($node); - $this->_attributeTypes[$val->getName()] = $val; - } - return $this; - } - - /** - * Gets the attribute Types - * - * @return array - */ - public function getAttributeTypes() - { - return $this->_attributeTypes; - } - - /** - * Gets the object classes - * - * @return array - */ - public function getObjectClasses() - { - return $this->_objectClasses; - } -} diff --git a/library/vendor/Zend/Ldap/Node/Schema/AttributeType/ActiveDirectory.php b/library/vendor/Zend/Ldap/Node/Schema/AttributeType/ActiveDirectory.php deleted file mode 100644 index 0987daabf..000000000 --- a/library/vendor/Zend/Ldap/Node/Schema/AttributeType/ActiveDirectory.php +++ /dev/null @@ -1,102 +0,0 @@ -ldapdisplayname[0]; - } - - /** - * Gets the attribute OID - * - * @return string - */ - public function getOid() - { - - } - - /** - * Gets the attribute syntax - * - * @return string - */ - public function getSyntax() - { - - } - - /** - * Gets the attribute maximum length - * - * @return int|null - */ - public function getMaxLength() - { - - } - - /** - * Returns if the attribute is single-valued. - * - * @return boolean - */ - public function isSingleValued() - { - - } - - /** - * Gets the attribute description - * - * @return string - */ - public function getDescription() - { - - } -} diff --git a/library/vendor/Zend/Ldap/Node/Schema/AttributeType/Interface.php b/library/vendor/Zend/Ldap/Node/Schema/AttributeType/Interface.php deleted file mode 100644 index 59226635e..000000000 --- a/library/vendor/Zend/Ldap/Node/Schema/AttributeType/Interface.php +++ /dev/null @@ -1,75 +0,0 @@ -name; - } - - /** - * Gets the attribute OID - * - * @return string - */ - public function getOid() - { - return $this->oid; - } - - /** - * Gets the attribute syntax - * - * @return string - */ - public function getSyntax() - { - if ($this->syntax === null) { - $parent = $this->getParent(); - if ($parent === null) return null; - else return $parent->getSyntax(); - } else { - return $this->syntax; - } - } - - /** - * Gets the attribute maximum length - * - * @return int|null - */ - public function getMaxLength() - { - $maxLength = $this->{'max-length'}; - if ($maxLength === null) { - $parent = $this->getParent(); - if ($parent === null) return null; - else return $parent->getMaxLength(); - } else { - return (int)$maxLength; - } - } - - /** - * Returns if the attribute is single-valued. - * - * @return boolean - */ - public function isSingleValued() - { - return $this->{'single-value'}; - } - - /** - * Gets the attribute description - * - * @return string - */ - public function getDescription() - { - return $this->desc; - } - - /** - * Returns the parent attribute type in the inhertitance tree if one exists - * - * @return Zend_Ldap_Node_Schema_AttributeType_OpenLdap|null - */ - public function getParent() - { - if (count($this->_parents) === 1) { - return $this->_parents[0]; - } - } -} diff --git a/library/vendor/Zend/Ldap/Node/Schema/Item.php b/library/vendor/Zend/Ldap/Node/Schema/Item.php deleted file mode 100644 index 4404f1dcb..000000000 --- a/library/vendor/Zend/Ldap/Node/Schema/Item.php +++ /dev/null @@ -1,163 +0,0 @@ -setData($data); - } - - /** - * Sets the data - * - * @param array $data - * @return Zend_Ldap_Node_Schema_Item Provides a fluent interface - */ - public function setData(array $data) - { - $this->_data = $data; - return $this; - } - - /** - * Gets the data - * - * @return array - */ - public function getData() - { - return $this->_data; - } - - /** - * Gets a specific attribute from this item - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - if (array_key_exists($name, $this->_data)) { - return $this->_data[$name]; - } else { - return null; - } - } - - /** - * Checks whether a specific attribute exists. - * - * @param string $name - * @return boolean - */ - public function __isset($name) - { - return (array_key_exists($name, $this->_data)); - } - - /** - * Always throws BadMethodCallException - * Implements ArrayAccess. - * - * This method is needed for a full implementation of ArrayAccess - * - * @param string $name - * @param mixed $value - * @return null - * @throws BadMethodCallException - */ - public function offsetSet($name, $value) - { - throw new BadMethodCallException(); - } - - /** - * Gets a specific attribute from this item - * - * @param string $name - * @return mixed - */ - public function offsetGet($name) - { - return $this->__get($name); - } - - /** - * Always throws BadMethodCallException - * Implements ArrayAccess. - * - * This method is needed for a full implementation of ArrayAccess - * - * @param string $name - * @return null - * @throws BadMethodCallException - */ - public function offsetUnset($name) - { - throw new BadMethodCallException(); - } - - /** - * Checks whether a specific attribute exists. - * - * @param string $name - * @return boolean - */ - public function offsetExists($name) - { - return $this->__isset($name); - } - - /** - * Returns the number of attributes. - * Implements Countable - * - * @return int - */ - public function count() - { - return count($this->_data); - } -} diff --git a/library/vendor/Zend/Ldap/Node/Schema/ObjectClass/ActiveDirectory.php b/library/vendor/Zend/Ldap/Node/Schema/ObjectClass/ActiveDirectory.php deleted file mode 100644 index 252be6d94..000000000 --- a/library/vendor/Zend/Ldap/Node/Schema/ObjectClass/ActiveDirectory.php +++ /dev/null @@ -1,113 +0,0 @@ -ldapdisplayname[0]; - } - - /** - * Gets the objectClass OID - * - * @return string - */ - public function getOid() - { - - } - - /** - * Gets the attributes that this objectClass must contain - * - * @return array - */ - public function getMustContain() - { - - } - - /** - * Gets the attributes that this objectClass may contain - * - * @return array - */ - public function getMayContain() - { - - } - - /** - * Gets the objectClass description - * - * @return string - */ - public function getDescription() - { - - } - - /** - * Gets the objectClass type - * - * @return integer - */ - public function getType() - { - - } - - /** - * Returns the parent objectClasses of this class. - * This includes structural, abstract and auxiliary objectClasses - * - * @return array - */ - public function getParentClasses() - { - - } -} diff --git a/library/vendor/Zend/Ldap/Node/Schema/ObjectClass/Interface.php b/library/vendor/Zend/Ldap/Node/Schema/ObjectClass/Interface.php deleted file mode 100644 index f73519026..000000000 --- a/library/vendor/Zend/Ldap/Node/Schema/ObjectClass/Interface.php +++ /dev/null @@ -1,83 +0,0 @@ -name; - } - - /** - * Gets the objectClass OID - * - * @return string - */ - public function getOid() - { - return $this->oid; - } - - /** - * Gets the attributes that this objectClass must contain - * - * @return array - */ - public function getMustContain() - { - if ($this->_inheritedMust === null) { - $this->_resolveInheritance(); - } - return $this->_inheritedMust; - } - - /** - * Gets the attributes that this objectClass may contain - * - * @return array - */ - public function getMayContain() - { - if ($this->_inheritedMay === null) { - $this->_resolveInheritance(); - } - return $this->_inheritedMay; - } - - /** - * Resolves the inheritance tree - * - * @return void - */ - protected function _resolveInheritance() - { - $must = $this->must; - $may = $this->may; - foreach ($this->getParents() as $p) { - $must = array_merge($must, $p->getMustContain()); - $may = array_merge($may, $p->getMayContain()); - } - $must = array_unique($must); - $may = array_unique($may); - $may = array_diff($may, $must); - sort($must, SORT_STRING); - sort($may, SORT_STRING); - $this->_inheritedMust = $must; - $this->_inheritedMay = $may; - } - - /** - * Gets the objectClass description - * - * @return string - */ - public function getDescription() - { - return $this->desc; - } - - /** - * Gets the objectClass type - * - * @return integer - */ - public function getType() - { - if ($this->structural) { - return Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_STRUCTURAL; - } else if ($this->abstract) { - return Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_ABSTRACT; - } else if ($this->auxiliary) { - return Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_AUXILIARY; - } else { - return Zend_Ldap_Node_Schema::OBJECTCLASS_TYPE_UNKNOWN; - } - } - - /** - * Returns the parent objectClasses of this class. - * This includes structural, abstract and auxiliary objectClasses - * - * @return array - */ - public function getParentClasses() - { - return $this->sup; - } - - /** - * Returns the parent object classes in the inhertitance tree if one exists - * - * @return array of Zend_Ldap_Node_Schema_ObjectClass_OpenLdap - */ - public function getParents() - { - return $this->_parents; - } -} diff --git a/library/vendor/Zend/Ldap/Node/Schema/OpenLdap.php b/library/vendor/Zend/Ldap/Node/Schema/OpenLdap.php deleted file mode 100644 index df49d9884..000000000 --- a/library/vendor/Zend/Ldap/Node/Schema/OpenLdap.php +++ /dev/null @@ -1,499 +0,0 @@ -_loadAttributeTypes(); - $this->_loadLdapSyntaxes(); - $this->_loadMatchingRules(); - $this->_loadMatchingRuleUse(); - $this->_loadObjectClasses(); - return $this; - } - - /** - * Gets the attribute Types - * - * @return array - */ - public function getAttributeTypes() - { - return $this->_attributeTypes; - } - - /** - * Gets the object classes - * - * @return array - */ - public function getObjectClasses() - { - return $this->_objectClasses; - } - - /** - * Gets the LDAP syntaxes - * - * @return array - */ - public function getLdapSyntaxes() - { - return $this->_ldapSyntaxes; - } - - /** - * Gets the matching rules - * - * @return array - */ - public function getMatchingRules() - { - return $this->_matchingRules; - } - - /** - * Gets the matching rule use - * - * @return array - */ - public function getMatchingRuleUse() - { - return $this->_matchingRuleUse; - } - - /** - * Loads the attribute Types - * - * @return void - */ - protected function _loadAttributeTypes() - { - $this->_attributeTypes = array(); - foreach ($this->getAttribute('attributeTypes') as $value) { - $val = $this->_parseAttributeType($value); - $val = new Zend_Ldap_Node_Schema_AttributeType_OpenLdap($val); - $this->_attributeTypes[$val->getName()] = $val; - - } - foreach ($this->_attributeTypes as $val) { - if (count($val->sup) > 0) { - $this->_resolveInheritance($val, $this->_attributeTypes); - } - foreach ($val->aliases as $alias) { - $this->_attributeTypes[$alias] = $val; - } - } - ksort($this->_attributeTypes, SORT_STRING); - } - - /** - * Parses an attributeType value - * - * @param string $value - * @return array - */ - protected function _parseAttributeType($value) - { - $attributeType = array( - 'oid' => null, - 'name' => null, - 'desc' => null, - 'obsolete' => false, - 'sup' => null, - 'equality' => null, - 'ordering' => null, - 'substr' => null, - 'syntax' => null, - 'max-length' => null, - 'single-value' => false, - 'collective' => false, - 'no-user-modification' => false, - 'usage' => 'userApplications', - '_string' => $value, - '_parents' => array()); - - $tokens = $this->_tokenizeString($value); - $attributeType['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLdapSchemaSyntax($attributeType, $tokens); - - if (array_key_exists('syntax', $attributeType)) { - // get max length from syntax - if (preg_match('/^(.+){(\d+)}$/', $attributeType['syntax'], $matches)) { - $attributeType['syntax'] = $matches[1]; - $attributeType['max-length'] = $matches[2]; - } - } - - $this->_ensureNameAttribute($attributeType); - - return $attributeType; - } - - /** - * Loads the object classes - * - * @return void - */ - protected function _loadObjectClasses() - { - $this->_objectClasses = array(); - foreach ($this->getAttribute('objectClasses') as $value) { - $val = $this->_parseObjectClass($value); - $val = new Zend_Ldap_Node_Schema_ObjectClass_OpenLdap($val); - $this->_objectClasses[$val->getName()] = $val; - } - foreach ($this->_objectClasses as $val) { - if (count($val->sup) > 0) { - $this->_resolveInheritance($val, $this->_objectClasses); - } - foreach ($val->aliases as $alias) { - $this->_objectClasses[$alias] = $val; - } - } - ksort($this->_objectClasses, SORT_STRING); - } - - /** - * Parses an objectClasses value - * - * @param string $value - * @return array - */ - protected function _parseObjectClass($value) - { - $objectClass = array( - 'oid' => null, - 'name' => null, - 'desc' => null, - 'obsolete' => false, - 'sup' => array(), - 'abstract' => false, - 'structural' => false, - 'auxiliary' => false, - 'must' => array(), - 'may' => array(), - '_string' => $value, - '_parents' => array()); - - $tokens = $this->_tokenizeString($value); - $objectClass['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLdapSchemaSyntax($objectClass, $tokens); - - $this->_ensureNameAttribute($objectClass); - - return $objectClass; - } - - /** - * Resolves inheritance in objectClasses and attributes - * - * @param Zend_Ldap_Node_Schema_Item $node - * @param array $repository - */ - protected function _resolveInheritance(Zend_Ldap_Node_Schema_Item $node, array $repository) - { - $data = $node->getData(); - $parents = $data['sup']; - if ($parents === null || !is_array($parents) || count($parents) < 1) return; - foreach ($parents as $parent) { - if (!array_key_exists($parent, $repository)) continue; - if (!array_key_exists('_parents', $data) || !is_array($data['_parents'])) { - $data['_parents'] = array(); - } - $data['_parents'][] = $repository[$parent]; - } - $node->setData($data); - } - - /** - * Loads the LDAP syntaxes - * - * @return void - */ - protected function _loadLdapSyntaxes() - { - $this->_ldapSyntaxes = array(); - foreach ($this->getAttribute('ldapSyntaxes') as $value) { - $val = $this->_parseLdapSyntax($value); - $this->_ldapSyntaxes[$val['oid']] = $val; - } - ksort($this->_ldapSyntaxes, SORT_STRING); - } - - /** - * Parses an ldapSyntaxes value - * - * @param string $value - * @return array - */ - protected function _parseLdapSyntax($value) - { - $ldapSyntax = array( - 'oid' => null, - 'desc' => null, - '_string' => $value); - - $tokens = $this->_tokenizeString($value); - $ldapSyntax['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLdapSchemaSyntax($ldapSyntax, $tokens); - - return $ldapSyntax; - } - - /** - * Loads the matching rules - * - * @return void - */ - protected function _loadMatchingRules() - { - $this->_matchingRules = array(); - foreach ($this->getAttribute('matchingRules') as $value) { - $val = $this->_parseMatchingRule($value); - $this->_matchingRules[$val['name']] = $val; - } - ksort($this->_matchingRules, SORT_STRING); - } - - /** - * Parses an matchingRules value - * - * @param string $value - * @return array - */ - protected function _parseMatchingRule($value) - { - $matchingRule = array( - 'oid' => null, - 'name' => null, - 'desc' => null, - 'obsolete' => false, - 'syntax' => null, - '_string' => $value); - - $tokens = $this->_tokenizeString($value); - $matchingRule['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLdapSchemaSyntax($matchingRule, $tokens); - - $this->_ensureNameAttribute($matchingRule); - - return $matchingRule; - } - - /** - * Loads the matching rule use - * - * @return void - */ - protected function _loadMatchingRuleUse() - { - $this->_matchingRuleUse = array(); - foreach ($this->getAttribute('matchingRuleUse') as $value) { - $val = $this->_parseMatchingRuleUse($value); - $this->_matchingRuleUse[$val['name']] = $val; - } - ksort($this->_matchingRuleUse, SORT_STRING); - } - - /** - * Parses an matchingRuleUse value - * - * @param string $value - * @return array - */ - protected function _parseMatchingRuleUse($value) - { - $matchingRuleUse = array( - 'oid' => null, - 'name' => null, - 'desc' => null, - 'obsolete' => false, - 'applies' => array(), - '_string' => $value); - - $tokens = $this->_tokenizeString($value); - $matchingRuleUse['oid'] = array_shift($tokens); // first token is the oid - $this->_parseLdapSchemaSyntax($matchingRuleUse, $tokens); - - $this->_ensureNameAttribute($matchingRuleUse); - - return $matchingRuleUse; - } - - /** - * Ensures that a name element is present and that it is single-values. - * - * @param array $data - */ - protected function _ensureNameAttribute(array &$data) - { - if (!array_key_exists('name', $data) || empty($data['name'])) { - // force a name - $data['name'] = $data['oid']; - } - if (is_array($data['name'])) { - // make one name the default and put the other ones into aliases - $aliases = $data['name']; - $data['name'] = array_shift($aliases); - $data['aliases'] = $aliases; - } else { - $data['aliases'] = array(); - } - } - - /** - * Parse the given tokens into a data structure - * - * @param array $data - * @param array $tokens - * @return void - */ - protected function _parseLdapSchemaSyntax(array &$data, array $tokens) - { - // tokens that have no value associated - $noValue = array('single-value', - 'obsolete', - 'collective', - 'no-user-modification', - 'abstract', - 'structural', - 'auxiliary'); - // tokens that can have multiple values - $multiValue = array('must', 'may', 'sup'); - - while (count($tokens) > 0) { - $token = strtolower(array_shift($tokens)); - if (in_array($token, $noValue)) { - $data[$token] = true; // single value token - } else { - $data[$token] = array_shift($tokens); - // this one follows a string or a list if it is multivalued - if ($data[$token] == '(') { - // this creates the list of values and cycles through the tokens - // until the end of the list is reached ')' - $data[$token] = array(); - while ($tmp = array_shift($tokens)) { - if ($tmp == ')') break; - if ($tmp != '$') { - $data[$token][] = Zend_Ldap_Attribute::convertFromLdapValue($tmp); - } - } - } else { - $data[$token] = Zend_Ldap_Attribute::convertFromLdapValue($data[$token]); - } - // create a array if the value should be multivalued but was not - if (in_array($token, $multiValue) && !is_array($data[$token])) { - $data[$token] = array($data[$token]); - } - } - } - } - - /** - * Tokenizes the given value into an array - * - * @param string $value - * @return array tokens - */ - protected function _tokenizeString($value) - { - $tokens = array(); - $matches = array(); - // this one is taken from PEAR::Net_LDAP2 - $pattern = "/\s* (?:([()]) | ([^'\s()]+) | '((?:[^']+|'[^\s)])*)') \s*/x"; - preg_match_all($pattern, $value, $matches); - $cMatches = count($matches[0]); - $cPattern = count($matches); - for ($i = 0; $i < $cMatches; $i++) { // number of tokens (full pattern match) - for ($j = 1; $j < $cPattern; $j++) { // each subpattern - $tok = trim($matches[$j][$i]); - if (!empty($tok)) { // pattern match in this subpattern - $tokens[$i] = $tok; // this is the token - } - } - } - if ($tokens[0] == '(') array_shift($tokens); - if ($tokens[count($tokens) - 1] == ')') array_pop($tokens); - return $tokens; - } -} diff --git a/library/vendor/Zend/Loader/Autoloader/Resource.php b/library/vendor/Zend/Loader/Autoloader/Resource.php deleted file mode 100644 index 964517881..000000000 --- a/library/vendor/Zend/Loader/Autoloader/Resource.php +++ /dev/null @@ -1,459 +0,0 @@ -toArray(); - } - if (!is_array($options)) { - throw new Zend_Loader_Exception('Options must be passed to resource loader constructor'); - } - - $this->setOptions($options); - - $namespace = $this->getNamespace(); - if ((null === $namespace) - || (null === $this->getBasePath()) - ) { - throw new Zend_Loader_Exception('Resource loader requires both a namespace and a base path for initialization'); - } - - if (!empty($namespace)) { - $namespace .= '_'; - } - Zend_Loader_Autoloader::getInstance()->unshiftAutoloader($this, $namespace); - } - - /** - * Overloading: methods - * - * Allow retrieving concrete resource object instances using 'get()' - * syntax. Example: - * - * $loader = new Zend_Loader_Autoloader_Resource(array( - * 'namespace' => 'Stuff_', - * 'basePath' => '/path/to/some/stuff', - * )) - * $loader->addResourceType('Model', 'models', 'Model'); - * - * $foo = $loader->getModel('Foo'); // get instance of Stuff_Model_Foo class - * - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Loader_Exception if method not beginning with 'get' or not matching a valid resource type is called - */ - public function __call($method, $args) - { - if ('get' == substr($method, 0, 3)) { - $type = strtolower(substr($method, 3)); - if (!$this->hasResourceType($type)) { - throw new Zend_Loader_Exception("Invalid resource type $type; cannot load resource"); - } - if (empty($args)) { - throw new Zend_Loader_Exception("Cannot load resources; no resource specified"); - } - $resource = array_shift($args); - return $this->load($resource, $type); - } - - throw new Zend_Loader_Exception("Method '$method' is not supported"); - } - - /** - * Helper method to calculate the correct class path - * - * @param string $class - * @return False if not matched other wise the correct path - */ - public function getClassPath($class) - { - $segments = explode('_', $class); - $namespaceTopLevel = $this->getNamespace(); - $namespace = ''; - - if (!empty($namespaceTopLevel)) { - $namespace = array(); - $topLevelSegments = count(explode('_', $namespaceTopLevel)); - for ($i = 0; $i < $topLevelSegments; $i++) { - $namespace[] = array_shift($segments); - } - $namespace = implode('_', $namespace); - if ($namespace != $namespaceTopLevel) { - // wrong prefix? we're done - return false; - } - } - - if (count($segments) < 2) { - // assumes all resources have a component and class name, minimum - return false; - } - - $final = array_pop($segments); - $component = $namespace; - $lastMatch = false; - do { - $segment = array_shift($segments); - $component .= empty($component) ? $segment : '_' . $segment; - if (isset($this->_components[$component])) { - $lastMatch = $component; - } - } while (count($segments)); - - if (!$lastMatch) { - return false; - } - - $final = substr($class, strlen($lastMatch) + 1); - $path = $this->_components[$lastMatch]; - $classPath = $path . '/' . str_replace('_', '/', $final) . '.php'; - - if (Zend_Loader::isReadable($classPath)) { - return $classPath; - } - - return false; - } - - /** - * Attempt to autoload a class - * - * @param string $class - * @return mixed False if not matched, otherwise result if include operation - */ - public function autoload($class) - { - $classPath = $this->getClassPath($class); - if (false !== $classPath) { - return include $classPath; - } - return false; - } - - /** - * Set class state from options - * - * @param array $options - * @return Zend_Loader_Autoloader_Resource - */ - public function setOptions(array $options) - { - // Set namespace first, see ZF-10836 - if (isset($options['namespace'])) { - $this->setNamespace($options['namespace']); - unset($options['namespace']); - } - - $methods = get_class_methods($this); - foreach ($options as $key => $value) { - $method = 'set' . ucfirst($key); - if (in_array($method, $methods)) { - $this->$method($value); - } - } - return $this; - } - - /** - * Set namespace that this autoloader handles - * - * @param string $namespace - * @return Zend_Loader_Autoloader_Resource - */ - public function setNamespace($namespace) - { - $this->_namespace = rtrim((string) $namespace, '_'); - return $this; - } - - /** - * Get namespace this autoloader handles - * - * @return string - */ - public function getNamespace() - { - return $this->_namespace; - } - - /** - * Set base path for this set of resources - * - * @param string $path - * @return Zend_Loader_Autoloader_Resource - */ - public function setBasePath($path) - { - $this->_basePath = (string) $path; - return $this; - } - - /** - * Get base path to this set of resources - * - * @return string - */ - public function getBasePath() - { - return $this->_basePath; - } - - /** - * Add resource type - * - * @param string $type identifier for the resource type being loaded - * @param string $path path relative to resource base path containing the resource types - * @param null|string $namespace sub-component namespace to append to base namespace that qualifies this resource type - * @return Zend_Loader_Autoloader_Resource - */ - public function addResourceType($type, $path, $namespace = null) - { - $type = strtolower($type); - if (!isset($this->_resourceTypes[$type])) { - if (null === $namespace) { - throw new Zend_Loader_Exception('Initial definition of a resource type must include a namespace'); - } - $namespaceTopLevel = $this->getNamespace(); - $namespace = ucfirst(trim($namespace, '_')); - $this->_resourceTypes[$type] = array( - 'namespace' => empty($namespaceTopLevel) ? $namespace : $namespaceTopLevel . '_' . $namespace, - ); - } - if (!is_string($path)) { - throw new Zend_Loader_Exception('Invalid path specification provided; must be string'); - } - $this->_resourceTypes[$type]['path'] = $this->getBasePath() . '/' . rtrim($path, '\/'); - - $component = $this->_resourceTypes[$type]['namespace']; - $this->_components[$component] = $this->_resourceTypes[$type]['path']; - return $this; - } - - /** - * Add multiple resources at once - * - * $types should be an associative array of resource type => specification - * pairs. Each specification should be an associative array containing - * minimally the 'path' key (specifying the path relative to the resource - * base path) and optionally the 'namespace' key (indicating the subcomponent - * namespace to append to the resource namespace). - * - * As an example: - * - * $loader->addResourceTypes(array( - * 'model' => array( - * 'path' => 'models', - * 'namespace' => 'Model', - * ), - * 'form' => array( - * 'path' => 'forms', - * 'namespace' => 'Form', - * ), - * )); - * - * - * @param array $types - * @return Zend_Loader_Autoloader_Resource - */ - public function addResourceTypes(array $types) - { - foreach ($types as $type => $spec) { - if (!is_array($spec)) { - throw new Zend_Loader_Exception('addResourceTypes() expects an array of arrays'); - } - if (!isset($spec['path'])) { - throw new Zend_Loader_Exception('addResourceTypes() expects each array to include a paths element'); - } - $paths = $spec['path']; - $namespace = null; - if (isset($spec['namespace'])) { - $namespace = $spec['namespace']; - } - $this->addResourceType($type, $paths, $namespace); - } - return $this; - } - - /** - * Overwrite existing and set multiple resource types at once - * - * @see Zend_Loader_Autoloader_Resource::addResourceTypes() - * @param array $types - * @return Zend_Loader_Autoloader_Resource - */ - public function setResourceTypes(array $types) - { - $this->clearResourceTypes(); - return $this->addResourceTypes($types); - } - - /** - * Retrieve resource type mappings - * - * @return array - */ - public function getResourceTypes() - { - return $this->_resourceTypes; - } - - /** - * Is the requested resource type defined? - * - * @param string $type - * @return bool - */ - public function hasResourceType($type) - { - return isset($this->_resourceTypes[$type]); - } - - /** - * Remove the requested resource type - * - * @param string $type - * @return Zend_Loader_Autoloader_Resource - */ - public function removeResourceType($type) - { - if ($this->hasResourceType($type)) { - $namespace = $this->_resourceTypes[$type]['namespace']; - unset($this->_components[$namespace]); - unset($this->_resourceTypes[$type]); - } - return $this; - } - - /** - * Clear all resource types - * - * @return Zend_Loader_Autoloader_Resource - */ - public function clearResourceTypes() - { - $this->_resourceTypes = array(); - $this->_components = array(); - return $this; - } - - /** - * Set default resource type to use when calling load() - * - * @param string $type - * @return Zend_Loader_Autoloader_Resource - */ - public function setDefaultResourceType($type) - { - if ($this->hasResourceType($type)) { - $this->_defaultResourceType = $type; - } - return $this; - } - - /** - * Get default resource type to use when calling load() - * - * @return string|null - */ - public function getDefaultResourceType() - { - return $this->_defaultResourceType; - } - - /** - * Object registry and factory - * - * Loads the requested resource of type $type (or uses the default resource - * type if none provided). If the resource has been loaded previously, - * returns the previous instance; otherwise, instantiates it. - * - * @param string $resource - * @param string $type - * @return object - * @throws Zend_Loader_Exception if resource type not specified or invalid - */ - public function load($resource, $type = null) - { - if (null === $type) { - $type = $this->getDefaultResourceType(); - if (empty($type)) { - throw new Zend_Loader_Exception('No resource type specified'); - } - } - if (!$this->hasResourceType($type)) { - throw new Zend_Loader_Exception('Invalid resource type specified'); - } - $namespace = $this->_resourceTypes[$type]['namespace']; - $class = $namespace . '_' . ucfirst($resource); - if (!isset($this->_resources[$class])) { - $this->_resources[$class] = new $class; - } - return $this->_resources[$class]; - } -} diff --git a/library/vendor/Zend/Loader/AutoloaderFactory.php b/library/vendor/Zend/Loader/AutoloaderFactory.php deleted file mode 100644 index 9b0e976f7..000000000 --- a/library/vendor/Zend/Loader/AutoloaderFactory.php +++ /dev/null @@ -1,218 +0,0 @@ - - * array( - * '' => $autoloaderOptions, - * ) - * - * - * The factory will then loop through and instantiate each autoloader with - * the specified options, and register each with the spl_autoloader. - * - * You may retrieve the concrete autoloader instances later using - * {@link getRegisteredAutoloaders()}. - * - * Note that the class names must be resolvable on the include_path or via - * the Zend library, using PSR-0 rules (unless the class has already been - * loaded). - * - * @param array|Traversable $options (optional) options to use. Defaults to Zend_Loader_StandardAutoloader - * @return void - * @throws Zend_Loader_Exception_InvalidArgumentException for invalid options - * @throws Zend_Loader_Exception_InvalidArgumentException for unloadable autoloader classes - */ - public static function factory($options = null) - { - if (null === $options) { - if (!isset(self::$loaders[self::STANDARD_AUTOLOADER])) { - $autoloader = self::getStandardAutoloader(); - $autoloader->register(); - self::$loaders[self::STANDARD_AUTOLOADER] = $autoloader; - } - - // Return so we don't hit the next check's exception (we're done here anyway) - return; - } - - if (!is_array($options) && !($options instanceof Traversable)) { - throw new Zend_Loader_Exception_InvalidArgumentException( - 'Options provided must be an array or Traversable' - ); - } - - foreach ($options as $class => $options) { - if (!isset(self::$loaders[$class])) { - // Check class map autoloader - if ($class == self::CLASS_MAP_AUTOLOADER) { - if (!class_exists(self::CLASS_MAP_AUTOLOADER)) { - // Extract the filename from the classname - $classMapLoader = substr( - strrchr(self::CLASS_MAP_AUTOLOADER, '_'), 1 - ); - - } - } - - // Autoload with standard autoloader - $autoloader = self::getStandardAutoloader(); - if (!class_exists($class) && !$autoloader->autoload($class)) { - throw new Zend_Loader_Exception_InvalidArgumentException(sprintf( - 'Autoloader class "%s" not loaded', - $class - )); - } - - // unfortunately is_subclass_of is broken on some 5.3 versions - // additionally instanceof is also broken for this use case - if (version_compare(PHP_VERSION, '5.3.7', '>=')) { - if (!is_subclass_of($class, 'Zend_Loader_SplAutoloader')) { - throw new Zend_Loader_Exception_InvalidArgumentException(sprintf( - 'Autoloader class %s must implement Zend\\Loader\\SplAutoloader', - $class - )); - } - } - - if ($class === self::STANDARD_AUTOLOADER) { - $autoloader->setOptions($options); - } else { - $autoloader = new $class($options); - } - $autoloader->register(); - self::$loaders[$class] = $autoloader; - } else { - self::$loaders[$class]->setOptions($options); - } - } - } - - /** - * Get an list of all autoloaders registered with the factory - * - * Returns an array of autoloader instances. - * - * @return array - */ - public static function getRegisteredAutoloaders() - { - return self::$loaders; - } - - /** - * Retrieves an autoloader by class name - * - * @param string $class - * @return Zend_Loader_SplAutoloader - * @throws Zend_Loader_Exception_InvalidArgumentException for non-registered class - */ - public static function getRegisteredAutoloader($class) - { - if (!isset(self::$loaders[$class])) { - throw new Zend_Loader_Exception_InvalidArgumentException(sprintf('Autoloader class "%s" not loaded', $class)); - } - return self::$loaders[$class]; - } - - /** - * Unregisters all autoloaders that have been registered via the factory. - * This will NOT unregister autoloaders registered outside of the fctory. - * - * @return void - */ - public static function unregisterAutoloaders() - { - foreach (self::getRegisteredAutoloaders() as $class => $autoloader) { - spl_autoload_unregister(array($autoloader, 'autoload')); - unset(self::$loaders[$class]); - } - } - - /** - * Unregister a single autoloader by class name - * - * @param string $autoloaderClass - * @return bool - */ - public static function unregisterAutoloader($autoloaderClass) - { - if (!isset(self::$loaders[$autoloaderClass])) { - return false; - } - - $autoloader = self::$loaders[$autoloaderClass]; - spl_autoload_unregister(array($autoloader, 'autoload')); - unset(self::$loaders[$autoloaderClass]); - return true; - } - - /** - * Get an instance of the standard autoloader - * - * Used to attempt to resolve autoloader classes, using the - * StandardAutoloader. The instance is marked as a fallback autoloader, to - * allow resolving autoloaders not under the "Zend" or "Zend" namespaces. - * - * @return Zend_Loader_SplAutoloader - */ - protected static function getStandardAutoloader() - { - if (null !== self::$standardAutoloader) { - return self::$standardAutoloader; - } - - // Extract the filename from the classname - $stdAutoloader = substr(strrchr(self::STANDARD_AUTOLOADER, '_'), 1); - - if (!class_exists(self::STANDARD_AUTOLOADER)) { - } - $loader = new Zend_Loader_StandardAutoloader(); - self::$standardAutoloader = $loader; - return self::$standardAutoloader; - } -} diff --git a/library/vendor/Zend/Loader/ClassMapAutoloader.php b/library/vendor/Zend/Loader/ClassMapAutoloader.php deleted file mode 100644 index c72a49221..000000000 --- a/library/vendor/Zend/Loader/ClassMapAutoloader.php +++ /dev/null @@ -1,243 +0,0 @@ -setOptions($options); - } - } - - /** - * Configure the autoloader - * - * Proxies to {@link registerAutoloadMaps()}. - * - * @param array|Traversable $options - * @return Zend_Loader_ClassMapAutoloader - */ - public function setOptions($options) - { - $this->registerAutoloadMaps($options); - return $this; - } - - /** - * Register an autoload map - * - * An autoload map may be either an associative array, or a file returning - * an associative array. - * - * An autoload map should be an associative array containing - * classname/file pairs. - * - * @param string|array $location - * @return Zend_Loader_ClassMapAutoloader - */ - public function registerAutoloadMap($map) - { - if (is_string($map)) { - $location = $map; - if ($this === ($map = $this->loadMapFromFile($location))) { - return $this; - } - } - - if (!is_array($map)) { - throw new Zend_Loader_Exception_InvalidArgumentException('Map file provided does not return a map'); - } - - $this->map = array_merge($this->map, $map); - - if (isset($location)) { - $this->mapsLoaded[] = $location; - } - - return $this; - } - - /** - * Register many autoload maps at once - * - * @param array $locations - * @return Zend_Loader_ClassMapAutoloader - */ - public function registerAutoloadMaps($locations) - { - if (!is_array($locations) && !($locations instanceof Traversable)) { - throw new Zend_Loader_Exception_InvalidArgumentException('Map list must be an array or implement Traversable'); - } - foreach ($locations as $location) { - $this->registerAutoloadMap($location); - } - return $this; - } - - /** - * Retrieve current autoload map - * - * @return array - */ - public function getAutoloadMap() - { - return $this->map; - } - - /** - * Defined by Autoloadable - * - * @param string $class - * @return void - */ - public function autoload($class) - { - if (isset($this->map[$class])) { - } - } - - /** - * Register the autoloader with spl_autoload registry - * - * @return void - */ - public function register() - { - if (version_compare(PHP_VERSION, '5.3.0', '>=')) { - spl_autoload_register(array($this, 'autoload'), true, true); - } else { - spl_autoload_register(array($this, 'autoload'), true); - } - } - - /** - * Load a map from a file - * - * If the map has been previously loaded, returns the current instance; - * otherwise, returns whatever was returned by calling include() on the - * location. - * - * @param string $location - * @return Zend_Loader_ClassMapAutoloader|mixed - * @throws Zend_Loader_Exception_InvalidArgumentException for nonexistent locations - */ - protected function loadMapFromFile($location) - { - if (!file_exists($location)) { - throw new Zend_Loader_Exception_InvalidArgumentException('Map file provided does not exist'); - } - - if (!$path = self::realPharPath($location)) { - $path = realpath($location); - } - - if (in_array($path, $this->mapsLoaded)) { - // Already loaded this map - return $this; - } - - $map = include $path; - - return $map; - } - - /** - * Resolve the real_path() to a file within a phar. - * - * @see https://bugs.php.net/bug.php?id=52769 - * @param string $path - * @return string - */ - public static function realPharPath($path) - { - if (strpos($path, 'phar:///') !== 0) { - return; - } - - $parts = explode('/', str_replace(array('/','\\'), '/', substr($path, 8))); - $parts = array_values(array_filter($parts, array(__CLASS__, 'concatPharParts'))); - - array_walk($parts, array(__CLASS__, 'resolvePharParentPath'), $parts); - - if (file_exists($realPath = 'phar:///' . implode('/', $parts))) { - return $realPath; - } - } - - /** - * Helper callback for filtering phar paths - * - * @param string $part - * @return bool - */ - public static function concatPharParts($part) - { - return ($part !== '' && $part !== '.'); - } - - /** - * Helper callback to resolve a parent path in a Phar archive - * - * @param string $value - * @param int $key - * @param array $parts - * @return void - */ - public static function resolvePharParentPath($value, $key, &$parts) - { - if ($value !== '...') { - return; - } - unset($parts[$key], $parts[$key-1]); - $parts = array_values($parts); - } -} diff --git a/library/vendor/Zend/Loader/SplAutoloader.php b/library/vendor/Zend/Loader/SplAutoloader.php deleted file mode 100644 index f502f8f03..000000000 --- a/library/vendor/Zend/Loader/SplAutoloader.php +++ /dev/null @@ -1,75 +0,0 @@ - - * spl_autoload_register(array($this, 'autoload')); - * - * - * @return void - */ - public function register(); -} diff --git a/library/vendor/Zend/Loader/StandardAutoloader.php b/library/vendor/Zend/Loader/StandardAutoloader.php deleted file mode 100644 index 95c97ba85..000000000 --- a/library/vendor/Zend/Loader/StandardAutoloader.php +++ /dev/null @@ -1,363 +0,0 @@ -setOptions($options); - } - } - - /** - * Configure autoloader - * - * Allows specifying both "namespace" and "prefix" pairs, using the - * following structure: - * - * array( - * 'namespaces' => array( - * 'Zend' => '/path/to/Zend/library', - * 'Doctrine' => '/path/to/Doctrine/library', - * ), - * 'prefixes' => array( - * 'Phly_' => '/path/to/Phly/library', - * ), - * 'fallback_autoloader' => true, - * ) - * - * - * @param array|Traversable $options - * @return Zend_Loader_StandardAutoloader - */ - public function setOptions($options) - { - if (!is_array($options) && !($options instanceof Traversable)) { - throw new Zend_Loader_Exception_InvalidArgumentException('Options must be either an array or Traversable'); - } - - foreach ($options as $type => $pairs) { - switch ($type) { - case self::AUTOREGISTER_ZF: - if ($pairs) { - $this->registerPrefix('Zend', dirname(dirname(__FILE__))); - } - break; - case self::LOAD_NS: - if (is_array($pairs) || $pairs instanceof Traversable) { - $this->registerNamespaces($pairs); - } - break; - case self::LOAD_PREFIX: - if (is_array($pairs) || $pairs instanceof Traversable) { - $this->registerPrefixes($pairs); - } - break; - case self::ACT_AS_FALLBACK: - $this->setFallbackAutoloader($pairs); - break; - default: - // ignore - } - } - return $this; - } - - /** - * Set flag indicating fallback autoloader status - * - * @param bool $flag - * @return Zend_Loader_StandardAutoloader - */ - public function setFallbackAutoloader($flag) - { - $this->fallbackAutoloaderFlag = (bool) $flag; - return $this; - } - - /** - * Is this autoloader acting as a fallback autoloader? - * - * @return bool - */ - public function isFallbackAutoloader() - { - return $this->fallbackAutoloaderFlag; - } - - /** - * Register a namespace/directory pair - * - * @param string $namespace - * @param string $directory - * @return Zend_Loader_StandardAutoloader - */ - public function registerNamespace($namespace, $directory) - { - $namespace = rtrim($namespace, self::NS_SEPARATOR). self::NS_SEPARATOR; - $this->namespaces[$namespace] = $this->normalizeDirectory($directory); - return $this; - } - - /** - * Register many namespace/directory pairs at once - * - * @param array $namespaces - * @return Zend_Loader_StandardAutoloader - */ - public function registerNamespaces($namespaces) - { - if (!is_array($namespaces) && !$namespaces instanceof Traversable) { - throw new Zend_Loader_Exception_InvalidArgumentException('Namespace pairs must be either an array or Traversable'); - } - - foreach ($namespaces as $namespace => $directory) { - $this->registerNamespace($namespace, $directory); - } - return $this; - } - - /** - * Register a prefix/directory pair - * - * @param string $prefix - * @param string $directory - * @return Zend_Loader_StandardAutoloader - */ - public function registerPrefix($prefix, $directory) - { - $prefix = rtrim($prefix, self::PREFIX_SEPARATOR). self::PREFIX_SEPARATOR; - $this->prefixes[$prefix] = $this->normalizeDirectory($directory); - return $this; - } - - /** - * Register many namespace/directory pairs at once - * - * @param array $prefixes - * @return Zend_Loader_StandardAutoloader - */ - public function registerPrefixes($prefixes) - { - if (!is_array($prefixes) && !$prefixes instanceof Traversable) { - throw new Zend_Loader_Exception_InvalidArgumentException('Prefix pairs must be either an array or Traversable'); - } - - foreach ($prefixes as $prefix => $directory) { - $this->registerPrefix($prefix, $directory); - } - return $this; - } - - /** - * Defined by Autoloadable; autoload a class - * - * @param string $class - * @return false|string - */ - public function autoload($class) - { - $isFallback = $this->isFallbackAutoloader(); - if (false !== strpos($class, self::NS_SEPARATOR)) { - if ($this->loadClass($class, self::LOAD_NS)) { - return $class; - } elseif ($isFallback) { - return $this->loadClass($class, self::ACT_AS_FALLBACK); - } - return false; - } - if (false !== strpos($class, self::PREFIX_SEPARATOR)) { - if ($this->loadClass($class, self::LOAD_PREFIX)) { - return $class; - } elseif ($isFallback) { - return $this->loadClass($class, self::ACT_AS_FALLBACK); - } - return false; - } - if ($isFallback) { - return $this->loadClass($class, self::ACT_AS_FALLBACK); - } - return false; - } - - /** - * Register the autoloader with spl_autoload - * - * @return void - */ - public function register() - { - spl_autoload_register(array($this, 'autoload')); - } - - /** - * Error handler - * - * Used by {@link loadClass} during fallback autoloading in PHP versions - * prior to 5.3.0. - * - * @param mixed $errno - * @param mixed $errstr - * @return void - */ - public function handleError($errno, $errstr) - { - $this->error = true; - } - - /** - * Transform the class name to a filename - * - * @param string $class - * @param string $directory - * @return string - */ - protected function transformClassNameToFilename($class, $directory) - { - // $class may contain a namespace portion, in which case we need - // to preserve any underscores in that portion. - $matches = array(); - preg_match('/(?P.+\\\)?(?P[^\\\]+$)/', $class, $matches); - - $class = (isset($matches['class'])) ? $matches['class'] : ''; - $namespace = (isset($matches['namespace'])) ? $matches['namespace'] : ''; - - return $directory - . str_replace(self::NS_SEPARATOR, '/', $namespace) - . str_replace(self::PREFIX_SEPARATOR, '/', $class) - . '.php'; - } - - /** - * Load a class, based on its type (namespaced or prefixed) - * - * @param string $class - * @param string $type - * @return void - */ - protected function loadClass($class, $type) - { - if (!in_array($type, array(self::LOAD_NS, self::LOAD_PREFIX, self::ACT_AS_FALLBACK))) { - throw new Zend_Loader_Exception_InvalidArgumentException(); - } - - // Fallback autoloading - if ($type === self::ACT_AS_FALLBACK) { - // create filename - $filename = $this->transformClassNameToFilename($class, ''); - if (version_compare(PHP_VERSION, '5.3.2', '>=')) { - $resolvedName = stream_resolve_include_path($filename); - if ($resolvedName !== false) { - return include $resolvedName; - } - return false; - } - $this->error = false; - set_error_handler(array($this, 'handleError'), E_WARNING); - include $filename; - restore_error_handler(); - if ($this->error) { - return false; - } - return class_exists($class, false); - } - - // Namespace and/or prefix autoloading - foreach ($this->$type as $leader => $path) { - if (0 === strpos($class, $leader)) { - // Trim off leader (namespace or prefix) - $trimmedClass = substr($class, strlen($leader)); - - // create filename - $filename = $this->transformClassNameToFilename($trimmedClass, $path); - if (file_exists($filename)) { - return include $filename; - } - return false; - } - } - return false; - } - - /** - * Normalize the directory to include a trailing directory separator - * - * @param string $directory - * @return string - */ - protected function normalizeDirectory($directory) - { - $last = $directory[strlen($directory) - 1]; - if (in_array($last, array('/', '\\'))) { - $directory[strlen($directory) - 1] = DIRECTORY_SEPARATOR; - return $directory; - } - $directory .= DIRECTORY_SEPARATOR; - return $directory; - } - -} diff --git a/library/vendor/Zend/Log.php b/library/vendor/Zend/Log.php index b2ad2b0ca..e9d14a967 100644 --- a/library/vendor/Zend/Log.php +++ b/library/vendor/Zend/Log.php @@ -25,6 +25,17 @@ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ + * + * Convenience methods for log [@see Zend_Log::__call()]: + * + * @method emerg(string $message, $extras = null) + * @method alert(string $message, $extras = null) + * @method crit(string $message, $extras = null) + * @method err(string $message, $extras = null) + * @method warn(string $message, $extras = null) + * @method notice(string $message, $extras = null) + * @method info(string $message, $extras = null) + * @method debug(string $message, $extras = null) */ class Zend_Log { @@ -104,7 +115,6 @@ class Zend_Log * Class constructor. Create a new logger * * @param Zend_Log_Writer_Abstract|null $writer default writer - * @return void */ public function __construct(Zend_Log_Writer_Abstract $writer = null) { @@ -171,7 +181,7 @@ class Zend_Log /** * Construct a writer object based on a configuration array * - * @param array $spec config array with writer spec + * @param array $config config array with writer spec * @return Zend_Log_Writer_Abstract * @throws Zend_Log_Exception */ @@ -342,6 +352,7 @@ class Zend_Log */ public function __destruct() { + /** @var Zend_Log_Writer_Abstract $writer */ foreach($this->_writers as $writer) { $writer->shutdown(); } @@ -427,6 +438,7 @@ class Zend_Log } // abort if rejected by the global filters + /** @var Zend_Log_Filter_Interface $filter */ foreach ($this->_filters as $filter) { if (! $filter->accept($event)) { return; @@ -434,6 +446,7 @@ class Zend_Log } // send to each writer + /** @var Zend_Log_Writer_Abstract $writer */ foreach ($this->_writers as $writer) { $writer->write($event); } @@ -442,8 +455,9 @@ class Zend_Log /** * Add a custom priority * - * @param string $name Name of priority - * @param integer $priority Numeric priority + * @param string $name Name of priority + * @param integer $priority Numeric priority + * @return $this * @throws Zend_Log_Exception */ public function addPriority($name, $priority) @@ -467,7 +481,7 @@ class Zend_Log * must be accepted by all filters added with this method. * * @param int|Zend_Config|array|Zend_Log_Filter_Interface $filter - * @return Zend_Log + * @return $this * @throws Zend_Log_Exception */ public function addFilter($filter) @@ -494,6 +508,7 @@ class Zend_Log * * @param mixed $writer Zend_Log_Writer_Abstract or Config array * @return Zend_Log + * @throws Zend_Log_Exception */ public function addWriter($writer) { diff --git a/library/vendor/Zend/Log/Formatter/Firebug.php b/library/vendor/Zend/Log/Formatter/Firebug.php deleted file mode 100644 index 332d0d807..000000000 --- a/library/vendor/Zend/Log/Formatter/Firebug.php +++ /dev/null @@ -1,60 +0,0 @@ - Zend_Wildfire_Plugin_FirePhp::ERROR, - Zend_Log::ALERT => Zend_Wildfire_Plugin_FirePhp::ERROR, - Zend_Log::CRIT => Zend_Wildfire_Plugin_FirePhp::ERROR, - Zend_Log::ERR => Zend_Wildfire_Plugin_FirePhp::ERROR, - Zend_Log::WARN => Zend_Wildfire_Plugin_FirePhp::WARN, - Zend_Log::NOTICE => Zend_Wildfire_Plugin_FirePhp::INFO, - Zend_Log::INFO => Zend_Wildfire_Plugin_FirePhp::INFO, - Zend_Log::DEBUG => Zend_Wildfire_Plugin_FirePhp::LOG); - - /** - * The default logging style for un-mapped priorities - * - * @var string - */ - protected $_defaultPriorityStyle = Zend_Wildfire_Plugin_FirePhp::LOG; - - /** - * Flag indicating whether the log writer is enabled - * - * @var boolean - */ - protected $_enabled = true; - - /** - * Class constructor - * - * @return void - */ - public function __construct() - { - if (php_sapi_name() == 'cli') { - $this->setEnabled(false); - } - - $this->_formatter = new Zend_Log_Formatter_Firebug(); - } - - /** - * Create a new instance of Zend_Log_Writer_Firebug - * - * @param array|Zend_Config $config - * @return Zend_Log_Writer_Firebug - */ - static public function factory($config) - { - return new self(); - } - - /** - * Enable or disable the log writer. - * - * @param boolean $enabled Set to TRUE to enable the log writer - * @return boolean The previous value. - */ - public function setEnabled($enabled) - { - $previous = $this->_enabled; - $this->_enabled = $enabled; - return $previous; - } - - /** - * Determine if the log writer is enabled. - * - * @return boolean Returns TRUE if the log writer is enabled. - */ - public function getEnabled() - { - return $this->_enabled; - } - - /** - * Set the default display style for user-defined priorities - * - * @param string $style The default log display style - * @return string Returns previous default log display style - */ - public function setDefaultPriorityStyle($style) - { - $previous = $this->_defaultPriorityStyle; - $this->_defaultPriorityStyle = $style; - return $previous; - } - - /** - * Get the default display style for user-defined priorities - * - * @return string Returns the default log display style - */ - public function getDefaultPriorityStyle() - { - return $this->_defaultPriorityStyle; - } - - /** - * Set a display style for a logging priority - * - * @param int $priority The logging priority - * @param string $style The logging display style - * @return string|boolean The previous logging display style if defined or TRUE otherwise - */ - public function setPriorityStyle($priority, $style) - { - $previous = true; - if (array_key_exists($priority,$this->_priorityStyles)) { - $previous = $this->_priorityStyles[$priority]; - } - $this->_priorityStyles[$priority] = $style; - return $previous; - } - - /** - * Get a display style for a logging priority - * - * @param int $priority The logging priority - * @return string|boolean The logging display style if defined or FALSE otherwise - */ - public function getPriorityStyle($priority) - { - if (array_key_exists($priority,$this->_priorityStyles)) { - return $this->_priorityStyles[$priority]; - } - return false; - } - - /** - * Log a message to the Firebug Console. - * - * @param array $event The event data - * @return void - */ - protected function _write($event) - { - if (!$this->getEnabled()) { - return; - } - - if (array_key_exists($event['priority'],$this->_priorityStyles)) { - $type = $this->_priorityStyles[$event['priority']]; - } else { - $type = $this->_defaultPriorityStyle; - } - - $message = $this->_formatter->format($event); - - $label = isset($event['firebugLabel'])?$event['firebugLabel']:null; - - Zend_Wildfire_Plugin_FirePhp::getInstance()->send($message, - $label, - $type, - array('traceOffset'=>4, - 'fixZendLogOffsetIfApplicable'=>true)); - } -} diff --git a/library/vendor/Zend/Mail.php b/library/vendor/Zend/Mail.php index 6d393d06b..8a1173cfe 100644 --- a/library/vendor/Zend/Mail.php +++ b/library/vendor/Zend/Mail.php @@ -205,7 +205,6 @@ class Zend_Mail extends Zend_Mime_Message * Public constructor * * @param string $charset - * @return void */ public function __construct($charset = null) { @@ -324,8 +323,10 @@ class Zend_Mail extends Zend_Mime_Message /** * Set the encoding of mail headers * - * @param string $encoding Zend_Mime::ENCODING_QUOTEDPRINTABLE or Zend_Mime::ENCODING_BASE64 + * @param string $encoding Zend_Mime::ENCODING_QUOTEDPRINTABLE or + * Zend_Mime::ENCODING_BASE64 * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception */ public function setHeaderEncoding($encoding) { @@ -372,7 +373,8 @@ class Zend_Mail extends Zend_Mime_Message /** * Return text body Zend_Mime_Part or string * - * @param bool textOnly Whether to return just the body text content or the MIME part; defaults to false, the MIME part + * @param bool $textOnly Whether to return just the body text content or + * the MIME part; defaults to false, the MIME part * @return false|Zend_Mime_Part|string */ public function getBodyText($textOnly = false) @@ -556,7 +558,8 @@ class Zend_Mail extends Zend_Mime_Message } /** - * Adds To-header and recipient, $email can be an array, or a single string address + * Adds To-header and recipient, $email can be an array, or a single string + * address * * @param string|array $email * @param string $name @@ -577,7 +580,8 @@ class Zend_Mail extends Zend_Mime_Message } /** - * Adds Cc-header and recipient, $email can be an array, or a single string address + * Adds Cc-header and recipient, $email can be an array, or a single string + * address * * @param string|array $email * @param string $name @@ -755,8 +759,8 @@ class Zend_Mail extends Zend_Mime_Message /** * Sets Default From-email and name of the message * - * @param string $email - * @param string Optional $name + * @param string $email + * @param string $name optional * @return void */ public static function setDefaultFrom($email, $name = null) @@ -788,6 +792,7 @@ class Zend_Mail extends Zend_Mime_Message * Sets From-name and -email based on the defaults * * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception */ public function setFromToDefaultFrom() { $from = self::getDefaultFrom(); @@ -804,8 +809,8 @@ class Zend_Mail extends Zend_Mime_Message /** * Sets Default ReplyTo-address and -name of the message * - * @param string $email - * @param string Optional $name + * @param string $email + * @param string $name optional * @return void */ public static function setDefaultReplyTo($email, $name = null) @@ -837,6 +842,7 @@ class Zend_Mail extends Zend_Mime_Message * Sets ReplyTo-name and -email based on the defaults * * @return Zend_Mail Provides fluent interface + * @throws Zend_Mail_Exception */ public function setReplyToFromDefault() { $replyTo = self::getDefaultReplyTo(); @@ -949,9 +955,10 @@ class Zend_Mail extends Zend_Mime_Message /** * Sets Date-header * - * @param timestamp|string|Zend_Date $date + * @param int|string|Zend_Date $date * @return Zend_Mail Provides fluent interface - * @throws Zend_Mail_Exception if called subsequent times or wrong date format. + * @throws Zend_Mail_Exception if called subsequent times or wrong date + * format. */ public function setDate($date = null) { @@ -1136,7 +1143,7 @@ class Zend_Mail extends Zend_Mime_Message /** * Return mail headers * - * @return void + * @return array */ public function getHeaders() { diff --git a/library/vendor/Zend/Mail/Storage/Mbox.php b/library/vendor/Zend/Mail/Storage/Mbox.php index 840ca94ae..5f5bffb88 100644 --- a/library/vendor/Zend/Mail/Storage/Mbox.php +++ b/library/vendor/Zend/Mail/Storage/Mbox.php @@ -25,6 +25,7 @@ * @see Zend_Loader * May be used in constructor, but commented out for now */ +// require_once 'Zend/Loader.php'; /** * @see Zend_Mail_Storage_Abstract diff --git a/library/vendor/Zend/Markup.php b/library/vendor/Zend/Markup.php deleted file mode 100644 index ab60dcbb7..000000000 --- a/library/vendor/Zend/Markup.php +++ /dev/null @@ -1,133 +0,0 @@ - 'Zend/Markup/Parser/', - )); - } - - return self::$_parserLoader; - } - - /** - * Get the renderer loader - * - * @return Zend_Loader_PluginLoader - */ - public static function getRendererLoader() - { - if (!(self::$_rendererLoader instanceof Zend_Loader_PluginLoader)) { - self::$_rendererLoader = new Zend_Loader_PluginLoader(array( - 'Zend_Markup_Renderer' => 'Zend/Markup/Renderer/', - )); - } - - return self::$_rendererLoader; - } - - /** - * Add a parser path - * - * @param string $prefix - * @param string $path - * @return Zend_Loader_PluginLoader - */ - public static function addParserPath($prefix, $path) - { - return self::getParserLoader()->addPrefixPath($prefix, $path); - } - - /** - * Add a renderer path - * - * @param string $prefix - * @param string $path - * @return Zend_Loader_PluginLoader - */ - public static function addRendererPath($prefix, $path) - { - return self::getRendererLoader()->addPrefixPath($prefix, $path); - } - - /** - * Factory pattern - * - * @param string $parser - * @param string $renderer - * @param array $options - * @return Zend_Markup_Renderer_RendererAbstract - */ - public static function factory($parser, $renderer = 'Html', array $options = array()) - { - $parserClass = self::getParserLoader()->load($parser); - $rendererClass = self::getRendererLoader()->load($renderer); - - $parser = new $parserClass(); - $options['parser'] = $parser; - $renderer = new $rendererClass($options); - - return $renderer; - } -} diff --git a/library/vendor/Zend/Markup/Exception.php b/library/vendor/Zend/Markup/Exception.php deleted file mode 100644 index 4a685a34a..000000000 --- a/library/vendor/Zend/Markup/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ - array( - 'type' => self::TYPE_DEFAULT, - 'stoppers' => array(), - ), - '*' => array( - 'type' => self::TYPE_DEFAULT, - 'stoppers' => array(self::NEWLINE, '[/*]', '[/]'), - ), - 'hr' => array( - 'type' => self::TYPE_SINGLE, - 'stoppers' => array(), - ), - 'code' => array( - 'type' => self::TYPE_DEFAULT, - 'stoppers' => array('[/code]', '[/]'), - 'parse_inside' => false - ) - ); - - /** - * Token array - * - * @var array - */ - protected $_tokens = array(); - - /** - * State - * - * @var int - */ - protected $_state = self::STATE_SCAN; - - - /** - * Prepare the parsing of a bbcode string, the real parsing is done in {@link _parse()} - * - * @param string $value - * @return Zend_Markup_TokenList - */ - public function parse($value) - { - if (!is_string($value)) { - /** - * @see Zend_Markup_Parser_Exception - */ - throw new Zend_Markup_Parser_Exception('Value to parse should be a string.'); - } - - if (empty($value)) { - /** - * @see Zend_Markup_Parser_Exception - */ - throw new Zend_Markup_Parser_Exception('Value to parse cannot be left empty.'); - } - - $this->_value = str_replace(array("\r\n", "\r", "\n"), self::NEWLINE, $value); - - // variable initialization for tokenizer - $this->_valueLen = strlen($this->_value); - $this->_pointer = 0; - $this->_buffer = ''; - $this->_temp = array(); - $this->_state = self::STATE_SCAN; - $this->_tokens = array(); - - $this->_tokenize(); - - // variable initialization for treebuilder - $this->_searchedStoppers = array(); - $this->_tree = new Zend_Markup_TokenList(); - $this->_current = new Zend_Markup_Token( - '', - Zend_Markup_Token::TYPE_NONE, - 'Zend_Markup_Root' - ); - - $this->_tree->addChild($this->_current); - - $this->_createTree(); - - return $this->_tree; - } - - /** - * Tokenize - * - * @param string $input - * - * @return void - */ - protected function _tokenize() - { - $attribute = ''; - - while ($this->_pointer < $this->_valueLen) { - switch ($this->_state) { - case self::STATE_SCAN: - $matches = array(); - $regex = '#\G(?[^\[]*)(?\[(?[' . self::NAME_CHARSET . ']+)?)?#'; - preg_match($regex, $this->_value, $matches, null, $this->_pointer); - - $this->_pointer += strlen($matches[0]); - - if (!empty($matches['text'])) { - $this->_buffer .= $matches['text']; - } - - if (!isset($matches['open'])) { - // great, no tag, we are ending the string - break; - } - if (!isset($matches['name'])) { - $this->_buffer .= $matches['open']; - break; - } - - $this->_temp = array( - 'tag' => '[' . $matches['name'], - 'name' => $matches['name'], - 'attributes' => array() - ); - - if ($this->_pointer >= $this->_valueLen) { - // damn, no tag - $this->_buffer .= $this->_temp['tag']; - break 2; - } - - if ($this->_value[$this->_pointer] == '=') { - $this->_pointer++; - - $this->_temp['tag'] .= '='; - $this->_state = self::STATE_PARSEVALUE; - $attribute = $this->_temp['name']; - } else { - $this->_state = self::STATE_SCANATTRS; - } - break; - case self::STATE_SCANATTRS: - $matches = array(); - $regex = '#\G((?\s*\])|\s+(?[' . self::NAME_CHARSET . ']+)(?=?))#'; - if (!preg_match($regex, $this->_value, $matches, null, $this->_pointer)) { - break 2; - } - - $this->_pointer += strlen($matches[0]); - - if (!empty($matches['end'])) { - if (!empty($this->_buffer)) { - $this->_tokens[] = array( - 'tag' => $this->_buffer, - 'type' => Zend_Markup_Token::TYPE_NONE - ); - $this->_buffer = ''; - } - $this->_temp['tag'] .= $matches['end']; - $this->_temp['type'] = Zend_Markup_Token::TYPE_TAG; - - $this->_tokens[] = $this->_temp; - $this->_temp = array(); - - $this->_state = self::STATE_SCAN; - } else { - // attribute name - $attribute = $matches['attribute']; - - $this->_temp['tag'] .= $matches[0]; - - $this->_temp['attributes'][$attribute] = ''; - - if (empty($matches['eq'])) { - $this->_state = self::STATE_SCANATTRS; - } else { - $this->_state = self::STATE_PARSEVALUE; - } - } - break; - case self::STATE_PARSEVALUE: - $matches = array(); - $regex = '#\G((?"|\')(?.*?)\\2|(?[^\]\s]+))#'; - if (!preg_match($regex, $this->_value, $matches, null, $this->_pointer)) { - $this->_state = self::STATE_SCANATTRS; - break; - } - - $this->_pointer += strlen($matches[0]); - - if (!empty($matches['quote'])) { - $this->_temp['attributes'][$attribute] = $matches['valuequote']; - } else { - $this->_temp['attributes'][$attribute] = $matches['value']; - } - $this->_temp['tag'] .= $matches[0]; - - $this->_state = self::STATE_SCANATTRS; - break; - } - } - - if (!empty($this->_buffer)) { - $this->_tokens[] = array( - 'tag' => $this->_buffer, - 'type' => Zend_Markup_Token::TYPE_NONE - ); - } - } - - /** - * Parse the token array into a tree - * - * @param array $tokens - * - * @return void - */ - public function _createTree() - { - foreach ($this->_tokens as $token) { - // first we want to know if this tag is a stopper, or at least a searched one - if ($this->_isStopper($token['tag'])) { - // find the stopper - $oldItems = array(); - - while (!in_array($token['tag'], $this->_tags[$this->_current->getName()]['stoppers'])) { - $oldItems[] = clone $this->_current; - $this->_current = $this->_current->getParent(); - } - - // we found the stopper, so stop the tag - $this->_current->setStopper($token['tag']); - $this->_removeFromSearchedStoppers($this->_current); - $this->_current = $this->_current->getParent(); - - // add the old items again if there are any - if (!empty($oldItems)) { - foreach (array_reverse($oldItems) as $item) { - /* @var $token Zend_Markup_Token */ - $this->_current->addChild($item); - $item->setParent($this->_current); - $this->_current = $item; - } - } - } else { - if ($token['type'] == Zend_Markup_Token::TYPE_TAG) { - if ($token['tag'] == self::NEWLINE) { - // this is a newline tag, add it as a token - $this->_current->addChild(new Zend_Markup_Token( - "\n", - Zend_Markup_Token::TYPE_NONE, - '', - array(), - $this->_current - )); - } elseif (isset($token['name']) && ($token['name'][0] == '/')) { - // this is a stopper, add it as a empty token - $this->_current->addChild(new Zend_Markup_Token( - $token['tag'], - Zend_Markup_Token::TYPE_NONE, - '', - array(), - $this->_current - )); - } elseif (isset($this->_tags[$this->_current->getName()]['parse_inside']) - && !$this->_tags[$this->_current->getName()]['parse_inside'] - ) { - $this->_current->addChild(new Zend_Markup_Token( - $token['tag'], - Zend_Markup_Token::TYPE_NONE, - '', - array(), - $this->_current - )); - } else { - // add the tag - $child = new Zend_Markup_Token( - $token['tag'], - $token['type'], - $token['name'], - $token['attributes'], - $this->_current - ); - $this->_current->addChild($child); - - // add stoppers for this tag, if its has stoppers - if ($this->_getType($token['name']) == self::TYPE_DEFAULT) { - $this->_current = $child; - - $this->_addToSearchedStoppers($this->_current); - } - } - } else { - // no tag, just add it as a simple token - $this->_current->addChild(new Zend_Markup_Token( - $token['tag'], - Zend_Markup_Token::TYPE_NONE, - '', - array(), - $this->_current - )); - } - } - } - } - - /** - * Check if there is a tag declaration, and if it isnt there, add it - * - * @param string $name - * - * @return void - */ - protected function _checkTagDeclaration($name) - { - if (!isset($this->_tags[$name])) { - $this->_tags[$name] = array( - 'type' => self::TYPE_DEFAULT, - 'stoppers' => array( - '[/' . $name . ']', - '[/]' - ) - ); - } - } - /** - * Check the tag's type - * - * @param string $name - * @return string - */ - protected function _getType($name) - { - $this->_checkTagDeclaration($name); - - return $this->_tags[$name]['type']; - } - - /** - * Check if the tag is a stopper - * - * @param string $tag - * @return bool - */ - protected function _isStopper($tag) - { - $this->_checkTagDeclaration($this->_current->getName()); - - if (!empty($this->_searchedStoppers[$tag])) { - return true; - } - - return false; - } - - /** - * Add to searched stoppers - * - * @param Zend_Markup_Token $token - * @return void - */ - protected function _addToSearchedStoppers(Zend_Markup_Token $token) - { - $this->_checkTagDeclaration($token->getName()); - - foreach ($this->_tags[$token->getName()]['stoppers'] as $stopper) { - if (!isset($this->_searchedStoppers[$stopper])) { - $this->_searchedStoppers[$stopper] = 0; - } - ++$this->_searchedStoppers[$stopper]; - } - } - - /** - * Remove from searched stoppers - * - * @param Zend_Markup_Token $token - * @return void - */ - protected function _removeFromSearchedStoppers(Zend_Markup_Token $token) - { - $this->_checkTagDeclaration($token->getName()); - - foreach ($this->_tags[$token->getName()]['stoppers'] as $stopper) { - --$this->_searchedStoppers[$stopper]; - } - } - -} diff --git a/library/vendor/Zend/Markup/Parser/Exception.php b/library/vendor/Zend/Markup/Parser/Exception.php deleted file mode 100644 index d1ecfad7a..000000000 --- a/library/vendor/Zend/Markup/Parser/Exception.php +++ /dev/null @@ -1,39 +0,0 @@ - - * array( - * array( - * 'tag' => '[tag="a" attr=val]', - * 'type' => Zend_Markup::TYPE_TAG, - * 'name' => 'tag', - * 'stoppers' => array('[/]', '[/tag]'), - * 'attributes' => array( - * 'tag' => 'a', - * 'attr' => 'val' - * ) - * ), - * array( - * 'tag' => 'value', - * 'type' => Zend_Markup::TYPE_NONE - * ), - * array( - * 'tag' => '[/tag]', - * 'type' => Zend_Markup::TYPE_STOPPER, - * 'name' => 'tag', - * 'stoppers' => array(), - * 'attributes' => array() - * ) - * ) - * - * - * @param string $value - * @return array - */ - public function parse($value); -} diff --git a/library/vendor/Zend/Markup/Renderer/Exception.php b/library/vendor/Zend/Markup/Renderer/Exception.php deleted file mode 100644 index f97a0f09b..000000000 --- a/library/vendor/Zend/Markup/Renderer/Exception.php +++ /dev/null @@ -1,39 +0,0 @@ - array('block', 'inline', 'block-empty', 'inline-empty', 'list'), - 'inline' => array('inline', 'inline-empty'), - 'list' => array('list-item'), - 'list-item' => array('inline', 'inline-empty', 'list'), - 'block-empty' => array(), - 'inline-empty' => array(), - ); - - /** - * The current group - * - * @var string - */ - protected $_group = 'block'; - - /** - * Default attributes - * - * @var array - */ - protected static $_defaultAttributes = array( - 'id' => '', - 'class' => '', - 'style' => '', - 'lang' => '', - 'title' => '' - ); - - - /** - * Constructor - * - * @param array|Zend_Config $options - * - * @return void - */ - public function __construct($options = array()) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - - $this->_pluginLoader = new Zend_Loader_PluginLoader(array( - 'Zend_Markup_Renderer_Html' => 'Zend/Markup/Renderer/Html/' - )); - - if (!isset($options['useDefaultMarkups']) && isset($options['useDefaultTags'])) { - $options['useDefaultMarkups'] = $options['useDefaultTags']; - } - if (isset($options['useDefaultMarkups']) && ($options['useDefaultMarkups'] !== false)) { - $this->_defineDefaultMarkups(); - } elseif (!isset($options['useDefaultMarkups'])) { - $this->_defineDefaultMarkups(); - } - - parent::__construct($options); - } - - /** - * Define the default markups - * - * @return void - */ - protected function _defineDefaultMarkups() - { - $this->_markups = array( - 'b' => array( - 'type' => 10, // self::TYPE_REPLACE | self::TAG_NORMAL - 'tag' => 'strong', - 'group' => 'inline', - 'filter' => true, - ), - 'u' => array( - 'type' => 10, - 'tag' => 'span', - 'attributes' => array( - 'style' => 'text-decoration: underline;', - ), - 'group' => 'inline', - 'filter' => true, - ), - 'i' => array( - 'type' => 10, - 'tag' => 'em', - 'group' => 'inline', - 'filter' => true, - ), - 'cite' => array( - 'type' => 10, - 'tag' => 'cite', - 'group' => 'inline', - 'filter' => true, - ), - 'del' => array( - 'type' => 10, - 'tag' => 'del', - 'group' => 'inline', - 'filter' => true, - ), - 'ins' => array( - 'type' => 10, - 'tag' => 'ins', - 'group' => 'inline', - 'filter' => true, - ), - 'sub' => array( - 'type' => 10, - 'tag' => 'sub', - 'group' => 'inline', - 'filter' => true, - ), - 'sup' => array( - 'type' => 10, - 'tag' => 'sup', - 'group' => 'inline', - 'filter' => true, - ), - 'span' => array( - 'type' => 10, - 'tag' => 'span', - 'group' => 'inline', - 'filter' => true, - ), - 'acronym' => array( - 'type' => 10, - 'tag' => 'acronym', - 'group' => 'inline', - 'filter' => true, - ), - // headings - 'h1' => array( - 'type' => 10, - 'tag' => 'h1', - 'group' => 'inline', - 'filter' => true, - ), - 'h2' => array( - 'type' => 10, - 'tag' => 'h2', - 'group' => 'inline', - 'filter' => true, - ), - 'h3' => array( - 'type' => 10, - 'tag' => 'h3', - 'group' => 'inline', - 'filter' => true, - ), - 'h4' => array( - 'type' => 10, - 'tag' => 'h4', - 'group' => 'inline', - 'filter' => true, - ), - 'h5' => array( - 'type' => 10, - 'tag' => 'h5', - 'group' => 'inline', - 'filter' => true, - ), - 'h6' => array( - 'type' => 10, - 'tag' => 'h6', - 'group' => 'inline', - 'filter' => true, - ), - // callback tags - 'url' => array( - 'type' => 6, // self::TYPE_CALLBACK | self::TAG_NORMAL - 'callback' => null, - 'group' => 'inline', - 'filter' => true, - ), - 'img' => array( - 'type' => 6, - 'callback' => null, - 'group' => 'inline-empty', - 'filter' => true, - ), - 'code' => array( - 'type' => 6, - 'callback' => null, - 'group' => 'block-empty', - 'filter' => false, - ), - 'p' => array( - 'type' => 10, - 'tag' => 'p', - 'group' => 'block', - 'filter' => true, - ), - 'ignore' => array( - 'type' => 10, - 'start' => '', - 'end' => '', - 'group' => 'block-empty', - 'filter' => true, - ), - 'quote' => array( - 'type' => 10, - 'tag' => 'blockquote', - 'group' => 'block', - 'filter' => true, - ), - 'list' => array( - 'type' => 6, - 'callback' => null, - 'group' => 'list', - 'filter' => new Zend_Filter_PregReplace('/.*/is', ''), - ), - '*' => array( - 'type' => 10, - 'tag' => 'li', - 'group' => 'list-item', - 'filter' => true, - ), - 'hr' => array( - 'type' => 9, // self::TYPE_REPLACE | self::TAG_SINGLE - 'tag' => 'hr', - 'group' => 'block', - 'empty' => true, - ), - // aliases - 'bold' => array( - 'type' => 16, - 'name' => 'b', - ), - 'strong' => array( - 'type' => 16, - 'name' => 'b', - ), - 'italic' => array( - 'type' => 16, - 'name' => 'i', - ), - 'em' => array( - 'type' => 16, - 'name' => 'i', - ), - 'emphasized' => array( - 'type' => 16, - 'name' => 'i', - ), - 'underline' => array( - 'type' => 16, - 'name' => 'u', - ), - 'citation' => array( - 'type' => 16, - 'name' => 'cite', - ), - 'deleted' => array( - 'type' => 16, - 'name' => 'del', - ), - 'insert' => array( - 'type' => 16, - 'name' => 'ins', - ), - 'strike' => array( - 'type' => 16, - 'name' => 's', - ), - 's' => array( - 'type' => 16, - 'name' => 'del', - ), - 'subscript' => array( - 'type' => 16, - 'name' => 'sub', - ), - 'superscript' => array( - 'type' => 16, - 'name' => 'sup', - ), - 'a' => array( - 'type' => 16, - 'name' => 'url', - ), - 'image' => array( - 'type' => 16, - 'name' => 'img', - ), - 'li' => array( - 'type' => 16, - 'name' => '*', - ), - 'color' => array( - 'type' => 16, - 'name' => 'span', - ), - ); - } - - /** - * Add the default filters - * - * @return void - */ - public function addDefaultFilters() - { - $this->_defaultFilter = new Zend_Filter(); - - $this->_defaultFilter->addFilter(new Zend_Filter_HtmlEntities(array('encoding' => self::getEncoding()))); - $this->_defaultFilter->addFilter(new Zend_Filter_Callback('nl2br')); - } - - /** - * Execute a replace token - * - * @param Zend_Markup_Token $token - * @param array $markup - * @return string - */ - protected function _executeReplace(Zend_Markup_Token $token, $markup) - { - if (isset($markup['tag'])) { - if (!isset($markup['attributes'])) { - $markup['attributes'] = array(); - } - $attrs = self::renderAttributes($token, $markup['attributes']); - return "<{$markup['tag']}{$attrs}>{$this->_render($token)}"; - } - - return parent::_executeReplace($token, $markup); - } - - /** - * Execute a single replace token - * - * @param Zend_Markup_Token $token - * @param array $markup - * @return string - */ - protected function _executeSingleReplace(Zend_Markup_Token $token, $markup) - { - if (isset($markup['tag'])) { - if (!isset($markup['attributes'])) { - $markup['attributes'] = array(); - } - $attrs = self::renderAttributes($token, $markup['attributes']); - return "<{$markup['tag']}{$attrs} />"; - } - return parent::_executeSingleReplace($token, $markup); - } - - /** - * Render some attributes - * - * @param Zend_Markup_Token $token - * @param array $attributes - * @return string - */ - public static function renderAttributes(Zend_Markup_Token $token, array $attributes = array()) - { - $attributes = array_merge(self::$_defaultAttributes, $attributes); - - $return = ''; - - $tokenAttributes = $token->getAttributes(); - - // correct style attribute - if (isset($tokenAttributes['style'])) { - $tokenAttributes['style'] = trim($tokenAttributes['style']); - - if ($tokenAttributes['style'][strlen($tokenAttributes['style']) - 1] != ';') { - $tokenAttributes['style'] .= ';'; - } - } else { - $tokenAttributes['style'] = ''; - } - - // special treathment for 'align' and 'color' attribute - if (isset($tokenAttributes['align'])) { - $tokenAttributes['style'] .= 'text-align: ' . $tokenAttributes['align'] . ';'; - unset($tokenAttributes['align']); - } - if (isset($tokenAttributes['color']) && self::checkColor($tokenAttributes['color'])) { - $tokenAttributes['style'] .= 'color: ' . $tokenAttributes['color'] . ';'; - unset($tokenAttributes['color']); - } - - /* - * loop through all the available attributes, and check if there is - * a value defined by the token - * if there is no value defined by the token, use the default value or - * don't set the attribute - */ - foreach ($attributes as $attribute => $value) { - if (isset($tokenAttributes[$attribute]) && !empty($tokenAttributes[$attribute])) { - $return .= ' ' . $attribute . '="' . htmlentities($tokenAttributes[$attribute], - ENT_QUOTES, - self::getEncoding()) . '"'; - } elseif (!empty($value)) { - $return .= ' ' . $attribute . '="' . htmlentities($value, ENT_QUOTES, self::getEncoding()) . '"'; - } - } - - return $return; - } - - /** - * Check if a color is a valid HTML color - * - * @param string $color - * - * @return bool - */ - public static function checkColor($color) - { - /* - * aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, - * purple, red, silver, teal, white, and yellow. - */ - $colors = array( - 'aqua', 'black', 'blue', 'fuchsia', 'gray', 'green', 'lime', - 'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal', - 'white', 'yellow' - ); - - if (in_array($color, $colors)) { - return true; - } - - if (preg_match('/\#[0-9a-f]{6}/i', $color)) { - return true; - } - - return false; - } - - /** - * Check if the URI is valid - * - * @param string $uri - * - * @return bool - */ - public static function isValidUri($uri) - { - if (!preg_match('/^([a-z][a-z+\-.]*):/i', $uri, $matches)) { - return false; - } - - $scheme = strtolower($matches[1]); - - switch ($scheme) { - case 'javascript': - // JavaScript scheme is not allowed for security reason - return false; - - case 'http': - case 'https': - case 'ftp': - $components = @parse_url($uri); - - if ($components === false) { - return false; - } - - if (!isset($components['host'])) { - return false; - } - - return true; - - default: - return true; - } - } -} diff --git a/library/vendor/Zend/Markup/Renderer/Html/Code.php b/library/vendor/Zend/Markup/Renderer/Html/Code.php deleted file mode 100644 index 86958742a..000000000 --- a/library/vendor/Zend/Markup/Renderer/Html/Code.php +++ /dev/null @@ -1,52 +0,0 @@ -_renderer = $renderer; - } - - /** - * Get the HTML renderer instance - * - * @return Zend_Markup_Renderer_Html - */ - public function getRenderer() - { - return $this->_renderer; - } -} diff --git a/library/vendor/Zend/Markup/Renderer/Html/Img.php b/library/vendor/Zend/Markup/Renderer/Html/Img.php deleted file mode 100644 index 109957125..000000000 --- a/library/vendor/Zend/Markup/Renderer/Html/Img.php +++ /dev/null @@ -1,82 +0,0 @@ -hasAttribute('alt')) { - $alt = $token->getAttribute('alt'); - } else { - // try to get the alternative from the URL - $alt = rtrim($text, '/'); - $alt = strrchr($alt, '/'); - if (false !== strpos($alt, '.')) { - $alt = substr($alt, 1, strpos($alt, '.') - 1); - } - } - - // run the URI and alt through htmlentities - $uri = htmlentities($uri, ENT_QUOTES, Zend_Markup_Renderer_Html::getEncoding()); - $alt = htmlentities($alt, ENT_QUOTES, Zend_Markup_Renderer_Html::getEncoding()); - - - return "\"{$alt}\"""; - } - -} diff --git a/library/vendor/Zend/Markup/Renderer/Html/List.php b/library/vendor/Zend/Markup/Renderer/Html/List.php deleted file mode 100644 index 3726060be..000000000 --- a/library/vendor/Zend/Markup/Renderer/Html/List.php +++ /dev/null @@ -1,102 +0,0 @@ -hasAttribute('list')) { - // because '01' == '1' - if ($token->getAttribute('list') === '01') { - $type = 'decimal-leading-zero'; - } else { - switch ($token->getAttribute('list')) { - case '1': - $type = 'decimal'; - break; - case 'i': - $type = 'lower-roman'; - break; - case 'I': - $type = 'upper-roman'; - break; - case 'a': - $type = 'lower-alpha'; - break; - case 'A': - $type = 'upper-alpha'; - break; - - // the following type is unsupported by IE (including IE8) - case 'alpha': - $type = 'lower-greek'; - break; - - // the CSS names itself - case 'armenian': // unsupported by IE (including IE8) - case 'decimal': - case 'decimal-leading-zero': // unsupported by IE (including IE8) - case 'georgian': // unsupported by IE (including IE8) - case 'lower-alpha': - case 'lower-greek': // unsupported by IE (including IE8) - case 'lower-latin': // unsupported by IE (including IE8) - case 'lower-roman': - case 'upper-alpha': - case 'upper-latin': // unsupported by IE (including IE8) - case 'upper-roman': - $type = $token->getAttribute('list'); - break; - } - } - } - - if (null !== $type) { - return "
    {$text}
"; - } else { - return "
    {$text}
"; - } - } - -} diff --git a/library/vendor/Zend/Markup/Renderer/Html/Url.php b/library/vendor/Zend/Markup/Renderer/Html/Url.php deleted file mode 100644 index f58dfbd1c..000000000 --- a/library/vendor/Zend/Markup/Renderer/Html/Url.php +++ /dev/null @@ -1,75 +0,0 @@ -hasAttribute('url')) { - $uri = $token->getAttribute('url'); - } else { - $uri = $text; - } - - if (!preg_match('/^([a-z][a-z+\-.]*):/i', $uri)) { - $uri = 'http://' . $uri; - } - - // check if the URL is valid - if (!Zend_Markup_Renderer_Html::isValidUri($uri)) { - return $text; - } - - $attributes = Zend_Markup_Renderer_Html::renderAttributes($token); - - // run the URI through htmlentities - $uri = htmlentities($uri, ENT_QUOTES, Zend_Markup_Renderer_Html::getEncoding()); - - return "{$text}"; - } - -} diff --git a/library/vendor/Zend/Markup/Renderer/RendererAbstract.php b/library/vendor/Zend/Markup/Renderer/RendererAbstract.php deleted file mode 100644 index 55856122c..000000000 --- a/library/vendor/Zend/Markup/Renderer/RendererAbstract.php +++ /dev/null @@ -1,695 +0,0 @@ -toArray(); - } - - if (isset($options['encoding'])) { - $this->setEncoding($options['encoding']); - } - if (isset($options['parser'])) { - $this->setParser($options['parser']); - } - if (!isset($options['useDefaultFilters']) || ($options['useDefaultFilters'] === true)) { - $this->addDefaultFilters(); - } - if (isset($options['defaultFilter'])) { - $this->addDefaultFilter($options['defaultFilter']); - } - } - - /** - * Set the parser - * - * @param Zend_Markup_Parser_ParserInterface $parser - * @return Zend_Markup_Renderer_RendererAbstract - */ - public function setParser(Zend_Markup_Parser_ParserInterface $parser) - { - $this->_parser = $parser; - return $this; - } - - /** - * Get the parser - * - * @return Zend_Markup_Parser_ParserInterface - */ - public function getParser() - { - return $this->_parser; - } - - /** - * Get the plugin loader - * - * @return Zend_Loader_PluginLoader - */ - public function getPluginLoader() - { - return $this->_pluginLoader; - } - - /** - * Set the renderer's encoding - * - * @param string $encoding - * - * @return void - */ - public static function setEncoding($encoding) - { - self::$_encoding = $encoding; - } - - /** - * Get the renderer's encoding - * - * @return string - */ - public static function getEncoding() - { - return self::$_encoding; - } - - /** - * Add a new markup - * - * @param string $name - * @param string $type - * @param array $options - * - * @return Zend_Markup_Renderer_RendererAbstract - */ - public function addMarkup($name, $type, array $options) - { - if (!isset($options['group']) && ($type ^ self::TYPE_ALIAS)) { - throw new Zend_Markup_Renderer_Exception("There is no render group defined."); - } - - // add the filter - if (isset($options['filter'])) { - if ($options['filter'] instanceof Zend_Filter_Interface) { - $filter = $options['filter']; - } elseif ($options['filter'] === true) { - $filter = $this->getDefaultFilter(); - } else { - $filter = false; - } - } else { - $filter = $this->getDefaultFilter(); - } - - // check the type - if ($type & self::TYPE_CALLBACK) { - // add a callback tag - if (isset($options['callback'])) { - if (!($options['callback'] instanceof Zend_Markup_Renderer_TokenConverterInterface)) { - throw new Zend_Markup_Renderer_Exception("Not a valid tag callback."); - } - if (method_exists($options['callback'], 'setRenderer')) { - $options['callback']->setRenderer($this); - } - } else { - $options['callback'] = null; - } - - $options['type'] = $type; - $options['filter'] = $filter; - - $this->_markups[$name] = $options; - } elseif ($type & self::TYPE_ALIAS) { - // add an alias - if (empty($options['name'])) { - throw new Zend_Markup_Renderer_Exception( - 'No alias was provided but tag was defined as such'); - } - - $this->_markups[$name] = array( - 'type' => self::TYPE_ALIAS, - 'name' => $options['name'] - ); - } else { - if ($type && array_key_exists('empty', $options) && $options['empty']) { - // add a single replace markup - $options['type'] = $type; - $options['filter'] = $filter; - - $this->_markups[$name] = $options; - } else { - // add a replace markup - $options['type'] = $type; - $options['filter'] = $filter; - - $this->_markups[$name] = $options; - } - } - return $this; - } - - /** - * Remove a markup - * - * @param string $name - * - * @return void - */ - public function removeMarkup($name) - { - unset($this->_markups[$name]); - } - - /** - * Remove the default tags - * - * @return void - */ - public function clearMarkups() - { - $this->_markups = array(); - } - - /** - * Render function - * - * @param Zend_Markup_TokenList|string $tokenList - * @return string - */ - public function render($value) - { - if ($value instanceof Zend_Markup_TokenList) { - $tokenList = $value; - } else { - $tokenList = $this->getParser()->parse($value); - } - - $root = $tokenList->current(); - - $this->_filter = $this->getDefaultFilter(); - - return $this->_render($root); - } - - /** - * Render a single token - * - * @param Zend_Markup_Token $token - * @return string - */ - protected function _render(Zend_Markup_Token $token) - { - $return = ''; - - $this->_token = $token; - - // if this tag has children, execute them - if ($token->hasChildren()) { - foreach ($token->getChildren() as $child) { - $return .= $this->_execute($child); - } - } - - return $return; - } - - /** - * Get the group of a token - * - * @param Zend_Markup_Token $token - * @return string|bool - */ - protected function _getGroup(Zend_Markup_Token $token) - { - if (!isset($this->_markups[$token->getName()])) { - return false; - } - - $tag = $this->_markups[$token->getName()]; - - // alias processing - while ($tag['type'] & self::TYPE_ALIAS) { - $tag = $this->_markups[$tag['name']]; - } - - return isset($tag['group']) ? $tag['group'] : false; - } - - /** - * Execute the token - * - * @param Zend_Markup_Token $token - * @return string - */ - protected function _execute(Zend_Markup_Token $token) - { - // first return the normal text tags - if ($token->getType() == Zend_Markup_Token::TYPE_NONE) { - return $this->_filter($token->getTag()); - } - - // if the token doesn't have a notation, return the plain text - if (!isset($this->_markups[$token->getName()])) { - $oldToken = $this->_token; - $return = $this->_filter($token->getTag()) . $this->_render($token) . $token->getStopper(); - $this->_token = $oldToken; - return $return; - } - - $name = $this->_getMarkupName($token); - $markup = (!$name) ? false : $this->_markups[$name]; - $empty = (is_array($markup) && array_key_exists('empty', $markup) && $markup['empty']); - - // check if the tag has content - if (!$empty && !$token->hasChildren()) { - return ''; - } - - // check for the context - if (is_array($markup) && !in_array($markup['group'], $this->_groups[$this->_group])) { - $oldToken = $this->_token; - $return = $this->_filter($token->getTag()) . $this->_render($token) . $token->getStopper(); - $this->_token = $oldToken; - return $return; - } - - // check for the filter - if (!isset($markup['filter']) - || (!($markup['filter'] instanceof Zend_Filter_Interface) && ($markup['filter'] !== false))) { - $this->_markups[$name]['filter'] = $this->getDefaultFilter(); - } - - // save old values to reset them after the work is done - $oldFilter = $this->_filter; - $oldGroup = $this->_group; - - $return = ''; - - // set the filter and the group - $this->_filter = $this->getFilter($name); - - if ($group = $this->_getGroup($token)) { - $this->_group = $group; - } - - // callback - if (is_array($markup) && ($markup['type'] & self::TYPE_CALLBACK)) { - // load the callback if the tag doesn't exist - if (!($markup['callback'] instanceof Zend_Markup_Renderer_TokenConverterInterface)) { - $class = $this->getPluginLoader()->load($name); - - $markup['callback'] = new $class; - - if (!($markup['callback'] instanceof Zend_Markup_Renderer_TokenConverterInterface)) { - throw new Zend_Markup_Renderer_Exception("Callback for tag '$name' found, but it isn't valid."); - } - - if (method_exists($markup['callback'], 'setRenderer')) { - $markup['callback']->setRenderer($this); - } - } - if ($markup['type'] && !$empty) { - $return = $markup['callback']->convert($token, $this->_render($token)); - } else { - $return = $markup['callback']->convert($token, null); - } - } else { - // replace - if ($markup['type'] && !$empty) { - $return = $this->_executeReplace($token, $markup); - } else { - $return = $this->_executeSingleReplace($token, $markup); - } - } - - // reset to the old values - $this->_filter = $oldFilter; - $this->_group = $oldGroup; - - return $return; - } - - /** - * Filter method - * - * @param string $value - * - * @return string - */ - protected function _filter($value) - { - if ($this->_filter instanceof Zend_Filter_Interface) { - return $this->_filter->filter($value); - } - return $value; - } - - /** - * Get the markup name - * - * @param Zend_Markup_Token - * - * @return string - */ - protected function _getMarkupName(Zend_Markup_Token $token) - { - $name = $token->getName(); - if (empty($name)) { - return false; - } - - return $this->_resolveMarkupName($name); - } - - /** - * Resolve aliases for a markup name - * - * @param string $name - * - * @return string - */ - protected function _resolveMarkupName($name) - { - while (($type = $this->_getMarkupType($name)) - && ($type & self::TYPE_ALIAS) - ) { - $name = $this->_markups[$name]['name']; - } - - return $name; - } - - /** - * Retrieve markup type - * - * @param string $name - * @return false|int - */ - protected function _getMarkupType($name) - { - if (!isset($this->_markups[$name])) { - return false; - } - if (!isset($this->_markups[$name]['type'])) { - return false; - } - return $this->_markups[$name]['type']; - } - - /** - * Execute a replace token - * - * @param Zend_Markup_Token $token - * @param array $tag - * @return string - */ - protected function _executeReplace(Zend_Markup_Token $token, $tag) - { - return $tag['start'] . $this->_render($token) . $tag['end']; - } - - /** - * Execute a single replace token - * - * @param Zend_Markup_Token $token - * @param array $tag - * @return string - */ - protected function _executeSingleReplace(Zend_Markup_Token $token, $tag) - { - return $tag['replace']; - } - - /** - * Get the default filter - * - * @return void - */ - public function getDefaultFilter() - { - if (null === $this->_defaultFilter) { - $this->addDefaultFilters(); - } - - return $this->_defaultFilter; - } - - /** - * Add a default filter - * - * @param string $filter - * - * @return void - */ - public function addDefaultFilter(Zend_Filter_Interface $filter, $placement = Zend_Filter::CHAIN_APPEND) - { - if (!($this->_defaultFilter instanceof Zend_Filter)) { - $defaultFilter = new Zend_Filter(); - $defaultFilter->addFilter($filter); - $this->_defaultFilter = $defaultFilter; - } - - $this->_defaultFilter->addFilter($filter, $placement); - } - - /** - * Set the default filter - * - * @param Zend_Filter_Interface $filter - * - * @return void - */ - public function setDefaultFilter(Zend_Filter_Interface $filter) - { - $this->_defaultFilter = $filter; - } - - /** - * Get the filter for an existing markup - * - * @param string $markup - * - * @return Zend_Filter_Interface - */ - public function getFilter($markup) - { - $markup = $this->_resolveMarkupName($markup); - - if (!isset($this->_markups[$markup]['filter']) - || !($this->_markups[$markup]['filter'] instanceof Zend_Filter_Interface) - ) { - if (isset($this->_markups[$markup]['filter']) && $this->_markups[$markup]['filter']) { - $this->_markups[$markup]['filter'] = $this->getDefaultFilter(); - } else { - return false; - } - } - - return $this->_markups[$markup]['filter']; - } - - /** - * Add a filter for an existing markup - * - * @param Zend_Filter_Interface $filter - * @param string $markup - * @param string $placement - * - * @return Zend_Markup_Renderer_RendererAbstract - */ - public function addFilter(Zend_Filter_Interface $filter, $markup, $placement = Zend_Filter::CHAIN_APPEND) - { - $markup = $this->_resolveMarkupName($markup); - - $oldFilter = $this->getFilter($markup); - - // if this filter is the default filter, clone it first - if ($oldFilter === $this->getDefaultFilter()) { - $oldFilter = clone $oldFilter; - } - - if (!($oldFilter instanceof Zend_Filter)) { - $this->_markups[$markup]['filter'] = new Zend_Filter(); - - if ($oldFilter instanceof Zend_Filter_Interface) { - $this->_markups[$markup]['filter']->addFilter($oldFilter); - } - } else { - $this->_markups[$markup]['filter'] = $oldFilter; - } - - $this->_markups[$markup]['filter']->addFilter($filter, $placement); - - return $this; - } - - /** - * Set the filter for an existing - * - * @param Zend_Filter_Interface $filter - * @param string $markup - * - * @return Zend_Markup_Renderer_RendererAbstract - */ - public function setFilter(Zend_Filter_Interface $filter, $markup) - { - $markup = $this->_resolveMarkupName($markup); - - $this->_markups[$markup]['filter'] = $filter; - - return $this; - } - - /** - * Add a render group - * - * @param string $name - * @param array $allowedInside - * @param array $allowsInside - * - * @return void - */ - public function addGroup($name, array $allowedInside = array(), array $allowsInside = array()) - { - $this->_groups[$name] = $allowsInside; - - foreach ($allowedInside as $group) { - $this->_groups[$group][] = $name; - } - } - - /** - * Get group definitions - * - * @return array - */ - public function getGroups() - { - return $this->_groups; - } - - /** - * Set the default filters - * - * @return void - */ - abstract public function addDefaultFilters(); - -} diff --git a/library/vendor/Zend/Markup/Renderer/TokenConverterInterface.php b/library/vendor/Zend/Markup/Renderer/TokenConverterInterface.php deleted file mode 100644 index 253c0c8a3..000000000 --- a/library/vendor/Zend/Markup/Renderer/TokenConverterInterface.php +++ /dev/null @@ -1,44 +0,0 @@ -_tag = $tag; - $this->_type = $type; - $this->_name = $name; - $this->_attributes = $attributes; - $this->_parent = $parent; - } - - // accessors - - /** - * Set the stopper - * - * @param string $stopper - * @return Zend_Markup_Token - */ - public function setStopper($stopper) - { - $this->_stopper = $stopper; - - return $this; - } - - /** - * Get the stopper - * - * @return string - */ - public function getStopper() - { - return $this->_stopper; - } - - /** - * Get the token's name - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * Get the token's type - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * Get the complete tag - * - * @return string - */ - public function getTag() - { - return $this->_tag; - } - - /** - * Get an attribute - * - * @param string $name - * - * @return string - */ - public function getAttribute($name) - { - return isset($this->_attributes[$name]) ? $this->_attributes[$name] : null; - } - - /** - * Check if the token has an attribute - * - * @param string $name - * - * @return bool - */ - public function hasAttribute($name) - { - return isset($this->_attributes[$name]); - } - - /** - * Get all the attributes - * - * @return array - */ - public function getAttributes() - { - return $this->_attributes; - } - - /** - * Add an attribute - * - * @return Zend_Markup_Token - */ - public function addAttribute($name, $value) - { - $this->_attributes[$name] = $value; - - return $this; - } - - /** - * Check if an attribute is empty - * - * @param string $name - * - * @return bool - */ - public function attributeIsEmpty($name) - { - return empty($this->_attributes[$name]); - } - - // functions for child/parent tokens - - /** - * Add a child token - * - * @return void - */ - public function addChild(Zend_Markup_Token $child) - { - $this->getChildren()->addChild($child); - } - - /** - * Set the children token list - * - * @param Zend_Markup_TokenList $children - * @return Zend_Markup_Token - */ - public function setChildren(Zend_Markup_TokenList $children) - { - $this->_children = $children; - return $this; - } - - /** - * Get the children for this token - * - * @return Zend_Markup_TokenList - */ - public function getChildren() - { - if (null === $this->_children) { - $this->setChildren(new Zend_Markup_TokenList()); - } - return $this->_children; - } - - /** - * Does this token have any children - * - * @return bool - */ - public function hasChildren() - { - return !empty($this->_children); - } - - /** - * Get the parent token (if any) - * - * @return Zend_Markup_Token - */ - public function getParent() - { - return $this->_parent; - } - - /** - * Set a parent token - * - * @param Zend_Markup_Token $parent - * @return Zend_Markup_Token - */ - public function setParent(Zend_Markup_Token $parent) - { - $this->_parent = $parent; - return $this; - } - - /** - * Magic clone function - * - * @return void - */ - public function __clone() - { - $this->_parent = null; - $this->_children = null; - $this->_tag = ''; - } -} diff --git a/library/vendor/Zend/Markup/TokenList.php b/library/vendor/Zend/Markup/TokenList.php deleted file mode 100644 index 97679b824..000000000 --- a/library/vendor/Zend/Markup/TokenList.php +++ /dev/null @@ -1,123 +0,0 @@ -_tokens); - } - - /** - * Get the children of the current token - * - * @return Zend_Markup_TokenList - */ - public function getChildren() - { - return current($this->_tokens)->getChildren(); - } - - /** - * Add a new child token - * - * @param Zend_Markup_Token $child - * - * @return void - */ - public function addChild(Zend_Markup_Token $child) - { - $this->_tokens[] = $child; - } - - /** - * Check if the current token has children - * - * @return bool - */ - public function hasChildren() - { - return current($this->_tokens)->hasChildren(); - } - - /** - * Get the key of the current token - * - * @return int - */ - public function key() - { - return key($this->_tokens); - } - - /** - * Go to the next token - * - * @return Zend_Markup_Token - */ - public function next() - { - return next($this->_tokens); - } - - /** - * Rewind the iterator - * - * @return void - */ - public function rewind() - { - reset($this->_tokens); - } - - /** - * Check if the element is valid - * - * @return void - */ - public function valid() - { - return $this->current() !== false; - } -} diff --git a/library/vendor/Zend/Measure/Abstract.php b/library/vendor/Zend/Measure/Abstract.php deleted file mode 100644 index 7f48ef503..000000000 --- a/library/vendor/Zend/Measure/Abstract.php +++ /dev/null @@ -1,409 +0,0 @@ -setLocale($locale); - if ($type === null) { - $type = $this->_units['STANDARD']; - } - - if (isset($this->_units[$type]) === false) { - throw new Zend_Measure_Exception("Type ($type) is unknown"); - } - - $this->setValue($value, $type, $this->_locale); - } - - /** - * Returns the actual set locale - * - * @return string - */ - public function getLocale() - { - return $this->_locale; - } - - /** - * Sets a new locale for the value representation - * - * @param string|Zend_Locale $locale (Optional) New locale to set - * @param boolean $check False, check but don't set; True, set the new locale - * @return Zend_Measure_Abstract - */ - public function setLocale($locale = null, $check = false) - { - if (empty($locale)) { - if (Zend_Registry::isRegistered('Zend_Locale') === true) { - $locale = Zend_Registry::get('Zend_Locale'); - } - } - - if ($locale === null) { - $locale = new Zend_Locale(); - } - - if (!Zend_Locale::isLocale($locale, true, false)) { - if (!Zend_Locale::isLocale($locale, false, false)) { - throw new Zend_Measure_Exception("Language (" . (string) $locale . ") is unknown"); - } - - $locale = new Zend_Locale($locale); - } - - if (!$check) { - $this->_locale = (string) $locale; - } - return $this; - } - - /** - * Returns the internal value - * - * @param integer $round (Optional) Rounds the value to an given precision, - * Default is -1 which returns without rounding - * @param string|Zend_Locale $locale (Optional) Locale for number representation - * @return integer|string - */ - public function getValue($round = -1, $locale = null) - { - if ($round < 0) { - $return = $this->_value; - } else { - $return = Zend_Locale_Math::round($this->_value, $round); - } - - if ($locale !== null) { - $this->setLocale($locale, true); - return Zend_Locale_Format::toNumber($return, array('locale' => $locale)); - } - - return $return; - } - - /** - * Set a new value - * - * @param integer|string $value Value as string, integer, real or float - * @param string $type OPTIONAL A measure type f.e. Zend_Measure_Length::METER - * @param string|Zend_Locale $locale OPTIONAL Locale for parsing numbers - * @throws Zend_Measure_Exception - * @return Zend_Measure_Abstract - */ - public function setValue($value, $type = null, $locale = null) - { - if (($type !== null) and (Zend_Locale::isLocale($type, null, false))) { - $locale = $type; - $type = null; - } - - if ($locale === null) { - $locale = $this->_locale; - } - - $this->setLocale($locale, true); - if ($type === null) { - $type = $this->_units['STANDARD']; - } - - if (empty($this->_units[$type])) { - throw new Zend_Measure_Exception("Type ($type) is unknown"); - } - - try { - $value = Zend_Locale_Format::getNumber($value, array('locale' => $locale)); - } catch(Exception $e) { - throw new Zend_Measure_Exception($e->getMessage(), $e->getCode(), $e); - } - - $this->_value = $value; - $this->setType($type); - return $this; - } - - /** - * Returns the original type - * - * @return type - */ - public function getType() - { - return $this->_type; - } - - /** - * Set a new type, and convert the value - * - * @param string $type New type to set - * @throws Zend_Measure_Exception - * @return Zend_Measure_Abstract - */ - public function setType($type) - { - if (empty($this->_units[$type])) { - throw new Zend_Measure_Exception("Type ($type) is unknown"); - } - - if (empty($this->_type)) { - $this->_type = $type; - } else { - // Convert to standard value - $value = $this->_value; - if (is_array($this->_units[$this->getType()][0])) { - foreach ($this->_units[$this->getType()][0] as $key => $found) { - switch ($key) { - case "/": - if ($found != 0) { - $value = call_user_func(Zend_Locale_Math::$div, $value, $found, 25); - } - break; - case "+": - $value = call_user_func(Zend_Locale_Math::$add, $value, $found, 25); - break; - case "-": - $value = call_user_func(Zend_Locale_Math::$sub, $value, $found, 25); - break; - default: - $value = call_user_func(Zend_Locale_Math::$mul, $value, $found, 25); - break; - } - } - } else { - $value = call_user_func(Zend_Locale_Math::$mul, $value, $this->_units[$this->getType()][0], 25); - } - - // Convert to expected value - if (is_array($this->_units[$type][0])) { - foreach (array_reverse($this->_units[$type][0]) as $key => $found) { - switch ($key) { - case "/": - $value = call_user_func(Zend_Locale_Math::$mul, $value, $found, 25); - break; - case "+": - $value = call_user_func(Zend_Locale_Math::$sub, $value, $found, 25); - break; - case "-": - $value = call_user_func(Zend_Locale_Math::$add, $value, $found, 25); - break; - default: - if ($found != 0) { - $value = call_user_func(Zend_Locale_Math::$div, $value, $found, 25); - } - break; - } - } - } else { - $value = call_user_func(Zend_Locale_Math::$div, $value, $this->_units[$type][0], 25); - } - - $slength = strlen($value); - $length = 0; - for($i = 1; $i <= $slength; ++$i) { - if ($value[$slength - $i] != '0') { - $length = 26 - $i; - break; - } - } - - $this->_value = Zend_Locale_Math::round($value, $length); - $this->_type = $type; - } - return $this; - } - - /** - * Compare if the value and type is equal - * - * @param Zend_Measure_Abstract $object object to compare - * @return boolean - */ - public function equals($object) - { - if ((string) $object == $this->toString()) { - return true; - } - - return false; - } - - /** - * Returns a string representation - * - * @param integer $round (Optional) Runds the value to an given exception - * @param string|Zend_Locale $locale (Optional) Locale to set for the number - * @return string - */ - public function toString($round = -1, $locale = null) - { - if ($locale === null) { - $locale = $this->_locale; - } - - return $this->getValue($round, $locale) . ' ' . $this->_units[$this->getType()][1]; - } - - /** - * Returns a string representation - * - * @return string - */ - public function __toString() - { - return $this->toString(); - } - - /** - * Returns the conversion list - * - * @return array - */ - public function getConversionList() - { - return $this->_units; - } - - /** - * Alias function for setType returning the converted unit - * - * @param string $type Constant Type - * @param integer $round (Optional) Rounds the value to a given precision - * @param string|Zend_Locale $locale (Optional) Locale to set for the number - * @return string - */ - public function convertTo($type, $round = 2, $locale = null) - { - $this->setType($type); - return $this->toString($round, $locale); - } - - /** - * Adds an unit to another one - * - * @param Zend_Measure_Abstract $object object of same unit type - * @return Zend_Measure_Abstract - */ - public function add($object) - { - $object->setType($this->getType()); - $value = $this->getValue(-1) + $object->getValue(-1); - - $this->setValue($value, $this->getType(), $this->_locale); - return $this; - } - - /** - * Substracts an unit from another one - * - * @param Zend_Measure_Abstract $object object of same unit type - * @return Zend_Measure_Abstract - */ - public function sub($object) - { - $object->setType($this->getType()); - $value = $this->getValue(-1) - $object->getValue(-1); - - $this->setValue($value, $this->getType(), $this->_locale); - return $this; - } - - /** - * Compares two units - * - * @param Zend_Measure_Abstract $object object of same unit type - * @return boolean - */ - public function compare($object) - { - $object->setType($this->getType()); - $value = $this->getValue(-1) - $object->getValue(-1); - - if ($value < 0) { - return -1; - } else if ($value > 0) { - return 1; - } - - return 0; - } -} diff --git a/library/vendor/Zend/Measure/Acceleration.php b/library/vendor/Zend/Measure/Acceleration.php deleted file mode 100644 index ec36eaba4..000000000 --- a/library/vendor/Zend/Measure/Acceleration.php +++ /dev/null @@ -1,89 +0,0 @@ - array('0.0001', 'cgal'), - 'CENTIMETER_PER_SQUARE_SECOND' => array('0.01', 'cm/s²'), - 'DECIGAL' => array('0.001', 'dgal'), - 'DECIMETER_PER_SQUARE_SECOND' => array('0.1', 'dm/s²'), - 'DEKAMETER_PER_SQUARE_SECOND' => array('10', 'dam/s²'), - 'FOOT_PER_SQUARE_SECOND' => array('0.3048', 'ft/s²'), - 'G' => array('9.80665', 'g'), - 'GAL' => array('0.01', 'gal'), - 'GALILEO' => array('0.01', 'gal'), - 'GRAV' => array('9.80665', 'g'), - 'HECTOMETER_PER_SQUARE_SECOND' => array('100', 'h/s²'), - 'INCH_PER_SQUARE_SECOND' => array('0.0254', 'in/s²'), - 'KILOMETER_PER_HOUR_SECOND' => array(array('' => '5','/' => '18'), 'km/h²'), - 'KILOMETER_PER_SQUARE_SECOND' => array('1000', 'km/s²'), - 'METER_PER_SQUARE_SECOND' => array('1', 'm/s²'), - 'MILE_PER_HOUR_MINUTE' => array(array('' => '22', '/' => '15', '*' => '0.3048', '/' => '60'), 'mph/m'), - 'MILE_PER_HOUR_SECOND' => array(array('' => '22', '/' => '15', '*' => '0.3048'), 'mph/s'), - 'MILE_PER_SQUARE_SECOND' => array('1609.344', 'mi/s²'), - 'MILLIGAL' => array('0.00001', 'mgal'), - 'MILLIMETER_PER_SQUARE_SECOND' => array('0.001', 'mm/s²'), - 'STANDARD' => 'METER_PER_SQUARE_SECOND' - ); -} diff --git a/library/vendor/Zend/Measure/Angle.php b/library/vendor/Zend/Measure/Angle.php deleted file mode 100644 index 882c5ea19..000000000 --- a/library/vendor/Zend/Measure/Angle.php +++ /dev/null @@ -1,76 +0,0 @@ - array('1','rad'), - 'MIL' => array(array('' => M_PI,'/' => '3200'), 'mil'), - 'GRAD' => array(array('' => M_PI,'/' => '200'), 'gr'), - 'DEGREE' => array(array('' => M_PI,'/' => '180'), '°'), - 'MINUTE' => array(array('' => M_PI,'/' => '10800'), "'"), - 'SECOND' => array(array('' => M_PI,'/' => '648000'), '"'), - 'POINT' => array(array('' => M_PI,'/' => '16'), 'pt'), - 'CIRCLE_16' => array(array('' => M_PI,'/' => '8'), 'per 16 circle'), - 'CIRCLE_10' => array(array('' => M_PI,'/' => '5'), 'per 10 circle'), - 'CIRCLE_8' => array(array('' => M_PI,'/' => '4'), 'per 8 circle'), - 'CIRCLE_6' => array(array('' => M_PI,'/' => '3'), 'per 6 circle'), - 'CIRCLE_4' => array(array('' => M_PI,'/' => '2'), 'per 4 circle'), - 'CIRCLE_2' => array(M_PI, 'per 2 circle'), - 'FULL_CIRCLE' => array(array('' => M_PI,'*' => '2'), 'cir'), - 'STANDARD' => 'RADIAN' - ); -} diff --git a/library/vendor/Zend/Measure/Area.php b/library/vendor/Zend/Measure/Area.php deleted file mode 100644 index 688dfbde5..000000000 --- a/library/vendor/Zend/Measure/Area.php +++ /dev/null @@ -1,308 +0,0 @@ - array('4046.856422', 'A'), - 'ACRE_COMMERCIAL' => array('3344.50944', 'A'), - 'ACRE_SURVEY' => array('4046.872627', 'A'), - 'ACRE_IRELAND' => array('6555', 'A'), - 'ARE' => array('100', 'a'), - 'ARPENT' => array('3418.89', 'arpent'), - 'BARN' => array('1e-28', 'b'), - 'BOVATE' => array('60000', 'bovate'), - 'BUNDER' => array('10000', 'bunder'), - 'CABALLERIA' => array('400000', 'caballeria'), - 'CABALLERIA_AMERICA' => array('450000', 'caballeria'), - 'CABALLERIA_CUBA' => array('134200', 'caballeria'), - 'CARREAU' => array('12900', 'carreau'), - 'CARUCATE' => array('486000', 'carucate'), - 'CAWNEY' => array('5400', 'cawney'), - 'CENTIARE' => array('1', 'ca'), - 'CONG' => array('1000', 'cong'), - 'COVER' => array('2698', 'cover'), - 'CUERDA' => array('3930', 'cda'), - 'DEKARE' => array('1000', 'dekare'), - 'DESSIATINA' => array('10925', 'dessiantina'), - 'DHUR' => array('16.929', 'dhur'), - 'DUNUM' => array('1000', 'dunum'), - 'DUNHAM' => array('1000', 'dunham'), - 'FALL_SCOTS' => array('32.15', 'fall'), - 'FALL' => array('47.03', 'fall'), - 'FANEGA' => array('6430', 'fanega'), - 'FARTHINGDALE' => array('1012', 'farthingdale'), - 'HACIENDA' => array('89600000', 'hacienda'), - 'HECTARE' => array('10000', 'ha'), - 'HIDE' => array('486000', 'hide'), - 'HOMESTEAD' => array('647500', 'homestead'), - 'HUNDRED' => array('50000000', 'hundred'), - 'JERIB' => array('2000', 'jerib'), - 'JITRO' => array('5755', 'jitro'), - 'JOCH' => array('5755', 'joch'), - 'JUTRO' => array('5755', 'jutro'), - 'JO' => array('1.62', 'jo'), - 'KAPPLAND' => array('154.26', 'kappland'), - 'KATTHA' => array('338', 'kattha'), - 'LABOR' => array('716850', 'labor'), - 'LEGUA' => array('17920000', 'legua'), - 'MANZANA_COSTA_RICA' => array('6988.96', 'manzana'), - 'MANZANA' => array('10000', 'manzana'), - 'MORGEN' => array('2500', 'morgen'), - 'MORGEN_AFRICA' => array('8567', 'morgen'), - 'MU' => array(array('' => '10000', '/' => '15'), 'mu'), - 'NGARN' => array('400', 'ngarn'), - 'NOOK' => array('80937.128', 'nook'), - 'OXGANG' => array('60000', 'oxgang'), - 'PERCH' => array('25.29285264', 'perch'), - 'PERCHE' => array('34.19', 'perche'), - 'PING' => array('3.305', 'ping'), - 'PYONG' => array('3.306', 'pyong'), - 'RAI' => array('1600', 'rai'), - 'ROOD' => array('1011.7141', 'rood'), - 'SECTION' => array('2589998.5', 'sec'), - 'SHED' => array('10e-52', 'shed'), - 'SITIO' => array('18000000', 'sitio'), - 'SQUARE' => array('9.290304', 'sq'), - 'SQUARE_ANGSTROM' => array('1.0e-20', 'A²'), - 'SQUARE_ASTRONOMICAL_UNIT' => array('2.2379523e+22', 'AU²'), - 'SQUARE_ATTOMETER' => array('1.0e-36', 'am²'), - 'SQUARE_BICRON' => array('1.0e-24', 'µµ²'), - 'SQUARE_CENTIMETER' => array('0.0001', 'cm²'), - 'SQUARE_CHAIN' => array('404.68726', 'ch²'), - 'SQUARE_CHAIN_ENGINEER' => array('929.03412', 'ch²'), - 'SQUARE_CITY_BLOCK_US_EAST' => array('4.97027584', 'sq block'), - 'SQUARE_CITY_BLOCK_US_WEST' => array('17.141056', 'sq block'), - 'SQUARE_CITY_BLOCK_US_SOUTH' => array('99.88110336', 'sq block'), - 'SQUARE_CUBIT' => array('0.20903184', 'sq cubit'), - 'SQUARE_DECIMETER' => array('0.01', 'dm²'), - 'SQUARE_DEKAMETER' => array('100', 'dam²'), - 'SQUARE_EXAMETER' => array('1.0e+36', 'Em²'), - 'SQUARE_FATHOM' => array('3.3445228', 'fth²'), - 'SQUARE_FEMTOMETER' => array('1.0e-30', 'fm²'), - 'SQUARE_FERMI' => array('1.0e-30', 'f²'), - 'SQUARE_FOOT' => array('0.09290304', 'ft²'), - 'SQUARE_FOOT_SURVEY' => array('0.092903412', 'ft²'), - 'SQUARE_FURLONG' => array('40468.726', 'fur²'), - 'SQUARE_GIGAMETER' => array('1.0e+18', 'Gm²'), - 'SQUARE_HECTOMETER' => array('10000', 'hm²'), - 'SQUARE_INCH' => array(array('' => '0.09290304','/' => '144'), 'in²'), - 'SQUARE_INCH_SURVEY' => array(array('' => '0.092903412','/' => '144'), 'in²'), - 'SQUARE_KILOMETER' => array('1000000', 'km²'), - 'SQUARE_LEAGUE_NAUTIC' => array('3.0869136e+07', 'sq league'), - 'SQUARE_LEAGUE' => array('2.3309986e+07', 'sq league'), - 'SQUARE_LIGHT_YEAR' => array('8.9505412e+31', 'ly²'), - 'SQUARE_LINK' => array('0.040468726', 'sq link'), - 'SQUARE_LINK_ENGINEER' => array('0.092903412', 'sq link'), - 'SQUARE_MEGAMETER' => array('1.0e+12', 'Mm²'), - 'SQUARE_METER' => array('1', 'm²'), - 'SQUARE_MICROINCH' => array(array('' => '1.0e-6','*' => '6.4516e-10'), 'µin²'), - 'SQUARE_MICROMETER' => array('1.0e-12', 'µm²'), - 'SQUARE_MICROMICRON' => array('1.0e-24', 'µµ²'), - 'SQUARE_MICRON' => array('1.0e-12', 'µ²'), - 'SQUARE_MIL' => array('6.4516e-10', 'sq mil'), - 'SQUARE_MILE' => array(array('' => '0.09290304','*' => '27878400'), 'mi²'), - 'SQUARE_MILE_NAUTIC' => array('3429904', 'mi²'), - 'SQUARE_MILE_SURVEY' => array('2589998.5', 'mi²'), - 'SQUARE_MILLIMETER' => array('0.000001', 'mm²'), - 'SQUARE_MILLIMICRON' => array('1.0e-18', 'mµ²'), - 'SQUARE_MYRIAMETER' => array('1.0e+8', 'mym²'), - 'SQUARE_NANOMETER' => array('1.0e-18', 'nm²'), - 'SQUARE_PARIS_FOOT' => array('0.1055', 'sq paris foot'), - 'SQUARE_PARSEC' => array('9.5214087e+32', 'pc²'), - 'SQUARE_PERCH' => array('25.292954', 'sq perch'), - 'SQUARE_PERCHE' => array('51.072', 'sq perche'), - 'SQUARE_PETAMETER' => array('1.0e+30', 'Pm²'), - 'SQUARE_PICOMETER' => array('1.0e-24', 'pm²'), - 'SQUARE_ROD' => array(array('' => '0.092903412','*' => '272.25'), 'rd²'), - 'SQUARE_TENTHMETER' => array('1.0e-20', 'sq tenth-meter'), - 'SQUARE_TERAMETER' => array('1.0e+24', 'Tm²'), - 'SQUARE_THOU' => array('6.4516e-10', 'sq thou'), - 'SQUARE_VARA' => array('0.70258205', 'sq vara'), - 'SQUARE_VARA_TEXAS' => array('0.71684731', 'sq vara'), - 'SQUARE_YARD' => array('0.83612736', 'yd²'), - 'SQUARE_YARD_SURVEY' => array('0.836130708', 'yd²'), - 'SQUARE_YOCTOMETER' => array('1.0e-48', 'ym²'), - 'SQUARE_YOTTAMETER' => array('1.0e+48', 'Ym²'), - 'STANG' => array('2709', 'stang'), - 'STREMMA' => array('1000', 'stremma'), - 'TAREA' => array('628.8', 'tarea'), - 'TATAMI' => array('1.62', 'tatami'), - 'TONDE_LAND' => array('5516', 'tonde land'), - 'TOWNSHIP' => array('93239945.3196288', 'twp'), - 'TSUBO' => array('3.3058', 'tsubo'), - 'TUNNLAND' => array('4936.4', 'tunnland'), - 'YARD' => array('0.83612736', 'yd'), - 'VIRGATE' => array('120000', 'virgate'), - 'STANDARD' => 'SQUARE_METER' - ); -} diff --git a/library/vendor/Zend/Measure/Binary.php b/library/vendor/Zend/Measure/Binary.php deleted file mode 100644 index 61148d3e3..000000000 --- a/library/vendor/Zend/Measure/Binary.php +++ /dev/null @@ -1,120 +0,0 @@ - array('0.125', 'b'), - 'CRUMB' => array('0.25', 'crumb'), - 'NIBBLE' => array('0.5', 'nibble'), - 'BYTE' => array('1', 'B'), - 'KILOBYTE' => array('1024', 'kB'), - 'KIBIBYTE' => array('1024', 'KiB'), - 'KILO_BINARY_BYTE' => array('1024', 'KiB'), - 'KILOBYTE_SI' => array('1000', 'kB.'), - 'MEGABYTE' => array('1048576', 'MB'), - 'MEBIBYTE' => array('1048576', 'MiB'), - 'MEGA_BINARY_BYTE' => array('1048576', 'MiB'), - 'MEGABYTE_SI' => array('1000000', 'MB.'), - 'GIGABYTE' => array('1073741824', 'GB'), - 'GIBIBYTE' => array('1073741824', 'GiB'), - 'GIGA_BINARY_BYTE' => array('1073741824', 'GiB'), - 'GIGABYTE_SI' => array('1000000000', 'GB.'), - 'TERABYTE' => array('1099511627776', 'TB'), - 'TEBIBYTE' => array('1099511627776', 'TiB'), - 'TERA_BINARY_BYTE' => array('1099511627776', 'TiB'), - 'TERABYTE_SI' => array('1000000000000', 'TB.'), - 'PETABYTE' => array('1125899906842624', 'PB'), - 'PEBIBYTE' => array('1125899906842624', 'PiB'), - 'PETA_BINARY_BYTE' => array('1125899906842624', 'PiB'), - 'PETABYTE_SI' => array('1000000000000000', 'PB.'), - 'EXABYTE' => array('1152921504606846976', 'EB'), - 'EXBIBYTE' => array('1152921504606846976', 'EiB'), - 'EXA_BINARY_BYTE' => array('1152921504606846976', 'EiB'), - 'EXABYTE_SI' => array('1000000000000000000', 'EB.'), - 'ZETTABYTE' => array('1180591620717411303424', 'ZB'), - 'ZEBIBYTE' => array('1180591620717411303424', 'ZiB'), - 'ZETTA_BINARY_BYTE'=> array('1180591620717411303424', 'ZiB'), - 'ZETTABYTE_SI' => array('1000000000000000000000', 'ZB.'), - 'YOTTABYTE' => array('1208925819614629174706176', 'YB'), - 'YOBIBYTE' => array('1208925819614629174706176', 'YiB'), - 'YOTTA_BINARY_BYTE'=> array('1208925819614629174706176', 'YiB'), - 'YOTTABYTE_SI' => array('1000000000000000000000000', 'YB.'), - 'STANDARD' => 'BYTE' - ); -} diff --git a/library/vendor/Zend/Measure/Capacitance.php b/library/vendor/Zend/Measure/Capacitance.php deleted file mode 100644 index d10e9bae1..000000000 --- a/library/vendor/Zend/Measure/Capacitance.php +++ /dev/null @@ -1,96 +0,0 @@ - array('1.0e+9', 'abfarad'), - 'AMPERE_PER_SECOND_VOLT' => array('1', 'A/sV'), - 'CENTIFARAD' => array('0.01', 'cF'), - 'COULOMB_PER_VOLT' => array('1', 'C/V'), - 'DECIFARAD' => array('0.1', 'dF'), - 'DEKAFARAD' => array('10', 'daF'), - 'ELECTROMAGNETIC_UNIT' => array('1.0e+9', 'capacity emu'), - 'ELECTROSTATIC_UNIT' => array('1.11265e-12', 'capacity esu'), - 'FARAD' => array('1', 'F'), - 'FARAD_INTERNATIONAL' => array('0.99951', 'F'), - 'GAUSSIAN' => array('1.11265e-12', 'G'), - 'GIGAFARAD' => array('1.0e+9', 'GF'), - 'HECTOFARAD' => array('100', 'hF'), - 'JAR' => array('1.11265e-9', 'jar'), - 'KILOFARAD' => array('1000', 'kF'), - 'MEGAFARAD' => array('1000000', 'MF'), - 'MICROFARAD' => array('0.000001', 'µF'), - 'MILLIFARAD' => array('0.001', 'mF'), - 'NANOFARAD' => array('1.0e-9', 'nF'), - 'PICOFARAD' => array('1.0e-12', 'pF'), - 'PUFF' => array('1.0e-12', 'pF'), - 'SECOND_PER_OHM' => array('1', 's/Ohm'), - 'STATFARAD' => array('1.11265e-12', 'statfarad'), - 'TERAFARAD' => array('1.0e+12', 'TF'), - 'STANDARD' => 'FARAD' - ); -} diff --git a/library/vendor/Zend/Measure/Cooking/Volume.php b/library/vendor/Zend/Measure/Cooking/Volume.php deleted file mode 100644 index 20bd9fad0..000000000 --- a/library/vendor/Zend/Measure/Cooking/Volume.php +++ /dev/null @@ -1,188 +0,0 @@ - array(array('' => '0.0037854118', '/' => '16', '' => '3.5'), '2.5th can'), - 'CAN_10' => array(array('' => '0.0037854118', '*' => '0.75'), '10th can'), - 'BARREL_WINE' => array('0.143201835', 'bbl'), - 'BARREL' => array('0.16365924', 'bbl'), - 'BARREL_US_DRY' => array(array('' => '26.7098656608', '/' => '231'), 'bbl'), - 'BARREL_US_FEDERAL' => array('0.1173477658', 'bbl'), - 'BARREL_US' => array('0.1192404717', 'bbl'), - 'BUCKET' => array('0.01818436', 'bucket'), - 'BUCKET_US' => array('0.018927059', 'bucket'), - 'BUSHEL' => array('0.03636872', 'bu'), - 'BUSHEL_US' => array('0.03523907', 'bu'), - 'CENTILITER' => array('0.00001', 'cl'), - 'COFFEE_SPOON' => array(array('' => '0.0037854118', '/' => '1536'), 'coffee spoon'), - 'CUBIC_CENTIMETER' => array('0.000001', 'cm³'), - 'CUBIC_DECIMETER' => array('0.001', 'dm³'), - 'CUBIC_FOOT' => array(array('' => '6.54119159', '/' => '231'), 'ft³'), - 'CUBIC_INCH' => array(array('' => '0.0037854118', '/' => '231'), 'in³'), - 'CUBIC_METER' => array('1', 'm³'), - 'CUBIC_MICROMETER' => array('1.0e-18', 'µm³'), - 'CUBIC_MILLIMETER' => array('1.0e-9', 'mm³'), - 'CUP_CANADA' => array('0.0002273045', 'c'), - 'CUP' => array('0.00025', 'c'), - 'CUP_US' => array(array('' => '0.0037854118', '/' => '16'), 'c'), - 'DASH' => array(array('' => '0.0037854118', '/' => '6144'), 'ds'), - 'DECILITER' => array('0.0001', 'dl'), - 'DEKALITER' => array('0.001', 'dal'), - 'DEMI' => array('0.00025', 'demi'), - 'DRAM' => array(array('' => '0.0037854118', '/' => '1024'), 'dr'), - 'DROP' => array(array('' => '0.0037854118', '/' => '73728'), 'ggt'), - 'FIFTH' => array('0.00075708236', 'fifth'), - 'GALLON' => array('0.00454609', 'gal'), - 'GALLON_US_DRY' => array('0.0044048838', 'gal'), - 'GALLON_US' => array('0.0037854118', 'gal'), - 'GILL' => array(array('' => '0.00454609', '/' => '32'), 'gi'), - 'GILL_US' => array(array('' => '0.0037854118', '/' => '32'), 'gi'), - 'HECTOLITER' => array('0.1', 'hl'), - 'HOGSHEAD' => array('0.28640367', 'hhd'), - 'HOGSHEAD_US' => array('0.2384809434', 'hhd'), - 'JIGGER' => array(array('' => '0.0037854118', '/' => '128', '*' => '1.5'), 'jigger'), - 'KILOLITER' => array('1', 'kl'), - 'LITER' => array('0.001', 'l'), - 'MEASURE' => array('0.0077', 'measure'), - 'MEGALITER' => array('1000', 'Ml'), - 'MICROLITER' => array('1.0e-9', 'µl'), - 'MILLILITER' => array('0.000001', 'ml'), - 'MINIM' => array(array('' => '0.00454609', '/' => '76800'), 'min'), - 'MINIM_US' => array(array('' => '0.0037854118','/' => '61440'), 'min'), - 'OUNCE' => array(array('' => '0.00454609', '/' => '160'), 'oz'), - 'OUNCE_US' => array(array('' => '0.0037854118', '/' => '128'), 'oz'), - 'PECK' => array('0.00909218', 'pk'), - 'PECK_US' => array('0.0088097676', 'pk'), - 'PINCH' => array(array('' => '0.0037854118', '/' => '12288'), 'pinch'), - 'PINT' => array(array('' => '0.00454609', '/' => '8'), 'pt'), - 'PINT_US_DRY' => array(array('' => '0.0044048838', '/' => '8'), 'pt'), - 'PINT_US' => array(array('' => '0.0037854118', '/' => '8'), 'pt'), - 'PIPE' => array('0.49097772', 'pipe'), - 'PIPE_US' => array('0.4769618868', 'pipe'), - 'PONY' => array(array('' => '0.0037854118', '/' => '128'), 'pony'), - 'QUART_GERMANY' => array('0.00114504', 'qt'), - 'QUART_ANCIENT' => array('0.00108', 'qt'), - 'QUART' => array(array('' => '0.00454609', '/' => '4'), 'qt'), - 'QUART_US_DRY' => array(array('' => '0.0044048838', '/' => '4'), 'qt'), - 'QUART_US' => array(array('' => '0.0037854118', '/' => '4'), 'qt'), - 'SHOT' => array(array('' => '0.0037854118', '/' => '128'), 'shot'), - 'TABLESPOON' => array('0.000015', 'tbsp'), - 'TABLESPOON_UK' => array(array('' => '0.00454609', '/' => '320'), 'tbsp'), - 'TABLESPOON_US' => array(array('' => '0.0037854118', '/' => '256'), 'tbsp'), - 'TEASPOON' => array('0.000005', 'tsp'), - 'TEASPOON_UK' => array(array('' => '0.00454609', '/' => '1280'), 'tsp'), - 'TEASPOON_US' => array(array('' => '0.0037854118', '/' => '768'), 'tsp'), - 'STANDARD' => 'CUBIC_METER' - ); -} diff --git a/library/vendor/Zend/Measure/Cooking/Weight.php b/library/vendor/Zend/Measure/Cooking/Weight.php deleted file mode 100644 index 213d81440..000000000 --- a/library/vendor/Zend/Measure/Cooking/Weight.php +++ /dev/null @@ -1,68 +0,0 @@ - array(array('' => '453.59237', '/' => '8'), 'half stk'), - 'STICK' => array(array('' => '453.59237', '/' => '4'), 'stk'), - 'CUP' => array(array('' => '453.59237', '/' => '2'), 'c'), - 'GRAM' => array('1', 'g'), - 'OUNCE' => array(array('' => '453.59237', '/' => '16'), 'oz'), - 'POUND' => array('453.59237', 'lb'), - 'TEASPOON' => array(array('' => '1.2503332', '' => '453.59237', '/' => '128'), 'tsp'), - 'TEASPOON_US' => array(array('' => '453.59237', '/' => '96'), 'tsp'), - 'TABLESPOON' => array(array('' => '1.2503332', '' => '453.59237', '/' => '32'), 'tbsp'), - 'TABLESPOON_US' => array(array('' => '453.59237', '/' => '32'), 'tbsp'), - 'STANDARD' => 'GRAM' - ); -} diff --git a/library/vendor/Zend/Measure/Current.php b/library/vendor/Zend/Measure/Current.php deleted file mode 100644 index 5caa505fa..000000000 --- a/library/vendor/Zend/Measure/Current.php +++ /dev/null @@ -1,100 +0,0 @@ - array('10', 'abampere'), - 'AMPERE' => array('1', 'A'), - 'BIOT' => array('10', 'Bi'), - 'CENTIAMPERE' => array('0.01', 'cA'), - 'COULOMB_PER_SECOND' => array('1', 'C/s'), - 'DECIAMPERE' => array('0.1', 'dA'), - 'DEKAAMPERE' => array('10', 'daA'), - 'ELECTROMAGNATIC_UNIT' => array('10', 'current emu'), - 'ELECTROSTATIC_UNIT' => array('3.335641e-10', 'current esu'), - 'FRANCLIN_PER_SECOND' => array('3.335641e-10', 'Fr/s'), - 'GAUSSIAN' => array('3.335641e-10', 'G current'), - 'GIGAAMPERE' => array('1.0e+9', 'GA'), - 'GILBERT' => array('0.79577472', 'Gi'), - 'HECTOAMPERE' => array('100', 'hA'), - 'KILOAMPERE' => array('1000', 'kA'), - 'MEGAAMPERE' => array('1000000', 'MA') , - 'MICROAMPERE' => array('0.000001', 'µA'), - 'MILLIAMPERE' => array('0.001', 'mA'), - 'NANOAMPERE' => array('1.0e-9', 'nA'), - 'PICOAMPERE' => array('1.0e-12', 'pA'), - 'SIEMENS_VOLT' => array('1', 'SV'), - 'STATAMPERE' => array('3.335641e-10', 'statampere'), - 'TERAAMPERE' => array('1.0e+12', 'TA'), - 'VOLT_PER_OHM' => array('1', 'V/Ohm'), - 'WATT_PER_VOLT' => array('1', 'W/V'), - 'WEBER_PER_HENRY' => array('1', 'Wb/H'), - 'STANDARD' => 'AMPERE' - ); -} diff --git a/library/vendor/Zend/Measure/Density.php b/library/vendor/Zend/Measure/Density.php deleted file mode 100644 index 348691680..000000000 --- a/library/vendor/Zend/Measure/Density.php +++ /dev/null @@ -1,204 +0,0 @@ - array('2643', 'aluminium'), - 'COPPER' => array('8906', 'copper'), - 'GOLD' => array('19300', 'gold'), - 'GRAIN_PER_CUBIC_FOOT' => array('0.0022883519', 'gr/ft³'), - 'GRAIN_PER_CUBIC_INCH' => array('3.9542721', 'gr/in³'), - 'GRAIN_PER_CUBIC_YARD' => array('0.000084753774', 'gr/yd³'), - 'GRAIN_PER_GALLON' => array('0.014253768', 'gr/gal'), - 'GRAIN_PER_GALLON_US' => array('0.017118061', 'gr/gal'), - 'GRAM_PER_CUBIC_CENTIMETER' => array('1000', 'g/cm³'), - 'GRAM_PER_CUBIC_DECIMETER' => array('1', 'g/dm³'), - 'GRAM_PER_CUBIC_METER' => array('0.001', 'g/m³'), - 'GRAM_PER_LITER' => array('1', 'g/l'), - 'GRAM_PER_MILLILITER' => array('1000', 'g/ml'), - 'IRON' => array('7658', 'iron'), - 'KILOGRAM_PER_CUBIC_CENTIMETER' => array('1000000', 'kg/cm³'), - 'KILOGRAM_PER_CUBIC_DECIMETER' => array('1000', 'kg/dm³'), - 'KILOGRAM_PER_CUBIC_METER' => array('1', 'kg/m³'), - 'KILOGRAM_PER_CUBIC_MILLIMETER' => array('1000000000', 'kg/l'), - 'KILOGRAM_PER_LITER' => array('1000', 'kg/ml'), - 'KILOGRAM_PER_MILLILITER' => array('1000000', 'kg/ml'), - 'LEAD' => array('11370', 'lead'), - 'MEGAGRAM_PER_CUBIC_CENTIMETER' => array('1.0e+9', 'Mg/cm³'), - 'MEGAGRAM_PER_CUBIC_DECIMETER' => array('1000000', 'Mg/dm³'), - 'MEGAGRAM_PER_CUBIC_METER' => array('1000', 'Mg/m³'), - 'MEGAGRAM_PER_LITER' => array('1000000', 'Mg/l'), - 'MEGAGRAM_PER_MILLILITER' => array('1.0e+9', 'Mg/ml'), - 'MICROGRAM_PER_CUBIC_CENTIMETER' => array('0.001', 'µg/cm³'), - 'MICROGRAM_PER_CUBIC_DECIMETER' => array('1.0e-6', 'µg/dm³'), - 'MICROGRAM_PER_CUBIC_METER' => array('1.0e-9', 'µg/m³'), - 'MICROGRAM_PER_LITER' => array('1.0e-6', 'µg/l'), - 'MICROGRAM_PER_MILLILITER' => array('0.001', 'µg/ml'), - 'MILLIGRAM_PER_CUBIC_CENTIMETER' => array('1', 'mg/cm³'), - 'MILLIGRAM_PER_CUBIC_DECIMETER' => array('0.001', 'mg/dm³'), - 'MILLIGRAM_PER_CUBIC_METER' => array('0.000001', 'mg/m³'), - 'MILLIGRAM_PER_LITER' => array('0.001', 'mg/l'), - 'MILLIGRAM_PER_MILLILITER' => array('1', 'mg/ml'), - 'OUNCE_PER_CUBIC_FOOT' => array('1.001154', 'oz/ft³'), - 'OUNCE_PER_CUBIC_FOOT_TROY' => array('1.0984089', 'oz/ft³'), - 'OUNCE_PER_CUBIC_INCH' => array('1729.994', 'oz/in³'), - 'OUNCE_PER_CUBIC_INCH_TROY' => array('1898.0506', 'oz/in³'), - 'OUNCE_PER_CUBIC_YARD' => array('0.037079776', 'oz/yd³'), - 'OUNCE_PER_CUBIC_YARD_TROY' => array('0.040681812', 'oz/yd³'), - 'OUNCE_PER_GALLON' => array('6.2360233', 'oz/gal'), - 'OUNCE_PER_GALLON_US' => array('7.4891517', 'oz/gal'), - 'OUNCE_PER_GALLON_TROY' => array('6.8418084', 'oz/gal'), - 'OUNCE_PER_GALLON_US_TROY' => array('8.2166693', 'oz/gal'), - 'POUND_PER_CIRCULAR_MIL_FOOT' => array('2.9369291', 'lb/cmil ft'), - 'POUND_PER_CUBIC_FOOT' => array('16.018463', 'lb/in³'), - 'POUND_PER_CUBIC_INCH' => array('27679.905', 'lb/in³'), - 'POUND_PER_CUBIC_YARD' => array('0.59327642', 'lb/yd³'), - 'POUND_PER_GALLON' => array('99.776373', 'lb/gal'), - 'POUND_PER_KILOGALLON' => array('0.099776373', 'lb/kgal'), - 'POUND_PER_MEGAGALLON' => array('0.000099776373', 'lb/Mgal'), - 'POUND_PER_GALLON_US' => array('119.82643', 'lb/gal'), - 'POUND_PER_KILOGALLON_US' => array('0.11982643', 'lb/kgal'), - 'POUND_PER_MEGAGALLON_US' => array('0.00011982643', 'lb/Mgal'), - 'SILVER' => array('10510', 'silver'), - 'SLUG_PER_CUBIC_FOOT' => array('515.37882', 'slug/ft³'), - 'SLUG_PER_CUBIC_INCH' => array('890574.6', 'slug/in³'), - 'SLUG_PER_CUBIC_YARD' => array('19.088104', 'slug/yd³'), - 'SLUG_PER_GALLON' => array('3210.2099', 'slug/gal'), - 'SLUG_PER_GALLON_US' => array('3855.3013', 'slug/gal'), - 'TON_PER_CUBIC_FOOT_LONG' => array('35881.358', 't/ft³'), - 'TON_PER_CUBIC_FOOT' => array('32036.927', 't/ft³'), - 'TON_PER_CUBIC_INCH_LONG' => array('6.2202987e+7', 't/in³'), - 'TON_PER_CUBIC_INCH' => array('5.5359809e+7', 't/in³'), - 'TON_PER_CUBIC_YARD_LONG' => array('1328.9392', 't/yd³'), - 'TON_PER_CUBIC_YARD' => array('1186.5528', 't/yd³'), - 'TON_PER_GALLON_LONG' => array('223499.07', 't/gal'), - 'TON_PER_GALLON_US_LONG' => array('268411.2', 't/gal'), - 'TON_PER_GALLON' => array('199522.75', 't/gal'), - 'TON_PER_GALLON_US' => array('239652.85', 't/gal'), - 'TONNE_PER_CUBIC_CENTIMETER' => array('1.0e+9', 't/cm³'), - 'TONNE_PER_CUBIC_DECIMETER' => array('1000000', 't/dm³'), - 'TONNE_PER_CUBIC_METER' => array('1000', 't/m³'), - 'TONNE_PER_LITER' => array('1000000', 't/l'), - 'TONNE_PER_MILLILITER' => array('1.0e+9', 't/ml'), - 'WATER' => array('1000', 'water'), - 'STANDARD' => 'KILOGRAM_PER_CUBIC_METER' - ); -} diff --git a/library/vendor/Zend/Measure/Energy.php b/library/vendor/Zend/Measure/Energy.php deleted file mode 100644 index 59925835b..000000000 --- a/library/vendor/Zend/Measure/Energy.php +++ /dev/null @@ -1,250 +0,0 @@ - array('1.0e-18', 'aJ'), - 'BOARD_OF_TRADE_UNIT' => array('3600000', 'BOTU'), - 'BTU' => array('1055.0559', 'Btu'), - 'BTU_TERMOCHEMICAL' => array('1054.3503', 'Btu'), - 'CALORIE' => array('4.1868', 'cal'), - 'CALORIE_15C' => array('6.1858', 'cal'), - 'CALORIE_NUTRITIONAL' => array('4186.8', 'cal'), - 'CALORIE_THERMOCHEMICAL' => array('4.184', 'cal'), - 'CELSIUS_HEAT_UNIT' => array('1899.1005', 'Chu'), - 'CENTIJOULE' => array('0.01', 'cJ'), - 'CHEVAL_VAPEUR_HEURE' => array('2647795.5', 'cv heure'), - 'DECIJOULE' => array('0.1', 'dJ'), - 'DEKAJOULE' => array('10', 'daJ'), - 'DEKAWATT_HOUR' => array('36000', 'daWh'), - 'DEKATHERM' => array('1.055057e+9', 'dathm'), - 'ELECTRONVOLT' => array('1.6021773e-19', 'eV'), - 'ERG' => array('0.0000001', 'erg'), - 'EXAJOULE' => array('1.0e+18', 'EJ'), - 'EXAWATT_HOUR' => array('3.6e+21', 'EWh'), - 'FEMTOJOULE' => array('1.0e-15', 'fJ'), - 'FOOT_POUND' => array('1.3558179', 'ft lb'), - 'FOOT_POUNDAL' => array('0.04214011', 'ft poundal'), - 'GALLON_UK_AUTOMOTIVE' => array('158237172', 'gal car gasoline'), - 'GALLON_US_AUTOMOTIVE' => array('131760000', 'gal car gasoline'), - 'GALLON_UK_AVIATION' => array('158237172', 'gal jet gasoline'), - 'GALLON_US_AVIATION' => array('131760000', 'gal jet gasoline'), - 'GALLON_UK_DIESEL' => array('175963194', 'gal diesel'), - 'GALLON_US_DIESEL' => array('146520000', 'gal diesel'), - 'GALLON_UK_DISTILATE' => array('175963194', 'gal destilate fuel'), - 'GALLON_US_DISTILATE' => array('146520000', 'gal destilate fuel'), - 'GALLON_UK_KEROSINE_JET' => array('170775090', 'gal jet kerosine'), - 'GALLON_US_KEROSINE_JET' => array('142200000', 'gal jet kerosine'), - 'GALLON_UK_LPG' => array('121005126.0865275', 'gal lpg'), - 'GALLON_US_LPG' => array('100757838.45', 'gal lpg'), - 'GALLON_UK_NAPHTA' => array('160831224', 'gal jet fuel'), - 'GALLON_US_NAPHTA' => array('133920000', 'gal jet fuel'), - 'GALLON_UK_KEROSINE' => array('170775090', 'gal kerosine'), - 'GALLON_US_KEROSINE' => array('142200000', 'gal kerosine'), - 'GALLON_UK_RESIDUAL' => array('189798138', 'gal residual fuel'), - 'GALLON_US_RESIDUAL' => array('158040000', 'gal residual fuel'), - 'GIGAELECTRONVOLT' => array('1.6021773e-10', 'GeV'), - 'GIGACALORIE' => array('4186800000', 'Gcal'), - 'GIGACALORIE_15C' => array('4185800000', 'Gcal'), - 'GIGAJOULE' => array('1.0e+9', 'GJ'), - 'GIGAWATT_HOUR' => array('3.6e+12', 'GWh'), - 'GRAM_CALORIE' => array('4.1858', 'g cal'), - 'HARTREE' => array('4.3597482e-18', 'Eh'), - 'HECTOJOULE' => array('100', 'hJ'), - 'HECTOWATT_HOUR' => array('360000', 'hWh'), - 'HORSEPOWER_HOUR' => array('2684519.5', 'hph'), - 'HUNDRED_CUBIC_FOOT_GAS' => array('108720000', 'hundred ft� gas'), - 'INCH_OUNCE' => array('0.0070615518', 'in oc'), - 'INCH_POUND' => array('0.112984825', 'in lb'), - 'JOULE' => array('1', 'J'), - 'KILOCALORIE_15C' => array('4185.8', 'kcal'), - 'KILOCALORIE' => array('4186','8', 'kcal'), - 'KILOCALORIE_THERMOCHEMICAL' => array('4184', 'kcal'), - 'KILOELECTRONVOLT' => array('1.6021773e-16', 'keV'), - 'KILOGRAM_CALORIE' => array('4185.8', 'kg cal'), - 'KILOGRAM_FORCE_METER' => array('9.80665', 'kgf m'), - 'KILOJOULE' => array('1000', 'kJ'), - 'KILOPOND_METER' => array('9.80665', 'kp m'), - 'KILOTON' => array('4.184e+12', 'kt'), - 'KILOWATT_HOUR' => array('3600000', 'kWh'), - 'LITER_ATMOSPHERE' => array('101.325', 'l atm'), - 'MEGAELECTRONVOLT' => array('1.6021773e-13', 'MeV'), - 'MEGACALORIE' => array('4186800', 'Mcal'), - 'MEGACALORIE_15C' => array('4185800', 'Mcal'), - 'MEGAJOULE' => array('1000000', 'MJ'), - 'MEGALERG' => array('0.1', 'megalerg'), - 'MEGATON' => array('4.184e+15', 'Mt'), - 'MEGAWATTHOUR' => array('3.6e+9', 'MWh'), - 'METER_KILOGRAM_FORCE' => array('9.80665', 'm kgf'), - 'MICROJOULE' => array('0.000001', '�J'), - 'MILLIJOULE' => array('0.001', 'mJ'), - 'MYRIAWATT_HOUR' => array('3.6e+7', 'myWh'), - 'NANOJOULE' => array('1.0e-9', 'nJ'), - 'NEWTON_METER' => array('1', 'Nm'), - 'PETAJOULE' => array('1.0e+15', 'PJ'), - 'PETAWATTHOUR' => array('3.6e+18', 'PWh'), - 'PFERDESTAERKENSTUNDE' => array('2647795.5', 'ps h'), - 'PICOJOULE' => array('1.0e-12', 'pJ'), - 'Q_UNIT' => array('1.0550559e+21', 'Q unit'), - 'QUAD' => array('1.0550559e+18', 'quad'), - 'TERAELECTRONVOLT' => array('1.6021773e-7', 'TeV'), - 'TERAJOULE' => array('1.0e+12', 'TJ'), - 'TERAWATTHOUR' => array('3.6e+15', 'TWh'), - 'THERM' => array('1.0550559e+8', 'thm'), - 'THERM_US' => array('1.054804e+8', 'thm'), - 'THERMIE' => array('4185800', 'th'), - 'TON' => array('4.184e+9', 'T explosive'), - 'TONNE_COAL' => array('2.93076e+10', 'T coal'), - 'TONNE_OIL' => array('4.1868e+10', 'T oil'), - 'WATTHOUR' => array('3600', 'Wh'), - 'WATTSECOND' => array('1', 'Ws'), - 'YOCTOJOULE' => array('1.0e-24', 'yJ'), - 'YOTTAJOULE' => array('1.0e+24', 'YJ'), - 'YOTTAWATTHOUR' => array('3.6e+27', 'YWh'), - 'ZEPTOJOULE' => array('1.0e-21', 'zJ'), - 'ZETTAJOULE' => array('1.0e+21', 'ZJ'), - 'ZETTAWATTHOUR' => array('3.6e+24', 'ZWh'), - 'STANDARD' => 'JOULE' - ); -} diff --git a/library/vendor/Zend/Measure/Exception.php b/library/vendor/Zend/Measure/Exception.php deleted file mode 100644 index eaac4e544..000000000 --- a/library/vendor/Zend/Measure/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ - array(array('' => '0.00001', '/' => '86400'), 'cg/day'), - 'CENTIGRAM_PER_HOUR' => array(array('' => '0.00001', '/' => '3600'), 'cg/h'), - 'CENTIGRAM_PER_MINUTE' => array(array('' => '0.00001', '/' => '60'), 'cg/m'), - 'CENTIGRAM_PER_SECOND' => array('0.00001', 'cg/s'), - 'GRAM_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'g/day'), - 'GRAM_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'g/h'), - 'GRAM_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'g/m'), - 'GRAM_PER_SECOND' => array('0.001', 'g/s'), - 'KILOGRAM_PER_DAY' => array(array('' => '1', '/' => '86400'), 'kg/day'), - 'KILOGRAM_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'kg/h'), - 'KILOGRAM_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'kg/m'), - 'KILOGRAM_PER_SECOND' => array('1', 'kg/s'), - 'MILLIGRAM_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'mg/day'), - 'MILLIGRAM_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'mg/h'), - 'MILLIGRAM_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'mg/m'), - 'MILLIGRAM_PER_SECOND' => array('0.000001', 'mg/s'), - 'OUNCE_PER_DAY' => array(array('' => '0.0283495', '/' => '86400'), 'oz/day'), - 'OUNCE_PER_HOUR' => array(array('' => '0.0283495', '/' => '3600'), 'oz/h'), - 'OUNCE_PER_MINUTE' => array(array('' => '0.0283495', '/' => '60'), 'oz/m'), - 'OUNCE_PER_SECOND' => array('0.0283495', 'oz/s'), - 'POUND_PER_DAY' => array(array('' => '0.453592', '/' => '86400'), 'lb/day'), - 'POUND_PER_HOUR' => array(array('' => '0.453592', '/' => '3600'), 'lb/h'), - 'POUND_PER_MINUTE' => array(array('' => '0.453592', '/' => '60'), 'lb/m'), - 'POUND_PER_SECOND' => array('0.453592', 'lb/s'), - 'TON_LONG_PER_DAY' => array(array('' => '1016.04608', '/' => '86400'), 't/day'), - 'TON_LONG_PER_HOUR' => array(array('' => '1016.04608', '/' => '3600'), 't/h'), - 'TON_LONG_PER_MINUTE' => array(array('' => '1016.04608', '/' => '60'), 't/m'), - 'TON_LONG_PER_SECOND' => array('1016.04608', 't/s'), - 'TON_PER_DAY' => array(array('' => '1000', '/' => '86400'), 't/day'), - 'TON_PER_HOUR' => array(array('' => '1000', '/' => '3600'), 't/h'), - 'TON_PER_MINUTE' => array(array('' => '1000', '/' => '60'), 't/m'), - 'TON_PER_SECOND' => array('1000', 't/s'), - 'TON_SHORT_PER_DAY' => array(array('' => '907.184', '/' => '86400'), 't/day'), - 'TON_SHORT_PER_HOUR' => array(array('' => '907.184', '/' => '3600'), 't/h'), - 'TON_SHORT_PER_MINUTE' => array(array('' => '907.184', '/' => '60'), 't/m'), - 'TON_SHORT_PER_SECOND' => array('907.184', 't/s'), - 'STANDARD' => 'KILOGRAM_PER_SECOND' - ); -} diff --git a/library/vendor/Zend/Measure/Flow/Mole.php b/library/vendor/Zend/Measure/Flow/Mole.php deleted file mode 100644 index a315d6d17..000000000 --- a/library/vendor/Zend/Measure/Flow/Mole.php +++ /dev/null @@ -1,88 +0,0 @@ - array(array('' => '0.01', '/' => '86400'), 'cmol/day'), - 'CENTIMOLE_PER_HOUR' => array(array('' => '0.01', '/' => '3600'), 'cmol/h'), - 'CENTIMOLE_PER_MINUTE' => array(array('' => '0.01', '/' => '60'), 'cmol/m'), - 'CENTIMOLE_PER_SECOND' => array('0.01', 'cmol/s'), - 'MEGAMOLE_PER_DAY' => array(array('' => '1000000', '/' => '86400'), 'Mmol/day'), - 'MEGAMOLE_PER_HOUR' => array(array('' => '1000000', '/' => '3600'), 'Mmol/h'), - 'MEGAMOLE_PER_MINUTE' => array(array('' => '1000000', '/' => '60'), 'Mmol/m'), - 'MEGAMOLE_PER_SECOND' => array('1000000', 'Mmol/s'), - 'MICROMOLE_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'µmol/day'), - 'MICROMOLE_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'µmol/h'), - 'MICROMOLE_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'µmol/m'), - 'MICROMOLE_PER_SECOND' => array('0.000001', 'µmol/s'), - 'MILLIMOLE_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'mmol/day'), - 'MILLIMOLE_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'mmol/h'), - 'MILLIMOLE_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'mmol/m'), - 'MILLIMOLE_PER_SECOND' => array('0.001', 'mmol/s'), - 'MOLE_PER_DAY' => array(array('' => '1', '/' => '86400'), 'mol/day'), - 'MOLE_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'mol/h'), - 'MOLE_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'mol/m'), - 'MOLE_PER_SECOND' => array('1', 'mol/s'), - 'STANDARD' => 'MOLE_PER_SECOND' - ); -} diff --git a/library/vendor/Zend/Measure/Flow/Volume.php b/library/vendor/Zend/Measure/Flow/Volume.php deleted file mode 100644 index 2d7a6ab88..000000000 --- a/library/vendor/Zend/Measure/Flow/Volume.php +++ /dev/null @@ -1,400 +0,0 @@ - array(array('' => '1233.48184', '/' => '86400'), 'ac ft/day'), - 'ACRE_FOOT_PER_HOUR' => array(array('' => '1233.48184', '/' => '3600'), 'ac ft/h'), - 'ACRE_FOOT_PER_MINUTE' => array(array('' => '1233.48184', '/' => '60'), 'ac ft/m'), - 'ACRE_FOOT_PER_SECOND' => array('1233.48184', 'ac ft/s'), - 'ACRE_FOOT_SURVEY_PER_DAY' => array(array('' => '1233.48924', '/' => '86400'), 'ac ft/day'), - 'ACRE_FOOT_SURVEY_PER_HOUR' => array(array('' => '1233.48924', '/' => '3600'), 'ac ft/h'), - 'ACRE_FOOT_SURVEY_PER_MINUTE' => array(array('' => '1233.48924', '/' => '60'), 'ac ft/m'), - 'ACRE_FOOT_SURVEY_PER_SECOND' => array('1233.48924', 'ac ft/s'), - 'ACRE_INCH_PER_DAY' => array(array('' => '1233.48184', '/' => '1036800'), 'ac in/day'), - 'ACRE_INCH_PER_HOUR' => array(array('' => '1233.48184', '/' => '43200'), 'ac in/h'), - 'ACRE_INCH_PER_MINUTE' => array(array('' => '1233.48184', '/' => '720'), 'ac in/m'), - 'ACRE_INCH_PER_SECOND' => array(array('' => '1233.48184', '/' => '12'), 'ac in/s'), - 'ACRE_INCH_SURVEY_PER_DAY' => array(array('' => '1233.48924', '/' => '1036800'), 'ac in/day'), - 'ACRE_INCH_SURVEY_PER_HOUR' => array(array('' => '1233.48924', '/' => '43200'), 'ac in/h'), - 'ACRE_INCH_SURVEY_PER_MINUTE' => array(array('' => '1233.48924', '/' => '720'), 'ac in /m'), - 'ACRE_INCH_SURVEY_PER_SECOND' => array(array('' => '1233.48924', '/' => '12'), 'ac in/s'), - 'BARREL_PETROLEUM_PER_DAY' => array(array('' => '0.1589872956', '/' => '86400'), 'bbl/day'), - 'BARREL_PETROLEUM_PER_HOUR' => array(array('' => '0.1589872956', '/' => '3600'), 'bbl/h'), - 'BARREL_PETROLEUM_PER_MINUTE' => array(array('' => '0.1589872956', '/' => '60'), 'bbl/m'), - 'BARREL_PETROLEUM_PER_SECOND' => array('0.1589872956', 'bbl/s'), - 'BARREL_PER_DAY' => array(array('' => '0.16365924', '/' => '86400'), 'bbl/day'), - 'BARREL_PER_HOUR' => array(array('' => '0.16365924', '/' => '3600'), 'bbl/h'), - 'BARREL_PER_MINUTE' => array(array('' => '0.16365924', '/' => '60'), 'bbl/m'), - 'BARREL_PER_SECOND' => array('0.16365924', 'bbl/s'), - 'BARREL_US_PER_DAY' => array(array('' => '0.1192404717', '/' => '86400'), 'bbl/day'), - 'BARREL_US_PER_HOUR' => array(array('' => '0.1192404717', '/' => '3600'), 'bbl/h'), - 'BARREL_US_PER_MINUTE' => array(array('' => '0.1192404717', '/' => '60'), 'bbl/m'), - 'BARREL_US_PER_SECOND' => array('0.1192404717', 'bbl/s'), - 'BARREL_WINE_PER_DAY' => array(array('' => '0.1173477658', '/' => '86400'), 'bbl/day'), - 'BARREL_WINE_PER_HOUR' => array(array('' => '0.1173477658', '/' => '3600'), 'bbl/h'), - 'BARREL_WINE_PER_MINUTE' => array(array('' => '0.1173477658', '/' => '60'), 'bbl/m'), - 'BARREL_WINE_PER_SECOND' => array('0.1173477658', 'bbl/s'), - 'BARREL_BEER_PER_DAY' => array(array('' => '0.1173477658', '/' => '86400'), 'bbl/day'), - 'BARREL_BEER_PER_HOUR' => array(array('' => '0.1173477658', '/' => '3600'), 'bbl/h'), - 'BARREL_BEER_PER_MINUTE' => array(array('' => '0.1173477658', '/' => '60'), 'bbl/m'), - 'BARREL_BEER_PER_SECOND' => array('0.1173477658', 'bbl/s'), - 'BILLION_CUBIC_FOOT_PER_DAY' => array(array('' => '28316847', '/' => '86400'), 'bn ft³/day'), - 'BILLION_CUBIC_FOOT_PER_HOUR' => array(array('' => '28316847', '/' => '3600'), 'bn ft³/h'), - 'BILLION_CUBIC_FOOT_PER_MINUTE' => array(array('' => '28316847', '/' => '60'), 'bn ft³/m'), - 'BILLION_CUBIC_FOOT_PER_SECOND' => array('28316847', 'bn ft³/s'), - 'CENTILITER_PER_DAY' => array(array('' => '0.00001', '/' => '86400'), 'cl/day'), - 'CENTILITER_PER_HOUR' => array(array('' => '0.00001', '/' => '3600'), 'cl/h'), - 'CENTILITER_PER_MINUTE' => array(array('' => '0.00001', '/' => '60'), 'cl/m'), - 'CENTILITER_PER_SECOND' => array('0.00001', 'cl/s'), - 'CUBEM_PER_DAY' => array(array('' => '4168181830', '/' => '86400'), 'cubem/day'), - 'CUBEM_PER_HOUR' => array(array('' => '4168181830', '/' => '3600'), 'cubem/h'), - 'CUBEM_PER_MINUTE' => array(array('' => '4168181830', '/' => '60'), 'cubem/m'), - 'CUBEM_PER_SECOND' => array('4168181830', 'cubem/s'), - 'CUBIC_CENTIMETER_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'cm³/day'), - 'CUBIC_CENTIMETER_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'cm³/h'), - 'CUBIC_CENTIMETER_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'cm³/m'), - 'CUBIC_CENTIMETER_PER_SECOND' => array('0.000001', 'cm³/s'), - 'CUBIC_DECIMETER_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'dm³/day'), - 'CUBIC_DECIMETER_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'dm³/h'), - 'CUBIC_DECIMETER_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'dm³/m'), - 'CUBIC_DECIMETER_PER_SECOND' => array('0.001', 'dm³/s'), - 'CUBIC_DEKAMETER_PER_DAY' => array(array('' => '1000', '/' => '86400'), 'dam³/day'), - 'CUBIC_DEKAMETER_PER_HOUR' => array(array('' => '1000', '/' => '3600'), 'dam³/h'), - 'CUBIC_DEKAMETER_PER_MINUTE' => array(array('' => '1000', '/' => '60'), 'dam³/m'), - 'CUBIC_DEKAMETER_PER_SECOND' => array('1000', 'dam³/s'), - 'CUBIC_FOOT_PER_DAY' => array(array('' => '0.028316847', '/' => '86400'), 'ft³/day'), - 'CUBIC_FOOT_PER_HOUR' => array(array('' => '0.028316847', '/' => '3600'), 'ft³/h'), - 'CUBIC_FOOT_PER_MINUTE' => array(array('' => '0.028316847', '/' => '60'), 'ft³/m'), - 'CUBIC_FOOT_PER_SECOND' => array('0.028316847', 'ft³/s'), - 'CUBIC_INCH_PER_DAY' => array(array('' => '0.028316847', '/' => '149299200'), 'in³/day'), - 'CUBIC_INCH_PER_HOUR' => array(array('' => '0.028316847', '/' => '6220800'), 'in³/h'), - 'CUBIC_INCH_PER_MINUTE' => array(array('' => '0.028316847', '/' => '103680'), 'in³/m'), - 'CUBIC_INCH_PER_SECOND' => array('0.028316847', 'in³/s'), - 'CUBIC_KILOMETER_PER_DAY' => array(array('' => '1000000000', '/' => '86400'), 'km³/day'), - 'CUBIC_KILOMETER_PER_HOUR' => array(array('' => '1000000000', '/' => '3600'), 'km³/h'), - 'CUBIC_KILOMETER_PER_MINUTE' => array(array('' => '1000000000', '/' => '60'), 'km³/m'), - 'CUBIC_KILOMETER_PER_SECOND' => array('1000000000', 'km³/s'), - 'CUBIC_METER_PER_DAY' => array(array('' => '1', '/' => '86400'), 'm³/day'), - 'CUBIC_METER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'm³/h'), - 'CUBIC_METER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'm³/m'), - 'CUBIC_METER_PER_SECOND' => array('1', 'm³/s'), - 'CUBIC_MILE_PER_DAY' => array(array('' => '4168181830', '/' => '86400'), 'mi³/day'), - 'CUBIC_MILE_PER_HOUR' => array(array('' => '4168181830', '/' => '3600'), 'mi³/h'), - 'CUBIC_MILE_PER_MINUTE' => array(array('' => '4168181830', '/' => '60'), 'mi³/m'), - 'CUBIC_MILE_PER_SECOND' => array('4168181830', 'mi³/s'), - 'CUBIC_MILLIMETER_PER_DAY' => array(array('' => '0.000000001', '/' => '86400'), 'mm³/day'), - 'CUBIC_MILLIMETER_PER_HOUR' => array(array('' => '0.000000001', '/' => '3600'), 'mm³/h'), - 'CUBIC_MILLIMETER_PER_MINUTE' => array(array('' => '0.000000001', '/' => '60'), 'mm³/m'), - 'CUBIC_MILLIMETER_PER_SECOND' => array('0.000000001', 'mm³/s'), - 'CUBIC_YARD_PER_DAY' => array(array('' => '0.764554869', '/' => '86400'), 'yd³/day'), - 'CUBIC_YARD_PER_HOUR' => array(array('' => '0.764554869', '/' => '3600'), 'yd³/h'), - 'CUBIC_YARD_PER_MINUTE' => array(array('' => '0.764554869', '/' => '60'), 'yd³/m'), - 'CUBIC_YARD_PER_SECOND' => array('0.764554869', 'yd³/s'), - 'CUSEC' => array('0.028316847', 'cusec'), - 'DECILITER_PER_DAY' => array(array('' => '0.0001', '/' => '86400'), 'dl/day'), - 'DECILITER_PER_HOUR' => array(array('' => '0.0001', '/' => '3600'), 'dl/h'), - 'DECILITER_PER_MINUTE' => array(array('' => '0.0001', '/' => '60'), 'dl/m'), - 'DECILITER_PER_SECOND' => array('0.0001', 'dl/s'), - 'DEKALITER_PER_DAY' => array(array('' => '0.01', '/' => '86400'), 'dal/day'), - 'DEKALITER_PER_HOUR' => array(array('' => '0.01', '/' => '3600'), 'dal/h'), - 'DEKALITER_PER_MINUTE' => array(array('' => '0.01', '/' => '60'), 'dal/m'), - 'DEKALITER_PER_SECOND' => array('0.01', 'dal/s'), - 'GALLON_PER_DAY' => array(array('' => '0.00454609', '/' => '86400'), 'gal/day'), - 'GALLON_PER_HOUR' => array(array('' => '0.00454609', '/' => '3600'), 'gal/h'), - 'GALLON_PER_MINUTE' => array(array('' => '0.00454609', '/' => '60'), 'gal/m'), - 'GALLON_PER_SECOND' => array('0.00454609', 'gal/s'), - 'GALLON_US_PER_DAY' => array(array('' => '0.0037854118', '/' => '86400'), 'gal/day'), - 'GALLON_US_PER_HOUR' => array(array('' => '0.0037854118', '/' => '3600'), 'gal/h'), - 'GALLON_US_PER_MINUTE' => array(array('' => '0.0037854118', '/' => '60'), 'gal/m'), - 'GALLON_US_PER_SECOND' => array('0.0037854118', 'gal/s'), - 'HECTARE_METER_PER_DAY' => array(array('' => '10000', '/' => '86400'), 'ha m/day'), - 'HECTARE_METER_PER_HOUR' => array(array('' => '10000', '/' => '3600'), 'ha m/h'), - 'HECTARE_METER_PER_MINUTE' => array(array('' => '10000', '/' => '60'), 'ha m/m'), - 'HECTARE_METER_PER_SECOND' => array('10000', 'ha m/s'), - 'HECTOLITER_PER_DAY' => array(array('' => '0.1', '/' => '86400'), 'hl/day'), - 'HECTOLITER_PER_HOUR' => array(array('' => '0.1', '/' => '3600'), 'hl/h'), - 'HECTOLITER_PER_MINUTE' => array(array('' => '0.1', '/' => '60'), 'hl/m'), - 'HECTOLITER_PER_SECOND' => array('0.1', 'hl/s'), - 'KILOLITER_PER_DAY' => array(array('' => '1', '/' => '86400'), 'kl/day'), - 'KILOLITER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'kl/h'), - 'KILOLITER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'kl/m'), - 'KILOLITER_PER_SECOND' => array('1', 'kl/s'), - 'LAMBDA_PER_DAY' => array(array('' => '0.000000001', '/' => '86400'), 'λ/day'), - 'LAMBDA_PER_HOUR' => array(array('' => '0.000000001', '/' => '3600'), 'λ/h'), - 'LAMBDA_PER_MINUTE' => array(array('' => '0.000000001', '/' => '60'), 'λ/m'), - 'LAMBDA_PER_SECOND' => array('0.000000001', 'λ/s'), - 'LITER_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'l/day'), - 'LITER_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'l/h'), - 'LITER_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'l/m'), - 'LITER_PER_SECOND' => array('0.001', 'l/s'), - 'MILLILITER_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'ml/day'), - 'MILLILITER_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'ml/h'), - 'MILLILITER_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'ml/m'), - 'MILLILITER_PER_SECOND' => array('0.000001', 'ml/s'), - 'MILLION_ACRE_FOOT_PER_DAY' => array(array('' => '1233481840', '/' => '86400'), 'million ac ft/day'), - 'MILLION_ACRE_FOOT_PER_HOUR' => array(array('' => '1233481840', '/' => '3600'), 'million ac ft/h'), - 'MILLION_ACRE_FOOT_PER_MINUTE' => array(array('' => '1233481840', '/' => '60'), 'million ac ft/m'), - 'MILLION_ACRE_FOOT_PER_SECOND' => array('1233481840', 'million ac ft/s'), - 'MILLION_CUBIC_FOOT_PER_DAY' => array(array('' => '28316.847', '/' => '86400'), 'million ft³/day'), - 'MILLION_CUBIC_FOOT_PER_HOUR' => array(array('' => '28316.847', '/' => '3600'), 'million ft³/h'), - 'MILLION_CUBIC_FOOT_PER_MINUTE' => array(array('' => '28316.847', '/' => '60'), 'million ft³/m'), - 'MILLION_CUBIC_FOOT_PER_SECOND' => array('28316.847', 'million ft³/s'), - 'MILLION_GALLON_PER_DAY' => array(array('' => '4546.09', '/' => '86400'), 'million gal/day'), - 'MILLION_GALLON_PER_HOUR' => array(array('' => '4546.09', '/' => '3600'), 'million gal/h'), - 'MILLION_GALLON_PER_MINUTE' => array(array('' => '4546.09', '/' => '60'), 'million gal/m'), - 'MILLION_GALLON_PER_SECOND' => array('4546.09', 'million gal/s'), - 'MILLION_GALLON_US_PER_DAY' => array(array('' => '3785.4118', '/' => '86400'), 'million gal/day'), - 'MILLION_GALLON_US_PER_HOUR' => array(array('' => '3785.4118', '/' => '3600'), 'million gal/h'), - 'MILLION_GALLON_US_PER_MINUTE'=> array(array('' => '3785.4118', '/' => '60'), 'million gal/m'), - 'MILLION_GALLON_US_PER_SECOND'=> array('3785.4118', 'million gal/s'), - 'MINERS_INCH_AZ' => array(array('' => '0.0424752705', '/' => '60'), "miner's inch"), - 'MINERS_INCH_CA' => array(array('' => '0.0424752705', '/' => '60'), "miner's inch"), - 'MINERS_INCH_OR' => array(array('' => '0.0424752705', '/' => '60'), "miner's inch"), - 'MINERS_INCH_CO' => array(array('' => '0.0442450734375', '/' => '60'), "miner's inch"), - 'MINERS_INCH_ID' => array(array('' => '0.0340687062', '/' => '60'), "miner's inch"), - 'MINERS_INCH_WA' => array(array('' => '0.0340687062', '/' => '60'), "miner's inch"), - 'MINERS_INCH_NM' => array(array('' => '0.0340687062', '/' => '60'), "miner's inch"), - 'OUNCE_PER_DAY' => array(array('' => '0.00454609', '/' => '13824000'), 'oz/day'), - 'OUNCE_PER_HOUR' => array(array('' => '0.00454609', '/' => '576000'), 'oz/h'), - 'OUNCE_PER_MINUTE' => array(array('' => '0.00454609', '/' => '9600'), 'oz/m'), - 'OUNCE_PER_SECOND' => array(array('' => '0.00454609', '/' => '160'), 'oz/s'), - 'OUNCE_US_PER_DAY' => array(array('' => '0.0037854118', '/' => '11059200'), 'oz/day'), - 'OUNCE_US_PER_HOUR' => array(array('' => '0.0037854118', '/' => '460800'), 'oz/h'), - 'OUNCE_US_PER_MINUTE' => array(array('' => '0.0037854118', '/' => '7680'), 'oz/m'), - 'OUNCE_US_PER_SECOND' => array(array('' => '0.0037854118', '/' => '128'), 'oz/s'), - 'PETROGRAD_STANDARD_PER_DAY' => array(array('' => '4.672279755', '/' => '86400'), 'petrograd standard/day'), - 'PETROGRAD_STANDARD_PER_HOUR' => array(array('' => '4.672279755', '/' => '3600'), 'petrograd standard/h'), - 'PETROGRAD_STANDARD_PER_MINUTE' => array(array('' => '4.672279755', '/' => '60'), 'petrograd standard/m'), - 'PETROGRAD_STANDARD_PER_SECOND' => array('4.672279755', 'petrograd standard/s'), - 'STERE_PER_DAY' => array(array('' => '1', '/' => '86400'), 'st/day'), - 'STERE_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'st/h'), - 'STERE_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'st/m'), - 'STERE_PER_SECOND' => array('1', 'st/s'), - 'THOUSAND_CUBIC_FOOT_PER_DAY' => array(array('' => '28.316847', '/' => '86400'), 'thousand ft³/day'), - 'THOUSAND_CUBIC_FOOT_PER_HOUR' => array(array('' => '28.316847', '/' => '3600'), 'thousand ft³/h'), - 'THOUSAND_CUBIC_FOOT_PER_MINUTE' => array(array('' => '28.316847', '/' => '60'), 'thousand ft³/m'), - 'THOUSAND_CUBIC_FOOT_PER_SECOND' => array('28.316847', 'thousand ft³/s'), - 'TRILLION_CUBIC_FOOT_PER_DAY' => array(array('' => '28316847000', '/' => '86400'), 'trillion ft³/day'), - 'TRILLION_CUBIC_FOOT_PER_HOUR' => array(array('' => '28316847000', '/' => '3600'), 'trillion ft³/h'), - 'TRILLION_CUBIC_FOOT_PER_MINUTE' => array(array('' => '28316847000', '/' => '60'), 'trillion ft³/m'), - 'TRILLION_CUBIC_FOOT_PER_' => array('28316847000', 'trillion ft³/s'), - 'STANDARD' => 'CUBIC_METER_PER_SECOND' - ); -} diff --git a/library/vendor/Zend/Measure/Force.php b/library/vendor/Zend/Measure/Force.php deleted file mode 100644 index 1247cbd3c..000000000 --- a/library/vendor/Zend/Measure/Force.php +++ /dev/null @@ -1,124 +0,0 @@ - array('1.0e-18', 'aN'), - 'CENTINEWTON' => array('0.01', 'cN'), - 'DECIGRAM_FORCE' => array('0.000980665', 'dgf'), - 'DECINEWTON' => array('0.1', 'dN'), - 'DEKAGRAM_FORCE' => array('0.0980665', 'dagf'), - 'DEKANEWTON' => array('10', 'daN'), - 'DYNE' => array('0.00001', 'dyn'), - 'EXANEWTON' => array('1.0e+18', 'EN'), - 'FEMTONEWTON' => array('1.0e-15', 'fN'), - 'GIGANEWTON' => array('1.0e+9', 'GN'), - 'GRAM_FORCE' => array('0.00980665', 'gf'), - 'HECTONEWTON' => array('100', 'hN'), - 'JOULE_PER_METER' => array('1', 'J/m'), - 'KILOGRAM_FORCE' => array('9.80665', 'kgf'), - 'KILONEWTON' => array('1000', 'kN'), - 'KILOPOND' => array('9.80665', 'kp'), - 'KIP' => array('4448.2216', 'kip'), - 'MEGANEWTON' => array('1000000', 'Mp'), - 'MEGAPOND' => array('9806.65', 'MN'), - 'MICRONEWTON' => array('0.000001', 'µN'), - 'MILLINEWTON' => array('0.001', 'mN'), - 'NANONEWTON' => array('0.000000001', 'nN'), - 'NEWTON' => array('1', 'N'), - 'OUNCE_FORCE' => array('0.27801385', 'ozf'), - 'PETANEWTON' => array('1.0e+15', 'PN'), - 'PICONEWTON' => array('1.0e-12', 'pN'), - 'POND' => array('0.00980665', 'pond'), - 'POUND_FORCE' => array('4.4482216', 'lbf'), - 'POUNDAL' => array('0.13825495', 'pdl'), - 'STHENE' => array('1000', 'sn'), - 'TERANEWTON' => array('1.0e+12', 'TN'), - 'TON_FORCE_LONG' => array('9964.016384', 'tnf'), - 'TON_FORCE' => array('9806.65', 'tnf'), - 'TON_FORCE_SHORT' => array('8896.4432', 'tnf'), - 'YOCTONEWTON' => array('1.0e-24', 'yN'), - 'YOTTANEWTON' => array('1.0e+24', 'YN'), - 'ZEPTONEWTON' => array('1.0e-21', 'zN'), - 'ZETTANEWTON' => array('1.0e+21', 'ZN'), - 'STANDARD' => 'NEWTON' - ); -} diff --git a/library/vendor/Zend/Measure/Frequency.php b/library/vendor/Zend/Measure/Frequency.php deleted file mode 100644 index 57343f41d..000000000 --- a/library/vendor/Zend/Measure/Frequency.php +++ /dev/null @@ -1,84 +0,0 @@ - array('1', '1/s'), - 'CYCLE_PER_SECOND' => array('1', 'cps'), - 'DEGREE_PER_HOUR' => array(array('' => '1', '/' => '1296000'), '°/h'), - 'DEGREE_PER_MINUTE' => array(array('' => '1', '/' => '21600'), '°/m'), - 'DEGREE_PER_SECOND' => array(array('' => '1', '/' => '360'), '°/s'), - 'GIGAHERTZ' => array('1000000000', 'GHz'), - 'HERTZ' => array('1', 'Hz'), - 'KILOHERTZ' => array('1000', 'kHz'), - 'MEGAHERTZ' => array('1000000', 'MHz'), - 'MILLIHERTZ' => array('0.001', 'mHz'), - 'RADIAN_PER_HOUR' => array(array('' => '1', '/' => '22619.467'), 'rad/h'), - 'RADIAN_PER_MINUTE' => array(array('' => '1', '/' => '376.99112'), 'rad/m'), - 'RADIAN_PER_SECOND' => array(array('' => '1', '/' => '6.2831853'), 'rad/s'), - 'REVOLUTION_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'rph'), - 'REVOLUTION_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'rpm'), - 'REVOLUTION_PER_SECOND' => array('1', 'rps'), - 'RPM' => array(array('' => '1', '/' => '60'), 'rpm'), - 'TERRAHERTZ' => array('1000000000000', 'THz'), - 'STANDARD' =>'HERTZ' - ); -} diff --git a/library/vendor/Zend/Measure/Illumination.php b/library/vendor/Zend/Measure/Illumination.php deleted file mode 100644 index cb5192d9d..000000000 --- a/library/vendor/Zend/Measure/Illumination.php +++ /dev/null @@ -1,70 +0,0 @@ - array('10.7639104', 'fc'), - 'KILOLUX' => array('1000', 'klx'), - 'LUMEN_PER_SQUARE_CENTIMETER' => array('10000', 'lm/cm²'), - 'LUMEN_PER_SQUARE_FOOT' => array('10.7639104', 'lm/ft²'), - 'LUMEN_PER_SQUARE_INCH' => array('1550.0030976', 'lm/in²'), - 'LUMEN_PER_SQUARE_METER' => array('1', 'lm/m²'), - 'LUX' => array('1', 'lx'), - 'METERCANDLE' => array('1', 'metercandle'), - 'MILLIPHOT' => array('10', 'mph'), - 'NOX' => array('0.001', 'nox'), - 'PHOT' => array('10000', 'ph'), - 'STANDARD' => 'LUX' - ); -} diff --git a/library/vendor/Zend/Measure/Length.php b/library/vendor/Zend/Measure/Length.php deleted file mode 100644 index f13fb9a46..000000000 --- a/library/vendor/Zend/Measure/Length.php +++ /dev/null @@ -1,672 +0,0 @@ - array(array('' => '0.0254', '/' => '72'), 'agate'), - 'ALEN_DANISH' => array('0.6277', 'alen'), - 'ALEN' => array('0.6', 'alen'), - 'ALEN_SWEDISH' => array('0.5938', 'alen'), - 'ANGSTROM' => array('1.0e-10', 'Å'), - 'ARMS' => array('0.7', 'arms'), - 'ARPENT_CANADIAN' => array('58.47', 'arpent'), - 'ARPENT' => array('58.471308', 'arpent'), - 'ARSHEEN' => array('0.7112', 'arsheen'), - 'ARSHIN' => array('1.04', 'arshin'), - 'ARSHIN_IRAQ' => array('74.5', 'arshin'), - 'ASTRONOMICAL_UNIT' => array('149597870691', 'AU'), - 'ATTOMETER' => array('1.0e-18', 'am'), - 'BAMBOO' => array('3.2', 'bamboo'), - 'BARLEYCORN' => array('0.0085', 'barleycorn'), - 'BEE_SPACE' => array('0.0065', 'bee space'), - 'BICRON' => array('1.0e-12', 'µµ'), - 'BLOCK_US_EAST' => array('80.4672', 'block'), - 'BLOCK_US_WEST' => array('100.584', 'block'), - 'BLOCK_US_SOUTH' => array('160.9344', 'block'), - 'BOHR' => array('52.918e-12', 'a₀'), - 'BRACCIO' => array('0.7', 'braccio'), - 'BRAZA_ARGENTINA' => array('1.733', 'braza'), - 'BRAZA' => array('1.67', 'braza'), - 'BRAZA_US' => array('1.693', 'braza'), - 'BUTTON' => array('0.000635', 'button'), - 'CABLE_US' => array('219.456', 'cable'), - 'CABLE_UK' => array('185.3184', 'cable'), - 'CALIBER' => array('0.0254', 'cal'), - 'CANA' => array('2', 'cana'), - 'CAPE_FOOT' => array('0.314858', 'cf'), - 'CAPE_INCH' => array(array('' => '0.314858','/' => '12'), 'ci'), - 'CAPE_ROOD' => array('3.778296', 'cr'), - 'CENTIMETER' => array('0.01', 'cm'), - 'CHAIN' => array(array('' => '79200','/' => '3937'), 'ch'), - 'CHAIN_ENGINEER' => array('30.48', 'ch'), - 'CHIH' => array('0.35814', "ch'ih"), - 'CHINESE_FOOT' => array('0.371475', 'ft'), - 'CHINESE_INCH' => array('0.0371475', 'in'), - 'CHINESE_MILE' => array('557.21', 'mi'), - 'CHINESE_YARD' => array('0.89154', 'yd'), - 'CITY_BLOCK_US_EAST' => array('80.4672', 'block'), - 'CITY_BLOCK_US_WEST' => array('100.584', 'block'), - 'CITY_BLOCK_US_SOUTH' => array('160.9344', 'block'), - 'CLICK' => array('1000', 'click'), - 'CUADRA' => array('84', 'cuadra'), - 'CUADRA_ARGENTINA'=> array('130', 'cuadra'), - 'Length:CUBIT_EGYPT' => array('0.45', 'cubit'), - 'CUBIT_ROYAL' => array('0.5235', 'cubit'), - 'CUBIT_UK' => array('0.4572', 'cubit'), - 'CUBIT' => array('0.444', 'cubit'), - 'CUERDA' => array('21', 'cda'), - 'DECIMETER' => array('0.1', 'dm'), - 'DEKAMETER' => array('10', 'dam'), - 'DIDOT_POINT' => array('0.000377', 'didot point'), - 'DIGIT' => array('0.019', 'digit'), - 'DIRAA' => array('0.58', ''), - 'DONG' => array(array('' => '7','/' => '300'), 'dong'), - 'DOUZIEME_WATCH' => array('0.000188', 'douzième'), - 'DOUZIEME' => array('0.00017638888889', 'douzième'), - 'DRA_IRAQ' => array('0.745', 'dra'), - 'DRA' => array('0.7112', 'dra'), - 'EL' => array('0.69', 'el'), - 'ELL' => array('1.143', 'ell'), - 'ELL_SCOTTISH' => array('0.945', 'ell'), - 'ELLE' => array('0.6', 'ellen'), - 'ELLE_VIENNA' => array('0.7793', 'ellen'), - 'EM' => array('0.0042175176', 'em'), - 'ESTADIO_PORTUGAL'=> array('261', 'estadio'), - 'ESTADIO' => array('174', 'estadio'), - 'EXAMETER' => array('1.0e+18', 'Em'), - 'FADEN_AUSTRIA' => array('1.8965', 'faden'), - 'FADEN' => array('1.8', 'faden'), - 'FALL' => array('6.858', 'fall'), - 'FALL_SCOTTISH' => array('5.67', 'fall'), - 'FATHOM' => array('1.8288', 'fth'), - 'FATHOM_ANCIENT' => array('1.829', 'fth'), - 'FAUST' => array('0.10536', 'faust'), - 'FEET_OLD_CANADIAN' => array('0.325', 'ft'), - 'FEET_EGYPT' => array('0.36', 'ft'), - 'FEET_FRANCE' => array('0.3248406', 'ft'), - 'FEET' => array('0.3048', 'ft'), - 'FEET_IRAQ' => array('0.316', 'ft'), - 'FEET_NETHERLAND' => array('0.28313', 'ft'), - 'FEET_ITALIC' => array('0.296', 'ft'), - 'FEET_SURVEY' => array(array('' => '1200', '/' => '3937'), 'ft'), - 'FEMTOMETER' => array('1.0e-15', 'fm'), - 'FERMI' => array('1.0e-15', 'f'), - 'FINGER' => array('0.1143', 'finger'), - 'FINGERBREADTH' => array('0.01905', 'fingerbreadth'), - 'FIST' => array('0.1', 'fist'), - 'FOD' => array('0.3141', 'fod'), - 'FOOT_EGYPT' => array('0.36', 'ft'), - 'FOOT_FRANCE' => array('0.3248406', 'ft'), - 'FOOT' => array('0.3048', 'ft'), - 'FOOT_IRAQ' => array('0.316', 'ft'), - 'FOOT_NETHERLAND' => array('0.28313', 'ft'), - 'FOOT_ITALIC' => array('0.296', 'ft'), - 'FOOT_SURVEY' => array(array('' => '1200', '/' => '3937'), 'ft'), - 'FOOTBALL_FIELD_CANADA' => array('100.584', 'football field'), - 'FOOTBALL_FIELD_US' => array('91.44', 'football field'), - 'FOOTBALL_FIELD' => array('109.728', 'football field'), - 'FURLONG' => array('201.168', 'fur'), - 'FURLONG_SURVEY' => array(array('' => '792000', '/' => '3937'), 'fur'), - 'FUSS' => array('0.31608', 'fuss'), - 'GIGAMETER' => array('1.0e+9', 'Gm'), - 'GIGAPARSEC' => array('30.85678e+24', 'Gpc'), - 'GNATS_EYE' => array('0.000125', "gnat's eye"), - 'GOAD' => array('1.3716', 'goad'), - 'GRY' => array('0.000211667', 'gry'), - 'HAIRS_BREADTH' => array('0.0001', "hair's breadth"), - 'HAND' => array('0.1016', 'hand'), - 'HANDBREADTH' => array('0.08', "hand's breadth"), - 'HAT' => array('0.5', 'hat'), - 'HECTOMETER' => array('100', 'hm'), - 'HEER' => array('73.152', 'heer'), - 'HIRO' => array('1.818', 'hiro'), - 'HUBBLE' => array('9.4605e+24', 'hubble'), - 'HVAT' => array('1.8965', 'hvat'), - 'INCH' => array('0.0254', 'in'), - 'IRON' => array(array('' => '0.0254', '/' => '48'), 'iron'), - 'KEN' => array('1.818', 'ken'), - 'KERAT' => array('0.0286', 'kerat'), - 'KILOFOOT' => array('304.8', 'kft'), - 'KILOMETER' => array('1000', 'km'), - 'KILOPARSEC' => array('3.0856776e+19', 'kpc'), - 'KILOYARD' => array('914.4', 'kyd'), - 'KIND' => array('0.5', 'kind'), - 'KLAFTER' => array('1.8965', 'klafter'), - 'KLAFTER_SWISS' => array('1.8', 'klafter'), - 'KLICK' => array('1000', 'klick'), - 'KYU' => array('0.00025', 'kyu'), - 'LAP_ANCIENT' => array('402.336', ''), - 'LAP' => array('400', 'lap'), - 'LAP_POOL' => array('100', 'lap'), - 'LEAGUE_ANCIENT' => array('2275', 'league'), - 'LEAGUE_NAUTIC' => array('5556', 'league'), - 'LEAGUE_UK_NAUTIC'=> array('5559.552', 'league'), - 'LEAGUE' => array('4828', 'league'), - 'LEAGUE_US' => array('4828.0417', 'league'), - 'LEAP' => array('2.0574', 'leap'), - 'LEGOA' => array('6174.1', 'legoa'), - 'LEGUA' => array('4200', 'legua'), - 'LEGUA_US' => array('4233.4', 'legua'), - 'LEGUA_SPAIN_OLD' => array('4179.4', 'legua'), - 'LEGUA_SPAIN' => array('6680', 'legua'), - 'LI_ANCIENT' => array('500', 'li'), - 'LI_IMPERIAL' => array('644.65', 'li'), - 'LI' => array('500', 'li'), - 'LIEUE' => array('3898', 'lieue'), - 'LIEUE_METRIC' => array('4000', 'lieue'), - 'LIEUE_NAUTIC' => array('5556', 'lieue'), - 'LIGHT_SECOND' => array('299792458', 'light second'), - 'LIGHT_MINUTE' => array('17987547480', 'light minute'), - 'LIGHT_HOUR' => array('1079252848800', 'light hour'), - 'LIGHT_DAY' => array('25902068371200', 'light day'), - 'LIGHT_YEAR' => array('9460528404879000', 'ly'), - 'LIGNE' => array('0.0021167', 'ligne'), - 'LIGNE_SWISS' => array('0.002256', 'ligne'), - 'LINE' => array('0.0021167', 'li'), - 'LINE_SMALL' => array('0.000635', 'li'), - 'LINK' => array(array('' => '792','/' => '3937'), 'link'), - 'LINK_ENGINEER' => array('0.3048', 'link'), - 'LUG' => array('5.0292', 'lug'), - 'LUG_GREAT' => array('6.4008', 'lug'), - 'MARATHON' => array('42194.988', 'marathon'), - 'MARK_TWAIN' => array('3.6576074', 'mark twain'), - 'MEGAMETER' => array('1000000', 'Mm'), - 'MEGAPARSEC' => array('3.085677e+22', 'Mpc'), - 'MEILE_AUSTRIAN' => array('7586', 'meile'), - 'MEILE' => array('7412.7', 'meile'), - 'MEILE_GERMAN' => array('7532.5', 'meile'), - 'METER' => array('1', 'm'), - 'METRE' => array('1', 'm'), - 'METRIC_MILE' => array('1500', 'metric mile'), - 'METRIC_MILE_US' => array('1600', 'metric mile'), - 'MICROINCH' => array('2.54e-08', 'µin'), - 'MICROMETER' => array('0.000001', 'µm'), - 'MICROMICRON' => array('1.0e-12', 'µµ'), - 'MICRON' => array('0.000001', 'µm'), - 'MIGLIO' => array('1488.6', 'miglio'), - 'MIIL' => array('7500', 'miil'), - 'MIIL_DENMARK' => array('7532.5', 'miil'), - 'MIIL_SWEDISH' => array('10687', 'miil'), - 'MIL' => array('0.0000254', 'mil'), - 'MIL_SWEDISH' => array('10000', 'mil'), - 'MILE_UK' => array('1609', 'mi'), - 'MILE_IRISH' => array('2048', 'mi'), - 'MILE' => array('1609.344', 'mi'), - 'MILE_NAUTIC' => array('1852', 'mi'), - 'MILE_NAUTIC_UK' => array('1853.184', 'mi'), - 'MILE_NAUTIC_US' => array('1852', 'mi'), - 'MILE_ANCIENT' => array('1520', 'mi'), - 'MILE_SCOTTISH' => array('1814', 'mi'), - 'MILE_STATUTE' => array('1609.344', 'mi'), - 'MILE_US' => array(array('' => '6336000','/' => '3937'), 'mi'), - 'MILHA' => array('2087.3', 'milha'), - 'MILITARY_PACE' => array('0.762', 'mil. pace'), - 'MILITARY_PACE_DOUBLE' => array('0.9144', 'mil. pace'), - 'MILLA' => array('1392', 'milla'), - 'MILLE' => array('1949', 'mille'), - 'MILLIARE' => array('0.001478', 'milliare'), - 'MILLIMETER' => array('0.001', 'mm'), - 'MILLIMICRON' => array('1.0e-9', 'mµ'), - 'MKONO' => array('0.4572', 'mkono'), - 'MOOT' => array('0.0762', 'moot'), - 'MYRIAMETER' => array('10000', 'mym'), - 'NAIL' => array('0.05715', 'nail'), - 'NANOMETER' => array('1.0e-9', 'nm'), - 'NANON' => array('1.0e-9', 'nanon'), - 'PACE' => array('1.524', 'pace'), - 'PACE_ROMAN' => array('1.48', 'pace'), - 'PALM_DUTCH' => array('0.10', 'palm'), - 'PALM_UK' => array('0.075', 'palm'), - 'PALM' => array('0.2286', 'palm'), - 'PALMO_PORTUGUESE'=> array('0.22', 'palmo'), - 'PALMO' => array('0.20', 'palmo'), - 'PALMO_US' => array('0.2117', 'palmo'), - 'PARASANG' => array('6000', 'parasang'), - 'PARIS_FOOT' => array('0.3248406', 'paris foot'), - 'PARSEC' => array('3.0856776e+16', 'pc'), - 'PE' => array('0.33324', 'pé'), - 'PEARL' => array('0.001757299', 'pearl'), - 'PERCH' => array('5.0292', 'perch'), - 'PERCH_IRELAND' => array('6.4008', 'perch'), - 'PERTICA' => array('2.96', 'pertica'), - 'PES' => array('0.2967', 'pes'), - 'PETAMETER' => array('1.0e+15', 'Pm'), - 'PICA' => array('0.0042175176', 'pi'), - 'PICOMETER' => array('1.0e-12', 'pm'), - 'PIE_ARGENTINA' => array('0.2889', 'pie'), - 'PIE_ITALIC' => array('0.298', 'pie'), - 'PIE' => array('0.2786', 'pie'), - 'PIE_US' => array('0.2822', 'pie'), - 'PIED_DE_ROI' => array('0.3248406', 'pied de roi'), - 'PIK' => array('0.71', 'pik'), - 'PIKE' => array('0.71', 'pike'), - 'POINT_ADOBE' => array(array('' => '0.3048', '/' => '864'), 'pt'), - 'POINT' => array('0.00035', 'pt'), - 'POINT_DIDOT' => array('0.000377', 'pt'), - 'POINT_TEX' => array('0.0003514598035', 'pt'), - 'POLE' => array('5.0292', 'pole'), - 'POLEGADA' => array('0.02777', 'polegada'), - 'POUCE' => array('0.02707', 'pouce'), - 'PU' => array('1.7907', 'pu'), - 'PULGADA' => array('0.02365', 'pulgada'), - 'PYGME' => array('0.346', 'pygme'), - 'Q' => array('0.00025', 'q'), - 'QUADRANT' => array('10001300', 'quad'), - 'QUARTER' => array('402.336', 'Q'), - 'QUARTER_CLOTH' => array('0.2286', 'Q'), - 'QUARTER_PRINT' => array('0.00025', 'Q'), - 'RANGE' => array(array('' => '38016000','/' => '3937'), 'range'), - 'REED' => array('2.679', 'reed'), - 'RI' => array('3927', 'ri'), - 'RIDGE' => array('6.1722', 'ridge'), - 'RIVER' => array('2000', 'river'), - 'ROD' => array('5.0292', 'rd'), - 'ROD_SURVEY' => array(array('' => '19800', '/' => '3937'), 'rd'), - 'ROEDE' => array('10', 'roede'), - 'ROOD' => array('3.7783', 'rood'), - 'ROPE' => array('3.7783', 'rope'), - 'ROYAL_FOOT' => array('0.3248406', 'royal foot'), - 'RUTE' => array('3.75', 'rute'), - 'SADZHEN' => array('2.1336', 'sadzhen'), - 'SAGENE' => array('2.1336', 'sagene'), - 'SCOTS_FOOT' => array('0.30645', 'scots foot'), - 'SCOTS_MILE' => array('1814.2', 'scots mile'), - 'SEEMEILE' => array('1852', 'seemeile'), - 'SHACKLE' => array('27.432', 'shackle'), - 'SHAFTMENT' => array('0.15124', 'shaftment'), - 'SHAFTMENT_ANCIENT' => array('0.165', 'shaftment'), - 'SHAKU' => array('0.303', 'shaku'), - 'SIRIOMETER' => array('1.4959787e+17', 'siriometer'), - 'SMOOT' => array('1.7018', 'smoot'), - 'SPAN' => array('0.2286', 'span'), - 'SPAT' => array('1.0e+12', 'spat'), - 'STADIUM' => array('185', 'stadium'), - 'STEP' => array('0.762', 'step'), - 'STICK' => array('3.048', 'stk'), - 'STORY' => array('3.3', 'story'), - 'STRIDE' => array('1.524', 'stride'), - 'STRIDE_ROMAN' => array('1.48', 'stride'), - 'TENTHMETER' => array('1.0e-10', 'tenth-meter'), - 'TERAMETER' => array('1.0e+12', 'Tm'), - 'THOU' => array('0.0000254', 'thou'), - 'TOISE' => array('1.949', 'toise'), - 'TOWNSHIP' => array(array('' => '38016000','/' => '3937'), 'twp'), - 'T_SUN' => array('0.0358', "t'sun"), - 'TU' => array('161130', 'tu'), - 'TWAIN' => array('3.6576074', 'twain'), - 'TWIP' => array('0.000017639', 'twip'), - 'U' => array('0.04445', 'U'), - 'VARA_CALIFORNIA' => array('0.83820168', 'vara'), - 'VARA_MEXICAN' => array('0.83802', 'vara'), - 'VARA_PORTUGUESE' => array('1.10', 'vara'), - 'VARA_AMERICA' => array('0.864', 'vara'), - 'VARA' => array('0.83587', 'vara'), - 'VARA_TEXAS' => array('0.84666836', 'vara'), - 'VERGE' => array('0.9144', 'verge'), - 'VERSHOK' => array('0.04445', 'vershok'), - 'VERST' => array('1066.8', 'verst'), - 'WAH' => array('2', 'wah'), - 'WERST' => array('1066.8', 'werst'), - 'X_UNIT' => array('1.0020722e-13', 'Xu'), - 'YARD' => array('0.9144', 'yd'), - 'YOCTOMETER' => array('1.0e-24', 'ym'), - 'YOTTAMETER' => array('1.0e+24', 'Ym'), - 'ZEPTOMETER' => array('1.0e-21', 'zm'), - 'ZETTAMETER' => array('1.0e+21', 'Zm'), - 'ZOLL' => array('0.02634', 'zoll'), - 'ZOLL_SWISS' => array('0.03', 'zoll'), - 'STANDARD' => 'METER' - ); -} diff --git a/library/vendor/Zend/Measure/Lightness.php b/library/vendor/Zend/Measure/Lightness.php deleted file mode 100644 index ee9cb8e6f..000000000 --- a/library/vendor/Zend/Measure/Lightness.php +++ /dev/null @@ -1,78 +0,0 @@ - array('0.31830989', 'asb'), - 'BLONDEL' => array('0.31830989', 'blondel'), - 'CANDELA_PER_SQUARE_CENTIMETER' => array('10000', 'cd/cm²'), - 'CANDELA_PER_SQUARE_FOOT' => array('10.76391', 'cd/ft²'), - 'CANDELA_PER_SQUARE_INCH' => array('1550.00304', 'cd/in²'), - 'CANDELA_PER_SQUARE_METER' => array('1', 'cd/m²'), - 'FOOTLAMBERT' => array('3.4262591', 'ftL'), - 'KILOCANDELA_PER_SQUARE_CENTIMETER' => array('10000000', 'kcd/cm²'), - 'KILOCANDELA_PER_SQUARE_FOOT' => array('10763.91', 'kcd/ft²'), - 'KILOCANDELA_PER_SQUARE_INCH' => array('1550003.04', 'kcd/in²'), - 'KILOCANDELA_PER_SQUARE_METER' => array('1000', 'kcd/m²'), - 'LAMBERT' => array('3183.0989', 'L'), - 'MILLILAMBERT' => array('3.1830989', 'mL'), - 'NIT' => array('1', 'nt'), - 'STILB' => array('10000', 'sb'), - 'STANDARD' => 'CANDELA_PER_SQUARE_METER' - ); -} diff --git a/library/vendor/Zend/Measure/Number.php b/library/vendor/Zend/Measure/Number.php deleted file mode 100644 index 33ce660c8..000000000 --- a/library/vendor/Zend/Measure/Number.php +++ /dev/null @@ -1,417 +0,0 @@ - array(2, '⑵'), - 'TERNARY' => array(3, '⑶'), - 'QUATERNARY' => array(4, '⑷'), - 'QUINARY' => array(5, '⑸'), - 'SENARY' => array(6, '⑹'), - 'SEPTENARY' => array(7, '⑺'), - 'OCTAL' => array(8, '⑻'), - 'NONARY' => array(9, '⑼'), - 'DECIMAL' => array(10, '⑽'), - 'DUODECIMAL' => array(12, '⑿'), - 'HEXADECIMAL' => array(16, '⒃'), - 'ROMAN' => array(99, ''), - 'STANDARD' => 'DECIMAL' - ); - - /** - * Definition of all roman signs - * - * @var array $_roman - */ - private static $_roman = array( - 'I' => 1, - 'A' => 4, - 'V' => 5, - 'B' => 9, - 'X' => 10, - 'E' => 40, - 'L' => 50, - 'F' => 90, - 'C' => 100, - 'G' => 400, - 'D' => 500, - 'H' => 900, - 'M' => 1000, - 'J' => 4000, - 'P' => 5000, - 'K' => 9000, - 'Q' => 10000, - 'N' => 40000, - 'R' => 50000, - 'W' => 90000, - 'S' => 100000, - 'Y' => 400000, - 'T' => 500000, - 'Z' => 900000, - 'U' => 1000000 - ); - - /** - * Convertion table for roman signs - * - * @var array $_romanconvert - */ - private static $_romanconvert = array( - '/_V/' => '/P/', - '/_X/' => '/Q/', - '/_L/' => '/R/', - '/_C/' => '/S/', - '/_D/' => '/T/', - '/_M/' => '/U/', - '/IV/' => '/A/', - '/IX/' => '/B/', - '/XL/' => '/E/', - '/XC/' => '/F/', - '/CD/' => '/G/', - '/CM/' => '/H/', - '/M_V/'=> '/J/', - '/MQ/' => '/K/', - '/QR/' => '/N/', - '/QS/' => '/W/', - '/ST/' => '/Y/', - '/SU/' => '/Z/' - ); - - /** - * Zend_Measure_Abstract is an abstract class for the different measurement types - * - * @param integer $value Value - * @param string $type (Optional) A Zend_Measure_Number Type - * @param string|Zend_Locale $locale (Optional) A Zend_Locale - * @throws Zend_Measure_Exception When language is unknown - * @throws Zend_Measure_Exception When type is unknown - */ - public function __construct($value, $type, $locale = null) - { - if (($type !== null) and (Zend_Locale::isLocale($type, null, false))) { - $locale = $type; - $type = null; - } - - if ($locale === null) { - $locale = new Zend_Locale(); - } - - if (!Zend_Locale::isLocale($locale, true, false)) { - if (!Zend_Locale::isLocale($locale, true, false)) { - throw new Zend_Measure_Exception("Language (" . (string) $locale . ") is unknown"); - } - - $locale = new Zend_Locale($locale); - } - - $this->_locale = (string) $locale; - - if ($type === null) { - $type = $this->_units['STANDARD']; - } - - if (isset($this->_units[$type]) === false) { - throw new Zend_Measure_Exception("Type ($type) is unknown"); - } - - $this->setValue($value, $type, $this->_locale); - } - - /** - * Set a new value - * - * @param integer $value Value - * @param string $type (Optional) A Zend_Measure_Number Type - * @param string|Zend_Locale $locale (Optional) A Zend_Locale Type - * @throws Zend_Measure_Exception - */ - public function setValue($value, $type = null, $locale = null) - { - if (empty($locale)) { - $locale = $this->_locale; - } - - if (empty($this->_units[$type])) { - throw new Zend_Measure_Exception('unknown type of number:' . $type); - } - - switch($type) { - case 'BINARY': - preg_match('/[01]+/', $value, $ergebnis); - $value = $ergebnis[0]; - break; - - case 'TERNARY': - preg_match('/[012]+/', $value, $ergebnis); - $value = $ergebnis[0]; - break; - - case 'QUATERNARY': - preg_match('/[0123]+/', $value, $ergebnis); - $value = $ergebnis[0]; - break; - - case 'QUINARY': - preg_match('/[01234]+/', $value, $ergebnis); - $value = $ergebnis[0]; - break; - - case 'SENARY': - preg_match('/[012345]+/', $value, $ergebnis); - $value = $ergebnis[0]; - break; - - case 'SEPTENARY': - preg_match('/[0123456]+/', $value, $ergebnis); - $value = $ergebnis[0]; - break; - - case 'OCTAL': - preg_match('/[01234567]+/', $value, $ergebnis); - $value = $ergebnis[0]; - break; - - case 'NONARY': - preg_match('/[012345678]+/', $value, $ergebnis); - $value = $ergebnis[0]; - break; - - case 'DUODECIMAL': - preg_match('/[0123456789AB]+/', strtoupper($value), $ergebnis); - $value = $ergebnis[0]; - break; - - case 'HEXADECIMAL': - preg_match('/[0123456789ABCDEF]+/', strtoupper($value), $ergebnis); - $value = $ergebnis[0]; - break; - - case 'ROMAN': - preg_match('/[IVXLCDM_]+/', strtoupper($value), $ergebnis); - $value = $ergebnis[0]; - break; - - default: - try { - $value = Zend_Locale_Format::getInteger($value, array('locale' => $locale)); - } catch (Exception $e) { - throw new Zend_Measure_Exception($e->getMessage(), $e->getCode(), $e); - } - if (call_user_func(Zend_Locale_Math::$comp, $value, 0) < 0) { - $value = call_user_func(Zend_Locale_Math::$sqrt, call_user_func(Zend_Locale_Math::$pow, $value, 2)); - } - break; - } - - $this->_value = $value; - $this->_type = $type; - } - - /** - * Convert input to decimal value string - * - * @param integer $input Input string - * @param string $type Type from which to convert to decimal - * @return string - */ - private function _toDecimal($input, $type) - { - $value = ''; - // Convert base xx values - if ($this->_units[$type][0] <= 16) { - $split = str_split($input); - $length = strlen($input); - for ($x = 0; $x < $length; ++$x) { - $split[$x] = hexdec($split[$x]); - $value = call_user_func(Zend_Locale_Math::$add, $value, - call_user_func(Zend_Locale_Math::$mul, $split[$x], - call_user_func(Zend_Locale_Math::$pow, $this->_units[$type][0], ($length - $x - 1)))); - } - } - - // Convert roman numbers - if ($type === 'ROMAN') { - $input = strtoupper($input); - $input = preg_replace(array_keys(self::$_romanconvert), array_values(self::$_romanconvert), $input); - - $split = preg_split('//', strrev($input), -1, PREG_SPLIT_NO_EMPTY); - - for ($x =0; $x < sizeof($split); $x++) { - if ($split[$x] == '/') { - continue; - } - - $num = self::$_roman[$split[$x]]; - if (($x > 0 and ($split[$x-1] != '/') and ($num < self::$_roman[$split[$x-1]]))) { - $num -= $num; - } - - $value += $num; - } - - str_replace('/', '', $value); - } - - return $value; - } - - /** - * Convert input to type value string - * - * @param integer $value Input string - * @param string $type Type to convert to - * @return string - * @throws Zend_Measure_Exception When more than 200 digits are calculated - */ - private function _fromDecimal($value, $type) - { - $tempvalue = $value; - if ($this->_units[$type][0] <= 16) { - $newvalue = ''; - $count = 200; - $base = $this->_units[$type][0]; - - while (call_user_func(Zend_Locale_Math::$comp, $value, 0, 25) <> 0) { - $target = call_user_func(Zend_Locale_Math::$mod, $value, $base); - - $newvalue = strtoupper(dechex($target)) . $newvalue; - - $value = call_user_func(Zend_Locale_Math::$sub, $value, $target, 0); - $value = call_user_func(Zend_Locale_Math::$div, $value, $base, 0); - - --$count; - if ($count === 0) { - throw new Zend_Measure_Exception("Your value '$tempvalue' cannot be processed because it extends 200 digits"); - } - } - - if ($newvalue === '') { - $newvalue = '0'; - } - } - - if ($type === 'ROMAN') { - $i = 0; - $newvalue = ''; - $romanval = array_values(array_reverse(self::$_roman)); - $romankey = array_keys(array_reverse(self::$_roman)); - $count = 200; - while (call_user_func(Zend_Locale_Math::$comp, $value, 0, 25) <> 0) { - while ($value >= $romanval[$i]) { - $value -= $romanval[$i]; - $newvalue .= $romankey[$i]; - - if ($value < 1) { - break; - } - - --$count; - if ($count === 0) { - throw new Zend_Measure_Exception("Your value '$tempvalue' cannot be processed because it extends 200 digits"); - } - } - - $i++; - } - - $newvalue = str_replace('/', '', preg_replace(array_values(self::$_romanconvert), array_keys(self::$_romanconvert), $newvalue)); - } - - return $newvalue; - } - - /** - * Set a new type, and convert the value - * - * @param string $type New type to set - * @throws Zend_Measure_Exception When a unknown type is given - * @return void - */ - public function setType($type) - { - if (empty($this->_units[$type]) === true) { - throw new Zend_Measure_Exception('Unknown type of number:' . $type); - } - - $value = $this->_toDecimal($this->getValue(-1), $this->getType(-1)); - $value = $this->_fromDecimal($value, $type); - - $this->_value = $value; - $this->_type = $type; - } - - /** - * Alias function for setType returning the converted unit - * Default is 0 as this class only handles numbers without precision - * - * @param string $type Type to convert to - * @param integer $round (Optional) Precision to add, will always be 0 - * @return string - */ - public function convertTo($type, $round = 0, $locale = null) - { - $this->setType($type); - - // Roman numerals do not need a formatting - if ($this->getType() === self::ROMAN) { - return $this->_value; - } - - return $this->toString($round, $locale); - } -} diff --git a/library/vendor/Zend/Measure/Power.php b/library/vendor/Zend/Measure/Power.php deleted file mode 100644 index d619162eb..000000000 --- a/library/vendor/Zend/Measure/Power.php +++ /dev/null @@ -1,186 +0,0 @@ - array('1.0e-18', 'aW'), - 'BTU_PER_HOUR' => array('0.29307197', 'BTU/h'), - 'BTU_PER_MINUTE' => array('17.5843182', 'BTU/m'), - 'BTU_PER_SECOND' => array('1055.059092', 'BTU/s'), - 'CALORIE_PER_HOUR' => array(array('' => '11630', '*' => '1.0e-7'), 'cal/h'), - 'CALORIE_PER_MINUTE' => array(array('' => '697800', '*' => '1.0e-7'), 'cal/m'), - 'CALORIE_PER_SECOND' => array(array('' => '41868000', '*' => '1.0e-7'), 'cal/s'), - 'CENTIWATT' => array('0.01', 'cW'), - 'CHEVAL_VAPEUR' => array('735.49875', 'cv'), - 'CLUSEC' => array('0.0000013332237', 'clusec'), - 'DECIWATT' => array('0.1', 'dW'), - 'DEKAWATT' => array('10', 'daW'), - 'DYNE_CENTIMETER_PER_HOUR' => array(array('' => '1.0e-7','/' => '3600'), 'dyn cm/h'), - 'DYNE_CENTIMETER_PER_MINUTE' => array(array('' => '1.0e-7','/' => '60'), 'dyn cm/m'), - 'DYNE_CENTIMETER_PER_SECOND' => array('1.0e-7', 'dyn cm/s'), - 'ERG_PER_HOUR' => array(array('' => '1.0e-7','/' => '3600'), 'erg/h'), - 'ERG_PER_MINUTE' => array(array('' => '1.0e-7','/' => '60'), 'erg/m'), - 'ERG_PER_SECOND' => array('1.0e-7', 'erg/s'), - 'EXAWATT' => array('1.0e+18', 'EW'), - 'FEMTOWATT' => array('1.0e-15', 'fW'), - 'FOOT_POUND_FORCE_PER_HOUR' => array(array('' => '1.3558179', '/' => '3600'), 'ft lb/h'), - 'FOOT_POUND_FORCE_PER_MINUTE' => array(array('' => '1.3558179', '/' => '60'), 'ft lb/m'), - 'FOOT_POUND_FORCE_PER_SECOND' => array('1.3558179', 'ft lb/s'), - 'FOOT_POUNDAL_PER_HOUR' => array(array('' => '0.04214011','/' => '3600'), 'ft pdl/h'), - 'FOOT_POUNDAL_PER_MINUTE' => array(array('' => '0.04214011', '/' => '60'), 'ft pdl/m'), - 'FOOT_POUNDAL_PER_SECOND' => array('0.04214011', 'ft pdl/s'), - 'GIGAWATT' => array('1.0e+9', 'GW'), - 'GRAM_FORCE_CENTIMETER_PER_HOUR' => array(array('' => '0.0000980665','/' => '3600'), 'gf cm/h'), - 'GRAM_FORCE_CENTIMETER_PER_MINUTE' => array(array('' => '0.0000980665','/' => '60'), 'gf cm/m'), - 'GRAM_FORCE_CENTIMETER_PER_SECOND' => array('0.0000980665', 'gf cm/s'), - 'HECTOWATT' => array('100', 'hW'), - 'HORSEPOWER_INTERNATIONAL' => array('745.69987', 'hp'), - 'HORSEPOWER_ELECTRIC' => array('746', 'hp'), - 'HORSEPOWER' => array('735.49875', 'hp'), - 'HORSEPOWER_WATER' => array('746.043', 'hp'), - 'INCH_OUNCH_FORCE_REVOLUTION_PER_MINUTE' => array('0.00073948398', 'in ocf/m'), - 'JOULE_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'J/h'), - 'JOULE_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'J/m'), - 'JOULE_PER_SECOND' => array('1', 'J/s'), - 'KILOCALORIE_PER_HOUR' => array('1.163', 'kcal/h'), - 'KILOCALORIE_PER_MINUTE' => array('69.78', 'kcal/m'), - 'KILOCALORIE_PER_SECOND' => array('4186.8', 'kcal/s'), - 'KILOGRAM_FORCE_METER_PER_HOUR' => array(array('' => '9.80665', '/' => '3600'), 'kgf m/h'), - 'KILOGRAM_FORCE_METER_PER_MINUTE' => array(array('' => '9.80665', '/' => '60'), 'kfg m/m'), - 'KILOGRAM_FORCE_METER_PER_SECOND' => array('9.80665', 'kfg m/s'), - 'KILOPOND_METER_PER_HOUR' => array(array('' => '9.80665', '/' => '3600'), 'kp/h'), - 'KILOPOND_METER_PER_MINUTE' => array(array('' => '9.80665', '/' => '60'), 'kp/m'), - 'KILOPOND_METER_PER_SECOND' => array('9.80665', 'kp/s'), - 'KILOWATT' => array('1000', 'kW'), - 'MEGAWATT' => array('1000000', 'MW'), - 'MICROWATT' => array('0.000001', 'µW'), - 'MILLION_BTU_PER_HOUR' => array('293071.07', 'mio BTU/h'), - 'MILLIWATT' => array('0.001', 'mM'), - 'NANOWATT' => array('1.0e-9', 'nN'), - 'NEWTON_METER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'Nm/h'), - 'NEWTON_METER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'Nm/m'), - 'NEWTON_METER_PER_SECOND' => array('1', 'Nm/s'), - 'PETAWATT' => array('1.0e+15', 'PW'), - 'PFERDESTAERKE' => array('735.49875', 'PS'), - 'PICOWATT' => array('1.0e-12', 'pW'), - 'PONCELET' => array('980.665', 'p'), - 'POUND_SQUARE_FOOT_PER_CUBIC_SECOND' => array('0.04214011', 'lb ft²/s³'), - 'TERAWATT' => array('1.0e+12', 'TW'), - 'TON_OF_REFRIGERATION' => array('3516.85284', 'RT'), - 'WATT' => array('1', 'W'), - 'YOCTOWATT' => array('1.0e-24', 'yW'), - 'YOTTAWATT' => array('1.0e+24', 'YW'), - 'ZEPTOWATT' => array('1.0e-21', 'zW'), - 'ZETTAWATT' => array('1.0e+21', 'ZW'), - 'STANDARD' => 'WATT' - ); -} diff --git a/library/vendor/Zend/Measure/Pressure.php b/library/vendor/Zend/Measure/Pressure.php deleted file mode 100644 index 3a6c5de67..000000000 --- a/library/vendor/Zend/Measure/Pressure.php +++ /dev/null @@ -1,248 +0,0 @@ - array('101325.01', 'atm'), - 'ATMOSPHERE_TECHNICAL' => array('98066.5', 'atm'), - 'ATTOBAR' => array('1.0e-13', 'ab'), - 'ATTOPASCAL' => array('1.0e-18', 'aPa'), - 'BAR' => array('100000', 'b'), - 'BARAD' => array('0.1', 'barad'), - 'BARYE' => array('0.1', 'ba'), - 'CENTIBAR' => array('1000', 'cb'), - 'CENTIHG' => array('1333.2239', 'cHg'), - 'CENTIMETER_MERCURY_0C' => array('1333.2239', 'cm mercury (0°C)'), - 'CENTIMETER_WATER_4C' => array('98.0665', 'cm water (4°C)'), - 'CENTIPASCAL' => array('0.01', 'cPa'), - 'CENTITORR' => array('1.3332237', 'cTorr'), - 'DECIBAR' => array('10000', 'db'), - 'DECIPASCAL' => array('0.1', 'dPa'), - 'DECITORR' => array('13.332237', 'dTorr'), - 'DEKABAR' => array('1000000', 'dab'), - 'DEKAPASCAL' => array('10', 'daPa'), - 'DYNE_PER_SQUARE_CENTIMETER' => array('0.1', 'dyn/cm²'), - 'EXABAR' => array('1.0e+23', 'Eb'), - 'EXAPASCAL' => array('1.0e+18', 'EPa'), - 'FEMTOBAR' => array('1.0e-10', 'fb'), - 'FEMTOPASCAL' => array('1.0e-15', 'fPa'), - 'FOOT_AIR_0C' => array('3.8640888', 'ft air (0°C)'), - 'FOOT_AIR_15C' => array('3.6622931', 'ft air (15°C)'), - 'FOOT_HEAD' => array('2989.0669', 'ft head'), - 'FOOT_MERCURY_0C' => array('40636.664', 'ft mercury (0°C)'), - 'FOOT_WATER_4C' => array('2989.0669', 'ft water (4°C)'), - 'GIGABAR' => array('1.0e+14', 'Gb'), - 'GIGAPASCAL' => array('1.0e+9', 'GPa'), - 'GRAM_FORCE_SQUARE_CENTIMETER' => array('98.0665', 'gf'), - 'HECTOBAR' => array('1.0e+7', 'hb'), - 'HECTOPASCAL' => array('100', 'hPa'), - 'INCH_AIR_0C' => array(array('' => '3.8640888', '/' => '12'), 'in air (0°C)'), - 'INCH_AIR_15C' => array(array('' => '3.6622931', '/' => '12'), 'in air (15°C)'), - 'INCH_MERCURY_0C' => array(array('' => '40636.664', '/' => '12'), 'in mercury (0°C)'), - 'INCH_WATER_4C' => array(array('' => '2989.0669', '/' => '12'), 'in water (4°C)'), - 'KILOBAR' => array('1.0e+8', 'kb'), - 'KILOGRAM_FORCE_PER_SQUARE_CENTIMETER' => array('98066.5', 'kgf/cm²'), - 'KILOGRAM_FORCE_PER_SQUARE_METER' => array('9.80665', 'kgf/m²'), - 'KILOGRAM_FORCE_PER_SQUARE_MILLIMETER' => array('9806650', 'kgf/mm²'), - 'KILONEWTON_PER_SQUARE_METER' => array('1000', 'kN/m²'), - 'KILOPASCAL' => array('1000', 'kPa'), - 'KILOPOND_PER_SQUARE_CENTIMETER' => array('98066.5', 'kp/cm²'), - 'KILOPOND_PER_SQUARE_METER' => array('9.80665', 'kp/m²'), - 'KILOPOND_PER_SQUARE_MILLIMETER' => array('9806650', 'kp/mm²'), - 'KIP_PER_SQUARE_FOOT' => array(array('' => '430.92233', '/' => '0.009'), 'kip/ft²'), - 'KIP_PER_SQUARE_INCH' => array(array('' => '62052.81552', '/' => '0.009'), 'kip/in²'), - 'MEGABAR' => array('1.0e+11', 'Mb'), - 'MEGANEWTON_PER_SQUARE_METER' => array('1000000', 'MN/m²'), - 'MEGAPASCAL' => array('1000000', 'MPa'), - 'METER_AIR_0C' => array('12.677457', 'm air (0°C)'), - 'METER_AIR_15C' => array('12.015397', 'm air (15°C)'), - 'METER_HEAD' => array('9804.139432', 'm head'), - 'MICROBAR' => array('0.1', 'µb'), - 'MICROMETER_MERCURY_0C' => array('0.13332239', 'µm mercury (0°C)'), - 'MICROMETER_WATER_4C' => array('0.00980665', 'µm water (4°C)'), - 'MICRON_MERCURY_0C' => array('0.13332239', 'µ mercury (0°C)'), - 'MICROPASCAL' => array('0.000001', 'µPa'), - 'MILLIBAR' => array('100', 'mb'), - 'MILLIHG' => array('133.32239', 'mHg'), - 'MILLIMETER_MERCURY_0C' => array('133.32239', 'mm mercury (0°C)'), - 'MILLIMETER_WATER_4C' => array('9.80665', 'mm water (0°C)'), - 'MILLIPASCAL' => array('0.001', 'mPa'), - 'MILLITORR' => array('0.13332237', 'mTorr'), - 'NANOBAR' => array('0.0001', 'nb'), - 'NANOPASCAL' => array('1.0e-9', 'nPa'), - 'NEWTON_PER_SQUARE_METER' => array('1', 'N/m²'), - 'NEWTON_PER_SQUARE_MILLIMETER' => array('1000000', 'N/mm²'), - 'OUNCE_PER_SQUARE_INCH' => array('430.92233', 'oz/in²'), - 'PASCAL' => array('1', 'Pa'), - 'PETABAR' => array('1.0e+20', 'Pb'), - 'PETAPASCAL' => array('1.0e+15', 'PPa'), - 'PICOBAR' => array('0.0000001', 'pb'), - 'PICOPASCAL' => array('1.0e-12', 'pPa'), - 'PIEZE' => array('1000', 'pz'), - 'POUND_PER_SQUARE_FOOT' => array(array('' => '430.92233', '/' => '9'), 'lb/ft²'), - 'POUND_PER_SQUARE_INCH' => array('6894.75728', 'lb/in²'), - 'POUNDAL_PER_SQUARE_FOOT' => array('1.4881639', 'pdl/ft²'), - 'STHENE_PER_SQUARE_METER' => array('1000', 'sn/m²'), - 'TECHNICAL_ATMOSPHERE' => array('98066.5', 'at'), - 'TERABAR' => array('1.0e+17', 'Tb'), - 'TERAPASCAL' => array('1.0e+12', 'TPa'), - 'TON_PER_SQUARE_FOOT' => array(array('' => '120658.2524', '/' => '1.125'), 't/ft²'), - 'TON_PER_SQUARE_FOOT_SHORT' => array(array('' => '430.92233', '/' => '0.0045'), 't/ft²'), - 'TON_PER_SQUARE_INCH' => array(array('' => '17374788.3456', '/' => '1.125'), 't/in²'), - 'TON_PER_SQUARE_INCH_SHORT' => array(array('' => '62052.81552', '/' => '0.0045'), 't/in²'), - 'TON_PER_SQUARE_METER' => array('9806.65', 't/m²'), - 'TORR' => array('133.32237', 'Torr'), - 'WATER_COLUMN_CENTIMETER' => array('98.0665', 'WC (cm)'), - 'WATER_COLUMN_INCH' => array(array('' => '2989.0669', '/' => '12'), 'WC (in)'), - 'WATER_COLUMN_MILLIMETER' => array('9.80665', 'WC (mm)'), - 'YOCTOBAR' => array('1.0e-19', 'yb'), - 'YOCTOPASCAL' => array('1.0e-24', 'yPa'), - 'YOTTABAR' => array('1.0e+29', 'Yb'), - 'YOTTAPASCAL' => array('1.0e+24', 'YPa'), - 'ZEPTOBAR' => array('1.0e-16', 'zb'), - 'ZEPTOPASCAL' => array('1.0e-21', 'zPa'), - 'ZETTABAR' => array('1.0e+26', 'Zb'), - 'ZETTAPASCAL' => array('1.0e+21', 'ZPa'), - 'STANDARD' => 'NEWTON_PER_SQUARE_METER' - ); -} diff --git a/library/vendor/Zend/Measure/Speed.php b/library/vendor/Zend/Measure/Speed.php deleted file mode 100644 index 1e67be6ab..000000000 --- a/library/vendor/Zend/Measure/Speed.php +++ /dev/null @@ -1,188 +0,0 @@ - array('1', 'Bz'), - 'CENTIMETER_PER_DAY' => array(array('' => '0.01', '/' => '86400'), 'cm/day'), - 'CENTIMETER_PER_HOUR' => array(array('' => '0.01', '/' => '3600'), 'cm/h'), - 'CENTIMETER_PER_MINUTE' => array(array('' => '0.01', '/' => '60'), 'cm/m'), - 'CENTIMETER_PER_SECOND' => array('0.01', 'cd/s'), - 'DEKAMETER_PER_DAY' => array(array('' => '10', '/' => '86400'), 'dam/day'), - 'DEKAMETER_PER_HOUR' => array(array('' => '10', '/' => '3600'), 'dam/h'), - 'DEKAMETER_PER_MINUTE' => array(array('' => '10', '/' => '60'), 'dam/m'), - 'DEKAMETER_PER_SECOND' => array('10', 'dam/s'), - 'FOOT_PER_DAY' => array(array('' => '0.3048', '/' => '86400'), 'ft/day'), - 'FOOT_PER_HOUR' => array(array('' => '0.3048', '/' => '3600'), 'ft/h'), - 'FOOT_PER_MINUTE' => array(array('' => '0.3048', '/' => '60'), 'ft/m'), - 'FOOT_PER_SECOND' => array('0.3048', 'ft/s'), - 'FURLONG_PER_DAY' => array(array('' => '201.1684', '/' => '86400'), 'fur/day'), - 'FURLONG_PER_FORTNIGHT' => array(array('' => '201.1684', '/' => '1209600'), 'fur/fortnight'), - 'FURLONG_PER_HOUR' => array(array('' => '201.1684', '/' => '3600'), 'fur/h'), - 'FURLONG_PER_MINUTE' => array(array('' => '201.1684', '/' => '60'), 'fur/m'), - 'FURLONG_PER_SECOND' => array('201.1684', 'fur/s'), - 'HECTOMETER_PER_DAY' => array(array('' => '100', '/' => '86400'), 'hm/day'), - 'HECTOMETER_PER_HOUR' => array(array('' => '100', '/' => '3600'), 'hm/h'), - 'HECTOMETER_PER_MINUTE' => array(array('' => '100', '/' => '60'), 'hm/m'), - 'HECTOMETER_PER_SECOND' => array('100', 'hm/s'), - 'INCH_PER_DAY' => array(array('' => '0.0254', '/' => '86400'), 'in/day'), - 'INCH_PER_HOUR' => array(array('' => '0.0254', '/' => '3600'), 'in/h'), - 'INCH_PER_MINUTE' => array(array('' => '0.0254', '/' => '60'), 'in/m'), - 'INCH_PER_SECOND' => array('0.0254', 'in/s'), - 'KILOMETER_PER_DAY' => array(array('' => '1000', '/' => '86400'), 'km/day'), - 'KILOMETER_PER_HOUR' => array(array('' => '1000', '/' => '3600'), 'km/h'), - 'KILOMETER_PER_MINUTE' => array(array('' => '1000', '/' => '60'), 'km/m'), - 'KILOMETER_PER_SECOND' => array('1000', 'km/s'), - 'KNOT' => array(array('' => '1852', '/' => '3600'), 'kn'), - 'LEAGUE_PER_DAY' => array(array('' => '4828.0417', '/' => '86400'), 'league/day'), - 'LEAGUE_PER_HOUR' => array(array('' => '4828.0417', '/' => '3600'), 'league/h'), - 'LEAGUE_PER_MINUTE' => array(array('' => '4828.0417', '/' => '60'), 'league/m'), - 'LEAGUE_PER_SECOND' => array('4828.0417', 'league/s'), - 'MACH' => array('340.29', 'M'), - 'MEGAMETER_PER_DAY' => array(array('' => '1000000', '/' => '86400'), 'Mm/day'), - 'MEGAMETER_PER_HOUR' => array(array('' => '1000000', '/' => '3600'), 'Mm/h'), - 'MEGAMETER_PER_MINUTE' => array(array('' => '1000000', '/' => '60'), 'Mm/m'), - 'MEGAMETER_PER_SECOND' => array('1000000', 'Mm/s'), - 'METER_PER_DAY' => array(array('' => '1', '/' => '86400'), 'm/day'), - 'METER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'm/h'), - 'METER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'm/m'), - 'METER_PER_SECOND' => array('1', 'm/s'), - 'MILE_PER_DAY' => array(array('' => '1609.344', '/' => '86400'), 'mi/day'), - 'MILE_PER_HOUR' => array(array('' => '1609.344', '/' => '3600'), 'mi/h'), - 'MILE_PER_MINUTE' => array(array('' => '1609.344', '/' => '60'), 'mi/m'), - 'MILE_PER_SECOND' => array('1609.344', 'mi/s'), - 'MILLIMETER_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'mm/day'), - 'MILLIMETER_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'mm/h'), - 'MILLIMETER_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'mm/m'), - 'MILLIMETER_PER_SECOND' => array('0.001', 'mm/s'), - 'MILLIMETER_PER_MICROSECOND' => array('1000', 'mm/µs'), - 'MILLIMETER_PER_100_MICROSECOND' => array('10', 'mm/100µs'), - 'NAUTIC_MILE_PER_DAY' => array(array('' => '1852', '/' => '86400'), 'nmi/day'), - 'NAUTIC_MILE_PER_HOUR' => array(array('' => '1852', '/' => '3600'), 'nmi/h'), - 'NAUTIC_MILE_PER_MINUTE' => array(array('' => '1852', '/' => '60'), 'nmi/m'), - 'NAUTIC_MILE_PER_SECOND' => array('1852', 'nmi/s'), - 'LIGHTSPEED_AIR' => array('299702547', 'speed of light (air)'), - 'LIGHTSPEED_GLASS' => array('199861638', 'speed of light (glass)'), - 'LIGHTSPEED_ICE' => array('228849204', 'speed of light (ice)'), - 'LIGHTSPEED_VACUUM' => array('299792458', 'speed of light (vacuum)'), - 'LIGHTSPEED_WATER' => array('225407863', 'speed of light (water)'), - 'SOUNDSPEED_AIT' => array('340.29', 'speed of sound (air)'), - 'SOUNDSPEED_METAL' => array('5000', 'speed of sound (metal)'), - 'SOUNDSPEED_WATER' => array('1500', 'speed of sound (water)'), - 'YARD_PER_DAY' => array(array('' => '0.9144', '/' => '86400'), 'yd/day'), - 'YARD_PER_HOUR' => array(array('' => '0.9144', '/' => '3600'), 'yd/h'), - 'YARD_PER_MINUTE' => array(array('' => '0.9144', '/' => '60'), 'yd/m'), - 'YARD_PER_SECOND' => array('0.9144', 'yd/s'), - 'STANDARD' => 'METER_PER_SECOND' - ); -} diff --git a/library/vendor/Zend/Measure/Temperature.php b/library/vendor/Zend/Measure/Temperature.php deleted file mode 100644 index 06a355015..000000000 --- a/library/vendor/Zend/Measure/Temperature.php +++ /dev/null @@ -1,58 +0,0 @@ - array(array('' => '1', '+' => '273.15'),'°C'), - 'FAHRENHEIT' => array(array('' => '1', '-' => '32', '/' => '1.8', '+' => '273.15'),'°F'), - 'RANKINE' => array(array('' => '1', '/' => '1.8'),'°R'), - 'REAUMUR' => array(array('' => '1', '*' => '1.25', '+' => '273.15'),'°r'), - 'KELVIN' => array(1,'°K'), - 'STANDARD' => 'KELVIN' - ); -} diff --git a/library/vendor/Zend/Measure/Time.php b/library/vendor/Zend/Measure/Time.php deleted file mode 100644 index a9aab219b..000000000 --- a/library/vendor/Zend/Measure/Time.php +++ /dev/null @@ -1,115 +0,0 @@ - array('31558432', 'anomalistic year'), - 'ATTOSECOND' => array('1.0e-18', 'as'), - 'CENTURY' => array('3153600000', 'century'), - 'DAY' => array('86400', 'day'), - 'DECADE' => array('315360000', 'decade'), - 'DRACONIC_YEAR' => array('29947974', 'draconic year'), - 'EXASECOND' => array('1.0e+18', 'Es'), - 'FEMTOSECOND' => array('1.0e-15', 'fs'), - 'FORTNIGHT' => array('1209600', 'fortnight'), - 'GAUSSIAN_YEAR' => array('31558196', 'gaussian year'), - 'GIGASECOND' => array('1.0e+9', 'Gs'), - 'GREAT_YEAR' => array(array('*' => '31536000', '*' => '25700'), 'great year'), - 'GREGORIAN_YEAR' => array('31536000', 'year'), - 'HOUR' => array('3600', 'h'), - 'JULIAN_YEAR' => array('31557600', 'a'), - 'KILOSECOND' => array('1000', 'ks'), - 'LEAPYEAR' => array('31622400', 'year'), - 'MEGASECOND' => array('1000000', 'Ms'), - 'MICROSECOND' => array('0.000001', 'µs'), - 'MILLENIUM' => array('31536000000', 'millenium'), - 'MILLISECOND' => array('0.001', 'ms'), - 'MINUTE' => array('60', 'min'), - 'MONTH' => array('2628600', 'month'), - 'NANOSECOND' => array('1.0e-9', 'ns'), - 'PETASECOND' => array('1.0e+15', 'Ps'), - 'PICOSECOND' => array('1.0e-12', 'ps'), - 'QUARTER' => array('7884000', 'quarter'), - 'SECOND' => array('1', 's'), - 'SHAKE' => array('1.0e-9', 'shake'), - 'SIDEREAL_YEAR' => array('31558149.7676', 'sidereal year'), - 'TERASECOND' => array('1.0e+12', 'Ts'), - 'TROPICAL_YEAR' => array('31556925', 'tropical year'), - 'WEEK' => array('604800', 'week'), - 'YEAR' => array('31536000', 'year'), - 'STANDARD' => 'SECOND' - ); -} diff --git a/library/vendor/Zend/Measure/Torque.php b/library/vendor/Zend/Measure/Torque.php deleted file mode 100644 index be2ef7596..000000000 --- a/library/vendor/Zend/Measure/Torque.php +++ /dev/null @@ -1,80 +0,0 @@ - array('0.0000001', 'dyncm'), - 'GRAM_CENTIMETER' => array('0.0000980665', 'gcm'), - 'KILOGRAM_CENTIMETER' => array('0.0980665', 'kgcm'), - 'KILOGRAM_METER' => array('9.80665', 'kgm'), - 'KILONEWTON_METER' => array('1000', 'kNm'), - 'KILOPOND_METER' => array('9.80665', 'kpm'), - 'MEGANEWTON_METER' => array('1000000', 'MNm'), - 'MICRONEWTON_METER' => array('0.000001', 'µNm'), - 'MILLINEWTON_METER' => array('0.001', 'mNm'), - 'NEWTON_CENTIMETER' => array('0.01', 'Ncm'), - 'NEWTON_METER' => array('1', 'Nm'), - 'OUNCE_FOOT' => array('0.084738622', 'ozft'), - 'OUNCE_INCH' => array(array('' => '0.084738622', '/' => '12'), 'ozin'), - 'POUND_FOOT' => array(array('' => '0.084738622', '*' => '16'), 'lbft'), - 'POUNDAL_FOOT' => array('0.0421401099752144', 'plft'), - 'POUND_INCH' => array(array('' => '0.084738622', '/' => '12', '*' => '16'), 'lbin'), - 'STANDARD' => 'NEWTON_METER' - ); -} diff --git a/library/vendor/Zend/Measure/Viscosity/Dynamic.php b/library/vendor/Zend/Measure/Viscosity/Dynamic.php deleted file mode 100644 index fb28fcd7c..000000000 --- a/library/vendor/Zend/Measure/Viscosity/Dynamic.php +++ /dev/null @@ -1,118 +0,0 @@ - array('0.001', 'cP'), - 'DECIPOISE' => array('0.01', 'dP'), - 'DYNE_SECOND_PER_SQUARE_CENTIMETER' => array('0.1', 'dyn s/cm²'), - 'GRAM_FORCE_SECOND_PER_SQUARE_CENTIMETER' => array('98.0665', 'gf s/cm²'), - 'GRAM_PER_CENTIMETER_SECOND' => array('0.1', 'g/cm s'), - 'KILOGRAM_FORCE_SECOND_PER_SQUARE_METER' => array('9.80665', 'kgf s/m²'), - 'KILOGRAM_PER_METER_HOUR' => array(array('' => '1', '/' => '3600'), 'kg/m h'), - 'KILOGRAM_PER_METER_SECOND' => array('1', 'kg/ms'), - 'MILLIPASCAL_SECOND' => array('0.001', 'mPa s'), - 'MILLIPOISE' => array('0.0001', 'mP'), - 'NEWTON_SECOND_PER_SQUARE_METER' => array('1', 'N s/m²'), - 'PASCAL_SECOND' => array('1', 'Pa s'), - 'POISE' => array('0.1', 'P'), - 'POISEUILLE' => array('1', 'Pl'), - 'POUND_FORCE_SECOND_PER_SQUARE_FEET' => array('47.880259', 'lbf s/ft²'), - 'POUND_FORCE_SECOND_PER_SQUARE_INCH' => array('6894.75729', 'lbf s/in²'), - 'POUND_PER_FOOT_HOUR' => array('0.00041337887', 'lb/ft h'), - 'POUND_PER_FOOT_SECOND' => array('1.4881639', 'lb/ft s'), - 'POUNDAL_HOUR_PER_SQUARE_FOOT' => array('0.00041337887', 'pdl h/ft²'), - 'POUNDAL_SECOND_PER_SQUARE_FOOT' => array('1.4881639', 'pdl s/ft²'), - 'REYN' => array('6894.75729', 'reyn'), - 'SLUG_PER_FOOT_SECOND'=> array('47.880259', 'slug/ft s'), - 'WATER_20C' => array('0.001', 'water (20°)'), - 'WATER_40C' => array('0.00065', 'water (40°)'), - 'HEAVY_OIL_20C' => array('0.45', 'oil (20°)'), - 'HEAVY_OIL_40C' => array('0.11', 'oil (40°)'), - 'GLYCERIN_20C' => array('1.41', 'glycerin (20°)'), - 'GLYCERIN_40C' => array('0.284', 'glycerin (40°)'), - 'SAE_5W_MINUS18C' => array('1.2', 'SAE 5W (-18°)'), - 'SAE_10W_MINUS18C' => array('2.4', 'SAE 10W (-18°)'), - 'SAE_20W_MINUS18C' => array('9.6', 'SAE 20W (-18°)'), - 'SAE_5W_99C' => array('0.0039', 'SAE 5W (99°)'), - 'SAE_10W_99C' => array('0.0042', 'SAE 10W (99°)'), - 'SAE_20W_99C' => array('0.0057', 'SAE 20W (99°)'), - 'STANDARD' => 'KILOGRAM_PER_METER_SECOND' - ); -} diff --git a/library/vendor/Zend/Measure/Viscosity/Kinematic.php b/library/vendor/Zend/Measure/Viscosity/Kinematic.php deleted file mode 100644 index b76cce146..000000000 --- a/library/vendor/Zend/Measure/Viscosity/Kinematic.php +++ /dev/null @@ -1,104 +0,0 @@ - array('0.000001', 'cSt'), - 'LENTOR' => array('0.0001', 'lentor'), - 'LITER_PER_CENTIMETER_DAY' => array(array('' => '1', '/' => '864000'), 'l/cm day'), - 'LITER_PER_CENTIMETER_HOUR' => array(array('' => '1', '/' => '36000'), 'l/cm h'), - 'LITER_PER_CENTIMETER_MINUTE' => array(array('' => '1', '/' => '600'), 'l/cm m'), - 'LITER_PER_CENTIMETER_SECOND' => array('0.1', 'l/cm s'), - 'POISE_CUBIC_CENTIMETER_PER_GRAM' => array('0.0001', 'P cm³/g'), - 'SQUARE_CENTIMETER_PER_DAY' => array(array('' => '1', '/' => '864000000'),'cm²/day'), - 'SQUARE_CENTIMETER_PER_HOUR' => array(array('' => '1', '/' => '36000000'),'cm²/h'), - 'SQUARE_CENTIMETER_PER_MINUTE' => array(array('' => '1', '/' => '600000'),'cm²/m'), - 'SQUARE_CENTIMETER_PER_SECOND' => array('0.0001', 'cm²/s'), - 'SQUARE_FOOT_PER_DAY' => array('0.0000010752667', 'ft²/day'), - 'SQUARE_FOOT_PER_HOUR' => array('0.0000258064', 'ft²/h'), - 'SQUARE_FOOT_PER_MINUTE' => array('0.001548384048', 'ft²/m'), - 'SQUARE_FOOT_PER_SECOND' => array('0.09290304', 'ft²/s'), - 'SQUARE_INCH_PER_DAY' => array('7.4671296e-9', 'in²/day'), - 'SQUARE_INCH_PER_HOUR' => array('0.00000017921111', 'in²/h'), - 'SQUARE_INCH_PER_MINUTE' => array('0.000010752667', 'in²/m'), - 'SQUARE_INCH_PER_SECOND' => array('0.00064516', 'in²/s'), - 'SQUARE_METER_PER_DAY' => array(array('' => '1', '/' => '86400'), 'm²/day'), - 'SQUARE_METER_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'm²/h'), - 'SQUARE_METER_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'm²/m'), - 'SQUARE_METER_PER_SECOND' => array('1', 'm²/s'), - 'SQUARE_MILLIMETER_PER_DAY' => array(array('' => '1', '/' => '86400000000'), 'mm²/day'), - 'SQUARE_MILLIMETER_PER_HOUR' => array(array('' => '1', '/' => '3600000000'), 'mm²/h'), - 'SQUARE_MILLIMETER_PER_MINUTE' => array(array('' => '1', '/' => '60000000'), 'mm²/m'), - 'SQUARE_MILLIMETER_PER_SECOND' => array('0.000001', 'mm²/s'), - 'STOKES' => array('0.0001', 'St'), - 'STANDARD' => 'SQUARE_METER_PER_SECOND' - ); -} diff --git a/library/vendor/Zend/Measure/Volume.php b/library/vendor/Zend/Measure/Volume.php deleted file mode 100644 index 12a5c3a32..000000000 --- a/library/vendor/Zend/Measure/Volume.php +++ /dev/null @@ -1,211 +0,0 @@ - array('1233.48185532', 'ac ft'), - 'ACRE_FOOT_SURVEY' => array('1233.489', 'ac ft'), - 'ACRE_INCH' => array('102.79015461', 'ac in'), - 'BARREL_WINE' => array('0.143201835', 'bbl'), - 'BARREL' => array('0.16365924', 'bbl'), - 'BARREL_US_DRY' => array(array('' => '26.7098656608', '/' => '231'), 'bbl'), - 'BARREL_US_FEDERAL' => array('0.1173477658', 'bbl'), - 'BARREL_US' => array('0.1192404717', 'bbl'), - 'BARREL_US_PETROLEUM' => array('0.1589872956', 'bbl'), - 'BOARD_FOOT' => array(array('' => '6.5411915904', '/' => '2772'), 'board foot'), - 'BUCKET' => array('0.01818436', 'bucket'), - 'BUCKET_US' => array('0.018927059', 'bucket'), - 'BUSHEL' => array('0.03636872', 'bu'), - 'BUSHEL_US' => array('0.03523907', 'bu'), - 'CENTILITER' => array('0.00001', 'cl'), - 'CORD' => array('3.624556416', 'cd'), - 'CORD_FOOT' => array('0.453069552', 'cd ft'), - 'CUBIC_CENTIMETER' => array('0.000001', 'cm³'), - 'CUBIC_CUBIT' => array('0.144', 'cubit³'), - 'CUBIC_DECIMETER' => array('0.001', 'dm³'), - 'CUBIC_DEKAMETER' => array('1000', 'dam³'), - 'CUBIC_FOOT' => array(array('' => '6.54119159', '/' => '231'), 'ft³'), - 'CUBIC_INCH' => array(array('' => '0.0037854118', '/' => '231'), 'in³'), - 'CUBIC_KILOMETER' => array('1.0e+9', 'km³'), - 'CUBIC_METER' => array('1', 'm³'), - 'CUBIC_MILE' => array(array('' => '0.0037854118', '/' => '231', '*' => '75271680', '*' => '3379200'), - 'mi³'), - 'CUBIC_MICROMETER' => array('1.0e-18', 'µm³'), - 'CUBIC_MILLIMETER' => array('1.0e-9', 'mm³'), - 'CUBIC_YARD' => array(array('' => '0.0037854118', '/' => '231', '*' => '46656'), 'yd³'), - 'CUP_CANADA' => array('0.0002273045', 'c'), - 'CUP' => array('0.00025', 'c'), - 'CUP_US' => array(array('' => '0.0037854118', '/' => '16'), 'c'), - 'DECILITER' => array('0.0001', 'dl'), - 'DEKALITER' => array('0.001', 'dal'), - 'DRAM' => array(array('' => '0.0037854118', '/' => '1024'), 'dr'), - 'DRUM_US' => array('0.208197649', 'drum'), - 'DRUM' => array('0.2', 'drum'), - 'FIFTH' => array('0.00075708236', 'fifth'), - 'GALLON' => array('0.00454609', 'gal'), - 'GALLON_US_DRY' => array('0.0044048838', 'gal'), - 'GALLON_US' => array('0.0037854118', 'gal'), - 'GILL' => array(array('' => '0.00454609', '/' => '32'), 'gi'), - 'GILL_US' => array(array('' => '0.0037854118', '/' => '32'), 'gi'), - 'HECTARE_METER' => array('10000', 'ha m'), - 'HECTOLITER' => array('0.1', 'hl'), - 'HOGSHEAD' => array('0.28640367', 'hhd'), - 'HOGSHEAD_US' => array('0.2384809434', 'hhd'), - 'JIGGER' => array(array('' => '0.0037854118', '/' => '128', '*' => '1.5'), 'jigger'), - 'KILOLITER' => array('1', 'kl'), - 'LITER' => array('0.001', 'l'), - 'MEASURE' => array('0.0077', 'measure'), - 'MEGALITER' => array('1000', 'Ml'), - 'MICROLITER' => array('1.0e-9', 'µl'), - 'MILLILITER' => array('0.000001', 'ml'), - 'MINIM' => array(array('' => '0.00454609', '/' => '76800'), 'min'), - 'MINIM_US' => array(array('' => '0.0037854118','/' => '61440'), 'min'), - 'OUNCE' => array(array('' => '0.00454609', '/' => '160'), 'oz'), - 'OUNCE_US' => array(array('' => '0.0037854118', '/' => '128'), 'oz'), - 'PECK' => array('0.00909218', 'pk'), - 'PECK_US' => array('0.0088097676', 'pk'), - 'PINT' => array(array('' => '0.00454609', '/' => '8'), 'pt'), - 'PINT_US_DRY' => array(array('' => '0.0044048838', '/' => '8'), 'pt'), - 'PINT_US' => array(array('' => '0.0037854118', '/' => '8'), 'pt'), - 'PIPE' => array('0.49097772', 'pipe'), - 'PIPE_US' => array('0.4769618868', 'pipe'), - 'PONY' => array(array('' => '0.0037854118', '/' => '128'), 'pony'), - 'QUART_GERMANY' => array('0.00114504', 'qt'), - 'QUART_ANCIENT' => array('0.00108', 'qt'), - 'QUART' => array(array('' => '0.00454609', '/' => '4'), 'qt'), - 'QUART_US_DRY' => array(array('' => '0.0044048838', '/' => '4'), 'qt'), - 'QUART_US' => array(array('' => '0.0037854118', '/' => '4'), 'qt'), - 'QUART_UK' => array('0.29094976', 'qt'), - 'SHOT' => array(array('' => '0.0037854118', '/' => '128'), 'shot'), - 'STERE' => array('1', 'st'), - 'TABLESPOON' => array('0.000015', 'tbsp'), - 'TABLESPOON_UK' => array(array('' => '0.00454609', '/' => '320'), 'tbsp'), - 'TABLESPOON_US' => array(array('' => '0.0037854118', '/' => '256'), 'tbsp'), - 'TEASPOON' => array('0.000005', 'tsp'), - 'TEASPOON_UK' => array(array('' => '0.00454609', '/' => '1280'), 'tsp'), - 'TEASPOON_US' => array(array('' => '0.0037854118', '/' => '768'), 'tsp'), - 'YARD' => array(array('' => '176.6121729408', '/' => '231'), 'yd'), - 'STANDARD' => 'CUBIC_METER' - ); -} diff --git a/library/vendor/Zend/Measure/Weight.php b/library/vendor/Zend/Measure/Weight.php deleted file mode 100644 index bba0ee759..000000000 --- a/library/vendor/Zend/Measure/Weight.php +++ /dev/null @@ -1,478 +0,0 @@ - array('0.5', 'arratel'), - 'ARTEL' => array('0.5', 'artel'), - 'ARROBA_PORTUGUESE' => array('14.69', 'arroba'), - 'ARROBA' => array('11.502', '@'), - 'AS_' => array('0.000052', 'as'), - 'ASS' => array('0.000052', 'ass'), - 'ATOMIC_MASS_UNIT_1960' => array('1.6603145e-27', 'amu'), - 'ATOMIC_MASS_UNIT_1973' => array('1.6605655e-27', 'amu'), - 'ATOMIC_MASS_UNIT_1986' => array('1.6605402e-27', 'amu'), - 'ATOMIC_MASS_UNIT' => array('1.66053873e-27', 'amu'), - 'AVOGRAM' => array('1.6605402e-27', 'avogram'), - 'BAG' => array('42.63768278', 'bag'), - 'BAHT' => array('0.015', 'baht'), - 'BALE' => array('326.5865064', 'bl'), - 'BALE_US' => array('217.7243376', 'bl'), - 'BISMAR_POUND' => array('5.993', 'bismar pound'), - 'CANDY' => array('254', 'candy'), - 'CARAT_INTERNATIONAL' => array('0.0002', 'ct'), - 'CARAT' => array('0.0002', 'ct'), - 'CARAT_UK' => array('0.00025919564', 'ct'), - 'CARAT_US_1913' => array('0.0002053', 'ct'), - 'CARGA' => array('140', 'carga'), - 'CATTI' => array('0.604875', 'catti'), - 'CATTI_JAPANESE' => array('0.594', 'catti'), - 'CATTY' => array('0.5', 'catty'), - 'CATTY_JAPANESE' => array('0.6', 'catty'), - 'CATTY_THAI' => array('0.6', 'catty'), - 'CENTAL' => array('45.359237', 'cH'), - 'CENTIGRAM' => array('0.00001', 'cg'), - 'CENTNER' => array('50', 'centner'), - 'CENTNER_RUSSIAN' => array('100', 'centner'), - 'CHALDER' => array('2692.52', 'chd'), - 'CHALDRON' => array('2692.52', 'chd'), - 'CHIN' => array('0.5', 'chin'), - 'CHIN_JAPANESE' => array('0.6', 'chin'), - 'CLOVE' => array('3.175', 'clove'), - 'CRITH' => array('0.000089885', 'crith'), - 'DALTON' => array('1.6605402e-27', 'D'), - 'DAN' => array('50', 'dan'), - 'DAN_JAPANESE' => array('60', 'dan'), - 'DECIGRAM' => array('0.0001', 'dg'), - 'DECITONNE' => array('100', 'dt'), - 'DEKAGRAM' => array('0.01', 'dag'), - 'DEKATONNE' => array('10000', 'dat'), - 'DENARO' => array('0.0011', 'denaro'), - 'DENIER' => array('0.001275', 'denier'), - 'DRACHME' => array('0.0038', 'drachme'), - 'DRAM' => array(array('' => '0.45359237', '/' => '256'), 'dr'), - 'DRAM_APOTHECARIES' => array('0.0038879346', 'dr'), - 'DYNE' => array('1.0197162e-6', 'dyn'), - 'ELECTRON' => array('9.109382e-31', 'e−'), - 'ELECTRONVOLT' => array('1.782662e-36', 'eV'), - 'ETTO' => array('0.1', 'hg'), - 'EXAGRAM' => array('1.0e+15', 'Eg'), - 'FEMTOGRAM' => array('1.0e-18', 'fg'), - 'FIRKIN' => array('25.40117272', 'fir'), - 'FLASK' => array('34.7', 'flask'), - 'FOTHER' => array('979.7595192', 'fother'), - 'FOTMAL' => array('32.65865064', 'fotmal'), - 'FUNT' => array('0.4095', 'funt'), - 'FUNTE' => array('0.4095', 'funte'), - 'GAMMA' => array('0.000000001', 'gamma'), - 'GIGAELECTRONVOLT' => array('1.782662e-27', 'GeV'), - 'GIGAGRAM' => array('1000000', 'Gg'), - 'GIGATONNE' => array('1.0e+12', 'Gt'), - 'GIN' => array('0.6', 'gin'), - 'GIN_JAPANESE' => array('0.594', 'gin'), - 'GRAIN' => array('0.00006479891', 'gr'), - 'GRAM' => array('0.001', 'g'), - 'GRAN' => array('0.00082', 'gran'), - 'GRANO' => array('0.00004905', 'grano'), - 'GRANI' => array('0.00004905', 'grani'), - 'GROS' => array('0.003824', 'gros'), - 'HECTOGRAM' => array('0.1', 'hg'), - 'HUNDRETWEIGHT' => array('50.80234544', 'cwt'), - 'HUNDRETWEIGHT_US' => array('45.359237', 'cwt'), - 'HYL' => array('9.80665', 'hyl'), - 'JIN' => array('0.5', 'jin'), - 'JUPITER' => array('1.899e+27', 'jupiter'), - 'KATI' => array('0.5', 'kati'), - 'KATI_JAPANESE' => array('0.6', 'kati'), - 'KEEL' => array('21540.19446656', 'keel'), - 'KEG' => array('45.359237', 'keg'), - 'KILODALTON' => array('1.6605402e-24', 'kD'), - 'KILOGRAM' => array('1', 'kg'), - 'KILOGRAM_FORCE' => array('1', 'kgf'), - 'KILOTON' => array('1016046.9088', 'kt'), - 'KILOTON_US' => array('907184.74', 'kt'), - 'KILOTONNE' => array('1000000', 'kt'), - 'KIN' => array('0.6', 'kin'), - 'KIP' => array('453.59237', 'kip'), - 'KOYAN' => array('2419', 'koyan'), - 'KWAN' => array('3.75', 'kwan'), - 'LAST_GERMANY' => array('2000', 'last'), - 'LAST' => array('1814.36948', 'last'), - 'LAST_WOOL' => array('1981.29147216', 'last'), - 'LB' => array('0.45359237', 'lb'), - 'LBS' => array('0.45359237', 'lbs'), - 'LIANG' => array('0.05', 'liang'), - 'LIBRE_ITALIAN' => array('0.339', 'lb'), - 'LIBRA_SPANISH' => array('0.459', 'lb'), - 'LIBRA_PORTUGUESE' => array('0.459', 'lb'), - 'LIBRA_ANCIENT' => array('0.323', 'lb'), - 'LIBRA' => array('1', 'lb'), - 'LIVRE' => array('0.4895', 'livre'), - 'LONG_TON' => array('1016.0469088', 't'), - 'LOT' => array('0.015', 'lot'), - 'MACE' => array('0.003778', 'mace'), - 'MAHND' => array('0.9253284348', 'mahnd'), - 'MARC' => array('0.24475', 'marc'), - 'MARCO' => array('0.23', 'marco'), - 'MARK' => array('0.2268', 'mark'), - 'MARK_GERMANY' => array('0.2805', 'mark'), - 'MAUND' => array('37.3242', 'maund'), - 'MAUND_PAKISTAN' => array('40', 'maund'), - 'MEGADALTON' => array('1.6605402e-21', 'MD'), - 'MEGAGRAM' => array('1000', 'Mg'), - 'MEGATONNE' => array('1.0e+9', 'Mt'), - 'MERCANTILE_POUND' => array('0.46655', 'lb merc'), - 'METRIC_TON' => array('1000', 't'), - 'MIC' => array('1.0e-9', 'mic'), - 'MICROGRAM' => array('1.0e-9', '�g'), - 'MILLIDALTON' => array('1.6605402e-30', 'mD'), - 'MILLIER' => array('1000', 'millier'), - 'MILLIGRAM' => array('0.000001', 'mg'), - 'MILLIMASS_UNIT' => array('1.6605402e-30', 'mmu'), - 'MINA' => array('0.499', 'mina'), - 'MOMME' => array('0.00375', 'momme'), - 'MYRIAGRAM' => array('10', 'myg'), - 'NANOGRAM' => array('1.0e-12', 'ng'), - 'NEWTON' => array('0.101971621', 'N'), - 'OBOL' => array('0.0001', 'obol'), - 'OBOLOS' => array('0.0001', 'obolos'), - 'OBOLUS' => array('0.0001', 'obolus'), - 'OBOLOS_ANCIENT' => array('0.0005', 'obolos'), - 'OBOLUS_ANCIENT' => array('0.00057', 'obolos'), - 'OKA' => array('1.28', 'oka'), - 'ONCA' => array('0.02869', 'onca'), - 'ONCE' => array('0.03059', 'once'), - 'ONCIA' => array('0.0273', 'oncia'), - 'ONZA' => array('0.02869', 'onza'), - 'ONS' => array('0.1', 'ons'), - 'OUNCE' => array(array('' => '0.45359237', '/' => '16'), 'oz'), - 'OUNCE_FORCE' => array(array('' => '0.45359237', '/' => '16'), 'ozf'), - 'OUNCE_TROY' => array(array('' => '65.31730128', '/' => '2100'), 'oz'), - 'PACKEN' => array('490.79', 'packen'), - 'PENNYWEIGHT' => array(array('' => '65.31730128', '/' => '42000'), 'dwt'), - 'PETAGRAM' => array('1.0e+12', 'Pg'), - 'PFUND' => array('0.5', 'pfd'), - 'PICOGRAM' => array('1.0e-15', 'pg'), - 'POINT' => array('0.000002', 'pt'), - 'POND' => array('0.5', 'pond'), - 'POUND' => array('0.45359237', 'lb'), - 'POUND_FORCE' => array('0.4535237', 'lbf'), - 'POUND_METRIC' => array('0.5', 'lb'), - 'POUND_TROY' => array(array('' => '65.31730128', '/' => '175'), 'lb'), - 'PUD' => array('16.3', 'pud'), - 'POOD' => array('16.3', 'pood'), - 'PUND' => array('0.5', 'pund'), - 'QIAN' => array('0.005', 'qian'), - 'QINTAR' => array('50', 'qintar'), - 'QUARTER' => array('12.70058636', 'qtr'), - 'QUARTER_US' => array('11.33980925', 'qtr'), - 'QUARTER_TON' => array('226.796185', 'qtr'), - 'QUARTERN' => array('1.587573295', 'quartern'), - 'QUARTERN_LOAF' => array('1.81436948', 'quartern-loaf'), - 'QUINTAL_FRENCH' => array('48.95', 'q'), - 'QUINTAL' => array('100', 'q'), - 'QUINTAL_PORTUGUESE' => array('58.752', 'q'), - 'QUINTAL_SPAIN' => array('45.9', 'q'), - 'REBAH' => array('0.2855', 'rebah'), - 'ROTL' => array('0.5', 'rotl'), - 'ROTEL' => array('0.5', 'rotel'), - 'ROTTLE' => array('0.5', 'rottle'), - 'RATEL' => array('0.5', 'ratel'), - 'SACK' => array('165.10762268', 'sack'), - 'SCRUPLE' => array(array('' => '65.31730128', '/' => '50400'), 's'), - 'SEER' => array('0.933105', 'seer'), - 'SEER_PAKISTAN' => array('1', 'seer'), - 'SHEKEL' => array('0.01142', 'shekel'), - 'SHORT_TON' => array('907.18474', 'st'), - 'SLINCH' => array('175.126908', 'slinch'), - 'SLUG' => array('14.593903', 'slug'), - 'STONE' => array('6.35029318', 'st'), - 'TAEL' => array('0.03751', 'tael'), - 'TAHIL_JAPANESE' => array('0.03751', 'tahil'), - 'TAHIL' => array('0.05', 'tahil'), - 'TALENT' => array('30', 'talent'), - 'TAN' => array('50', 'tan'), - 'TECHNISCHE_MASS_EINHEIT' => array('9.80665', 'TME'), - 'TERAGRAM' => array('1.0e+9', 'Tg'), - 'TETRADRACHM' => array('0.014', 'tetradrachm'), - 'TICAL' => array('0.0164', 'tical'), - 'TOD' => array('12.70058636', 'tod'), - 'TOLA' => array('0.0116638125', 'tola'), - 'TOLA_PAKISTAN' => array('0.0125', 'tola'), - 'TON_UK' => array('1016.0469088', 't'), - 'TON' => array('1000', 't'), - 'TON_US' => array('907.18474', 't'), - 'TONELADA_PORTUGUESE' => array('793.15', 'tonelada'), - 'TONELADA' => array('919.9', 'tonelada'), - 'TONNE' => array('1000', 't'), - 'TONNEAU' => array('979', 'tonneau'), - 'TOVAR' => array('128.8', 'tovar'), - 'TROY_OUNCE' => array(array('' => '65.31730128', '/' => '2100'), 'troy oz'), - 'TROY_POUND' => array(array('' => '65.31730128', '/' => '175'), 'troy lb'), - 'TRUSS' => array('25.40117272', 'truss'), - 'UNCIA' => array('0.0272875', 'uncia'), - 'UNZE' => array('0.03125', 'unze'), - 'VAGON' => array('10000', 'vagon'), - 'YOCTOGRAM' => array('1.0e-27', 'yg'), - 'YOTTAGRAM' => array('1.0e+21', 'Yg'), - 'ZENTNER' => array('50', 'Ztr'), - 'ZEPTOGRAM' => array('1.0e-24', 'zg'), - 'ZETTAGRAM' => array('1.0e+18', 'Zg'), - 'STANDARD' => 'KILOGRAM' - ); -} diff --git a/library/vendor/Zend/Memory.php b/library/vendor/Zend/Memory.php deleted file mode 100644 index c98f4b0d1..000000000 --- a/library/vendor/Zend/Memory.php +++ /dev/null @@ -1,76 +0,0 @@ -_memContainer = $memContainer; - } - - /** - * Object destructor - */ - public function __destruct() - { - $this->_memContainer->destroy(); - } - - - /** - * Get string value reference - * - * _Must_ be used for value access before PHP v 5.2 - * or _may_ be used for performance considerations - * - * @return &string - */ - public function &getRef() - { - return $this->_memContainer->getRef(); - } - - /** - * Signal, that value is updated by external code. - * - * Should be used together with getRef() - */ - public function touch() - { - $this->_memContainer->touch(); - } - - /** - * Lock object in memory. - */ - public function lock() - { - $this->_memContainer->lock(); - } - - - /** - * Unlock object - */ - public function unlock() - { - $this->_memContainer->unlock(); - } - - /** - * Return true if object is locked - * - * @return boolean - */ - public function isLocked() - { - return $this->_memContainer->isLocked(); - } - - /** - * Get handler - * - * Loads object if necessary and moves it to the top of loaded objects list. - * Swaps objects from the bottom of loaded objects list, if necessary. - * - * @param string $property - * @return string - * @throws Zend_Memory_Exception - */ - public function __get($property) - { - return $this->_memContainer->$property; - } - - /** - * Set handler - * - * @param string $property - * @param string $value - * @throws Zend_Exception - */ - public function __set($property, $value) - { - $this->_memContainer->$property = $value; - } -} diff --git a/library/vendor/Zend/Memory/Container.php b/library/vendor/Zend/Memory/Container.php deleted file mode 100644 index 56d06cff5..000000000 --- a/library/vendor/Zend/Memory/Container.php +++ /dev/null @@ -1,34 +0,0 @@ -value = $value; - } - - /** - * Lock object in memory. - */ - public function lock() - { - /* Do nothing */ - } - - /** - * Unlock object - */ - public function unlock() - { - /* Do nothing */ - } - - /** - * Return true if object is locked - * - * @return boolean - */ - public function isLocked() - { - return true; - } - - /** - * Get string value reference - * - * _Must_ be used for value access before PHP v 5.2 - * or _may_ be used for performance considerations - * - * @return &string - */ - public function &getRef() - { - return $this->value; - } - - /** - * Signal, that value is updated by external code. - * - * Should be used together with getRef() - */ - public function touch() - { - /* Do nothing */ - } - - /** - * Destroy memory container and remove it from memory manager list - */ - public function destroy() - { - /* Do nothing */ - } -} diff --git a/library/vendor/Zend/Memory/Container/Movable.php b/library/vendor/Zend/Memory/Container/Movable.php deleted file mode 100644 index e8c7bf34d..000000000 --- a/library/vendor/Zend/Memory/Container/Movable.php +++ /dev/null @@ -1,293 +0,0 @@ -_memManager = $memoryManager; - $this->_id = $id; - $this->_state = self::LOADED; - $this->_value = new Zend_Memory_Value($value, $this); - } - - /** - * Lock object in memory. - */ - public function lock() - { - if ( !($this->_state & self::LOADED) ) { - $this->_memManager->load($this, $this->_id); - $this->_state |= self::LOADED; - } - - $this->_state |= self::LOCKED; - - /** - * @todo - * It's possible to set "value" container attribute to avoid modification tracing, while it's locked - * Check, if it's more effective - */ - } - - /** - * Unlock object - */ - public function unlock() - { - // Clear LOCKED state bit - $this->_state &= ~self::LOCKED; - } - - /** - * Return true if object is locked - * - * @return boolean - */ - public function isLocked() - { - return $this->_state & self::LOCKED; - } - - /** - * Get handler - * - * Loads object if necessary and moves it to the top of loaded objects list. - * Swaps objects from the bottom of loaded objects list, if necessary. - * - * @param string $property - * @return string - * @throws Zend_Memory_Exception - */ - public function __get($property) - { - if ($property != 'value') { - throw new Zend_Memory_Exception('Unknown property: Zend_Memory_container::$' . $property); - } - - if ( !($this->_state & self::LOADED) ) { - $this->_memManager->load($this, $this->_id); - $this->_state |= self::LOADED; - } - - return $this->_value; - } - - /** - * Set handler - * - * @param string $property - * @param string $value - * @throws Zend_Exception - */ - public function __set($property, $value) - { - if ($property != 'value') { - throw new Zend_Memory_Exception('Unknown property: Zend_Memory_container::$' . $property); - } - - $this->_state = self::LOADED; - $this->_value = new Zend_Memory_Value($value, $this); - - $this->_memManager->processUpdate($this, $this->_id); - } - - - /** - * Get string value reference - * - * _Must_ be used for value access before PHP v 5.2 - * or _may_ be used for performance considerations - * - * @return &string - */ - public function &getRef() - { - if ( !($this->_state & self::LOADED) ) { - $this->_memManager->load($this, $this->_id); - $this->_state |= self::LOADED; - } - - return $this->_value->getRef(); - } - - /** - * Signal, that value is updated by external code. - * - * Should be used together with getRef() - */ - public function touch() - { - $this->_memManager->processUpdate($this, $this->_id); - } - - /** - * Process container value update. - * Must be called only by value object - * - * @internal - */ - public function processUpdate() - { - // Clear SWAPPED state bit - $this->_state &= ~self::SWAPPED; - - $this->_memManager->processUpdate($this, $this->_id); - } - - /** - * Start modifications trace - * - * @internal - */ - public function startTrace() - { - if ( !($this->_state & self::LOADED) ) { - $this->_memManager->load($this, $this->_id); - $this->_state |= self::LOADED; - } - - $this->_value->startTrace(); - } - - /** - * Set value (used by memory manager when value is loaded) - * - * @internal - */ - public function setValue($value) - { - $this->_value = new Zend_Memory_Value($value, $this); - } - - /** - * Clear value (used by memory manager when value is swapped) - * - * @internal - */ - public function unloadValue() - { - // Clear LOADED state bit - $this->_state &= ~self::LOADED; - - $this->_value = null; - } - - /** - * Mark, that object is swapped - * - * @internal - */ - public function markAsSwapped() - { - // Clear LOADED state bit - $this->_state |= self::LOADED; - } - - /** - * Check if object is marked as swapped - * - * @internal - * @return boolean - */ - public function isSwapped() - { - return $this->_state & self::SWAPPED; - } - - /** - * Get object id - * - * @internal - * @return integer - */ - public function getId() - { - return $this->_id; - } - /** - * Destroy memory container and remove it from memory manager list - * - * @internal - */ - public function destroy() - { - /** - * We don't clean up swap because of performance considerations - * Cleaning is performed by Memory Manager destructor - */ - - $this->_memManager->unlink($this, $this->_id); - } -} diff --git a/library/vendor/Zend/Memory/Exception.php b/library/vendor/Zend/Memory/Exception.php deleted file mode 100644 index f8d39cf16..000000000 --- a/library/vendor/Zend/Memory/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ - => , - * ... - * ) - * - * @var array - */ - private $_unloadCandidates = array(); - - /** - * List of object sizes. - * - * This list is used to calculate modification of object sizes - * - * array( => , ...) - * - * @var array - */ - private $_sizes = array(); - - /** - * Last modified object - * - * It's used to reduce number of calls necessary to trace objects' modifications - * Modification is not processed by memory manager until we do not switch to another - * object. - * So we have to trace only _first_ object modification and do nothing for others - * - * @var Zend_Memory_Container_Movable - */ - private $_lastModified = null; - - /** - * Unique memory manager id - * - * @var integer - */ - private $_managerId; - - /** - * Tags array, used by backend to categorize stored values - * - * @var array - */ - private $_tags; - - /** - * This function is intended to generate unique id, used by memory manager - */ - private function _generateMemManagerId() - { - /** - * @todo !!! - * uniqid() php function doesn't really garantee the id to be unique - * it should be changed by something else - * (Ex. backend interface should be extended to provide this functionality) - */ - $this->_managerId = uniqid('ZendMemManager', true); - $this->_tags = array($this->_managerId); - $this->_managerId .= '_'; - } - - - /** - * Memory manager constructor - * - * If backend is not specified, then memory objects are never swapped - * - * @param Zend_Cache_Backend $backend - * @param array $backendOptions associative array of options for the corresponding backend constructor - */ - public function __construct($backend = null) - { - if ($backend === null) { - return; - } - - $this->_backend = $backend; - $this->_generateMemManagerId(); - - $memoryLimitStr = trim(ini_get('memory_limit')); - if ($memoryLimitStr != '' && $memoryLimitStr != -1) { - $this->_memoryLimit = (integer)$memoryLimitStr; - switch (strtolower($memoryLimitStr[strlen($memoryLimitStr)-1])) { - case 'g': - $this->_memoryLimit *= 1024; - // Break intentionally omitted - case 'm': - $this->_memoryLimit *= 1024; - // Break intentionally omitted - case 'k': - $this->_memoryLimit *= 1024; - break; - - default: - break; - } - - $this->_memoryLimit = (int)($this->_memoryLimit*2/3); - } // No limit otherwise - } - - /** - * Object destructor - * - * Clean up backend storage - */ - public function __destruct() - { - if ($this->_backend !== null) { - $this->_backend->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, $this->_tags); - } - } - - /** - * Set memory grow limit - * - * @param integer $newLimit - * @throws Zend_Exception - */ - public function setMemoryLimit($newLimit) - { - $this->_memoryLimit = $newLimit; - - $this->_swapCheck(); - } - - /** - * Get memory grow limit - * - * @return integer - */ - public function getMemoryLimit() - { - return $this->_memoryLimit; - } - - /** - * Set minimum size of values, which may be swapped - * - * @param integer $newSize - */ - public function setMinSize($newSize) - { - $this->_minSize = $newSize; - } - - /** - * Get minimum size of values, which may be swapped - * - * @return integer - */ - public function getMinSize() - { - return $this->_minSize; - } - - /** - * Create new Zend_Memory value container - * - * @param string $value - * @return Zend_Memory_Container_Interface - * @throws Zend_Memory_Exception - */ - public function create($value = '') - { - return $this->_create($value, false); - } - - /** - * Create new Zend_Memory value container, which has value always - * locked in memory - * - * @param string $value - * @return Zend_Memory_Container_Interface - * @throws Zend_Memory_Exception - */ - public function createLocked($value = '') - { - return $this->_create($value, true); - } - - /** - * Create new Zend_Memory object - * - * @param string $value - * @param boolean $locked - * @return Zend_Memory_Container_Interface - * @throws Zend_Memory_Exception - */ - private function _create($value, $locked) - { - $id = $this->_nextId++; - - if ($locked || ($this->_backend === null) /* Use only memory locked objects if backend is not specified */) { - return new Zend_Memory_Container_Locked($value); - } - - // Commit other objects modifications - $this->_commit(); - - $valueObject = new Zend_Memory_Container_Movable($this, $id, $value); - - // Store last object size as 0 - $this->_sizes[$id] = 0; - // prepare object for next modifications - $this->_lastModified = $valueObject; - - return new Zend_Memory_AccessController($valueObject); - } - - /** - * Unlink value container from memory manager - * - * Used by Memory container destroy() method - * - * @internal - * @param integer $id - * @return Zend_Memory_Container - */ - public function unlink(Zend_Memory_Container_Movable $container, $id) - { - if ($this->_lastModified === $container) { - // Drop all object modifications - $this->_lastModified = null; - unset($this->_sizes[$id]); - return; - } - - if (isset($this->_unloadCandidates[$id])) { - unset($this->_unloadCandidates[$id]); - } - - $this->_memorySize -= $this->_sizes[$id]; - unset($this->_sizes[$id]); - } - - /** - * Process value update - * - * @internal - * @param Zend_Memory_Container_Movable $container - * @param integer $id - */ - public function processUpdate(Zend_Memory_Container_Movable $container, $id) - { - /** - * This method is automatically invoked by memory container only once per - * "modification session", but user may call memory container touch() method - * several times depending on used algorithm. So we have to use this check - * to optimize this case. - */ - if ($container === $this->_lastModified) { - return; - } - - // Remove just updated object from list of candidates to unload - if( isset($this->_unloadCandidates[$id])) { - unset($this->_unloadCandidates[$id]); - } - - // Reduce used memory mark - $this->_memorySize -= $this->_sizes[$id]; - - // Commit changes of previously modified object if necessary - $this->_commit(); - - $this->_lastModified = $container; - } - - /** - * Commit modified object and put it back to the loaded objects list - */ - private function _commit() - { - if (($container = $this->_lastModified) === null) { - return; - } - - $this->_lastModified = null; - - $id = $container->getId(); - - // Calculate new object size and increase used memory size by this value - $this->_memorySize += ($this->_sizes[$id] = strlen($container->getRef())); - - if ($this->_sizes[$id] > $this->_minSize) { - // Move object to "unload candidates list" - $this->_unloadCandidates[$id] = $container; - } - - $container->startTrace(); - - $this->_swapCheck(); - } - - /** - * Check and swap objects if necessary - * - * @throws Zend_MemoryException - */ - private function _swapCheck() - { - if ($this->_memoryLimit < 0 || $this->_memorySize < $this->_memoryLimit) { - // Memory limit is not reached - // Do nothing - return; - } - - // walk through loaded objects in access history order - foreach ($this->_unloadCandidates as $id => $container) { - $this->_swap($container, $id); - unset($this->_unloadCandidates[$id]); - - if ($this->_memorySize < $this->_memoryLimit) { - // We've swapped enough objects - return; - } - } - - throw new Zend_Memory_Exception('Memory manager can\'t get enough space.'); - } - - - /** - * Swap object data to disk - * Actualy swaps data or only unloads it from memory, - * if object is not changed since last swap - * - * @param Zend_Memory_Container_Movable $container - * @param integer $id - */ - private function _swap(Zend_Memory_Container_Movable $container, $id) - { - if ($container->isLocked()) { - return; - } - - if (!$container->isSwapped()) { - $this->_backend->save($container->getRef(), $this->_managerId . $id, $this->_tags); - } - - $this->_memorySize -= $this->_sizes[$id]; - - $container->markAsSwapped(); - $container->unloadValue(); - } - - /** - * Load value from swap file. - * - * @internal - * @param Zend_Memory_Container_Movable $container - * @param integer $id - */ - public function load(Zend_Memory_Container_Movable $container, $id) - { - $value = $this->_backend->load($this->_managerId . $id, true); - - // Try to swap other objects if necessary - // (do not include specified object into check) - $this->_memorySize += strlen($value); - $this->_swapCheck(); - - // Add loaded obect to the end of loaded objects list - $container->setValue($value); - - if ($this->_sizes[$id] > $this->_minSize) { - // Add object to the end of "unload candidates list" - $this->_unloadCandidates[$id] = $container; - } - } -} diff --git a/library/vendor/Zend/Memory/Value.php b/library/vendor/Zend/Memory/Value.php deleted file mode 100644 index 99950fb5b..000000000 --- a/library/vendor/Zend/Memory/Value.php +++ /dev/null @@ -1,177 +0,0 @@ -_container = $container; - - $this->_value = (string)$value; - - /** - * Object is marked as just modified by memory manager - * So we don't need to trace followed object modifications and - * object is processed (and marked as traced) when another - * memory object is modified. - * - * It reduces overall numberr of calls necessary to modification trace - */ - $this->_trace = false; - } - - - /** - * ArrayAccess interface method - * returns true if string offset exists - * - * @param integer $offset - * @return boolean - */ - public function offsetExists($offset) - { - return $offset >= 0 && $offset < strlen($this->_value); - } - - /** - * ArrayAccess interface method - * Get character at $offset position - * - * @param integer $offset - * @return string - */ - public function offsetGet($offset) - { - return $this->_value[$offset]; - } - - /** - * ArrayAccess interface method - * Set character at $offset position - * - * @param integer $offset - * @param string $char - */ - public function offsetSet($offset, $char) - { - $this->_value[$offset] = $char; - - if ($this->_trace) { - $this->_trace = false; - $this->_container->processUpdate(); - } - } - - /** - * ArrayAccess interface method - * Unset character at $offset position - * - * @param integer $offset - */ - public function offsetUnset($offset) - { - unset($this->_value[$offset]); - - if ($this->_trace) { - $this->_trace = false; - $this->_container->processUpdate(); - } - } - - - /** - * To string conversion - * - * @return string - */ - public function __toString() - { - return $this->_value; - } - - - /** - * Get string value reference - * - * _Must_ be used for value access before PHP v 5.2 - * or _may_ be used for performance considerations - * - * @internal - * @return string - */ - public function &getRef() - { - return $this->_value; - } - - /** - * Start modifications trace - * - * _Must_ be used for value access before PHP v 5.2 - * or _may_ be used for performance considerations - * - * @internal - */ - public function startTrace() - { - $this->_trace = true; - } -} diff --git a/library/vendor/Zend/Mobile/Exception.php b/library/vendor/Zend/Mobile/Exception.php deleted file mode 100644 index 5ea0f8cc4..000000000 --- a/library/vendor/Zend/Mobile/Exception.php +++ /dev/null @@ -1,32 +0,0 @@ -_isConnected = true; - return $this; - } - - /** - * Send a Push Message - * - * @param Zend_Mobile_Push_Message_Abstract $message - * @return boolean - * @throws DomainException - */ - public function send(Zend_Mobile_Push_Message_Abstract $message) - { - if (!$this->_isConnected) { - $this->connect(); - } - return true; - } - - /** - * Close the Connection to the Push Server - * - * @return void - */ - public function close() - { - $this->_isConnected = false; - } - - /** - * Is Connected - * - * @return boolean - */ - public function isConnected() - { - return $this->_isConnected; - } - - /** - * Set Options - * - * @param array $options - * @return Zend_Mobile_Push_Abstract - * @throws Zend_Mobile_Push_Exception - */ - public function setOptions(array $options) - { - foreach ($options as $k => $v) { - $method = 'set' . ucwords($k); - if (!method_exists($this, $method)) { - throw new Zend_Mobile_Push_Exception('The method "' . $method . "' does not exist."); - } - $this->$method($v); - } - return $this; - } -} diff --git a/library/vendor/Zend/Mobile/Push/Apns.php b/library/vendor/Zend/Mobile/Push/Apns.php deleted file mode 100644 index d9f62c0ea..000000000 --- a/library/vendor/Zend/Mobile/Push/Apns.php +++ /dev/null @@ -1,388 +0,0 @@ -_certificate; - } - - /** - * Set Certificate - * - * @param string $cert - * @return Zend_Mobile_Push_Apns - * @throws Zend_Mobile_Push_Exception - */ - public function setCertificate($cert) - { - if (!is_string($cert)) { - throw new Zend_Mobile_Push_Exception('$cert must be a string'); - } - if (!file_exists($cert)) { - throw new Zend_Mobile_Push_Exception('$cert must be a valid path to the certificate'); - } - $this->_certificate = $cert; - return $this; - } - - /** - * Get Certificate Passphrase - * - * @return string - */ - public function getCertificatePassphrase() - { - return $this->_certificatePassphrase; - } - - /** - * Set Certificate Passphrase - * - * @param string $passphrase - * @return Zend_Mobile_Push_Apns - * @throws Zend_Mobile_Push_Exception - */ - public function setCertificatePassphrase($passphrase) - { - if (!is_string($passphrase)) { - throw new Zend_Mobile_Push_Exception('$passphrase must be a string'); - } - $this->_certificatePassphrase = $passphrase; - return $this; - } - - /** - * Connect to Socket - * - * @param string $uri - * @return bool - * @throws Zend_Mobile_Push_Exception_ServerUnavailable - */ - protected function _connect($uri) - { - $ssl = array( - 'local_cert' => $this->_certificate, - ); - if ($this->_certificatePassphrase) { - $ssl['passphrase'] = $this->_certificatePassphrase; - } - - $this->_socket = stream_socket_client($uri, - $errno, - $errstr, - ini_get('default_socket_timeout'), - STREAM_CLIENT_CONNECT, - stream_context_create(array( - 'ssl' => $ssl, - )) - ); - - if (!is_resource($this->_socket)) { - throw new Zend_Mobile_Push_Exception_ServerUnavailable(sprintf('Unable to connect: %s: %d (%s)', - $uri, - $errno, - $errstr - )); - } - - stream_set_blocking($this->_socket, 0); - stream_set_write_buffer($this->_socket, 0); - return true; - } - - /** - * Read from the Socket Server - * - * @param int $length - * @return string - */ - protected function _read($length) { - $data = false; - if (!feof($this->_socket)) { - $data = fread($this->_socket, $length); - } - return $data; - } - - /** - * Write to the Socket Server - * - * @param string $payload - * @return int - */ - protected function _write($payload) { - return @fwrite($this->_socket, $payload); - } - - /** - * Connect to the Push Server - * - * @param int|string $env - * @throws Zend_Mobile_Push_Exception - * @throws Zend_Mobile_Push_Exception_ServerUnavailable - * @return Zend_Mobile_Push_Abstract - */ - public function connect($env = self::SERVER_PRODUCTION_URI) - { - if ($this->_isConnected) { - if ($this->_currentEnv == self::SERVER_PRODUCTION_URI) { - return $this; - } - $this->close(); - } - - if (!isset($this->_serverUriList[$env])) { - throw new Zend_Mobile_Push_Exception('$env is not a valid environment'); - } - - if (!$this->_certificate) { - throw new Zend_Mobile_Push_Exception('A certificate must be set prior to calling ::connect'); - } - - $this->_connect($this->_serverUriList[$env]); - - $this->_currentEnv = $env; - $this->_isConnected = true; - return $this; - } - - - - /** - * Feedback - * - * @return array array w/ key = token and value = time - * @throws Zend_Mobile_Push_Exception - * @throws Zend_Mobile_Push_Exception_ServerUnavailable - */ - public function feedback() - { - if (!$this->_isConnected || - !in_array($this->_currentEnv, - array(self::SERVER_FEEDBACK_SANDBOX_URI, self::SERVER_FEEDBACK_PRODUCTION_URI))) { - $this->connect(self::SERVER_FEEDBACK_PRODUCTION_URI); - } - - $tokens = array(); - while ($token = $this->_read(38)) { - if (strlen($token) < 38) { - continue; - } - $token = unpack('Ntime/ntokenLength/H*token', $token); - if (!isset($tokens[$token['token']]) || $tokens[$token['token']] < $token['time']) { - $tokens[$token['token']] = $token['time']; - } - } - return $tokens; - } - - /** - * Send Message - * - * @param Zend_Mobile_Push_Message_Abstract $message - * @throws Zend_Mobile_Push_Exception - * @throws Zend_Mobile_Push_Exception_InvalidPayload - * @throws Zend_Mobile_Push_Exception_InvalidToken - * @throws Zend_Mobile_Push_Exception_InvalidTopic - * @throws Zend_Mobile_Push_Exception_ServerUnavailable - * @return bool - */ - public function send(Zend_Mobile_Push_Message_Abstract $message) - { - if (!$message->validate()) { - throw new Zend_Mobile_Push_Exception('The message is not valid.'); - } - - if (!$this->_isConnected || !in_array($this->_currentEnv, array( - self::SERVER_SANDBOX_URI, - self::SERVER_PRODUCTION_URI))) { - $this->connect(self::SERVER_PRODUCTION_URI); - } - - $payload = array('aps' => array()); - - $alert = $message->getAlert(); - foreach ($alert as $k => $v) { - if ($v == null) { - unset($alert[$k]); - } - } - if (!empty($alert)) { - $payload['aps']['alert'] = $alert; - } - if (!is_null($message->getBadge())) { - $payload['aps']['badge'] = $message->getBadge(); - } - $sound = $message->getSound(); - if (!empty($sound)) { - $payload['aps']['sound'] = $sound; - } - - foreach($message->getCustomData() as $k => $v) { - $payload[$k] = $v; - } - - if (version_compare(PHP_VERSION, '5.4.0') >= 0) { - $payload = json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); - } else { - $payload = json_encode($payload); - } - - $expire = $message->getExpire(); - if ($expire > 0) { - $expire += time(); - } - $id = $message->getId(); - if (empty($id)) { - $id = time(); - } - - $payload = pack('CNNnH*', 1, $id, $expire, 32, $message->getToken()) - . pack('n', strlen($payload)) - . $payload; - $ret = $this->_write($payload); - if ($ret === false) { - throw new Zend_Mobile_Push_Exception_ServerUnavailable('Unable to send message'); - } - // check for errors from apple - $err = $this->_read(1024); - if (strlen($err) > 0) { - $err = unpack('Ccmd/Cerrno/Nid', $err); - switch ($err['errno']) { - case 0: - return true; - break; - case 1: - throw new Zend_Mobile_Push_Exception('A processing error has occurred on the apple push notification server.'); - break; - case 2: - throw new Zend_Mobile_Push_Exception_InvalidToken('Missing token; you must set a token for the message.'); - break; - case 3: - throw new Zend_Mobile_Push_Exception_InvalidTopic('Missing id; you must set an id for the message.'); - break; - case 4: - throw new Zend_Mobile_Push_Exception_InvalidPayload('Missing message; the message must always have some content.'); - break; - case 5: - throw new Zend_Mobile_Push_Exception_InvalidToken('Bad token. This token is too big and is not a regular apns token.'); - break; - case 6: - throw new Zend_Mobile_Push_Exception_InvalidTopic('The message id is too big; reduce the size of the id.'); - break; - case 7: - throw new Zend_Mobile_Push_Exception_InvalidPayload('The message is too big; reduce the size of the message.'); - break; - case 8: - throw new Zend_Mobile_Push_Exception_InvalidToken('Bad token. Remove this token from being sent to again.'); - break; - default: - throw new Zend_Mobile_Push_Exception(sprintf('An unknown error occurred: %d', $err['errno'])); - break; - } - } - return true; - } - - /** - * Close Connection - * - * @return void - */ - public function close() - { - if ($this->_isConnected && is_resource($this->_socket)) { - fclose($this->_socket); - } - $this->_isConnected = false; - } -} diff --git a/library/vendor/Zend/Mobile/Push/Exception.php b/library/vendor/Zend/Mobile/Push/Exception.php deleted file mode 100644 index ed48a7bea..000000000 --- a/library/vendor/Zend/Mobile/Push/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ -_apiKey; - } - - /** - * Set API Key - * - * @param string $key - * @return Zend_Mobile_Push_Gcm - * @throws Zend_Mobile_Push_Exception - */ - public function setApiKey($key) - { - if (!is_string($key) || empty($key)) { - throw new Zend_Mobile_Push_Exception('The api key must be a string and not empty'); - } - $this->_apiKey = $key; - return $this; - } - - /** - * Get Http Client - * - * @return Zend_Http_Client - */ - public function getHttpClient() - { - if (!$this->_httpClient) { - $this->_httpClient = new Zend_Http_Client(); - $this->_httpClient->setConfig(array( - 'strictredirects' => true, - )); - } - return $this->_httpClient; - } - - /** - * Set Http Client - * - * @return Zend_Mobile_Push_Gcm - */ - public function setHttpClient(Zend_Http_Client $client) - { - $this->_httpClient = $client; - return $this; - } - - /** - * Send Message - * - * @param Zend_Mobile_Push_Message_Abstract $message - * @throws Zend_Http_Client_Exception - * @throws Zend_Mobile_Push_Exception - * @throws Zend_Mobile_Push_Exception_InvalidAuthToken - * @throws Zend_Mobile_Push_Exception_InvalidPayload - * @throws Zend_Mobile_Push_Exception_ServerUnavailable - * @return Zend_Mobile_Push_Response_Gcm - */ - public function send(Zend_Mobile_Push_Message_Abstract $message) - { - if (!$message->validate()) { - throw new Zend_Mobile_Push_Exception('The message is not valid.'); - } - - $this->connect(); - - $client = $this->getHttpClient(); - $client->setUri(self::SERVER_URI); - $client->setHeaders('Authorization', 'key=' . $this->getApiKey()); - - $response = $client->setRawData($message->toJson(), 'application/json') - ->request('POST'); - $this->close(); - - switch ($response->getStatus()) - { - case 500: - throw new Zend_Mobile_Push_Exception_ServerUnavailable('The server encountered an internal error, try again'); - break; - case 503: - throw new Zend_Mobile_Push_Exception_ServerUnavailable('The server was unavailable, check Retry-After header'); - break; - case 401: - throw new Zend_Mobile_Push_Exception_InvalidAuthToken('There was an error authenticating the sender account'); - break; - case 400: - throw new Zend_Mobile_Push_Exception_InvalidPayload('The request could not be parsed as JSON or contains invalid fields'); - break; - } - return new Zend_Mobile_Push_Response_Gcm($response->getBody(), $message); - } -} diff --git a/library/vendor/Zend/Mobile/Push/Interface.php b/library/vendor/Zend/Mobile/Push/Interface.php deleted file mode 100644 index d8315e85d..000000000 --- a/library/vendor/Zend/Mobile/Push/Interface.php +++ /dev/null @@ -1,64 +0,0 @@ -_token; - } - - /** - * Set Token - * - * @param string $token - * @throws Zend_Mobile_Push_Message_Exception - * @return Zend_Mobile_Push_Message_Abstract - */ - public function setToken($token) - { - if (!is_string($token)) { - throw new Zend_Mobile_Push_Message_Exception('$token must be a string'); - } - $this->_token = $token; - return $this; - } - - /** - * Get Message ID - * - * @return int|string|float|bool Scalar - */ - public function getId() - { - return $this->_id; - } - - /** - * Set Message ID - * - * @param int|string|float|bool $id Scalar - * @return Zend_Mobile_Push_Message_Abstract - * @throws Exception - */ - public function setId($id) - { - if (!is_scalar($id)) { - throw new Zend_Mobile_Push_Message_Exception('$id must be a scalar'); - } - $this->_id = $id; - return $this; - } - - /** - * Set Options - * - * @param array $options - * @return Zend_Mobile_Push_Message_Abstract - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setOptions(array $options) - { - foreach ($options as $k => $v) { - $method = 'set' . ucwords($k); - if (!method_exists($this, $method)) { - throw new Zend_Mobile_Push_Message_Exception('The method "' . $method . "' does not exist."); - } - $this->$method($v); - } - return $this; - } - - - /** - * Validate Message format - * - * @return boolean - */ - public function validate() - { - return true; - } -} diff --git a/library/vendor/Zend/Mobile/Push/Message/Apns.php b/library/vendor/Zend/Mobile/Push/Message/Apns.php deleted file mode 100644 index 8cc4ac8f5..000000000 --- a/library/vendor/Zend/Mobile/Push/Message/Apns.php +++ /dev/null @@ -1,284 +0,0 @@ -_alert; - } - - /** - * Set Alert - * - * @param string $text - * @param string|null $actionLocKey - * @param string|null $locKey - * @param array|null $locArgs - * @param string|null $launchImage - * @throws Zend_Mobile_Push_Message_Exception - * @return Zend_Mobile_Push_Message_Apns - */ - public function setAlert($text, $actionLocKey=null, $locKey=null, $locArgs=null, $launchImage=null) - { - if ($text !== null && !is_string($text)) { - throw new Zend_Mobile_Push_Message_Exception('$text must be a string'); - } - - if ($actionLocKey !== null && !is_string($actionLocKey)) { - throw new Zend_Mobile_Push_Message_Exception('$actionLocKey must be a string'); - } - - if ($locKey !== null && !is_string($locKey)) { - throw new Zend_Mobile_Push_Message_Exception('$locKey must be a string'); - } - - if ($locArgs !== null) { - if (!is_array($locArgs)) { - throw new Zend_Mobile_Push_Message_Exception('$locArgs must be an array of strings'); - } else { - foreach ($locArgs as $str) { - if (!is_string($str)) { - throw new Zend_Mobile_Push_Message_Exception('$locArgs contains an item that is not a string'); - } - } - } - } - - if (null !== $launchImage && !is_string($launchImage)) { - throw new Zend_Mobile_Push_Message_Exception('$launchImage must be a string'); - } - - $this->_alert = array( - 'body' => $text, - 'action-loc-key' => $actionLocKey, - 'loc-key' => $locKey, - 'loc-args' => $locArgs, - 'launch-image' => $launchImage, - ); - return $this; - } - - /** - * Get Badge - * - * @return int - */ - public function getBadge() - { - return $this->_badge; - } - - /** - * Set Badge - * - * @param int $badge - * @return Zend_Mobile_Push_Message_Apns - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setBadge($badge) - { - if (!is_null($badge) && !is_numeric($badge)) { - throw new Zend_Mobile_Push_Message_Exception('$badge must be an integer'); - } - if (!is_null($badge) && $badge < 0) { - throw new Zend_Mobile_Push_Message_Exception('$badge must be greater or equal to 0'); - } - $this->_badge = $badge; - } - - /** - * Get Expire - * - * @return int - */ - public function getExpire() - { - return $this->_expire; - } - - /** - * Set Expire - * - * @param int $expire - * @return Zend_Mobile_Push_Message_Apns - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setExpire($expire) - { - if (!is_numeric($expire)) { - throw new Zend_Mobile_Push_Message_Exception('$expire must be an integer'); - } - $this->_expire = (int) $expire; - return $this; - } - - /** - * Get Sound - * - * @return string - */ - public function getSound() - { - return $this->_sound; - } - - /** - * Set Sound - * - * @param string $sound - * @return Zend_Mobile_Push_Message_Apns - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setSound($sound) - { - if (!is_string($sound)) { - throw new Zend_Mobile_Push_Message_Exception('$sound must be a string'); - } - $this->_sound = $sound; - return $this; - } - - /** - * Add Custom Data - * - * @param string $key - * @param mixed $value - * @return Zend_Mobile_Push_Message_Apns - * @throws Zend_Mobile_Push_Message_Exception - */ - public function addCustomData($key, $value) - { - if (!is_string($key)) { - throw new Zend_Mobile_Push_Message_Exception('$key is not a string'); - } - if ($key == 'aps') { - throw new Zend_Mobile_Push_Message_Exception('$key must not be aps as it is reserved by apple'); - } - $this->_custom[$key] = $value; - } - - /** - * Clear Custom Data - * - * @return throw new Zend_Mobile_Push_Message_Apns - */ - public function clearCustomData() - { - $this->_custom = array(); - return $this; - } - - /** - * Set Custom Data - * - * @param array $array - * @throws Zend_Mobile_Push_Message_Exception - * @return Zend_Mobile_Push_Message_Apns - */ - public function setCustomData($array) - { - $this->_custom = array(); - foreach ($array as $k => $v) { - $this->addCustomData($k, $v); - } - return $this; - } - - /** - * Get Custom Data - * - * @return array - */ - public function getCustomData() - { - return $this->_custom; - } - - /** - * Validate this is a proper Apns message - * - * @return boolean - */ - public function validate() - { - if (!is_string($this->_token) || strlen($this->_token) === 0) { - return false; - } - if (null != $this->_id && !is_numeric($this->_id)) { - return false; - } - return true; - } -} diff --git a/library/vendor/Zend/Mobile/Push/Message/Exception.php b/library/vendor/Zend/Mobile/Push/Message/Exception.php deleted file mode 100644 index e9527967c..000000000 --- a/library/vendor/Zend/Mobile/Push/Message/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ -_token)) { - $this->_token[] = $token; - } - return $this; - } - - /** - * Set Token - * - * @param string|array $token - * @return Zend_Mobile_Push_Message_Gcm - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setToken($token) - { - $this->clearToken(); - if (is_string($token)) { - $this->addToken($token); - } else if (is_array($token)) { - foreach ($token as $t) { - $this->addToken($t); - } - } - return $this; - } - - /** - * Clear Tokens - * - * @return Zend_Mobile_Push_Message_Gcm - */ - public function clearToken() - { - $this->_token = array(); - return $this; - } - - - /** - * Add Data - * - * @param string $key - * @param string $value - * @return Zend_Mobile_Push_Message_Gcm - * @throws Zend_Mobile_Push_Message_Exception - */ - public function addData($key, $value) - { - if (!is_string($key)) { - throw new Zend_Mobile_Push_Message_Exception('$key is not a string'); - } - if (!is_scalar($value)) { - throw new Zend_Mobile_Push_Message_Exception('$value is not a string'); - } - $this->_data[$key] = $value; - return $this; - } - - /** - * Set Data - * - * @param array $data - * @return Zend_Mobile_Push_Message_Gcm - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setData(array $data) - { - $this->clearData(); - foreach ($data as $k => $v) { - $this->addData($k, $v); - } - return $this; - } - - /** - * Clear Data - * - * @return Zend_Mobile_Push_Message_Gcm - */ - public function clearData() - { - $this->_data = array(); - return $this; - } - - /** - * Get Data - * - * @return array - */ - public function getData() - { - return $this->_data; - } - - /** - * Set Delay While Idle - * - * @param boolean $delay - * @return Zend_Mobile_Push_Message_Gcm - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setDelayWhileIdle($delay) - { - if (!is_bool($delay)) { - throw new Zend_Mobile_Push_Message_Exception('$delay must be boolean'); - } - $this->_delay = $delay; - return $this; - } - - /** - * Get Delay While Idle - * - * @return boolean - */ - public function getDelayWhileIdle() - { - return $this->_delay; - } - - /** - * Set time to live. - * - * @param int $secs - * @throws Zend_Mobile_Push_Message_Exception - * @return Zend_Mobile_Push_Message_Gcm - */ - public function setTtl($secs) - { - if (!is_numeric($secs)) { - throw new Zend_Mobile_Push_Message_Exception('$secs must be numeric'); - } - $this->_ttl = (int) $secs; - return $this; - } - - /** - * Get time to live - * - * @return int - */ - public function getTtl() - { - return $this->_ttl; - } - - /** - * Validate this is a proper Gcm message - * Does not validate size. - * - * @return boolean - */ - public function validate() - { - if (!is_array($this->_token) || empty($this->_token)) { - return false; - } - if ($this->_ttl !== 2419200 && - (!is_scalar($this->_id) || - strlen($this->_id) === 0)) { - return false; - } - return true; - } - - /** - * To Json utility method - * Takes the data and properly assigns it to - * a json encoded array to match the Gcm format. - * - * @return string - */ - public function toJson() - { - $json = array(); - if ($this->_token) { - $json['registration_ids'] = $this->_token; - } - if ($this->_id) { - $json['collapse_key'] = (string) $this->_id; - } - if ($this->_data) { - $json['data'] = $this->_data; - } - if ($this->_delay) { - $json['delay_while_idle'] = $this->_delay; - } - if ($this->_ttl !== 2419200) { - $json['time_to_live'] = $this->_ttl; - } - if (version_compare(PHP_VERSION, '5.4.0') >= 0) { - return json_encode($json, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); - } else { - return json_encode($json); - } - } -} diff --git a/library/vendor/Zend/Mobile/Push/Message/Interface.php b/library/vendor/Zend/Mobile/Push/Message/Interface.php deleted file mode 100644 index 27be3256a..000000000 --- a/library/vendor/Zend/Mobile/Push/Message/Interface.php +++ /dev/null @@ -1,79 +0,0 @@ -_token) || strlen($this->_token) === 0) { - return false; - } - return parent::validate(); - } -} diff --git a/library/vendor/Zend/Mobile/Push/Message/Mpns/Raw.php b/library/vendor/Zend/Mobile/Push/Message/Mpns/Raw.php deleted file mode 100644 index c18b3ee89..000000000 --- a/library/vendor/Zend/Mobile/Push/Message/Mpns/Raw.php +++ /dev/null @@ -1,150 +0,0 @@ -_delay) { - return self::DELAY_IMMEDIATE; - } - return $this->_delay; - } - - /** - * Set Delay - * - * @param int $delay - * @return Zend_Mobile_Push_Message_Mpns_Raw - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setDelay($delay) - { - if (!in_array($delay, array( - self::DELAY_IMMEDIATE, - self::DELAY_450S, - self::DELAY_900S - ))) { - throw new Zend_Mobile_Push_Message_Exception('$delay must be one of the DELAY_* constants'); - } - $this->_delay = $delay; - return $this; - } - - /** - * Set Message - * - * @param string $msg XML string - * @return Zend_Mobile_Push_Message_Mpns_Raw - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setMessage($msg) - { - if (!is_string($msg)) { - throw new Zend_Mobile_Push_Message_Exception('$msg is not a string'); - } - if (!Zend_Xml_Security::scan($msg)) { - throw new Zend_Mobile_Push_Message_Exception('$msg is not valid xml'); - } - $this->_msg = $msg; - return $this; - } - - /** - * Get Message - * - * @return string - */ - public function getMessage() - { - return $this->_msg; - } - - /** - * Get Notification Type - * - * @return string - */ - public static function getNotificationType() - { - return 'raw'; - } - - /** - * Get XML Payload - * - * @return string - */ - public function getXmlPayload() - { - return $this->_msg; - } - - /** - * Validate proper mpns message - * - * @return boolean - */ - public function validate() - { - if (!isset($this->_token) || strlen($this->_token) === 0) { - return false; - } - if (empty($this->_msg)) { - return false; - } - return parent::validate(); - } -} diff --git a/library/vendor/Zend/Mobile/Push/Message/Mpns/Tile.php b/library/vendor/Zend/Mobile/Push/Message/Mpns/Tile.php deleted file mode 100644 index 6d7b266e3..000000000 --- a/library/vendor/Zend/Mobile/Push/Message/Mpns/Tile.php +++ /dev/null @@ -1,364 +0,0 @@ -_backgroundImage; - } - - /** - * Set Background Image - * - * @param string $bgImg - * @return Zend_Mobile_Push_Message_Mpns_Tile - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setBackgroundImage($bgImg) - { - if (!is_string($bgImg)) { - throw new Zend_Mobile_Push_Message_Exception('$bgImg must be a string'); - } - $this->_backgroundImage = $bgImg; - return $this; - } - - /** - * Get Count - * - * @return int - */ - public function getCount() - { - return $this->_count; - } - - /** - * Set Count - * - * @param int $count - * @return Zend_Mobile_Push_Message_Mpns_Tile - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setCount($count) - { - if (!is_numeric($count)) { - throw new Zend_Mobile_Push_Message_Exception('$count is not numeric'); - } - $this->_count = (int) $count; - return $this; - } - - /** - * Get Title - * - * @return string - */ - public function getTitle() - { - return $this->_title; - } - - /** - * Set Title - * - * @param string $title - * @return Zend_Mobile_Push_Message_Mpns_Tile - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setTitle($title) - { - if (!is_string($title)) { - throw new Zend_Mobile_Push_Message_Exception('$title must be a string'); - } - $this->_title = $title; - return $this; - } - - /** - * Get Back Background Image - * - * @return string - */ - public function getBackBackgroundImage() - { - return $this->_backBackgroundImage; - } - - /** - * Set Back Background Image - * - * @param string $bgImg - * @return Zend_Mobile_Push_Message_Mpns_Tile - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setBackBackgroundImage($bgImg) - { - if (!is_string($bgImg)) { - throw new Zend_Mobile_Push_Message_Exception('$bgImg must be a string'); - } - $this->_backBackgroundImage = $bgImg; - return $this; - } - - /** - * Get Back Title - * - * @return string - */ - public function getBackTitle() - { - return $this->_backTitle; - } - - /** - * Set Back Title - * - * @param string $title - * @return Zend_Mobile_Push_Message_Mpns_Tile - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setBackTitle($title) - { - if (!is_string($title)) { - throw new Zend_Mobile_Push_Message_Exception('$title must be a string'); - } - $this->_backTitle = $title; - return $this; - } - - /** - * Get Back Content - * - * @return string - */ - public function getBackContent() - { - return $this->_backContent; - } - - /** - * Set Back Content - * - * @param string $content - * @return Zend_Mobile_Push_Message_Mpns_Tile - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setBackContent($content) - { - if (!is_string($content)) { - throw new Zend_Mobile_Push_Message_Exception('$content must be a string'); - } - $this->_backContent = $content; - } - - /** - * Get Tile Id - * - * @return string - */ - public function getTileId() - { - return $this->_tileId; - } - - /** - * Set Tile Id - * - * @param string $tileId - * @return Zend_Mobile_Push_Message_Mpns_Tile - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setTileId($tileId) - { - if (!is_string($tileId)) { - throw new Zend_Mobile_Push_Message_Exception('$tileId is not a string'); - } - $this->_tileId = $tileId; - return $this; - } - - /** - * Get Delay - * - * @return int - */ - public function getDelay() - { - if (!$this->_delay) { - return self::DELAY_IMMEDIATE; - } - return $this->_delay; - } - - /** - * Set Delay - * - * @param int $delay - * @return Zend_Mobile_Push_Message_Mpns_Tile - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setDelay($delay) - { - if (!in_array($delay, array( - self::DELAY_IMMEDIATE, - self::DELAY_450S, - self::DELAY_900S - ))) { - throw new Zend_Mobile_Push_Message_Exception('$delay must be one of the DELAY_* constants'); - } - $this->_delay = $delay; - return $this; - } - - /** - * Get Notification Type - * - * @return string - */ - public static function getNotificationType() - { - return 'token'; - } - - /** - * Get XML Payload - * - * @return string - */ - public function getXmlPayload() - { - $ret = '' - . '' - . '_tileId) ? ' Id="' . htmlspecialchars($this->_tileId) . '"' : '') . '>' - . '' . htmlspecialchars($this->_backgroundImage) . '' - . '' . (int) $this->_count . '' - . '' . htmlspecialchars($this->_title) . ''; - - if ($this->_backBackgroundImage) { - $ret .= '' . htmlspecialchars($this->_backBackgroundImage) . ''; - } - if ($this->_backTitle) { - $ret .= '' . htmlspecialchars($this->_backTitle) . ''; - } - if ($this->_backContent) { - $ret .= '' . htmlspecialchars($this->_backContent) . ''; - } - - $ret .= '' - . ''; - return $ret; - } - - /** - * Validate proper mpns message - * - * @return boolean - */ - public function validate() - { - if (!isset($this->_token) || strlen($this->_token) === 0) { - return false; - } - if (empty($this->_backgroundImage)) { - return false; - } - if (empty($this->_title)) { - return false; - } - return parent::validate(); - } -} diff --git a/library/vendor/Zend/Mobile/Push/Message/Mpns/Toast.php b/library/vendor/Zend/Mobile/Push/Message/Mpns/Toast.php deleted file mode 100644 index ee9f96ec2..000000000 --- a/library/vendor/Zend/Mobile/Push/Message/Mpns/Toast.php +++ /dev/null @@ -1,224 +0,0 @@ -_title; - } - - /** - * Set Title - * - * @param string $title - * @return Zend_Mobile_Push_Message_Mpns_Toast - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setTitle($title) - { - if (!is_string($title)) { - throw new Zend_Mobile_Push_Message_Exception('$title must be a string'); - } - $this->_title = $title; - return $this; - } - - /** - * Get Message - * - * @return string - */ - public function getMessage() - { - return $this->_msg; - } - - /** - * Set Message - * - * @param string $msg - * @return Zend_Mobile_Push_Message_Mpns_Toast - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setMessage($msg) - { - if (!is_string($msg)) { - throw new Zend_Mobile_Push_Message_Exception('$msg must be a string'); - } - $this->_msg = $msg; - return $this; - } - - /** - * Get Params - * - * @return string - */ - public function getParams() - { - return $this->_params; - } - - /** - * Set Params - * - * @param string $params - * @return Zend_Mobile_Push_Message_Mpns_Toast - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setParams($params) - { - if (!is_string($params)) { - throw new Zend_Mobile_Push_Message_Exception('$params must be a string'); - } - $this->_params = $params; - return $this; - } - - /** - * Get Delay - * - * @return int - */ - public function getDelay() - { - if (!$this->_delay) { - return self::DELAY_IMMEDIATE; - } - return $this->_delay; - } - - /** - * Set Delay - * - * @param int $delay - * @return Zend_Mobile_Push_Message_Mpns_Toast - * @throws Zend_Mobile_Push_Message_Exception - */ - public function setDelay($delay) - { - if (!in_array($delay, array( - self::DELAY_IMMEDIATE, - self::DELAY_450S, - self::DELAY_900S - ))) { - throw new Zend_Mobile_Push_Message_Exception('$delay must be one of the DELAY_* constants'); - } - $this->_delay = $delay; - return $this; - } - - /** - * Get Notification Type - * - * @return string - */ - public static function getNotificationType() - { - return 'toast'; - } - - /** - * Get XML Payload - * - * @return string - */ - public function getXmlPayload() - { - $ret = '' - . '' - . '' - . '' . htmlspecialchars($this->_title) . '' - . '' . htmlspecialchars($this->_msg) . ''; - if (!empty($this->_params)) { - $ret .= '' . htmlspecialchars($this->_params) . ''; - } - $ret .= '' - . ''; - return $ret; - } - - /** - * Validate proper mpns message - * - * @return boolean - */ - public function validate() - { - if (!isset($this->_token) || strlen($this->_token) === 0) { - return false; - } - if (empty($this->_title)) { - return false; - } - if (empty($this->_msg)) { - return false; - } - return parent::validate(); - } -} diff --git a/library/vendor/Zend/Mobile/Push/Mpns.php b/library/vendor/Zend/Mobile/Push/Mpns.php deleted file mode 100644 index 2fdb92e9d..000000000 --- a/library/vendor/Zend/Mobile/Push/Mpns.php +++ /dev/null @@ -1,148 +0,0 @@ -_httpClient) { - $this->_httpClient = new Zend_Http_Client(); - $this->_httpClient->setConfig(array( - 'strictredirects' => true, - )); - } - return $this->_httpClient; - } - - /** - * Set Http Client - * - * @return Zend_Mobile_Push_Mpns - */ - public function setHttpClient(Zend_Http_Client $client) - { - $this->_httpClient = $client; - return $this; - } - - /** - * Send Message - * - * @param Zend_Mobile_Push_Message_Abstract $message - * @throws Zend_Http_Client_Exception - * @throws Zend_Mobile_Push_Exception - * @throws Zend_Mobile_Push_Exception_DeviceQuotaExceeded - * @throws Zend_Mobile_Push_Exception_InvalidPayload - * @throws Zend_Mobile_Push_Exception_InvalidToken - * @throws Zend_Mobile_Push_Exception_QuotaExceeded - * @throws Zend_Mobile_Push_Exception_ServerUnavailable - * @return boolean - */ - public function send(Zend_Mobile_Push_Message_Abstract $message) - { - if (!$message->validate()) { - throw new Zend_Mobile_Push_Exception('The message is not valid.'); - } - - $this->connect(); - - $client = $this->getHttpClient(); - $client->setUri($message->getToken()); - $client->setHeaders(array( - 'Context-Type' => 'text/xml', - 'Accept' => 'application/*', - 'X-NotificationClass' => $message->getDelay() - )); - if ($message->getId()) { - $client->setHeaders('X-MessageID', $message->getId()); - } - if ($message->getNotificationType() != Zend_Mobile_Push_Message_Mpns::TYPE_RAW) { - $client->setHeaders('X-WindowsPhone-Target', $message->getNotificationType()); - } - $client->setRawData($message->getXmlPayload(), 'text/xml'); - $response = $client->request('POST'); - $this->close(); - - - switch ($response->getStatus()) - { - case 200: - // check headers for response? need to test how this actually works to correctly handle different states. - if ($response->getHeader('NotificationStatus') == 'QueueFull') { - throw new Zend_Mobile_Push_Exception_DeviceQuotaExceeded('The devices push notification queue is full, use exponential backoff'); - } - break; - case 400: - throw new Zend_Mobile_Push_Exception_InvalidPayload('The message xml was invalid'); - break; - case 401: - throw new Zend_Mobile_Push_Exception_InvalidToken('The device token is not valid or there is a mismatch between certificates'); - break; - case 404: - throw new Zend_Mobile_Push_Exception_InvalidToken('The device subscription is invalid, stop sending notifications to this device'); - break; - case 405: - throw new Zend_Mobile_Push_Exception('Invalid method, only POST is allowed'); // will never be hit unless overwritten - break; - case 406: - throw new Zend_Mobile_Push_Exception_QuotaExceeded('The unauthenticated web service has reached the per-day throttling limit'); - break; - case 412: - throw new Zend_Mobile_Push_Exception_InvalidToken('The device is in an inactive state. You may retry once per hour'); - break; - case 503: - throw new Zend_Mobile_Push_Exception_ServerUnavailable('The server was unavailable.'); - break; - default: - break; - } - return true; - } -} diff --git a/library/vendor/Zend/Mobile/Push/Response/Gcm.php b/library/vendor/Zend/Mobile/Push/Response/Gcm.php deleted file mode 100644 index 7a7445a7b..000000000 --- a/library/vendor/Zend/Mobile/Push/Response/Gcm.php +++ /dev/null @@ -1,242 +0,0 @@ -setResponse($response); - } - - if ($message) { - $this->setMessage($message); - } - - } - - /** - * Get Message - * - * @return Zend_Mobile_Push_Message_Gcm - */ - public function getMessage() - { - return $this->_message; - } - - /** - * Set Message - * - * @param Zend_Mobile_Push_Message_Gcm $message - * @return Zend_Mobile_Push_Response_Gcm - */ - public function setMessage(Zend_Mobile_Push_Message_Gcm $message) - { - $this->_message = $message; - return $this; - } - - /** - * Get Response - * - * @return array - */ - public function getResponse() - { - return $this->_response; - } - - /** - * Set Response - * - * @param array $response - * @throws Zend_Mobile_Push_Exception - * @return Zend_Mobile_Push_Response_Gcm - */ - public function setResponse(array $response) - { - if (!isset($response['results']) || - !isset($response['success']) || - !isset($response['failure']) || - !isset($response['canonical_ids']) || - !isset($response['multicast_id'])) { - throw new Zend_Mobile_Push_Exception('Response did not contain the proper fields'); - } - $this->_response = $response; - $this->_results = $response['results']; - $this->_successCnt = (int) $response['success']; - $this->_failureCnt = (int) $response['failure']; - $this->_canonicalCnt = (int) $response['canonical_ids']; - $this->_id = (int) $response['multicast_id']; - return $this; - } - - /** - * Get Success Count - * - * @return int - */ - public function getSuccessCount() - { - return $this->_successCnt; - } - - /** - * Get Failure Count - * - * @return int - */ - public function getFailureCount() - { - return $this->_failureCnt; - } - - /** - * Get Canonical Count - * - * @return int - */ - public function getCanonicalCount() - { - return $this->_canonicalCnt; - } - - /** - * Get Results - * - * @return array multi dimensional array of: - * NOTE: key is registration_id if the message is passed. - * 'registration_id' => array( - * 'message_id' => 'id', - * 'error' => 'error', - * 'registration_id' => 'id' - * ) - */ - public function getResults() - { - return $this->_correlate(); - } - - /** - * Get Singular Result - * - * @param int $flag one of the RESULT_* flags - * @return array singular array with keys being registration id - * value is the type of result - */ - public function getResult($flag) - { - $ret = array(); - foreach ($this->_correlate() as $k => $v) { - if (isset($v[$flag])) { - $ret[$k] = $v[$flag]; - } - } - return $ret; - } - - /** - * Correlate Message and Result - * - * @return array - */ - protected function _correlate() - { - $results = $this->_results; - if ($this->_message && $results) { - $tokens = $this->_message->getToken(); - while($token = array_shift($tokens)) { - $results[$token] = array_shift($results); - } - } - return $results; - } -} diff --git a/library/vendor/Zend/Mobile/Push/Test/ApnsProxy.php b/library/vendor/Zend/Mobile/Push/Test/ApnsProxy.php deleted file mode 100644 index ba889695e..000000000 --- a/library/vendor/Zend/Mobile/Push/Test/ApnsProxy.php +++ /dev/null @@ -1,101 +0,0 @@ -_readResponse = $str; - } - - /** - * Set the write response - * - * @param mixed $resp - * @return void - */ - public function setWriteResponse($resp) - { - $this->_writeResponse = $resp; - } - - /** - * Connect - * - * @return true - */ - protected function _connect($uri) { - return true; - } - - /** - * Return Response - * - * @param string $length - * @return string - */ - protected function _read($length) { - $ret = substr($this->_readResponse, 0, $length); - $this->_readResponse = null; - return $ret; - } - - /** - * Write and Return Length - * - * @param string $payload - * @return int - */ - protected function _write($payload) { - $ret = $this->_writeResponse; - $this->_writeResponse = null; - return (null === $ret) ? strlen($payload) : $ret; - } -} diff --git a/library/vendor/Zend/Navigation.php b/library/vendor/Zend/Navigation.php deleted file mode 100644 index 434fc74e1..000000000 --- a/library/vendor/Zend/Navigation.php +++ /dev/null @@ -1,52 +0,0 @@ -addPages($pages); - } elseif (null !== $pages) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $pages must be an array, an ' . - 'instance of Zend_Config, or null'); - } - } -} diff --git a/library/vendor/Zend/Navigation/Container.php b/library/vendor/Zend/Navigation/Container.php deleted file mode 100644 index 0b6c012af..000000000 --- a/library/vendor/Zend/Navigation/Container.php +++ /dev/null @@ -1,617 +0,0 @@ -_dirtyIndex) { - $newIndex = array(); - $index = 0; - - foreach ($this->_pages as $hash => $page) { - $order = $page->getOrder(); - if ($order === null) { - $newIndex[$hash] = $index; - $index++; - } else { - $newIndex[$hash] = $order; - } - } - - asort($newIndex); - $this->_index = $newIndex; - $this->_dirtyIndex = false; - } - } - - // Public methods: - - /** - * Notifies container that the order of pages are updated - * - * @return void - */ - public function notifyOrderUpdated() - { - $this->_dirtyIndex = true; - } - - /** - * Adds a page to the container - * - * This method will inject the container as the given page's parent by - * calling {@link Zend_Navigation_Page::setParent()}. - * - * @param Zend_Navigation_Page|array|Zend_Config $page page to add - * @return Zend_Navigation_Container fluent interface, - * returns self - * @throws Zend_Navigation_Exception if page is invalid - */ - public function addPage($page) - { - if ($page === $this) { - throw new Zend_Navigation_Exception( - 'A page cannot have itself as a parent'); - } - - if (is_array($page) || $page instanceof Zend_Config) { - $page = Zend_Navigation_Page::factory($page); - } elseif (!$page instanceof Zend_Navigation_Page) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $page must be an instance of ' . - 'Zend_Navigation_Page or Zend_Config, or an array'); - } - - $hash = $page->hashCode(); - - if (array_key_exists($hash, $this->_index)) { - // page is already in container - return $this; - } - - // adds page to container and sets dirty flag - $this->_pages[$hash] = $page; - $this->_index[$hash] = $page->getOrder(); - $this->_dirtyIndex = true; - - // inject self as page parent - $page->setParent($this); - - return $this; - } - - /** - * Adds several pages at once - * - * @param Zend_Navigation_Page[]|Zend_Config|Zend_Navigation_Container $pages pages to add - * @return Zend_Navigation_Container fluent interface, - * returns self - * @throws Zend_Navigation_Exception if $pages is not - * array, Zend_Config or - * Zend_Navigation_Container - */ - public function addPages($pages) - { - if ($pages instanceof Zend_Config) { - $pages = $pages->toArray(); - } - - if ($pages instanceof Zend_Navigation_Container) { - $pages = iterator_to_array($pages); - } - - if (!is_array($pages)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $pages must be an array, an ' . - 'instance of Zend_Config or an instance of ' . - 'Zend_Navigation_Container'); - } - - foreach ($pages as $page) { - $this->addPage($page); - } - - return $this; - } - - /** - * Sets pages this container should have, removing existing pages - * - * @param Zend_Navigation_Page[] $pages pages to set - * @return Zend_Navigation_Container fluent interface, returns self - */ - public function setPages(array $pages) - { - $this->removePages(); - return $this->addPages($pages); - } - - /** - * Returns pages in the container - * - * @return Zend_Navigation_Page[] array of Zend_Navigation_Page instances - */ - public function getPages() - { - return $this->_pages; - } - - /** - * Removes the given page from the container - * - * @param Zend_Navigation_Page|int $page page to remove, either a page - * instance or a specific page order - * @param bool $recursive [optional] whether to remove recursively - * @return bool whether the removal was successful - */ - public function removePage($page, $recursive = false) - { - if ($page instanceof Zend_Navigation_Page) { - $hash = $page->hashCode(); - } elseif (is_int($page)) { - $this->_sort(); - if (!$hash = array_search($page, $this->_index)) { - return false; - } - } else { - return false; - } - - if (isset($this->_pages[$hash])) { - unset($this->_pages[$hash]); - unset($this->_index[$hash]); - $this->_dirtyIndex = true; - return true; - } - - if ($recursive) { - /** @var Zend_Navigation_Page $childPage */ - foreach ($this->_pages as $childPage) { - if ($childPage->hasPage($page, true)) { - $childPage->removePage($page, true); - return true; - } - } - } - - return false; - } - - /** - * Removes all pages in container - * - * @return Zend_Navigation_Container fluent interface, returns self - */ - public function removePages() - { - $this->_pages = array(); - $this->_index = array(); - return $this; - } - - /** - * Checks if the container has the given page - * - * @param Zend_Navigation_Page $page page to look for - * @param bool $recursive [optional] whether to search - * recursively. Default is false. - * @return bool whether page is in container - */ - public function hasPage(Zend_Navigation_Page $page, $recursive = false) - { - if (array_key_exists($page->hashCode(), $this->_index)) { - return true; - } elseif ($recursive) { - foreach ($this->_pages as $childPage) { - if ($childPage->hasPage($page, true)) { - return true; - } - } - } - - return false; - } - - /** - * Returns true if container contains any pages - * - * @return bool whether container has any pages - */ - public function hasPages() - { - return count($this->_index) > 0; - } - - /** - * Returns a child page matching $property == $value or - * preg_match($value, $property), or null if not found - * - * @param string $property name of property to match against - * @param mixed $value value to match property against - * @param bool $useRegex [optional] if true PHP's preg_match - * is used. Default is false. - * @return Zend_Navigation_Page|null matching page or null - */ - public function findOneBy($property, $value, $useRegex = false) - { - $iterator = new RecursiveIteratorIterator( - $this, - RecursiveIteratorIterator::SELF_FIRST - ); - - foreach ($iterator as $page) { - $pageProperty = $page->get($property); - - // Rel and rev - if (is_array($pageProperty)) { - foreach ($pageProperty as $item) { - if (is_array($item)) { - // Use regex? - if (true === $useRegex) { - foreach ($item as $item2) { - if (0 !== preg_match($value, $item2)) { - return $page; - } - } - } else { - if (in_array($value, $item)) { - return $page; - } - } - } else { - // Use regex? - if (true === $useRegex) { - if (0 !== preg_match($value, $item)) { - return $page; - } - } else { - if ($item == $value) { - return $page; - } - } - } - } - - continue; - } - - // Use regex? - if (true === $useRegex) { - if (preg_match($value, $pageProperty)) { - return $page; - } - } else { - if ($pageProperty == $value) { - return $page; - } - } - } - - return null; - } - - /** - * Returns all child pages matching $property == $value or - * preg_match($value, $property), or an empty array if no pages are found - * - * @param string $property name of property to match against - * @param mixed $value value to match property against - * @param bool $useRegex [optional] if true PHP's preg_match is used. - * Default is false. - * @return Zend_Navigation_Page[] array containing only Zend_Navigation_Page - * instances - */ - public function findAllBy($property, $value, $useRegex = false) - { - $found = array(); - - $iterator = new RecursiveIteratorIterator( - $this, - RecursiveIteratorIterator::SELF_FIRST - ); - - foreach ($iterator as $page) { - $pageProperty = $page->get($property); - - // Rel and rev - if (is_array($pageProperty)) { - foreach ($pageProperty as $item) { - if (is_array($item)) { - // Use regex? - if (true === $useRegex) { - foreach ($item as $item2) { - if (0 !== preg_match($value, $item2)) { - $found[] = $page; - } - } - } else { - if (in_array($value, $item)) { - $found[] = $page; - } - } - } else { - // Use regex? - if (true === $useRegex) { - if (0 !== preg_match($value, $item)) { - $found[] = $page; - } - } else { - if ($item == $value) { - $found[] = $page; - } - } - } - } - - continue; - } - - // Use regex? - if (true === $useRegex) { - if (0 !== preg_match($value, $pageProperty)) { - $found[] = $page; - } - } else { - if ($pageProperty == $value) { - $found[] = $page; - } - } - } - - return $found; - } - - /** - * Returns page(s) matching $property == $value or - * preg_match($value, $property) - * - * @param string $property name of property to match against - * @param mixed $value value to match property against - * @param bool $all [optional] whether an array of all matching - * pages should be returned, or only the first. - * If true, an array will be returned, even if not - * matching pages are found. If false, null will - * be returned if no matching page is found. - * Default is false. - * @param bool $useRegex [optional] if true PHP's preg_match is used. - * Default is false. - * @return Zend_Navigation_Page|null matching page or null - */ - public function findBy($property, $value, $all = false, $useRegex = false) - { - if ($all) { - return $this->findAllBy($property, $value, $useRegex); - } else { - return $this->findOneBy($property, $value, $useRegex); - } - } - - /** - * Magic overload: Proxy calls to finder methods - * - * Examples of finder calls: - * - * // METHOD // SAME AS - * $nav->findByLabel('foo'); // $nav->findOneBy('label', 'foo'); - * $nav->findByLabel('/foo/', true); // $nav->findBy('label', '/foo/', true); - * $nav->findOneByLabel('foo'); // $nav->findOneBy('label', 'foo'); - * $nav->findAllByClass('foo'); // $nav->findAllBy('class', 'foo'); - * - * - * @param string $method method name - * @param array $arguments method arguments - * @return mixed Zend_Navigation|array|null matching page, array of pages - * or null - * @throws Zend_Navigation_Exception if method does not exist - */ - public function __call($method, $arguments) - { - if (@preg_match('/(find(?:One|All)?By)(.+)/', $method, $match)) { - return $this->{$match[1]}($match[2], $arguments[0], !empty($arguments[1])); - } - - throw new Zend_Navigation_Exception( - sprintf( - 'Bad method call: Unknown method %s::%s', - get_class($this), - $method - ) - ); - } - - /** - * Returns an array representation of all pages in container - * - * @return Zend_Navigation_Page[] - */ - public function toArray() - { - $pages = array(); - - $this->_dirtyIndex = true; - $this->_sort(); - $indexes = array_keys($this->_index); - foreach ($indexes as $hash) { - $pages[] = $this->_pages[$hash]->toArray(); - } - return $pages; - } - - // RecursiveIterator interface: - - /** - * Returns current page - * - * Implements RecursiveIterator interface. - * - * @return Zend_Navigation_Page current page or null - * @throws Zend_Navigation_Exception if the index is invalid - */ - public function current() - { - $this->_sort(); - current($this->_index); - $hash = key($this->_index); - - if (isset($this->_pages[$hash])) { - return $this->_pages[$hash]; - } else { - throw new Zend_Navigation_Exception( - 'Corruption detected in container; ' . - 'invalid key found in internal iterator'); - } - } - - /** - * Returns hash code of current page - * - * Implements RecursiveIterator interface. - * - * @return string hash code of current page - */ - public function key() - { - $this->_sort(); - return key($this->_index); - } - - /** - * Moves index pointer to next page in the container - * - * Implements RecursiveIterator interface. - * - * @return void - */ - public function next() - { - $this->_sort(); - next($this->_index); - } - - /** - * Sets index pointer to first page in the container - * - * Implements RecursiveIterator interface. - * - * @return void - */ - public function rewind() - { - $this->_sort(); - reset($this->_index); - } - - /** - * Checks if container index is valid - * - * Implements RecursiveIterator interface. - * - * @return bool - */ - public function valid() - { - $this->_sort(); - return current($this->_index) !== false; - } - - /** - * Proxy to hasPages() - * - * Implements RecursiveIterator interface. - * - * @return bool whether container has any pages - */ - public function hasChildren() - { - return $this->hasPages(); - } - - /** - * Returns the child container. - * - * Implements RecursiveIterator interface. - * - * @return Zend_Navigation_Page|null - */ - public function getChildren() - { - $hash = key($this->_index); - - if (isset($this->_pages[$hash])) { - return $this->_pages[$hash]; - } - - return null; - } - - // Countable interface: - - /** - * Returns number of pages in container - * - * Implements Countable interface. - * - * @return int number of pages in the container - */ - public function count() - { - return count($this->_index); - } -} diff --git a/library/vendor/Zend/Navigation/Exception.php b/library/vendor/Zend/Navigation/Exception.php deleted file mode 100644 index 7715b88d4..000000000 --- a/library/vendor/Zend/Navigation/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ -toArray(); - } - - if (!is_array($options)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $options must be an array or Zend_Config'); - } - - if (isset($options['type'])) { - $type = $options['type']; - } elseif(self::getDefaultPageType()!= null) { - $type = self::getDefaultPageType(); - } - - if(isset($type)) { - if (is_string($type) && !empty($type)) { - switch (strtolower($type)) { - case 'mvc': - $type = 'Zend_Navigation_Page_Mvc'; - break; - case 'uri': - $type = 'Zend_Navigation_Page_Uri'; - break; - } - - if (!class_exists($type)) { - @Zend_Loader::loadClass($type); - } - - $page = new $type($options); - if (!$page instanceof Zend_Navigation_Page) { - throw new Zend_Navigation_Exception(sprintf( - 'Invalid argument: Detected type "%s", which ' . - 'is not an instance of Zend_Navigation_Page', - $type)); - } - return $page; - } - } - - $hasUri = isset($options['uri']); - $hasMvc = isset($options['action']) || isset($options['controller']) || - isset($options['module']) || isset($options['route']) || - isset($options['params']); - - if ($hasMvc) { - return new Zend_Navigation_Page_Mvc($options); - } elseif ($hasUri) { - return new Zend_Navigation_Page_Uri($options); - } else { - - $message = 'Invalid argument: Unable to determine class to instantiate'; - if (isset($options['label'])) { - $message .= ' (Page label: ' . $options['label'] . ')'; - } - - throw new Zend_Navigation_Exception($message); - } - } - - /** - * Page constructor - * - * @param array|Zend_Config $options [optional] page options. Default is - * null, which should set defaults. - * @throws Zend_Navigation_Exception if invalid options are given - */ - public function __construct($options = null) - { - if (is_array($options)) { - $this->setOptions($options); - } elseif ($options instanceof Zend_Config) { - $this->setConfig($options); - } - - // do custom initialization - $this->_init(); - } - - /** - * Initializes page (used by subclasses) - * - * @return void - */ - protected function _init() - { - } - - /** - * Sets page properties using a Zend_Config object - * - * @param Zend_Config $config config object to get properties from - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if invalid options are given - */ - public function setConfig(Zend_Config $config) - { - return $this->setOptions($config->toArray()); - } - - /** - * Sets page properties using options from an associative array - * - * Each key in the array corresponds to the according set*() method, and - * each word is separated by underscores, e.g. the option 'target' - * corresponds to setTarget(), and the option 'reset_params' corresponds to - * the method setResetParams(). - * - * @param array $options associative array of options to set - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if invalid options are given - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - $this->set($key, $value); - } - - return $this; - } - - // Accessors: - - /** - * Sets page label - * - * @param string $label new page label - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if empty/no string is given - */ - public function setLabel($label) - { - if (null !== $label && !is_string($label)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $label must be a string or null'); - } - - $this->_label = $label; - return $this; - } - - /** - * Returns page label - * - * @return string page label or null - */ - public function getLabel() - { - return $this->_label; - } - - /** - * Sets a fragment identifier - * - * @param string $fragment new fragment identifier - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if empty/no string is given - */ - public function setFragment($fragment) - { - if (null !== $fragment && !is_string($fragment)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $fragment must be a string or null'); - } - - $this->_fragment = $fragment; - return $this; - } - - /** - * Returns fragment identifier - * - * @return string|null fragment identifier - */ - public function getFragment() - { - return $this->_fragment; - } - - /** - * Sets page id - * - * @param string|null $id [optional] id to set. Default is null, - * which sets no id. - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if not given string or null - */ - public function setId($id = null) - { - if (null !== $id && !is_string($id) && !is_numeric($id)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $id must be a string, number or null'); - } - - $this->_id = null === $id ? $id : (string) $id; - - return $this; - } - - /** - * Returns page id - * - * @return string|null page id or null - */ - public function getId() - { - return $this->_id; - } - - /** - * Sets page CSS class - * - * @param string|null $class [optional] CSS class to set. Default - * is null, which sets no CSS class. - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if not given string or null - */ - public function setClass($class = null) - { - if (null !== $class && !is_string($class)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $class must be a string or null'); - } - - $this->_class = $class; - return $this; - } - - /** - * Returns page class (CSS) - * - * @return string|null page's CSS class or null - */ - public function getClass() - { - return $this->_class; - } - - /** - * Sets page title - * - * @param string $title [optional] page title. Default is - * null, which sets no title. - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if not given string or null - */ - public function setTitle($title = null) - { - if (null !== $title && !is_string($title)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $title must be a non-empty string'); - } - - $this->_title = $title; - return $this; - } - - /** - * Returns page title - * - * @return string|null page title or null - */ - public function getTitle() - { - return $this->_title; - } - - /** - * Sets page target - * - * @param string|null $target [optional] target to set. Default is - * null, which sets no target. - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if target is not string or null - */ - public function setTarget($target = null) - { - if (null !== $target && !is_string($target)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $target must be a string or null'); - } - - $this->_target = $target; - return $this; - } - - /** - * Returns page target - * - * @return string|null page target or null - */ - public function getTarget() - { - return $this->_target; - } - - /** - * Sets access key for this page - * - * @param string|null $character [optional] access key to set. Default - * is null, which sets no access key. - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if access key is not string or null or - * if the string length not equal to one - */ - public function setAccesskey($character = null) - { - if (null !== $character - && (!is_string($character) || 1 != strlen($character))) - { - throw new Zend_Navigation_Exception( - 'Invalid argument: $character must be a single character or null' - ); - } - - $this->_accesskey = $character; - return $this; - } - - /** - * Returns page access key - * - * @return string|null page access key or null - */ - public function getAccesskey() - { - return $this->_accesskey; - } - - /** - * Sets the page's forward links to other pages - * - * This method expects an associative array of forward links to other pages, - * where each element's key is the name of the relation (e.g. alternate, - * prev, next, help, etc), and the value is a mixed value that could somehow - * be considered a page. - * - * @param array|Zend_Config $relations [optional] an associative array of - * forward links to other pages - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function setRel($relations = null) - { - $this->_rel = array(); - - if (null !== $relations) { - if ($relations instanceof Zend_Config) { - $relations = $relations->toArray(); - } - - if (!is_array($relations)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $relations must be an ' . - 'array or an instance of Zend_Config'); - } - - foreach ($relations as $name => $relation) { - if (is_string($name)) { - $this->_rel[$name] = $relation; - } - } - } - - return $this; - } - - /** - * Returns the page's forward links to other pages - * - * This method returns an associative array of forward links to other pages, - * where each element's key is the name of the relation (e.g. alternate, - * prev, next, help, etc), and the value is a mixed value that could somehow - * be considered a page. - * - * @param string $relation [optional] name of relation to return. If not - * given, all relations will be returned. - * @return array an array of relations. If $relation is not - * specified, all relations will be returned in - * an associative array. - */ - public function getRel($relation = null) - { - if (null !== $relation) { - return isset($this->_rel[$relation]) ? - $this->_rel[$relation] : - null; - } - - return $this->_rel; - } - - /** - * Sets the page's reverse links to other pages - * - * This method expects an associative array of reverse links to other pages, - * where each element's key is the name of the relation (e.g. alternate, - * prev, next, help, etc), and the value is a mixed value that could somehow - * be considered a page. - * - * @param array|Zend_Config $relations [optional] an associative array of - * reverse links to other pages - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function setRev($relations = null) - { - $this->_rev = array(); - - if (null !== $relations) { - if ($relations instanceof Zend_Config) { - $relations = $relations->toArray(); - } - - if (!is_array($relations)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $relations must be an ' . - 'array or an instance of Zend_Config'); - } - - foreach ($relations as $name => $relation) { - if (is_string($name)) { - $this->_rev[$name] = $relation; - } - } - } - - return $this; - } - - /** - * Returns the page's reverse links to other pages - * - * This method returns an associative array of forward links to other pages, - * where each element's key is the name of the relation (e.g. alternate, - * prev, next, help, etc), and the value is a mixed value that could somehow - * be considered a page. - * - * @param string $relation [optional] name of relation to return. If not - * given, all relations will be returned. - * @return array an array of relations. If $relation is not - * specified, all relations will be returned in - * an associative array. - */ - public function getRev($relation = null) - { - if (null !== $relation) { - return isset($this->_rev[$relation]) ? - $this->_rev[$relation] : - null; - } - - return $this->_rev; - } - - /** - * Sets a single custom HTML attribute - * - * @param string $name name of the HTML attribute - * @param string|null $value value for the HTML attribute - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if name is not string or value is - * not null or a string - */ - public function setCustomHtmlAttrib($name, $value) - { - if (!is_string($name)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $name must be a string' - ); - } - - if (null !== $value && !is_string($value)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $value must be a string or null' - ); - } - - if (null === $value && isset($this->_customHtmlAttribs[$name])) { - unset($this->_customHtmlAttribs[$name]); - } else { - $this->_customHtmlAttribs[$name] = $value; - } - - return $this; - } - - /** - * Returns a single custom HTML attributes by name - * - * @param string $name name of the HTML attribute - * @return string|null value for the HTML attribute or null - * @throws Zend_Navigation_Exception if name is not string - */ - public function getCustomHtmlAttrib($name) - { - if (!is_string($name)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $name must be a string' - ); - } - - if (isset($this->_customHtmlAttribs[$name])) { - return $this->_customHtmlAttribs[$name]; - } - - return null; - } - - /** - * Sets multiple custom HTML attributes at once - * - * @param array $attribs an associative array of html attributes - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function setCustomHtmlAttribs(array $attribs) - { - foreach ($attribs as $key => $value) { - $this->setCustomHtmlAttrib($key, $value); - } - return $this; - } - - /** - * Returns all custom HTML attributes as an array - * - * @return array an array containing custom HTML attributes - */ - public function getCustomHtmlAttribs() - { - return $this->_customHtmlAttribs; - } - - /** - * Removes a custom HTML attribute from the page - * - * @param string $name name of the custom HTML attribute - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function removeCustomHtmlAttrib($name) - { - if (!is_string($name)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $name must be a string' - ); - } - - if (isset($this->_customHtmlAttribs[$name])) { - unset($this->_customHtmlAttribs[$name]); - } - } - - /** - * Clear all custom HTML attributes - * - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function clearCustomHtmlAttribs() - { - $this->_customHtmlAttribs = array(); - - return $this; - } - - /** - * Sets page order to use in parent container - * - * @param int $order [optional] page order in container. - * Default is null, which sets no - * specific order. - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if order is not integer or null - */ - public function setOrder($order = null) - { - if (is_string($order)) { - $temp = (int) $order; - if ($temp < 0 || $temp > 0 || $order == '0') { - $order = $temp; - } - } - - if (null !== $order && !is_int($order)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $order must be an integer or null, ' . - 'or a string that casts to an integer'); - } - - $this->_order = $order; - - // notify parent, if any - if (isset($this->_parent)) { - $this->_parent->notifyOrderUpdated(); - } - - return $this; - } - - /** - * Returns page order used in parent container - * - * @return int|null page order or null - */ - public function getOrder() - { - return $this->_order; - } - - /** - * Sets ACL resource assoicated with this page - * - * @param string|Zend_Acl_Resource_Interface $resource [optional] resource - * to associate with - * page. Default is - * null, which sets no - * resource. - * @throws Zend_Navigation_Exception if $resource if - * invalid - * @return Zend_Navigation_Page fluent interface, - * returns self - */ - public function setResource($resource = null) - { - if (null === $resource || is_string($resource) || - $resource instanceof Zend_Acl_Resource_Interface) { - $this->_resource = $resource; - } else { - throw new Zend_Navigation_Exception( - 'Invalid argument: $resource must be null, a string, ' . - ' or an instance of Zend_Acl_Resource_Interface'); - } - - return $this; - } - - /** - * Returns ACL resource assoicated with this page - * - * @return string|Zend_Acl_Resource_Interface|null ACL resource or null - */ - public function getResource() - { - return $this->_resource; - } - - /** - * Sets ACL privilege associated with this page - * - * @param string|null $privilege [optional] ACL privilege to associate - * with this page. Default is null, which - * sets no privilege. - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function setPrivilege($privilege = null) - { - $this->_privilege = is_string($privilege) ? $privilege : null; - return $this; - } - - /** - * Returns ACL privilege associated with this page - * - * @return string|null ACL privilege or null - */ - public function getPrivilege() - { - return $this->_privilege; - } - - /** - * Sets whether page should be considered active or not - * - * @param bool $active [optional] whether page should be - * considered active or not. Default is true. - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function setActive($active = true) - { - $this->_active = (bool) $active; - return $this; - } - - /** - * Returns whether page should be considered active or not - * - * @param bool $recursive [optional] whether page should be considered - * active if any child pages are active. Default is - * false. - * @return bool whether page should be considered active - */ - public function isActive($recursive = false) - { - if (!$this->_active && $recursive) { - foreach ($this->_pages as $page) { - if ($page->isActive(true)) { - return true; - } - } - return false; - } - - return $this->_active; - } - - /** - * Proxy to isActive() - * - * @param bool $recursive [optional] whether page should be considered - * active if any child pages are active. Default - * is false. - * @return bool whether page should be considered active - */ - public function getActive($recursive = false) - { - return $this->isActive($recursive); - } - - /** - * Sets whether the page should be visible or not - * - * @param bool $visible [optional] whether page should be - * considered visible or not. Default is true. - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function setVisible($visible = true) - { - if (is_string($visible) && 'false' == strtolower($visible)) { - $visible = false; - } - $this->_visible = (bool) $visible; - return $this; - } - - /** - * Returns a boolean value indicating whether the page is visible - * - * @param bool $recursive [optional] whether page should be considered - * invisible if parent is invisible. Default is - * false. - * @return bool whether page should be considered visible - */ - public function isVisible($recursive = false) - { - if ($recursive && isset($this->_parent) && - $this->_parent instanceof Zend_Navigation_Page) { - if (!$this->_parent->isVisible(true)) { - return false; - } - } - - return $this->_visible; - } - - /** - * Proxy to isVisible() - * - * Returns a boolean value indicating whether the page is visible - * - * @param bool $recursive [optional] whether page should be considered - * invisible if parent is invisible. Default is - * false. - * @return bool whether page should be considered visible - */ - public function getVisible($recursive = false) - { - return $this->isVisible($recursive); - } - - /** - * Sets parent container - * - * @param Zend_Navigation_Container $parent [optional] new parent to set. - * Default is null which will set - * no parent. - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function setParent(Zend_Navigation_Container $parent = null) - { - if ($parent === $this) { - throw new Zend_Navigation_Exception( - 'A page cannot have itself as a parent'); - } - - // return if the given parent already is parent - if ($parent === $this->_parent) { - return $this; - } - - // remove from old parent - if (null !== $this->_parent) { - $this->_parent->removePage($this); - } - - // set new parent - $this->_parent = $parent; - - // add to parent if page and not already a child - if (null !== $this->_parent && !$this->_parent->hasPage($this, false)) { - $this->_parent->addPage($this); - } - - return $this; - } - - /** - * Returns parent container - * - * @return Zend_Navigation_Container|null parent container or null - */ - public function getParent() - { - return $this->_parent; - } - - /** - * Sets the given property - * - * If the given property is native (id, class, title, etc), the matching - * set method will be used. Otherwise, it will be set as a custom property. - * - * @param string $property property name - * @param mixed $value value to set - * @return Zend_Navigation_Page fluent interface, returns self - * @throws Zend_Navigation_Exception if property name is invalid - */ - public function set($property, $value) - { - if (!is_string($property) || empty($property)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $property must be a non-empty string'); - } - - $method = 'set' . self::_normalizePropertyName($property); - - if ($method != 'setOptions' && $method != 'setConfig' && - method_exists($this, $method)) { - $this->$method($value); - } else { - $this->_properties[$property] = $value; - } - - return $this; - } - - /** - * Returns the value of the given property - * - * If the given property is native (id, class, title, etc), the matching - * get method will be used. Otherwise, it will return the matching custom - * property, or null if not found. - * - * @param string $property property name - * @return mixed the property's value or null - * @throws Zend_Navigation_Exception if property name is invalid - */ - public function get($property) - { - if (!is_string($property) || empty($property)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $property must be a non-empty string'); - } - - $method = 'get' . self::_normalizePropertyName($property); - - if (method_exists($this, $method)) { - return $this->$method(); - } elseif (isset($this->_properties[$property])) { - return $this->_properties[$property]; - } - - return null; - } - - // Magic overloads: - - /** - * Sets a custom property - * - * Magic overload for enabling $page->propname = $value. - * - * @param string $name property name - * @param mixed $value value to set - * @return void - * @throws Zend_Navigation_Exception if property name is invalid - */ - public function __set($name, $value) - { - $this->set($name, $value); - } - - /** - * Returns a property, or null if it doesn't exist - * - * Magic overload for enabling $page->propname. - * - * @param string $name property name - * @return mixed property value or null - * @throws Zend_Navigation_Exception if property name is invalid - */ - public function __get($name) - { - return $this->get($name); - } - - /** - * Checks if a property is set - * - * Magic overload for enabling isset($page->propname). - * - * Returns true if the property is native (id, class, title, etc), and - * true or false if it's a custom property (depending on whether the - * property actually is set). - * - * @param string $name property name - * @return bool whether the given property exists - */ - public function __isset($name) - { - $method = 'get' . self::_normalizePropertyName($name); - if (method_exists($this, $method)) { - return true; - } - - return isset($this->_properties[$name]); - } - - /** - * Unsets the given custom property - * - * Magic overload for enabling unset($page->propname). - * - * @param string $name property name - * @return void - * @throws Zend_Navigation_Exception if the property is native - */ - public function __unset($name) - { - $method = 'set' . self::_normalizePropertyName($name); - if (method_exists($this, $method)) { - throw new Zend_Navigation_Exception(sprintf( - 'Unsetting native property "%s" is not allowed', - $name)); - } - - if (isset($this->_properties[$name])) { - unset($this->_properties[$name]); - } - } - - /** - * Returns page label - * - * Magic overload for enabling echo $page. - * - * @return string page label - */ - public function __toString() - { - return $this->_label; - } - - // Public methods: - - /** - * Adds a forward relation to the page - * - * @param string $relation relation name (e.g. alternate, glossary, - * canonical, etc) - * @param mixed $value value to set for relation - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function addRel($relation, $value) - { - if (is_string($relation)) { - $this->_rel[$relation] = $value; - } - return $this; - } - - /** - * Adds a reverse relation to the page - * - * @param string $relation relation name (e.g. alternate, glossary, - * canonical, etc) - * @param mixed $value value to set for relation - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function addRev($relation, $value) - { - if (is_string($relation)) { - $this->_rev[$relation] = $value; - } - return $this; - } - - /** - * Removes a forward relation from the page - * - * @param string $relation name of relation to remove - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function removeRel($relation) - { - if (isset($this->_rel[$relation])) { - unset($this->_rel[$relation]); - } - - return $this; - } - - /** - * Removes a reverse relation from the page - * - * @param string $relation name of relation to remove - * @return Zend_Navigation_Page fluent interface, returns self - */ - public function removeRev($relation) - { - if (isset($this->_rev[$relation])) { - unset($this->_rev[$relation]); - } - - return $this; - } - - /** - * Returns an array containing the defined forward relations - * - * @return array defined forward relations - */ - public function getDefinedRel() - { - return array_keys($this->_rel); - } - - /** - * Returns an array containing the defined reverse relations - * - * @return array defined reverse relations - */ - public function getDefinedRev() - { - return array_keys($this->_rev); - } - - /** - * Returns custom properties as an array - * - * @return array an array containing custom properties - */ - public function getCustomProperties() - { - return $this->_properties; - } - - /** - * Returns a hash code value for the page - * - * @return string a hash code value for this page - */ - public final function hashCode() - { - return spl_object_hash($this); - } - - /** - * Returns an array representation of the page - * - * @return array associative array containing all page properties - */ - public function toArray() - { - return array_merge( - $this->getCustomProperties(), - array( - 'label' => $this->getlabel(), - 'fragment' => $this->getFragment(), - 'id' => $this->getId(), - 'class' => $this->getClass(), - 'title' => $this->getTitle(), - 'target' => $this->getTarget(), - 'accesskey' => $this->getAccesskey(), - 'rel' => $this->getRel(), - 'rev' => $this->getRev(), - 'customHtmlAttribs' => $this->getCustomHtmlAttribs(), - 'order' => $this->getOrder(), - 'resource' => $this->getResource(), - 'privilege' => $this->getPrivilege(), - 'active' => $this->isActive(), - 'visible' => $this->isVisible(), - 'type' => get_class($this), - 'pages' => parent::toArray() - ) - ); - } - - // Internal methods: - - /** - * Normalizes a property name - * - * @param string $property property name to normalize - * @return string normalized property name - */ - protected static function _normalizePropertyName($property) - { - return str_replace(' ', '', ucwords(str_replace('_', ' ', $property))); - } - - public static function setDefaultPageType($type = null) { - if($type !== null && !is_string($type)) { - throw new Zend_Navigation_Exception( - 'Cannot set default page type: type is no string but should be' - ); - } - - self::$_defaultPageType = $type; - } - - public static function getDefaultPageType() { - return self::$_defaultPageType; - } - - // Abstract methods: - - /** - * Returns href for this page - * - * @return string the page's href - */ - abstract public function getHref(); -} diff --git a/library/vendor/Zend/Navigation/Page/Mvc.php b/library/vendor/Zend/Navigation/Page/Mvc.php deleted file mode 100644 index 965a5ce8e..000000000 --- a/library/vendor/Zend/Navigation/Page/Mvc.php +++ /dev/null @@ -1,687 +0,0 @@ -_active) { - $front = Zend_Controller_Front::getInstance(); - $request = $front->getRequest(); - $reqParams = array(); - if ($request) { - $reqParams = $request->getParams(); - if (!array_key_exists('module', $reqParams)) { - $reqParams['module'] = $front->getDefaultModule(); - } - } - - $myParams = $this->_params; - - if ($this->_route - && method_exists($front->getRouter(), 'getRoute') - ) { - $route = $front->getRouter()->getRoute($this->_route); - if (method_exists($route, 'getDefaults')) { - $myParams = array_merge($route->getDefaults(), $myParams); - } - } - - if (null !== $this->_module) { - $myParams['module'] = $this->_module; - } elseif (!array_key_exists('module', $myParams)) { - $myParams['module'] = $front->getDefaultModule(); - } - - if (null !== $this->_controller) { - $myParams['controller'] = $this->_controller; - } elseif (!array_key_exists('controller', $myParams)) { - $myParams['controller'] = $front->getDefaultControllerName(); - } - - if (null !== $this->_action) { - $myParams['action'] = $this->_action; - } elseif (!array_key_exists('action', $myParams)) { - $myParams['action'] = $front->getDefaultAction(); - } - - foreach ($myParams as $key => $value) { - if (null === $value) { - unset($myParams[$key]); - } - } - - if (count(array_intersect_assoc($reqParams, $myParams)) == - count($myParams) - ) { - $this->_active = true; - - return true; - } - - $this->_active = false; - } - - return parent::isActive($recursive); - } - - /** - * Returns href for this page - * - * This method uses {@link Zend_Controller_Action_Helper_Url} to assemble - * the href based on the page's properties. - * - * @return string page href - */ - public function getHref() - { - if ($this->_hrefCache) { - return $this->_hrefCache; - } - - if (null === self::$_urlHelper) { - self::$_urlHelper = - Zend_Controller_Action_HelperBroker::getStaticHelper('Url'); - } - - $params = $this->getParams(); - - if ($param = $this->getModule()) { - $params['module'] = $param; - } - - if ($param = $this->getController()) { - $params['controller'] = $param; - } - - if ($param = $this->getAction()) { - $params['action'] = $param; - } - - $url = self::$_urlHelper->url( - $params, - $this->getRoute(), - $this->getResetParams(), - $this->getEncodeUrl() - ); - - // Use scheme? - $scheme = $this->getScheme(); - if (null !== $scheme) { - if (null === self::$_schemeHelper) { - self::$_schemeHelper = new Zend_View_Helper_ServerUrl(); - } - - $url = self::$_schemeHelper->setScheme($scheme)->serverUrl($url); - } - - // Add the fragment identifier if it is set - $fragment = $this->getFragment(); - if (null !== $fragment) { - $url .= '#' . $fragment; - } - - return $this->_hrefCache = $url; - } - - /** - * Sets action name to use when assembling URL - * - * @see getHref() - * - * @param string $action action name - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - * @throws Zend_Navigation_Exception if invalid $action is given - */ - public function setAction($action) - { - if (null !== $action && !is_string($action)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $action must be a string or null' - ); - } - - $this->_action = $action; - $this->_hrefCache = null; - - return $this; - } - - /** - * Returns action name to use when assembling URL - * - * @see getHref() - * - * @return string|null action name - */ - public function getAction() - { - return $this->_action; - } - - /** - * Sets controller name to use when assembling URL - * - * @see getHref() - * - * @param string|null $controller controller name - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - * @throws Zend_Navigation_Exception if invalid controller name is given - */ - public function setController($controller) - { - if (null !== $controller && !is_string($controller)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $controller must be a string or null' - ); - } - - $this->_controller = $controller; - $this->_hrefCache = null; - - return $this; - } - - /** - * Returns controller name to use when assembling URL - * - * @see getHref() - * - * @return string|null controller name or null - */ - public function getController() - { - return $this->_controller; - } - - /** - * Sets module name to use when assembling URL - * - * @see getHref() - * - * @param string|null $module module name - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - * @throws Zend_Navigation_Exception if invalid module name is given - */ - public function setModule($module) - { - if (null !== $module && !is_string($module)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $module must be a string or null' - ); - } - - $this->_module = $module; - $this->_hrefCache = null; - - return $this; - } - - /** - * Returns module name to use when assembling URL - * - * @see getHref() - * - * @return string|null module name or null - */ - public function getModule() - { - return $this->_module; - } - - /** - * Set multiple parameters (to use when assembling URL) at once - * - * URL options passed to the url action helper for assembling URLs. - * Overwrites any previously set parameters! - * - * @see getHref() - * - * @param array|null $params [optional] paramters as array - * ('name' => 'value'). Default is null - * which clears all params. - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - */ - public function setParams(array $params = null) - { - $this->clearParams(); - - if (is_array($params)) { - $this->addParams($params); - } - - return $this; - } - - /** - * Set parameter (to use when assembling URL) - * - * URL option passed to the url action helper for assembling URLs. - * - * @see getHref() - * - * @param string $name parameter name - * @param mixed $value parameter value - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - */ - public function setParam($name, $value) - { - $name = (string)$name; - $this->_params[$name] = $value; - - $this->_hrefCache = null; - - return $this; - } - - /** - * Add multiple parameters (to use when assembling URL) at once - * - * URL options passed to the url action helper for assembling URLs. - * - * @see getHref() - * - * @param array $params paramters as array ('name' => 'value') - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - */ - public function addParams(array $params) - { - foreach ($params as $name => $value) { - $this->setParam($name, $value); - } - - return $this; - } - - /** - * Remove parameter (to use when assembling URL) - * - * @see getHref() - * - * @param string $name - * @return bool - */ - public function removeParam($name) - { - if (array_key_exists($name, $this->_params)) { - unset($this->_params[$name]); - - $this->_hrefCache = null; - return true; - } - - return false; - } - - /** - * Clear all parameters (to use when assembling URL) - * - * @see getHref() - * - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - */ - public function clearParams() - { - $this->_params = array(); - - $this->_hrefCache = null; - return $this; - } - - /** - * Retrieve all parameters (to use when assembling URL) - * - * @see getHref() - * - * @return array parameters as array ('name' => 'value') - */ - public function getParams() - { - return $this->_params; - } - - /** - * Retrieve a single parameter (to use when assembling URL) - * - * @see getHref() - * - * @param string $name parameter name - * @return mixed - */ - public function getParam($name) - { - $name = (string) $name; - - if (!array_key_exists($name, $this->_params)) { - return null; - } - - return $this->_params[$name]; - } - - /** - * Sets route name to use when assembling URL - * - * @see getHref() - * - * @param string $route route name to use when assembling URL - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - * @throws Zend_Navigation_Exception if invalid $route is given - */ - public function setRoute($route) - { - if (null !== $route && (!is_string($route) || strlen($route) < 1)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $route must be a non-empty string or null' - ); - } - - $this->_route = $route; - $this->_hrefCache = null; - - return $this; - } - - /** - * Returns route name to use when assembling URL - * - * @see getHref() - * - * @return string route name - */ - public function getRoute() - { - return $this->_route; - } - - /** - * Sets whether params should be reset when assembling URL - * - * @see getHref() - * - * @param bool $resetParams whether params should be reset when - * assembling URL - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - */ - public function setResetParams($resetParams) - { - $this->_resetParams = (bool) $resetParams; - $this->_hrefCache = null; - - return $this; - } - - /** - * Returns whether params should be reset when assembling URL - * - * @see getHref() - * - * @return bool whether params should be reset when assembling URL - */ - public function getResetParams() - { - return $this->_resetParams; - } - - /** - * Sets whether href should be encoded when assembling URL - * - * @see getHref() - * - * @param $encodeUrl - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - */ - public function setEncodeUrl($encodeUrl) - { - $this->_encodeUrl = (bool) $encodeUrl; - $this->_hrefCache = null; - - return $this; - } - - /** - * Returns whether herf should be encoded when assembling URL - * - * @see getHref() - * - * @return bool whether herf should be encoded when assembling URL - */ - public function getEncodeUrl() - { - return $this->_encodeUrl; - } - - /** - * Sets scheme to use when assembling URL - * - * @see getHref() - * - * @param string|null $scheme scheme - * @throws Zend_Navigation_Exception - * @return Zend_Navigation_Page_Mvc fluent interface, returns self - */ - public function setScheme($scheme) - { - if (null !== $scheme && !is_string($scheme)) { - throw new Zend_Navigation_Exception( - 'Invalid argument: $scheme must be a string or null' - ); - } - - $this->_scheme = $scheme; - return $this; - } - - /** - * Returns scheme to use when assembling URL - * - * @see getHref() - * - * @return string|null scheme or null - */ - public function getScheme() - { - return $this->_scheme; - } - - /** - * Sets action helper for assembling URLs - * - * @see getHref() - * - * @param Zend_Controller_Action_Helper_Url $uh URL helper - * @return void - */ - public static function setUrlHelper(Zend_Controller_Action_Helper_Url $uh) - { - self::$_urlHelper = $uh; - } - - /** - * Sets view helper for assembling URLs with schemes - * - * @see getHref() - * - * @param Zend_View_Helper_ServerUrl $sh scheme helper - * @return void - */ - public static function setSchemeHelper(Zend_View_Helper_ServerUrl $sh) - { - self::$_schemeHelper = $sh; - } - - // Public methods: - - /** - * Returns an array representation of the page - * - * @return array associative array containing all page properties - */ - public function toArray() - { - return array_merge( - parent::toArray(), - array( - 'action' => $this->getAction(), - 'controller' => $this->getController(), - 'module' => $this->getModule(), - 'params' => $this->getParams(), - 'route' => $this->getRoute(), - 'reset_params' => $this->getResetParams(), - 'encodeUrl' => $this->getEncodeUrl(), - 'scheme' => $this->getScheme(), - ) - ); - } -} diff --git a/library/vendor/Zend/Navigation/Page/Uri.php b/library/vendor/Zend/Navigation/Page/Uri.php deleted file mode 100644 index 4cc1d4683..000000000 --- a/library/vendor/Zend/Navigation/Page/Uri.php +++ /dev/null @@ -1,109 +0,0 @@ -_uri = $uri; - return $this; - } - - /** - * Returns URI - * - * @return string - */ - public function getUri() - { - return $this->_uri; - } - - /** - * Returns href for this page - * - * @return string - */ - public function getHref() - { - $uri = $this->getUri(); - - $fragment = $this->getFragment(); - if (null !== $fragment) { - if ('#' == substr($uri, -1)) { - return $uri . $fragment; - } else { - return $uri . '#' . $fragment; - } - } - - return $uri; - } - - // Public methods: - - /** - * Returns an array representation of the page - * - * @return array - */ - public function toArray() - { - return array_merge( - parent::toArray(), - array( - 'uri' => $this->getUri() - )); - } -} diff --git a/library/vendor/Zend/Oauth.php b/library/vendor/Zend/Oauth.php deleted file mode 100644 index c8028a7b2..000000000 --- a/library/vendor/Zend/Oauth.php +++ /dev/null @@ -1,89 +0,0 @@ -setHeaders('Authorization', null); - self::$httpClient->resetParameters(); - } - return self::$httpClient; - } - - /** - * Simple mechanism to delete the entire singleton HTTP Client instance - * which forces an new instantiation for subsequent requests. - * - * @return void - */ - public static function clearHttpClient() - { - self::$httpClient = null; - } -} diff --git a/library/vendor/Zend/Oauth/Client.php b/library/vendor/Zend/Oauth/Client.php deleted file mode 100644 index 5d47cdbdc..000000000 --- a/library/vendor/Zend/Oauth/Client.php +++ /dev/null @@ -1,322 +0,0 @@ -rfc3986_strict)) { - $config = $config->toArray(); - $config['rfc3986_strict'] = true; - } else if (null === $config || - (is_array($config) && !isset($config['rfc3986_strict']))) { - $config['rfc3986_strict'] = true; - } - parent::__construct($uri, $config); - $this->_config = new Zend_Oauth_Config; - if ($oauthOptions !== null) { - if ($oauthOptions instanceof Zend_Config) { - $oauthOptions = $oauthOptions->toArray(); - } - $this->_config->setOptions($oauthOptions); - } - } - - /** - * Load the connection adapter - * - * @param Zend_Http_Client_Adapter_Interface $adapter - * @return void - */ - public function setAdapter($adapter) - { - if ($adapter == null) { - $this->adapter = $adapter; - } else { - parent::setAdapter($adapter); - } - } - - /** - * Set the streamingRequest variable which controls whether we are - * sending the raw (already encoded) POST data from a stream source. - * - * @param boolean $value The value to set. - * @return void - */ - public function setStreamingRequest($value) - { - $this->_streamingRequest = $value; - } - - /** - * Check whether the client is set to perform streaming requests. - * - * @return boolean True if yes, false otherwise. - */ - public function getStreamingRequest() - { - if ($this->_streamingRequest) { - return true; - } else { - return false; - } - } - - /** - * Prepare the request body (for POST and PUT requests) - * - * @return string - * @throws Zend_Http_Client_Exception - */ - protected function _prepareBody() - { - if($this->_streamingRequest) { - $this->setHeaders(self::CONTENT_LENGTH, - $this->raw_post_data->getTotalSize()); - return $this->raw_post_data; - } - else { - return parent::_prepareBody(); - } - } - - /** - * Clear all custom parameters we set. - * - * @return Zend_Http_Client - */ - public function resetParameters($clearAll = false) - { - $this->_streamingRequest = false; - return parent::resetParameters($clearAll); - } - - /** - * Set the raw (already encoded) POST data from a stream source. - * - * This is used to support POSTing from open file handles without - * caching the entire body into memory. It is a wrapper around - * Zend_Http_Client::setRawData(). - * - * @param string $data The request data - * @param string $enctype The encoding type - * @return Zend_Http_Client - */ - public function setRawDataStream($data, $enctype = null) - { - $this->_streamingRequest = true; - return $this->setRawData($data, $enctype); - } - - /** - * Same as Zend_Http_Client::setMethod() except it also creates an - * Oauth specific reference to the method type. - * Might be defunct and removed in a later iteration. - * - * @param string $method - * @return Zend_Http_Client - */ - public function setMethod($method = self::GET) - { - if ($method == self::GET) { - $this->setRequestMethod(self::GET); - } elseif($method == self::POST) { - $this->setRequestMethod(self::POST); - } elseif($method == self::PUT) { - $this->setRequestMethod(self::PUT); - } elseif($method == self::DELETE) { - $this->setRequestMethod(self::DELETE); - } elseif($method == self::HEAD) { - $this->setRequestMethod(self::HEAD); - } elseif($method == self::OPTIONS) { - $this->setRequestMethod(self::OPTIONS); - } - return parent::setMethod($method); - } - - /** - * Same as Zend_Http_Client::request() except just before the request is - * executed, we automatically append any necessary OAuth parameters and - * sign the request using the relevant signature method. - * - * @param string $method - * @return Zend_Http_Response - */ - public function request($method = null) - { - if ($method !== null) { - $this->setMethod($method); - } - $this->prepareOauth(); - return parent::request(); - } - - /** - * Performs OAuth preparation on the request before sending. - * - * This primarily means taking a request, correctly encoding and signing - * all parameters, and applying the correct OAuth scheme to the method - * being used. - * - * @return void - * @throws Zend_Oauth_Exception If POSTBODY scheme requested, but GET request method used; or if invalid request scheme provided - */ - public function prepareOauth() - { - $requestScheme = $this->getRequestScheme(); - $requestMethod = $this->getRequestMethod(); - $query = null; - if ($requestScheme == Zend_Oauth::REQUEST_SCHEME_HEADER) { - $oauthHeaderValue = $this->getToken()->toHeader( - $this->getUri(true), - $this->_config, - $this->_getSignableParametersAsQueryString(), - $this->getRealm() - ); - $this->setHeaders('Authorization', $oauthHeaderValue); - } elseif ($requestScheme == Zend_Oauth::REQUEST_SCHEME_POSTBODY) { - if ($requestMethod == self::GET) { - throw new Zend_Oauth_Exception( - 'The client is configured to' - . ' pass OAuth parameters through a POST body but request method' - . ' is set to GET' - ); - } - $raw = $this->getToken()->toQueryString( - $this->getUri(true), - $this->_config, - $this->_getSignableParametersAsQueryString() - ); - $this->setRawData($raw, 'application/x-www-form-urlencoded'); - $this->paramsPost = array(); - } elseif ($requestScheme == Zend_Oauth::REQUEST_SCHEME_QUERYSTRING) { - $params = $this->paramsGet; - $query = $this->getUri()->getQuery(); - if ($query) { - $queryParts = explode('&', $this->getUri()->getQuery()); - foreach ($queryParts as $queryPart) { - $kvTuple = explode('=', $queryPart); - $params[urldecode($kvTuple[0])] = - (array_key_exists(1, $kvTuple) ? urldecode($kvTuple[1]) : null); - } - } - if (!empty($this->paramsPost)) { - $params = array_merge($params, $this->paramsPost); - $query = $this->getToken()->toQueryString( - $this->getUri(true), $this->_config, $params - ); - } - $query = $this->getToken()->toQueryString( - $this->getUri(true), $this->_config, $params - ); - $this->getUri()->setQuery($query); - $this->paramsGet = array(); - } else { - throw new Zend_Oauth_Exception('Invalid request scheme: ' . $requestScheme); - } - } - - /** - * Collect all signable parameters into a single array across query string - * and POST body. Don't include POST parameters if content type is multipart POST. - * - * @return array - */ - protected function _getSignableParametersAsQueryString() - { - $params = array(); - if (!empty($this->paramsGet)) { - $params = array_merge($params, $this->paramsGet); - } - if ($this->enctype != self::ENC_FORMDATA && !empty($this->paramsPost)) { - $params = array_merge($params, $this->paramsPost); - } - return $params; - } - - /** - * Simple Proxy to the current Zend_Oauth_Config method. It's that instance - * which holds all configuration methods and values this object also presents - * as it's API. - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Oauth_Exception if method does not exist in config object - */ - public function __call($method, array $args) - { - if (!method_exists($this->_config, $method)) { - throw new Zend_Oauth_Exception('Method does not exist: ' . $method); - } - return call_user_func_array(array($this->_config,$method), $args); - } -} diff --git a/library/vendor/Zend/Oauth/Config.php b/library/vendor/Zend/Oauth/Config.php deleted file mode 100644 index 2abb69668..000000000 --- a/library/vendor/Zend/Oauth/Config.php +++ /dev/null @@ -1,679 +0,0 @@ -toArray(); - } - $this->setOptions($options); - } - } - - /** - * Parse option array or Zend_Config instance and setup options using their - * relevant mutators. - * - * @param array|Zend_Config $options - * @return Zend_Oauth_Config - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - switch ($key) { - case 'consumerKey': - $this->setConsumerKey($value); - break; - case 'consumerSecret': - $this->setConsumerSecret($value); - break; - case 'signatureMethod': - $this->setSignatureMethod($value); - break; - case 'version': - $this->setVersion($value); - break; - case 'callbackUrl': - $this->setCallbackUrl($value); - break; - case 'siteUrl': - $this->setSiteUrl($value); - break; - case 'requestTokenUrl': - $this->setRequestTokenUrl($value); - break; - case 'accessTokenUrl': - $this->setAccessTokenUrl($value); - break; - case 'userAuthorizationUrl': - $this->setUserAuthorizationUrl($value); - break; - case 'authorizeUrl': - $this->setAuthorizeUrl($value); - break; - case 'requestMethod': - $this->setRequestMethod($value); - break; - case 'rsaPrivateKey': - $this->setRsaPrivateKey($value); - break; - case 'rsaPublicKey': - $this->setRsaPublicKey($value); - break; - case 'realm': - $this->setRealm($value); - break; - } - } - if (isset($options['requestScheme'])) { - $this->setRequestScheme($options['requestScheme']); - } - - return $this; - } - - /** - * Set consumer key - * - * @param string $key - * @return Zend_Oauth_Config - */ - public function setConsumerKey($key) - { - $this->_consumerKey = $key; - return $this; - } - - /** - * Get consumer key - * - * @return string - */ - public function getConsumerKey() - { - return $this->_consumerKey; - } - - /** - * Set consumer secret - * - * @param string $secret - * @return Zend_Oauth_Config - */ - public function setConsumerSecret($secret) - { - $this->_consumerSecret = $secret; - return $this; - } - - /** - * Get consumer secret - * - * Returns RSA private key if set; otherwise, returns any previously set - * consumer secret. - * - * @return string - */ - public function getConsumerSecret() - { - if ($this->_rsaPrivateKey !== null) { - return $this->_rsaPrivateKey; - } - return $this->_consumerSecret; - } - - /** - * Set signature method - * - * @param string $method - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception if unsupported signature method specified - */ - public function setSignatureMethod($method) - { - $method = strtoupper($method); - if (!in_array($method, array( - 'HMAC-SHA1', 'HMAC-SHA256', 'RSA-SHA1', 'PLAINTEXT' - )) - ) { - throw new Zend_Oauth_Exception('Unsupported signature method: ' - . $method - . '. Supported are HMAC-SHA1, RSA-SHA1, PLAINTEXT and HMAC-SHA256'); - } - $this->_signatureMethod = $method;; - return $this; - } - - /** - * Get signature method - * - * @return string - */ - public function getSignatureMethod() - { - return $this->_signatureMethod; - } - - /** - * Set request scheme - * - * @param string $scheme - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception if invalid scheme specified, or if POSTBODY set when request method of GET is specified - */ - public function setRequestScheme($scheme) - { - $scheme = strtolower($scheme); - if (!in_array($scheme, array( - Zend_Oauth::REQUEST_SCHEME_HEADER, - Zend_Oauth::REQUEST_SCHEME_POSTBODY, - Zend_Oauth::REQUEST_SCHEME_QUERYSTRING, - )) - ) { - throw new Zend_Oauth_Exception( - '\'' . $scheme . '\' is an unsupported request scheme' - ); - } - if ($scheme == Zend_Oauth::REQUEST_SCHEME_POSTBODY - && $this->getRequestMethod() == Zend_Oauth::GET - ) { - throw new Zend_Oauth_Exception( - 'Cannot set POSTBODY request method if HTTP method set to GET' - ); - } - $this->_requestScheme = $scheme; - return $this; - } - - /** - * Get request scheme - * - * @return string - */ - public function getRequestScheme() - { - return $this->_requestScheme; - } - - /** - * Set version - * - * @param string $version - * @return Zend_Oauth_Config - */ - public function setVersion($version) - { - $this->_version = $version; - return $this; - } - - /** - * Get version - * - * @return string - */ - public function getVersion() - { - return $this->_version; - } - - /** - * Set callback URL - * - * @param string $url - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception for invalid URLs - */ - public function setCallbackUrl($url) - { - if (!Zend_Uri::check($url) && $url !== 'oob') { - throw new Zend_Oauth_Exception( - '\'' . $url . '\' is not a valid URI' - ); - } - $this->_callbackUrl = $url; - return $this; - } - - /** - * Get callback URL - * - * @return string - */ - public function getCallbackUrl() - { - return $this->_callbackUrl; - } - - /** - * Set site URL - * - * @param string $url - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception for invalid URLs - */ - public function setSiteUrl($url) - { - if (!Zend_Uri::check($url)) { - throw new Zend_Oauth_Exception( - '\'' . $url . '\' is not a valid URI' - ); - } - $this->_siteUrl = $url; - return $this; - } - - /** - * Get site URL - * - * @return string - */ - public function getSiteUrl() - { - return $this->_siteUrl; - } - - /** - * Set request token URL - * - * @param string $url - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception for invalid URLs - */ - public function setRequestTokenUrl($url) - { - if (!Zend_Uri::check($url)) { - throw new Zend_Oauth_Exception( - '\'' . $url . '\' is not a valid URI' - ); - } - $this->_requestTokenUrl = rtrim($url, '/'); - return $this; - } - - /** - * Get request token URL - * - * If no request token URL has been set, but a site URL has, returns the - * site URL with the string "/request_token" appended. - * - * @return string - */ - public function getRequestTokenUrl() - { - if (!$this->_requestTokenUrl && $this->_siteUrl) { - return $this->_siteUrl . '/request_token'; - } - return $this->_requestTokenUrl; - } - - /** - * Set access token URL - * - * @param string $url - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception for invalid URLs - */ - public function setAccessTokenUrl($url) - { - if (!Zend_Uri::check($url)) { - throw new Zend_Oauth_Exception( - '\'' . $url . '\' is not a valid URI' - ); - } - $this->_accessTokenUrl = rtrim($url, '/'); - return $this; - } - - /** - * Get access token URL - * - * If no access token URL has been set, but a site URL has, returns the - * site URL with the string "/access_token" appended. - * - * @return string - */ - public function getAccessTokenUrl() - { - if (!$this->_accessTokenUrl && $this->_siteUrl) { - return $this->_siteUrl . '/access_token'; - } - return $this->_accessTokenUrl; - } - - /** - * Set user authorization URL - * - * @param string $url - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception for invalid URLs - */ - public function setUserAuthorizationUrl($url) - { - return $this->setAuthorizeUrl($url); - } - - /** - * Set authorization URL - * - * @param string $url - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception for invalid URLs - */ - public function setAuthorizeUrl($url) - { - if (!Zend_Uri::check($url)) { - throw new Zend_Oauth_Exception( - '\'' . $url . '\' is not a valid URI' - ); - } - $this->_authorizeUrl = rtrim($url, '/'); - return $this; - } - - /** - * Get user authorization URL - * - * @return string - */ - public function getUserAuthorizationUrl() - { - return $this->getAuthorizeUrl(); - } - - /** - * Get authorization URL - * - * If no authorization URL has been set, but a site URL has, returns the - * site URL with the string "/authorize" appended. - * - * @return string - */ - public function getAuthorizeUrl() - { - if (!$this->_authorizeUrl && $this->_siteUrl) { - return $this->_siteUrl . '/authorize'; - } - return $this->_authorizeUrl; - } - - /** - * Set request method - * - * @param string $method - * @return Zend_Oauth_Config - * @throws Zend_Oauth_Exception for invalid request methods - */ - public function setRequestMethod($method) - { - $method = strtoupper($method); - if (!in_array($method, array( - Zend_Oauth::GET, - Zend_Oauth::POST, - Zend_Oauth::PUT, - Zend_Oauth::DELETE, - Zend_Oauth::OPTIONS, - )) - ) { - throw new Zend_Oauth_Exception('Invalid method: ' . $method); - } - $this->_requestMethod = $method; - return $this; - } - - /** - * Get request method - * - * @return string - */ - public function getRequestMethod() - { - return $this->_requestMethod; - } - - /** - * Set RSA public key - * - * @param Zend_Crypt_Rsa_Key_Public $key - * @return Zend_Oauth_Config - */ - public function setRsaPublicKey(Zend_Crypt_Rsa_Key_Public $key) - { - $this->_rsaPublicKey = $key; - return $this; - } - - /** - * Get RSA public key - * - * @return Zend_Crypt_Rsa_Key_Public - */ - public function getRsaPublicKey() - { - return $this->_rsaPublicKey; - } - - /** - * Set RSA private key - * - * @param Zend_Crypt_Rsa_Key_Private $key - * @return Zend_Oauth_Config - */ - public function setRsaPrivateKey(Zend_Crypt_Rsa_Key_Private $key) - { - $this->_rsaPrivateKey = $key; - return $this; - } - - /** - * Get RSA private key - * - * @return Zend_Crypt_Rsa_Key_Private - */ - public function getRsaPrivateKey() - { - return $this->_rsaPrivateKey; - } - - /** - * Set OAuth token - * - * @param Zend_Oauth_Token $token - * @return Zend_Oauth_Config - */ - public function setToken(Zend_Oauth_Token $token) - { - $this->_token = $token; - return $this; - } - - /** - * Get OAuth token - * - * @return Zend_Oauth_Token - */ - public function getToken() - { - return $this->_token; - } - - /** - * Set OAuth realm - * - * @param string $realm - * @return Zend_Oauth_Config - */ - public function setRealm($realm) - { - $this->_realm = $realm; - return $this; - } - - /** - * Get OAuth realm - * - * @return string - */ - public function getRealm() - { - return $this->_realm; - } -} diff --git a/library/vendor/Zend/Oauth/Config/ConfigInterface.php b/library/vendor/Zend/Oauth/Config/ConfigInterface.php deleted file mode 100644 index 03ed051e4..000000000 --- a/library/vendor/Zend/Oauth/Config/ConfigInterface.php +++ /dev/null @@ -1,79 +0,0 @@ -_config = new Zend_Oauth_Config; - if ($options !== null) { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - $this->_config->setOptions($options); - } - } - - /** - * Attempts to retrieve a Request Token from an OAuth Provider which is - * later exchanged for an authorized Access Token used to access the - * protected resources exposed by a web service API. - * - * @param null|array $customServiceParameters Non-OAuth Provider-specified parameters - * @param null|string $httpMethod - * @param null|Zend_Oauth_Http_RequestToken $request - * @return Zend_Oauth_Token_Request - */ - public function getRequestToken( - array $customServiceParameters = null, - $httpMethod = null, - Zend_Oauth_Http_RequestToken $request = null - ) { - if ($request === null) { - $request = new Zend_Oauth_Http_RequestToken($this, $customServiceParameters); - } elseif($customServiceParameters !== null) { - $request->setParameters($customServiceParameters); - } - if ($httpMethod !== null) { - $request->setMethod($httpMethod); - } else { - $request->setMethod($this->getRequestMethod()); - } - $this->_requestToken = $request->execute(); - return $this->_requestToken; - } - - /** - * After a Request Token is retrieved, the user may be redirected to the - * OAuth Provider to authorize the application's access to their - * protected resources - the redirect URL being provided by this method. - * Once the user has authorized the application for access, they are - * redirected back to the application which can now exchange the previous - * Request Token for a fully authorized Access Token. - * - * @param null|array $customServiceParameters - * @param null|Zend_Oauth_Token_Request $token - * @param null|Zend_OAuth_Http_UserAuthorization $redirect - * @return string - */ - public function getRedirectUrl( - array $customServiceParameters = null, - Zend_Oauth_Token_Request $token = null, - Zend_Oauth_Http_UserAuthorization $redirect = null - ) { - if ($redirect === null) { - $redirect = new Zend_Oauth_Http_UserAuthorization($this, $customServiceParameters); - } elseif($customServiceParameters !== null) { - $redirect->setParameters($customServiceParameters); - } - if ($token !== null) { - $this->_requestToken = $token; - } - return $redirect->getUrl(); - } - - /** - * Rather than retrieve a redirect URL for use, e.g. from a controller, - * one may perform an immediate redirect. - * - * Sends headers and exit()s on completion. - * - * @param null|array $customServiceParameters - * @param null|Zend_Oauth_Token_Request $token - * @param null|Zend_Oauth_Http_UserAuthorization $request - * @return void - */ - public function redirect( - array $customServiceParameters = null, - Zend_Oauth_Token_Request $token = null, - Zend_Oauth_Http_UserAuthorization $request = null - ) { - if ($token instanceof Zend_Oauth_Http_UserAuthorization) { - $request = $token; - $token = null; - } - $redirectUrl = $this->getRedirectUrl($customServiceParameters, $token, $request); - header('Location: ' . $redirectUrl); - exit(1); - } - - /** - * Retrieve an Access Token in exchange for a previously received/authorized - * Request Token. - * - * @param array $queryData GET data returned in user's redirect from Provider - * @param Zend_Oauth_Token_Request Request Token information - * @param string $httpMethod - * @param Zend_Oauth_Http_AccessToken $request - * @return Zend_Oauth_Token_Access - * @throws Zend_Oauth_Exception on invalid authorization token, non-matching response authorization token, or unprovided authorization token - */ - public function getAccessToken( - $queryData, - Zend_Oauth_Token_Request $token, - $httpMethod = null, - Zend_Oauth_Http_AccessToken $request = null - ) { - $authorizedToken = new Zend_Oauth_Token_AuthorizedRequest($queryData); - if (!$authorizedToken->isValid()) { - throw new Zend_Oauth_Exception( - 'Response from Service Provider is not a valid authorized request token'); - } - if ($request === null) { - $request = new Zend_Oauth_Http_AccessToken($this); - } - - // OAuth 1.0a Verifier - if ($authorizedToken->getParam('oauth_verifier') !== null) { - $params = array_merge($request->getParameters(), array( - 'oauth_verifier' => $authorizedToken->getParam('oauth_verifier') - )); - $request->setParameters($params); - } - if ($httpMethod !== null) { - $request->setMethod($httpMethod); - } else { - $request->setMethod($this->getRequestMethod()); - } - if (isset($token)) { - if ($authorizedToken->getToken() !== $token->getToken()) { - throw new Zend_Oauth_Exception( - 'Authorized token from Service Provider does not match' - . ' supplied Request Token details' - ); - } - } else { - throw new Zend_Oauth_Exception('Request token must be passed to method'); - } - $this->_requestToken = $token; - $this->_accessToken = $request->execute(); - return $this->_accessToken; - } - - /** - * Return whatever the last Request Token retrieved was while using the - * current Consumer instance. - * - * @return Zend_Oauth_Token_Request - */ - public function getLastRequestToken() - { - return $this->_requestToken; - } - - /** - * Return whatever the last Access Token retrieved was while using the - * current Consumer instance. - * - * @return Zend_Oauth_Token_Access - */ - public function getLastAccessToken() - { - return $this->_accessToken; - } - - /** - * Alias to self::getLastAccessToken() - * - * @return Zend_Oauth_Token_Access - */ - public function getToken() - { - return $this->_accessToken; - } - - /** - * Simple Proxy to the current Zend_Oauth_Config method. It's that instance - * which holds all configuration methods and values this object also presents - * as it's API. - * - * @param string $method - * @param array $args - * @return mixed - * @throws Zend_Oauth_Exception if method does not exist in config object - */ - public function __call($method, array $args) - { - if (!method_exists($this->_config, $method)) { - throw new Zend_Oauth_Exception('Method does not exist: '.$method); - } - return call_user_func_array(array($this->_config,$method), $args); - } -} diff --git a/library/vendor/Zend/Oauth/Exception.php b/library/vendor/Zend/Oauth/Exception.php deleted file mode 100644 index 376e9dd2e..000000000 --- a/library/vendor/Zend/Oauth/Exception.php +++ /dev/null @@ -1,32 +0,0 @@ -_consumer = $consumer; - $this->_preferredRequestScheme = $this->_consumer->getRequestScheme(); - if ($parameters !== null) { - $this->setParameters($parameters); - } - if ($utility !== null) { - $this->_httpUtility = $utility; - } else { - $this->_httpUtility = new Zend_Oauth_Http_Utility; - } - } - - /** - * Set a preferred HTTP request method. - * - * @param string $method - * @return Zend_Oauth_Http - */ - public function setMethod($method) - { - if (!in_array($method, array(Zend_Oauth::POST, Zend_Oauth::GET))) { - throw new Zend_Oauth_Exception('invalid HTTP method: ' . $method); - } - $this->_preferredRequestMethod = $method; - return $this; - } - - /** - * Preferred HTTP request method accessor. - * - * @return string - */ - public function getMethod() - { - return $this->_preferredRequestMethod; - } - - /** - * Mutator to set an array of custom parameters for the HTTP request. - * - * @param array $customServiceParameters - * @return Zend_Oauth_Http - */ - public function setParameters(array $customServiceParameters) - { - $this->_parameters = $customServiceParameters; - return $this; - } - - /** - * Accessor for an array of custom parameters. - * - * @return array - */ - public function getParameters() - { - return $this->_parameters; - } - - /** - * Return the Consumer instance in use. - * - * @return Zend_Oauth_Consumer - */ - public function getConsumer() - { - return $this->_consumer; - } - - /** - * Commence a request cycle where the current HTTP method and OAuth - * request scheme set an upper preferred HTTP request style and where - * failures generate a new HTTP request style further down the OAuth - * preference list for OAuth Request Schemes. - * On success, return the Request object that results for processing. - * - * @param array $params - * @return Zend_Http_Response - * @throws Zend_Oauth_Exception on HTTP request errors - * @todo Remove cycling?; Replace with upfront do-or-die configuration - */ - public function startRequestCycle(array $params) - { - $response = null; - $body = null; - $status = null; - try { - $response = $this->_attemptRequest($params); - } catch (Zend_Http_Client_Exception $e) { - throw new Zend_Oauth_Exception('Error in HTTP request', null, $e); - } - if ($response !== null) { - $body = $response->getBody(); - $status = $response->getStatus(); - } - if ($response === null // Request failure/exception - || $status == 500 // Internal Server Error - || $status == 400 // Bad Request - || $status == 401 // Unauthorized - || empty($body) // Missing token - ) { - $this->_assessRequestAttempt($response); - $response = $this->startRequestCycle($params); - } - return $response; - } - - /** - * Return an instance of Zend_Http_Client configured to use the Query - * String scheme for an OAuth driven HTTP request. - * - * @param array $params - * @param string $url - * @return Zend_Http_Client - */ - public function getRequestSchemeQueryStringClient(array $params, $url) - { - $client = Zend_Oauth::getHttpClient(); - $client->setUri($url); - $client->getUri()->setQuery( - $this->_httpUtility->toEncodedQueryString($params) - ); - $client->setMethod($this->_preferredRequestMethod); - return $client; - } - - /** - * Manages the switch from OAuth request scheme to another lower preference - * scheme during a request cycle. - * - * @param Zend_Http_Response - * @return void - * @throws Zend_Oauth_Exception if unable to retrieve valid token response - */ - protected function _assessRequestAttempt(Zend_Http_Response $response = null) - { - switch ($this->_preferredRequestScheme) { - case Zend_Oauth::REQUEST_SCHEME_HEADER: - $this->_preferredRequestScheme = Zend_Oauth::REQUEST_SCHEME_POSTBODY; - break; - case Zend_Oauth::REQUEST_SCHEME_POSTBODY: - $this->_preferredRequestScheme = Zend_Oauth::REQUEST_SCHEME_QUERYSTRING; - break; - default: - throw new Zend_Oauth_Exception( - 'Could not retrieve a valid Token response from Token URL:' - . ($response !== null - ? PHP_EOL . $response->getBody() - : ' No body - check for headers') - ); - } - } - - /** - * Generates a valid OAuth Authorization header based on the provided - * parameters and realm. - * - * @param array $params - * @param string $realm - * @return string - */ - protected function _toAuthorizationHeader(array $params, $realm = null) - { - $headerValue = array(); - $headerValue[] = 'OAuth realm="' . $realm . '"'; - foreach ($params as $key => $value) { - if (!preg_match("/^oauth_/", $key)) { - continue; - } - $headerValue[] = Zend_Oauth_Http_Utility::urlEncode($key) - . '="' - . Zend_Oauth_Http_Utility::urlEncode($value) - . '"'; - } - return implode(",", $headerValue); - } -} diff --git a/library/vendor/Zend/Oauth/Http/AccessToken.php b/library/vendor/Zend/Oauth/Http/AccessToken.php deleted file mode 100644 index 8bf93a763..000000000 --- a/library/vendor/Zend/Oauth/Http/AccessToken.php +++ /dev/null @@ -1,187 +0,0 @@ -assembleParams(); - $response = $this->startRequestCycle($params); - $return = new Zend_Oauth_Token_Access($response); - return $return; - } - - /** - * Assemble all parameters for an OAuth Access Token request. - * - * @return array - */ - public function assembleParams() - { - $params = array( - 'oauth_consumer_key' => $this->_consumer->getConsumerKey(), - 'oauth_nonce' => $this->_httpUtility->generateNonce(), - 'oauth_signature_method' => $this->_consumer->getSignatureMethod(), - 'oauth_timestamp' => $this->_httpUtility->generateTimestamp(), - 'oauth_token' => $this->_consumer->getLastRequestToken()->getToken(), - 'oauth_version' => $this->_consumer->getVersion(), - ); - - if (!empty($this->_parameters)) { - $params = array_merge($params, $this->_parameters); - } - - $params['oauth_signature'] = $this->_httpUtility->sign( - $params, - $this->_consumer->getSignatureMethod(), - $this->_consumer->getConsumerSecret(), - $this->_consumer->getLastRequestToken()->getTokenSecret(), - $this->_preferredRequestMethod, - $this->_consumer->getAccessTokenUrl() - ); - - return $params; - } - - /** - * Generate and return a HTTP Client configured for the Header Request Scheme - * specified by OAuth, for use in requesting an Access Token. - * - * @param array $params - * @return Zend_Http_Client - */ - public function getRequestSchemeHeaderClient(array $params) - { - $params = $this->_cleanParamsOfIllegalCustomParameters($params); - $headerValue = $this->_toAuthorizationHeader($params); - $client = Zend_Oauth::getHttpClient(); - - $client->setUri($this->_consumer->getAccessTokenUrl()); - $client->setHeaders('Authorization', $headerValue); - $client->setMethod($this->_preferredRequestMethod); - - return $client; - } - - /** - * Generate and return a HTTP Client configured for the POST Body Request - * Scheme specified by OAuth, for use in requesting an Access Token. - * - * @param array $params - * @return Zend_Http_Client - */ - public function getRequestSchemePostBodyClient(array $params) - { - $params = $this->_cleanParamsOfIllegalCustomParameters($params); - $client = Zend_Oauth::getHttpClient(); - $client->setUri($this->_consumer->getAccessTokenUrl()); - $client->setMethod($this->_preferredRequestMethod); - $client->setRawData( - $this->_httpUtility->toEncodedQueryString($params) - ); - $client->setHeaders( - Zend_Http_Client::CONTENT_TYPE, - Zend_Http_Client::ENC_URLENCODED - ); - return $client; - } - - /** - * Generate and return a HTTP Client configured for the Query String Request - * Scheme specified by OAuth, for use in requesting an Access Token. - * - * @param array $params - * @param string $url - * @return Zend_Http_Client - */ - public function getRequestSchemeQueryStringClient(array $params, $url) - { - $params = $this->_cleanParamsOfIllegalCustomParameters($params); - return parent::getRequestSchemeQueryStringClient($params, $url); - } - - /** - * Attempt a request based on the current configured OAuth Request Scheme and - * return the resulting HTTP Response. - * - * @param array $params - * @return Zend_Http_Response - */ - protected function _attemptRequest(array $params) - { - switch ($this->_preferredRequestScheme) { - case Zend_Oauth::REQUEST_SCHEME_HEADER: - $httpClient = $this->getRequestSchemeHeaderClient($params); - break; - case Zend_Oauth::REQUEST_SCHEME_POSTBODY: - $httpClient = $this->getRequestSchemePostBodyClient($params); - break; - case Zend_Oauth::REQUEST_SCHEME_QUERYSTRING: - $httpClient = $this->getRequestSchemeQueryStringClient($params, - $this->_consumer->getAccessTokenUrl()); - break; - } - return $httpClient->request(); - } - - /** - * Access Token requests specifically may not contain non-OAuth parameters. - * So these should be striped out and excluded. Detection is easy since - * specified OAuth parameters start with "oauth_", Extension params start - * with "xouth_", and no other parameters should use these prefixes. - * - * xouth params are not currently allowable. - * - * @param array $params - * @return array - */ - protected function _cleanParamsOfIllegalCustomParameters(array $params) - { - foreach ($params as $key=>$value) { - if (!preg_match("/^oauth_/", $key)) { - unset($params[$key]); - } - } - return $params; - } -} diff --git a/library/vendor/Zend/Oauth/Http/RequestToken.php b/library/vendor/Zend/Oauth/Http/RequestToken.php deleted file mode 100644 index 435012655..000000000 --- a/library/vendor/Zend/Oauth/Http/RequestToken.php +++ /dev/null @@ -1,160 +0,0 @@ -assembleParams(); - $response = $this->startRequestCycle($params); - $return = new Zend_Oauth_Token_Request($response); - return $return; - } - - /** - * Assemble all parameters for an OAuth Request Token request. - * - * @return array - */ - public function assembleParams() - { - $params = array( - 'oauth_consumer_key' => $this->_consumer->getConsumerKey(), - 'oauth_nonce' => $this->_httpUtility->generateNonce(), - 'oauth_timestamp' => $this->_httpUtility->generateTimestamp(), - 'oauth_signature_method' => $this->_consumer->getSignatureMethod(), - 'oauth_version' => $this->_consumer->getVersion(), - ); - - // indicates we support 1.0a - if ($this->_consumer->getCallbackUrl()) { - $params['oauth_callback'] = $this->_consumer->getCallbackUrl(); - } else { - $params['oauth_callback'] = 'oob'; - } - - if (!empty($this->_parameters)) { - $params = array_merge($params, $this->_parameters); - } - - $params['oauth_signature'] = $this->_httpUtility->sign( - $params, - $this->_consumer->getSignatureMethod(), - $this->_consumer->getConsumerSecret(), - null, - $this->_preferredRequestMethod, - $this->_consumer->getRequestTokenUrl() - ); - - return $params; - } - - /** - * Generate and return a HTTP Client configured for the Header Request Scheme - * specified by OAuth, for use in requesting a Request Token. - * - * @param array $params - * @return Zend_Http_Client - */ - public function getRequestSchemeHeaderClient(array $params) - { - $headerValue = $this->_httpUtility->toAuthorizationHeader( - $params - ); - $client = Zend_Oauth::getHttpClient(); - $client->setUri($this->_consumer->getRequestTokenUrl()); - $client->setHeaders('Authorization', $headerValue); - $rawdata = $this->_httpUtility->toEncodedQueryString($params, true); - if (!empty($rawdata)) { - $client->setRawData($rawdata, 'application/x-www-form-urlencoded'); - } - $client->setMethod($this->_preferredRequestMethod); - return $client; - } - - /** - * Generate and return a HTTP Client configured for the POST Body Request - * Scheme specified by OAuth, for use in requesting a Request Token. - * - * @param array $params - * @return Zend_Http_Client - */ - public function getRequestSchemePostBodyClient(array $params) - { - $client = Zend_Oauth::getHttpClient(); - $client->setUri($this->_consumer->getRequestTokenUrl()); - $client->setMethod($this->_preferredRequestMethod); - $client->setRawData( - $this->_httpUtility->toEncodedQueryString($params) - ); - $client->setHeaders( - Zend_Http_Client::CONTENT_TYPE, - Zend_Http_Client::ENC_URLENCODED - ); - return $client; - } - - /** - * Attempt a request based on the current configured OAuth Request Scheme and - * return the resulting HTTP Response. - * - * @param array $params - * @return Zend_Http_Response - */ - protected function _attemptRequest(array $params) - { - switch ($this->_preferredRequestScheme) { - case Zend_Oauth::REQUEST_SCHEME_HEADER: - $httpClient = $this->getRequestSchemeHeaderClient($params); - break; - case Zend_Oauth::REQUEST_SCHEME_POSTBODY: - $httpClient = $this->getRequestSchemePostBodyClient($params); - break; - case Zend_Oauth::REQUEST_SCHEME_QUERYSTRING: - $httpClient = $this->getRequestSchemeQueryStringClient($params, - $this->_consumer->getRequestTokenUrl()); - break; - } - return $httpClient->request(); - } -} diff --git a/library/vendor/Zend/Oauth/Http/UserAuthorization.php b/library/vendor/Zend/Oauth/Http/UserAuthorization.php deleted file mode 100644 index 37cc2298f..000000000 --- a/library/vendor/Zend/Oauth/Http/UserAuthorization.php +++ /dev/null @@ -1,76 +0,0 @@ -assembleParams(); - $uri = Zend_Uri_Http::fromString($this->_consumer->getUserAuthorizationUrl()); - - $uri->setQuery( - $this->_httpUtility->toEncodedQueryString($params) - ); - - return $uri->getUri(); - } - - /** - * Assemble all parameters for inclusion in a redirect URL. - * - * @return array - */ - public function assembleParams() - { - $params = array( - 'oauth_token' => $this->_consumer->getLastRequestToken()->getToken(), - ); - - if (!Zend_Oauth_Client::$supportsRevisionA) { - $callback = $this->_consumer->getCallbackUrl(); - if (!empty($callback)) { - $params['oauth_callback'] = $callback; - } - } - - if (!empty($this->_parameters)) { - $params = array_merge($params, $this->_parameters); - } - - return $params; - } -} diff --git a/library/vendor/Zend/Oauth/Http/Utility.php b/library/vendor/Zend/Oauth/Http/Utility.php deleted file mode 100644 index bec396091..000000000 --- a/library/vendor/Zend/Oauth/Http/Utility.php +++ /dev/null @@ -1,214 +0,0 @@ - $config->getConsumerKey(), - 'oauth_nonce' => $this->generateNonce(), - 'oauth_signature_method' => $config->getSignatureMethod(), - 'oauth_timestamp' => $this->generateTimestamp(), - 'oauth_version' => $config->getVersion(), - ); - - if ($config->getToken()->getToken() != null) { - $params['oauth_token'] = $config->getToken()->getToken(); - } - - - if ($serviceProviderParams !== null) { - $params = array_merge($params, $serviceProviderParams); - } - - $params['oauth_signature'] = $this->sign( - $params, - $config->getSignatureMethod(), - $config->getConsumerSecret(), - $config->getToken()->getTokenSecret(), - $config->getRequestMethod(), - $url - ); - - return $params; - } - - /** - * Given both OAuth parameters and any custom parametere, generate an - * encoded query string. This method expects parameters to have been - * assembled and signed beforehand. - * - * @param array $params - * @param bool $customParamsOnly Ignores OAuth params e.g. for requests using OAuth Header - * @return string - */ - public function toEncodedQueryString(array $params, $customParamsOnly = false) - { - if ($customParamsOnly) { - foreach ($params as $key=>$value) { - if (preg_match("/^oauth_/", $key)) { - unset($params[$key]); - } - } - } - $encodedParams = array(); - foreach ($params as $key => $value) { - $encodedParams[] = self::urlEncode($key) - . '=' - . self::urlEncode($value); - } - return implode('&', $encodedParams); - } - - /** - * Cast to authorization header - * - * @param array $params - * @param null|string $realm - * @param bool $excludeCustomParams - * @return void - */ - public function toAuthorizationHeader(array $params, $realm = null, $excludeCustomParams = true) - { - $headerValue = array( - 'OAuth realm="' . $realm . '"', - ); - - foreach ($params as $key => $value) { - if ($excludeCustomParams) { - if (!preg_match("/^oauth_/", $key)) { - continue; - } - } - $headerValue[] = self::urlEncode($key) - . '="' - . self::urlEncode($value) . '"'; - } - return implode(",", $headerValue); - } - - /** - * Sign request - * - * @param array $params - * @param string $signatureMethod - * @param string $consumerSecret - * @param null|string $tokenSecret - * @param null|string $method - * @param null|string $url - * @return string - */ - public function sign( - array $params, $signatureMethod, $consumerSecret, $tokenSecret = null, $method = null, $url = null - ) { - $className = ''; - $hashAlgo = null; - $parts = explode('-', $signatureMethod); - if (count($parts) > 1) { - $className = 'Zend_Oauth_Signature_' . ucfirst(strtolower($parts[0])); - $hashAlgo = $parts[1]; - } else { - $className = 'Zend_Oauth_Signature_' . ucfirst(strtolower($signatureMethod)); - } - - $signatureObject = new $className($consumerSecret, $tokenSecret, $hashAlgo); - return $signatureObject->sign($params, $method, $url); - } - - /** - * Parse query string - * - * @param mixed $query - * @return array - */ - public function parseQueryString($query) - { - $params = array(); - if (empty($query)) { - return array(); - } - - // Not remotely perfect but beats parse_str() which converts - // periods and uses urldecode, not rawurldecode. - $parts = explode('&', $query); - foreach ($parts as $pair) { - $kv = explode('=', $pair); - $params[rawurldecode($kv[0])] = rawurldecode($kv[1]); - } - return $params; - } - - /** - * Generate nonce - * - * @return string - */ - public function generateNonce() - { - return md5(uniqid(rand(), true)); - } - - /** - * Generate timestamp - * - * @return int - */ - public function generateTimestamp() - { - return time(); - } - - /** - * urlencode a value - * - * @param string $value - * @return string - */ - public static function urlEncode($value) - { - $encoded = rawurlencode($value); - $encoded = str_replace('%7E', '~', $encoded); - return $encoded; - } -} diff --git a/library/vendor/Zend/Oauth/Signature/Hmac.php b/library/vendor/Zend/Oauth/Signature/Hmac.php deleted file mode 100644 index 91306b706..000000000 --- a/library/vendor/Zend/Oauth/Signature/Hmac.php +++ /dev/null @@ -1,52 +0,0 @@ -_key, - $this->_hashAlgorithm, - $this->_getBaseSignatureString($params, $method, $url), - Zend_Crypt_Hmac::BINARY - ); - return base64_encode($binaryHash); - } -} diff --git a/library/vendor/Zend/Oauth/Signature/Plaintext.php b/library/vendor/Zend/Oauth/Signature/Plaintext.php deleted file mode 100644 index 96fec151d..000000000 --- a/library/vendor/Zend/Oauth/Signature/Plaintext.php +++ /dev/null @@ -1,48 +0,0 @@ -_tokenSecret === null) { - return $this->_consumerSecret . '&'; - } - $return = implode('&', array($this->_consumerSecret, $this->_tokenSecret)); - return $return; - } -} diff --git a/library/vendor/Zend/Oauth/Signature/Rsa.php b/library/vendor/Zend/Oauth/Signature/Rsa.php deleted file mode 100644 index 1d0efea6b..000000000 --- a/library/vendor/Zend/Oauth/Signature/Rsa.php +++ /dev/null @@ -1,63 +0,0 @@ -setHashAlgorithm($this->_hashAlgorithm); - $sign = $rsa->sign( - $this->_getBaseSignatureString($params, $method, $url), - $this->_key, - Zend_Crypt_Rsa::BASE64 - ); - return $sign; - } - - /** - * Assemble encryption key - * - * @return string - */ - protected function _assembleKey() - { - return $this->_consumerSecret; - } -} diff --git a/library/vendor/Zend/Oauth/Signature/SignatureAbstract.php b/library/vendor/Zend/Oauth/Signature/SignatureAbstract.php deleted file mode 100644 index 00d5e14b6..000000000 --- a/library/vendor/Zend/Oauth/Signature/SignatureAbstract.php +++ /dev/null @@ -1,181 +0,0 @@ -_consumerSecret = $consumerSecret; - if (isset($tokenSecret)) { - $this->_tokenSecret = $tokenSecret; - } - $this->_key = $this->_assembleKey(); - if (isset($hashAlgo)) { - $this->_hashAlgorithm = $hashAlgo; - } - } - - /** - * Sign a request - * - * @param array $params - * @param null|string $method - * @param null|string $url - * @return string - */ - public abstract function sign(array $params, $method = null, $url = null); - - /** - * Normalize the base signature URL - * - * @param string $url - * @return string - */ - public function normaliseBaseSignatureUrl($url) - { - $uri = Zend_Uri_Http::fromString($url); - if ($uri->getScheme() == 'http' && $uri->getPort() == '80') { - $uri->setPort(''); - } elseif ($uri->getScheme() == 'https' && $uri->getPort() == '443') { - $uri->setPort(''); - } - $uri->setQuery(''); - $uri->setFragment(''); - $uri->setHost(strtolower($uri->getHost())); - return $uri->getUri(true); - } - - /** - * Assemble key from consumer and token secrets - * - * @return string - */ - protected function _assembleKey() - { - $parts = array($this->_consumerSecret); - if ($this->_tokenSecret !== null) { - $parts[] = $this->_tokenSecret; - } - foreach ($parts as $key => $secret) { - $parts[$key] = Zend_Oauth_Http_Utility::urlEncode($secret); - } - return implode('&', $parts); - } - - /** - * Get base signature string - * - * @param array $params - * @param null|string $method - * @param null|string $url - * @return string - */ - protected function _getBaseSignatureString(array $params, $method = null, $url = null) - { - $encodedParams = array(); - foreach ($params as $key => $value) { - $encodedParams[Zend_Oauth_Http_Utility::urlEncode($key)] = - Zend_Oauth_Http_Utility::urlEncode($value); - } - $baseStrings = array(); - if (isset($method)) { - $baseStrings[] = strtoupper($method); - } - if (isset($url)) { - // should normalise later - $baseStrings[] = Zend_Oauth_Http_Utility::urlEncode( - $this->normaliseBaseSignatureUrl($url) - ); - } - if (isset($encodedParams['oauth_signature'])) { - unset($encodedParams['oauth_signature']); - } - $baseStrings[] = Zend_Oauth_Http_Utility::urlEncode( - $this->_toByteValueOrderedQueryString($encodedParams) - ); - return implode('&', $baseStrings); - } - - /** - * Transform an array to a byte value ordered query string - * - * @param array $params - * @return string - */ - protected function _toByteValueOrderedQueryString(array $params) - { - $return = array(); - uksort($params, 'strnatcmp'); - foreach ($params as $key => $value) { - if (is_array($value)) { - natsort($value); - foreach ($value as $keyduplicate) { - $return[] = $key . '=' . $keyduplicate; - } - } else { - $return[] = $key . '=' . $value; - } - } - return implode('&', $return); - } -} diff --git a/library/vendor/Zend/Oauth/Token.php b/library/vendor/Zend/Oauth/Token.php deleted file mode 100644 index ad5c8897e..000000000 --- a/library/vendor/Zend/Oauth/Token.php +++ /dev/null @@ -1,284 +0,0 @@ -_response = $response; - $params = $this->_parseParameters($response); - if (count($params) > 0) { - $this->setParams($params); - } - } - if ($utility !== null) { - $this->_httpUtility = $utility; - } else { - $this->_httpUtility = new Zend_Oauth_Http_Utility; - } - } - - /** - * Attempts to validate the Token parsed from the HTTP response - really - * it's just very basic existence checks which are minimal. - * - * @return bool - */ - public function isValid() - { - if (isset($this->_params[self::TOKEN_PARAM_KEY]) - && !empty($this->_params[self::TOKEN_PARAM_KEY]) - && isset($this->_params[self::TOKEN_SECRET_PARAM_KEY]) - ) { - return true; - } - return false; - } - - /** - * Return the HTTP response object used to initialise this instance. - * - * @return Zend_Http_Response - */ - public function getResponse() - { - return $this->_response; - } - - /** - * Sets the value for the this Token's secret which may be used when signing - * requests with this Token. - * - * @param string $secret - * @return Zend_Oauth_Token - */ - public function setTokenSecret($secret) - { - $this->setParam(self::TOKEN_SECRET_PARAM_KEY, $secret); - return $this; - } - - /** - * Retrieve this Token's secret which may be used when signing - * requests with this Token. - * - * @return string - */ - public function getTokenSecret() - { - return $this->getParam(self::TOKEN_SECRET_PARAM_KEY); - } - - /** - * Sets the value for a parameter (e.g. token secret or other) and run - * a simple filter to remove any trailing newlines. - * - * @param string $key - * @param string $value - * @return Zend_Oauth_Token - */ - public function setParam($key, $value) - { - $this->_params[$key] = trim($value, "\n"); - return $this; - } - - /** - * Sets the value for some parameters (e.g. token secret or other) and run - * a simple filter to remove any trailing newlines. - * - * @param array $params - * @return Zend_Oauth_Token - */ - public function setParams(array $params) - { - foreach ($params as $key=>$value) { - $this->setParam($key, $value); - } - return $this; - } - - /** - * Get the value for a parameter (e.g. token secret or other). - * - * @param string $key - * @return mixed - */ - public function getParam($key) - { - if (isset($this->_params[$key])) { - return $this->_params[$key]; - } - return null; - } - - /** - * Sets the value for a Token. - * - * @param string $token - * @return Zend_Oauth_Token - */ - public function setToken($token) - { - $this->setParam(self::TOKEN_PARAM_KEY, $token); - return $this; - } - - /** - * Gets the value for a Token. - * - * @return string - */ - public function getToken() - { - return $this->getParam(self::TOKEN_PARAM_KEY); - } - - /** - * Generic accessor to enable access as public properties. - * - * @return string - */ - public function __get($key) - { - return $this->getParam($key); - } - - /** - * Generic mutator to enable access as public properties. - * - * @param string $key - * @param string $value - * @return void - */ - public function __set($key, $value) - { - $this->setParam($key, $value); - } - - /** - * Convert Token to a string, specifically a raw encoded query string. - * - * @return string - */ - public function toString() - { - return $this->_httpUtility->toEncodedQueryString($this->_params); - } - - /** - * Convert Token to a string, specifically a raw encoded query string. - * Aliases to self::toString() - * - * @return string - */ - public function __toString() - { - return $this->toString(); - } - - /** - * Parse a HTTP response body and collect returned parameters - * as raw url decoded key-value pairs in an associative array. - * - * @param Zend_Http_Response $response - * @return array - */ - protected function _parseParameters(Zend_Http_Response $response) - { - $params = array(); - $body = $response->getBody(); - if (empty($body)) { - return; - } - - // validate body based on acceptable characters...todo - $parts = explode('&', $body); - foreach ($parts as $kvpair) { - $pair = explode('=', $kvpair); - $params[rawurldecode($pair[0])] = rawurldecode($pair[1]); - } - return $params; - } - - /** - * Limit serialisation stored data to the parameters - */ - public function __sleep() - { - return array('_params'); - } - - /** - * After serialisation, re-instantiate a HTTP utility class for use - */ - public function __wakeup() - { - if ($this->_httpUtility === null) { - $this->_httpUtility = new Zend_Oauth_Http_Utility; - } - } -} diff --git a/library/vendor/Zend/Oauth/Token/Access.php b/library/vendor/Zend/Oauth/Token/Access.php deleted file mode 100644 index 699bf4aaf..000000000 --- a/library/vendor/Zend/Oauth/Token/Access.php +++ /dev/null @@ -1,93 +0,0 @@ -_httpUtility->assembleParams($url, $config, $customParams); - return $this->_httpUtility->toAuthorizationHeader($params, $realm); - } - - /** - * Cast to HTTP query string - * - * @param mixed $url - * @param Zend_Oauth_Config_ConfigInterface $config - * @param null|array $params - * @return string - */ - public function toQueryString($url, Zend_Oauth_Config_ConfigInterface $config, array $params = null) - { - if (!Zend_Uri::check($url)) { - throw new Zend_Oauth_Exception( - '\'' . $url . '\' is not a valid URI' - ); - } - $params = $this->_httpUtility->assembleParams($url, $config, $params); - return $this->_httpUtility->toEncodedQueryString($params); - } - - /** - * Get OAuth client - * - * @param array $oauthOptions - * @param null|string $uri - * @param null|array|Zend_Config $config - * @param bool $excludeCustomParamsFromHeader - * @return Zend_Oauth_Client - */ - public function getHttpClient(array $oauthOptions, $uri = null, $config = null, $excludeCustomParamsFromHeader = true) - { - $client = new Zend_Oauth_Client($oauthOptions, $uri, $config, $excludeCustomParamsFromHeader); - $client->setToken($this); - return $client; - } -} diff --git a/library/vendor/Zend/Oauth/Token/AuthorizedRequest.php b/library/vendor/Zend/Oauth/Token/AuthorizedRequest.php deleted file mode 100644 index 425f5d12c..000000000 --- a/library/vendor/Zend/Oauth/Token/AuthorizedRequest.php +++ /dev/null @@ -1,101 +0,0 @@ -_data = $data; - $params = $this->_parseData(); - if (count($params) > 0) { - $this->setParams($params); - } - } - if ($utility !== null) { - $this->_httpUtility = $utility; - } else { - $this->_httpUtility = new Zend_Oauth_Http_Utility; - } - } - - /** - * Retrieve token data - * - * @return array - */ - public function getData() - { - return $this->_data; - } - - /** - * Indicate if token is valid - * - * @return bool - */ - public function isValid() - { - if (isset($this->_params[self::TOKEN_PARAM_KEY]) - && !empty($this->_params[self::TOKEN_PARAM_KEY]) - ) { - return true; - } - return false; - } - - /** - * Parse string data into array - * - * @return array - */ - protected function _parseData() - { - $params = array(); - if (empty($this->_data)) { - return; - } - foreach ($this->_data as $key => $value) { - $params[rawurldecode($key)] = rawurldecode($value); - } - return $params; - } -} diff --git a/library/vendor/Zend/Oauth/Token/Request.php b/library/vendor/Zend/Oauth/Token/Request.php deleted file mode 100644 index 7de21b844..000000000 --- a/library/vendor/Zend/Oauth/Token/Request.php +++ /dev/null @@ -1,49 +0,0 @@ -_params[Zend_Oauth_Token::TOKEN_PARAM_CALLBACK_CONFIRMED])) { - Zend_Oauth_Client::$supportsRevisionA = true; - } - } -} diff --git a/library/vendor/Zend/OpenId.php b/library/vendor/Zend/OpenId.php deleted file mode 100644 index 650610966..000000000 --- a/library/vendor/Zend/OpenId.php +++ /dev/null @@ -1,750 +0,0 @@ - 1 ? $dir : '') - . '/' - . $url; - } - } - } - return $url; - } - - /** - * Converts variable/value pairs into URL encoded query string - * - * @param array $params variable/value pairs - * @return string URL encoded query string - */ - static public function paramsToQuery($params) - { - foreach($params as $key => $value) { - if (isset($query)) { - $query .= '&' . $key . '=' . urlencode($value); - } else { - $query = $key . '=' . urlencode($value); - } - } - return isset($query) ? $query : ''; - } - - /** - * Normalizes URL according to RFC 3986 to use it in comparison operations. - * The function gets URL argument by reference and modifies it. - * It returns true on success and false of failure. - * - * @param string &$id url to be normalized - * @return bool - */ - static public function normalizeUrl(&$id) - { - // RFC 3986, 6.2.2. Syntax-Based Normalization - - // RFC 3986, 6.2.2.2 Percent-Encoding Normalization - $i = 0; - $n = strlen($id); - $res = ''; - while ($i < $n) { - if ($id[$i] == '%') { - if ($i + 2 >= $n) { - return false; - } - ++$i; - if ($id[$i] >= '0' && $id[$i] <= '9') { - $c = ord($id[$i]) - ord('0'); - } else if ($id[$i] >= 'A' && $id[$i] <= 'F') { - $c = ord($id[$i]) - ord('A') + 10; - } else if ($id[$i] >= 'a' && $id[$i] <= 'f') { - $c = ord($id[$i]) - ord('a') + 10; - } else { - return false; - } - ++$i; - if ($id[$i] >= '0' && $id[$i] <= '9') { - $c = ($c << 4) | (ord($id[$i]) - ord('0')); - } else if ($id[$i] >= 'A' && $id[$i] <= 'F') { - $c = ($c << 4) | (ord($id[$i]) - ord('A') + 10); - } else if ($id[$i] >= 'a' && $id[$i] <= 'f') { - $c = ($c << 4) | (ord($id[$i]) - ord('a') + 10); - } else { - return false; - } - ++$i; - $ch = chr($c); - if (($ch >= 'A' && $ch <= 'Z') || - ($ch >= 'a' && $ch <= 'z') || - $ch == '-' || - $ch == '.' || - $ch == '_' || - $ch == '~') { - $res .= $ch; - } else { - $res .= '%'; - if (($c >> 4) < 10) { - $res .= chr(($c >> 4) + ord('0')); - } else { - $res .= chr(($c >> 4) - 10 + ord('A')); - } - $c = $c & 0xf; - if ($c < 10) { - $res .= chr($c + ord('0')); - } else { - $res .= chr($c - 10 + ord('A')); - } - } - } else { - $res .= $id[$i++]; - } - } - - if (!preg_match('|^([^:]+)://([^:@]*(?:[:][^@]*)?@)?([^/:@?#]*)(?:[:]([^/?#]*))?(/[^?#]*)?((?:[?](?:[^#]*))?)((?:#.*)?)$|', $res, $reg)) { - return false; - } - $scheme = $reg[1]; - $auth = $reg[2]; - $host = $reg[3]; - $port = $reg[4]; - $path = $reg[5]; - $query = $reg[6]; - $fragment = $reg[7]; /* strip it */ /* ZF-4358 Fragment retained under OpenID 2.0 */ - - if (empty($scheme) || empty($host)) { - return false; - } - - // RFC 3986, 6.2.2.1. Case Normalization - $scheme = strtolower($scheme); - $host = strtolower($host); - - // RFC 3986, 6.2.2.3. Path Segment Normalization - if (!empty($path)) { - $i = 0; - $n = strlen($path); - $res = ""; - while ($i < $n) { - if ($path[$i] == '/') { - ++$i; - while ($i < $n && $path[$i] == '/') { - ++$i; - } - if ($i < $n && $path[$i] == '.') { - ++$i; - if ($i < $n && $path[$i] == '.') { - ++$i; - if ($i == $n || $path[$i] == '/') { - if (($pos = strrpos($res, '/')) !== false) { - $res = substr($res, 0, $pos); - } - } else { - $res .= '/..'; - } - } else if ($i != $n && $path[$i] != '/') { - $res .= '/.'; - } - } else { - $res .= '/'; - } - } else { - $res .= $path[$i++]; - } - } - $path = $res; - } - - // RFC 3986,6.2.3. Scheme-Based Normalization - if ($scheme == 'http') { - if ($port == 80) { - $port = ''; - } - } else if ($scheme == 'https') { - if ($port == 443) { - $port = ''; - } - } - if (empty($path)) { - $path = '/'; - } - - $id = $scheme - . '://' - . $auth - . $host - . (empty($port) ? '' : (':' . $port)) - . $path - . $query - . $fragment; - return true; - } - - /** - * Normalizes OpenID identifier that can be URL or XRI name. - * Returns true on success and false of failure. - * - * Normalization is performed according to the following rules: - * 1. If the user's input starts with one of the "xri://", "xri://$ip*", - * or "xri://$dns*" prefixes, they MUST be stripped off, so that XRIs - * are used in the canonical form, and URI-authority XRIs are further - * considered URL identifiers. - * 2. If the first character of the resulting string is an XRI Global - * Context Symbol ("=", "@", "+", "$", "!"), then the input SHOULD be - * treated as an XRI. - * 3. Otherwise, the input SHOULD be treated as an http URL; if it does - * not include a "http" or "https" scheme, the Identifier MUST be - * prefixed with the string "http://". - * 4. URL identifiers MUST then be further normalized by both following - * redirects when retrieving their content and finally applying the - * rules in Section 6 of [RFC3986] to the final destination URL. - * @param string &$id identifier to be normalized - * @return bool - */ - static public function normalize(&$id) - { - $id = trim($id); - if (strlen($id) === 0) { - return true; - } - - // 7.2.1 - if (strpos($id, 'xri://$ip*') === 0) { - $id = substr($id, strlen('xri://$ip*')); - } else if (strpos($id, 'xri://$dns*') === 0) { - $id = substr($id, strlen('xri://$dns*')); - } else if (strpos($id, 'xri://') === 0) { - $id = substr($id, strlen('xri://')); - } - - // 7.2.2 - if ($id[0] == '=' || - $id[0] == '@' || - $id[0] == '+' || - $id[0] == '$' || - $id[0] == '!') { - return true; - } - - // 7.2.3 - if (strpos($id, "://") === false) { - $id = 'http://' . $id; - } - - // 7.2.4 - return self::normalizeURL($id); - } - - /** - * Performs a HTTP redirection to specified URL with additional data. - * It may generate redirected request using GET or POST HTTP method. - * The function never returns. - * - * @param string $url URL to redirect to - * @param array $params additional variable/value pairs to send - * @param Zend_Controller_Response_Abstract $response - * @param string $method redirection method ('GET' or 'POST') - */ - static public function redirect($url, $params = null, - Zend_Controller_Response_Abstract $response = null, $method = 'GET') - { - $url = Zend_OpenId::absoluteUrl($url); - $body = ""; - if (null === $response) { - $response = new Zend_Controller_Response_Http(); - } - - if ($method == 'POST') { - $body = "\n"; - $body .= "
\n"; - if (is_array($params) && count($params) > 0) { - foreach($params as $key => $value) { - $body .= '\n"; - } - } - $body .= "\n"; - $body .= "
\n"; - } else if (is_array($params) && count($params) > 0) { - if (strpos($url, '?') === false) { - $url .= '?' . self::paramsToQuery($params); - } else { - $url .= '&' . self::paramsToQuery($params); - } - } - if (!empty($body)) { - $response->setBody($body); - } else if (!$response->canSendHeaders()) { - $response->setBody(""); - } else { - $response->setRedirect($url); - } - $response->sendResponse(); - if (self::$exitOnRedirect) { - exit(); - } - } - - /** - * Produces string of random byte of given length. - * - * @param integer $len length of requested string - * @return string RAW random binary string - */ - static public function randomBytes($len) - { - $key = ''; - for($i=0; $i < $len; $i++) { - $key .= chr(mt_rand(0, 255)); - } - return $key; - } - - /** - * Generates a hash value (message digest) according to given algorithm. - * It returns RAW binary string. - * - * This is a wrapper function that uses one of available internal function - * dependent on given PHP configuration. It may use various functions from - * ext/openssl, ext/hash, ext/mhash or ext/standard. - * - * @param string $func digest algorithm - * @param string $data data to sign - * @return string RAW digital signature - * @throws Zend_OpenId_Exception - */ - static public function digest($func, $data) - { - if (function_exists('openssl_digest')) { - return openssl_digest($data, $func, true); - } else if (function_exists('hash')) { - return hash($func, $data, true); - } else if ($func === 'sha1') { - return sha1($data, true); - } else if ($func === 'sha256') { - if (function_exists('mhash')) { - return mhash(MHASH_SHA256 , $data); - } - } - throw new Zend_OpenId_Exception( - 'Unsupported digest algorithm "' . $func . '".', - Zend_OpenId_Exception::UNSUPPORTED_DIGEST); - } - - /** - * Generates a keyed hash value using the HMAC method. It uses ext/hash - * if available or user-level PHP implementation, that is not significantly - * slower. - * - * @param string $macFunc name of selected hashing algorithm (sha1, sha256) - * @param string $data data to sign - * @param string $secret shared secret key used for generating the HMAC - * variant of the message digest - * @return string RAW HMAC value - */ - static public function hashHmac($macFunc, $data, $secret) - { -// return Zend_Crypt_Hmac::compute($secret, $macFunc, $data, Zend_Crypt_Hmac::BINARY); - if (function_exists('hash_hmac')) { - return hash_hmac($macFunc, $data, $secret, true); - } else { - if (Zend_OpenId::strlen($secret) > 64) { - $secret = self::digest($macFunc, $secret); - } - $secret = str_pad($secret, 64, chr(0x00)); - $ipad = str_repeat(chr(0x36), 64); - $opad = str_repeat(chr(0x5c), 64); - $hash1 = self::digest($macFunc, ($secret ^ $ipad) . $data); - return self::digest($macFunc, ($secret ^ $opad) . $hash1); - } - } - - /** - * Converts binary representation into ext/gmp or ext/bcmath big integer - * representation. - * - * @param string $bin binary representation of big number - * @return mixed - * @throws Zend_OpenId_Exception - */ - static protected function binToBigNum($bin) - { - if (extension_loaded('gmp')) { - return gmp_init(bin2hex($bin), 16); - } else if (extension_loaded('bcmath')) { - $bn = 0; - $len = Zend_OpenId::strlen($bin); - for ($i = 0; $i < $len; $i++) { - $bn = bcmul($bn, 256); - $bn = bcadd($bn, ord($bin[$i])); - } - return $bn; - } - throw new Zend_OpenId_Exception( - 'The system doesn\'t have proper big integer extension', - Zend_OpenId_Exception::UNSUPPORTED_LONG_MATH); - } - - /** - * Converts internal ext/gmp or ext/bcmath big integer representation into - * binary string. - * - * @param mixed $bn big number - * @return string - * @throws Zend_OpenId_Exception - */ - static protected function bigNumToBin($bn) - { - if (extension_loaded('gmp')) { - $s = gmp_strval($bn, 16); - if (strlen($s) % 2 != 0) { - $s = '0' . $s; - } else if ($s[0] > '7') { - $s = '00' . $s; - } - return pack("H*", $s); - } else if (extension_loaded('bcmath')) { - $cmp = bccomp($bn, 0); - if ($cmp == 0) { - return "\0"; - } else if ($cmp < 0) { - throw new Zend_OpenId_Exception( - 'Big integer arithmetic error', - Zend_OpenId_Exception::ERROR_LONG_MATH); - } - $bin = ""; - while (bccomp($bn, 0) > 0) { - $bin = chr(bcmod($bn, 256)) . $bin; - $bn = bcdiv($bn, 256); - } - if (ord($bin[0]) > 127) { - $bin = "\0" . $bin; - } - return $bin; - } - throw new Zend_OpenId_Exception( - 'The system doesn\'t have proper big integer extension', - Zend_OpenId_Exception::UNSUPPORTED_LONG_MATH); - } - - /** - * Performs the first step of a Diffie-Hellman key exchange by generating - * private and public DH values based on given prime number $p and - * generator $g. Both sides of key exchange MUST have the same prime number - * and generator. In this case they will able to create a random shared - * secret that is never send from one to the other. - * - * @param string $p prime number in binary representation - * @param string $g generator in binary representation - * @param string $priv_key private key in binary representation - * @return mixed - */ - static public function createDhKey($p, $g, $priv_key = null) - { - if (function_exists('openssl_dh_compute_key')) { - $dh_details = array( - 'p' => $p, - 'g' => $g - ); - if ($priv_key !== null) { - $dh_details['priv_key'] = $priv_key; - } - return openssl_pkey_new(array('dh'=>$dh_details)); - } else { - $bn_p = self::binToBigNum($p); - $bn_g = self::binToBigNum($g); - if ($priv_key === null) { - $priv_key = self::randomBytes(Zend_OpenId::strlen($p)); - } - $bn_priv_key = self::binToBigNum($priv_key); - if (extension_loaded('gmp')) { - $bn_pub_key = gmp_powm($bn_g, $bn_priv_key, $bn_p); - } else if (extension_loaded('bcmath')) { - $bn_pub_key = bcpowmod($bn_g, $bn_priv_key, $bn_p); - } - $pub_key = self::bigNumToBin($bn_pub_key); - - return array( - 'p' => $bn_p, - 'g' => $bn_g, - 'priv_key' => $bn_priv_key, - 'pub_key' => $bn_pub_key, - 'details' => array( - 'p' => $p, - 'g' => $g, - 'priv_key' => $priv_key, - 'pub_key' => $pub_key)); - } - } - - /** - * Returns an associative array with Diffie-Hellman key components in - * binary representation. The array includes original prime number 'p' and - * generator 'g', random private key 'priv_key' and corresponding public - * key 'pub_key'. - * - * @param mixed $dh Diffie-Hellman key - * @return array - */ - static public function getDhKeyDetails($dh) - { - if (function_exists('openssl_dh_compute_key')) { - $details = openssl_pkey_get_details($dh); - if (isset($details['dh'])) { - return $details['dh']; - } - } else { - return $dh['details']; - } - } - - /** - * Computes the shared secret from the private DH value $dh and the other - * party's public value in $pub_key - * - * @param string $pub_key other party's public value - * @param mixed $dh Diffie-Hellman key - * @return string - * @throws Zend_OpenId_Exception - */ - static public function computeDhSecret($pub_key, $dh) - { - if (function_exists('openssl_dh_compute_key')) { - $ret = openssl_dh_compute_key($pub_key, $dh); - if (ord($ret[0]) > 127) { - $ret = "\0" . $ret; - } - return $ret; - } else if (extension_loaded('gmp')) { - $bn_pub_key = self::binToBigNum($pub_key); - $bn_secret = gmp_powm($bn_pub_key, $dh['priv_key'], $dh['p']); - return self::bigNumToBin($bn_secret); - } else if (extension_loaded('bcmath')) { - $bn_pub_key = self::binToBigNum($pub_key); - $bn_secret = bcpowmod($bn_pub_key, $dh['priv_key'], $dh['p']); - return self::bigNumToBin($bn_secret); - } - throw new Zend_OpenId_Exception( - 'The system doesn\'t have proper big integer extension', - Zend_OpenId_Exception::UNSUPPORTED_LONG_MATH); - } - - /** - * Takes an arbitrary precision integer and returns its shortest big-endian - * two's complement representation. - * - * Arbitrary precision integers MUST be encoded as big-endian signed two's - * complement binary strings. Henceforth, "btwoc" is a function that takes - * an arbitrary precision integer and returns its shortest big-endian two's - * complement representation. All integers that are used with - * Diffie-Hellman Key Exchange are positive. This means that the left-most - * bit of the two's complement representation MUST be zero. If it is not, - * implementations MUST add a zero byte at the front of the string. - * - * @param string $str binary representation of arbitrary precision integer - * @return string big-endian signed representation - */ - static public function btwoc($str) - { - if (ord($str[0]) > 127) { - return "\0" . $str; - } - return $str; - } - - /** - * Returns lenght of binary string in bytes - * - * @param string $str - * @return int the string lenght - */ - static public function strlen($str) - { - if (extension_loaded('mbstring') && - (((int)ini_get('mbstring.func_overload')) & 2)) { - return mb_strlen($str, 'latin1'); - } else { - return strlen($str); - } - } - -} diff --git a/library/vendor/Zend/OpenId/Consumer.php b/library/vendor/Zend/OpenId/Consumer.php deleted file mode 100644 index 5282548c1..000000000 --- a/library/vendor/Zend/OpenId/Consumer.php +++ /dev/null @@ -1,992 +0,0 @@ -_storage = new Zend_OpenId_Consumer_Storage_File(); - } else { - $this->_storage = $storage; - } - $this->_dumbMode = $dumbMode; - } - - /** - * Performs check (with possible user interaction) of OpenID identity. - * - * This is the first step of OpenID authentication process. - * On success the function does not return (it does HTTP redirection to - * server and exits). On failure it returns false. - * - * @param string $id OpenID identity - * @param string $returnTo URL to redirect response from server to - * @param string $root HTTP URL to identify consumer on server - * @param mixed $extensions extension object or array of extensions objects - * @param Zend_Controller_Response_Abstract $response an optional response - * object to perform HTTP or HTML form redirection - * @return bool - */ - public function login($id, $returnTo = null, $root = null, $extensions = null, - Zend_Controller_Response_Abstract $response = null) - { - return $this->_checkId( - false, - $id, - $returnTo, - $root, - $extensions, - $response); - } - - /** - * Performs immediate check (without user interaction) of OpenID identity. - * - * This is the first step of OpenID authentication process. - * On success the function does not return (it does HTTP redirection to - * server and exits). On failure it returns false. - * - * @param string $id OpenID identity - * @param string $returnTo HTTP URL to redirect response from server to - * @param string $root HTTP URL to identify consumer on server - * @param mixed $extensions extension object or array of extensions objects - * @param Zend_Controller_Response_Abstract $response an optional response - * object to perform HTTP or HTML form redirection - * @return bool - */ - public function check($id, $returnTo=null, $root=null, $extensions = null, - Zend_Controller_Response_Abstract $response = null) - - { - return $this->_checkId( - true, - $id, - $returnTo, - $root, - $extensions, - $response); - } - - /** - * Verifies authentication response from OpenID server. - * - * This is the second step of OpenID authentication process. - * The function returns true on successful authentication and false on - * failure. - * - * @param array $params HTTP query data from OpenID server - * @param string &$identity this argument is set to end-user's claimed - * identifier or OpenID provider local identifier. - * @param mixed $extensions extension object or array of extensions objects - * @return bool - */ - public function verify($params, &$identity = "", $extensions = null) - { - $this->_setError(''); - - $version = 1.1; - if (isset($params['openid_ns']) && - $params['openid_ns'] == Zend_OpenId::NS_2_0) { - $version = 2.0; - } - - if (isset($params["openid_claimed_id"])) { - $identity = $params["openid_claimed_id"]; - } else if (isset($params["openid_identity"])){ - $identity = $params["openid_identity"]; - } else { - $identity = ""; - } - - if ($version < 2.0 && !isset($params["openid_claimed_id"])) { - if ($this->_session !== null) { - if ($this->_session->identity === $identity) { - $identity = $this->_session->claimed_id; - } - } else if (defined('SID')) { - if (isset($_SESSION["zend_openid"]["identity"]) && - isset($_SESSION["zend_openid"]["claimed_id"]) && - $_SESSION["zend_openid"]["identity"] === $identity) { - $identity = $_SESSION["zend_openid"]["claimed_id"]; - } - } else { - $this->_session = new Zend_Session_Namespace("zend_openid"); - if ($this->_session->identity === $identity) { - $identity = $this->_session->claimed_id; - } - } - } - - if (empty($params['openid_mode'])) { - $this->_setError("Missing openid.mode"); - return false; - } - if (empty($params['openid_return_to'])) { - $this->_setError("Missing openid.return_to"); - return false; - } - if (empty($params['openid_signed'])) { - $this->_setError("Missing openid.signed"); - return false; - } - if (empty($params['openid_sig'])) { - $this->_setError("Missing openid.sig"); - return false; - } - if ($params['openid_mode'] != 'id_res') { - $this->_setError("Wrong openid.mode '".$params['openid_mode']."' != 'id_res'"); - return false; - } - if (empty($params['openid_assoc_handle'])) { - $this->_setError("Missing openid.assoc_handle"); - return false; - } - if ($params['openid_return_to'] != Zend_OpenId::selfUrl()) { - /* Ignore query part in openid.return_to */ - $pos = strpos($params['openid_return_to'], '?'); - if ($pos === false || - SUBSTR($params['openid_return_to'], 0 , $pos) != Zend_OpenId::selfUrl()) { - - $this->_setError("Wrong openid.return_to '". - $params['openid_return_to']."' != '" . Zend_OpenId::selfUrl() ."'"); - return false; - } - } - if ($version >= 2.0) { - if (empty($params['openid_response_nonce'])) { - $this->_setError("Missing openid.response_nonce"); - return false; - } - if (empty($params['openid_op_endpoint'])) { - $this->_setError("Missing openid.op_endpoint"); - return false; - /* OpenID 2.0 (11.3) Checking the Nonce */ - } else if (!$this->_storage->isUniqueNonce($params['openid_op_endpoint'], $params['openid_response_nonce'])) { - $this->_setError("Duplicate openid.response_nonce"); - return false; - } - } - - if (!empty($params['openid_invalidate_handle'])) { - if ($this->_storage->getAssociationByHandle( - $params['openid_invalidate_handle'], - $url, - $macFunc, - $secret, - $expires)) { - $this->_storage->delAssociation($url); - } - } - - if ($this->_storage->getAssociationByHandle( - $params['openid_assoc_handle'], - $url, - $macFunc, - $secret, - $expires)) { - // Security fix - check the association bewteen op_endpoint and assoc_handle - if (isset($params['openid_op_endpoint']) && $url !== $params['openid_op_endpoint']) { - $this->_setError("The op_endpoint URI is not the same of URI associated with the assoc_handle"); - return false; - } - $signed = explode(',', $params['openid_signed']); - // Check the parameters for the signature - // @see https://openid.net/specs/openid-authentication-2_0.html#positive_assertions - $toCheck = $this->_signParams; - if (isset($params['openid_claimed_id']) && isset($params['openid_identity'])) { - $toCheck = array_merge($toCheck, array('claimed_id', 'identity')); - } - foreach ($toCheck as $param) { - if (!in_array($param, $signed, true)) { - $this->_setError("The required parameter $param is missing in the signed"); - return false; - } - } - - $data = ''; - foreach ($signed as $key) { - $data .= $key . ':' . $params['openid_' . strtr($key,'.','_')] . "\n"; - } - if (base64_decode($params['openid_sig']) == - Zend_OpenId::hashHmac($macFunc, $data, $secret)) { - if (!Zend_OpenId_Extension::forAll($extensions, 'parseResponse', $params)) { - $this->_setError("Extension::parseResponse failure"); - return false; - } - /* OpenID 2.0 (11.2) Verifying Discovered Information */ - if (isset($params['openid_claimed_id'])) { - $id = $params['openid_claimed_id']; - if (!Zend_OpenId::normalize($id)) { - $this->_setError("Normalization failed"); - return false; - } else if (!$this->_discovery($id, $discovered_server, $discovered_version)) { - $this->_setError("Discovery failed: " . $this->getError()); - return false; - } else if ((!empty($params['openid_identity']) && - $params["openid_identity"] != $id) || - (!empty($params['openid_op_endpoint']) && - $params['openid_op_endpoint'] != $discovered_server) || - $discovered_version != $version) { - $this->_setError("Discovery information verification failed"); - return false; - } - } - return true; - } - $this->_storage->delAssociation($url); - $this->_setError("Signature check failed"); - return false; - } - else - { - /* Use dumb mode */ - if (isset($params['openid_claimed_id'])) { - $id = $params['openid_claimed_id']; - } else if (isset($params['openid_identity'])) { - $id = $params['openid_identity']; - } else { - $this->_setError("Missing openid.claimed_id and openid.identity"); - return false; - } - - if (!Zend_OpenId::normalize($id)) { - $this->_setError("Normalization failed"); - return false; - } else if (!$this->_discovery($id, $server, $discovered_version)) { - $this->_setError("Discovery failed: " . $this->getError()); - return false; - } - - /* OpenID 2.0 (11.2) Verifying Discovered Information */ - if ((isset($params['openid_identity']) && - $params["openid_identity"] != $id) || - (isset($params['openid_op_endpoint']) && - $params['openid_op_endpoint'] != $server) || - $discovered_version != $version) { - $this->_setError("Discovery information verification failed"); - return false; - } - - $params2 = array(); - foreach ($params as $key => $val) { - if (strpos($key, 'openid_ns_') === 0) { - $key = 'openid.ns.' . substr($key, strlen('openid_ns_')); - } else if (strpos($key, 'openid_sreg_') === 0) { - $key = 'openid.sreg.' . substr($key, strlen('openid_sreg_')); - } else if (strpos($key, 'openid_') === 0) { - $key = 'openid.' . substr($key, strlen('openid_')); - } - $params2[$key] = $val; - } - $params2['openid.mode'] = 'check_authentication'; - $ret = $this->_httpRequest($server, 'POST', $params2, $status); - if ($status != 200) { - $this->_setError("'Dumb' signature verification HTTP request failed"); - return false; - } - $r = array(); - if (is_string($ret)) { - foreach(explode("\n", $ret) as $line) { - $line = trim($line); - if (!empty($line)) { - $x = explode(':', $line, 2); - if (is_array($x) && count($x) == 2) { - list($key, $value) = $x; - $r[trim($key)] = trim($value); - } - } - } - } - $ret = $r; - if (!empty($ret['invalidate_handle'])) { - if ($this->_storage->getAssociationByHandle( - $ret['invalidate_handle'], - $url, - $macFunc, - $secret, - $expires)) { - $this->_storage->delAssociation($url); - } - } - if (isset($ret['is_valid']) && $ret['is_valid'] == 'true') { - if (!Zend_OpenId_Extension::forAll($extensions, 'parseResponse', $params)) { - $this->_setError("Extension::parseResponse failure"); - return false; - } - return true; - } - $this->_setError("'Dumb' signature verification failed"); - return false; - } - } - - /** - * Store assiciation in internal chace and external storage - * - * @param string $url OpenID server url - * @param string $handle association handle - * @param string $macFunc HMAC function (sha1 or sha256) - * @param string $secret shared secret - * @param integer $expires expiration UNIX time - * @return void - */ - protected function _addAssociation($url, $handle, $macFunc, $secret, $expires) - { - $this->_cache[$url] = array($handle, $macFunc, $secret, $expires); - return $this->_storage->addAssociation( - $url, - $handle, - $macFunc, - $secret, - $expires); - } - - /** - * Retrive assiciation information for given $url from internal cahce or - * external storage - * - * @param string $url OpenID server url - * @param string &$handle association handle - * @param string &$macFunc HMAC function (sha1 or sha256) - * @param string &$secret shared secret - * @param integer &$expires expiration UNIX time - * @return void - */ - protected function _getAssociation($url, &$handle, &$macFunc, &$secret, &$expires) - { - if (isset($this->_cache[$url])) { - $handle = $this->_cache[$url][0]; - $macFunc = $this->_cache[$url][1]; - $secret = $this->_cache[$url][2]; - $expires = $this->_cache[$url][3]; - return true; - } - if ($this->_storage->getAssociation( - $url, - $handle, - $macFunc, - $secret, - $expires)) { - $this->_cache[$url] = array($handle, $macFunc, $secret, $expires); - return true; - } - return false; - } - - /** - * Performs HTTP request to given $url using given HTTP $method. - * Send additinal query specified by variable/value array, - * On success returns HTTP response without headers, false on failure. - * - * @param string $url OpenID server url - * @param string $method HTTP request method 'GET' or 'POST' - * @param array $params additional qwery parameters to be passed with - * @param int &$staus HTTP status code - * request - * @return mixed - */ - protected function _httpRequest($url, $method = 'GET', array $params = array(), &$status = null) - { - $client = $this->_httpClient; - if ($client === null) { - $client = new Zend_Http_Client( - $url, - array( - 'maxredirects' => 4, - 'timeout' => 15, - 'useragent' => 'Zend_OpenId' - ) - ); - } else { - $client->setUri($url); - } - - $client->resetParameters(); - if ($method == 'POST') { - $client->setMethod(Zend_Http_Client::POST); - $client->setParameterPost($params); - } else { - $client->setMethod(Zend_Http_Client::GET); - $client->setParameterGet($params); - } - - try { - $response = $client->request(); - } catch (Exception $e) { - $this->_setError('HTTP Request failed: ' . $e->getMessage()); - return false; - } - $status = $response->getStatus(); - $body = $response->getBody(); - if ($status == 200 || ($status == 400 && !empty($body))) { - return $body; - }else{ - $this->_setError('Bad HTTP response'); - return false; - } - } - - /** - * Create (or reuse existing) association between OpenID consumer and - * OpenID server based on Diffie-Hellman key agreement. Returns true - * on success and false on failure. - * - * @param string $url OpenID server url - * @param float $version OpenID protocol version - * @param string $priv_key for testing only - * @return bool - */ - protected function _associate($url, $version, $priv_key=null) - { - - /* Check if we already have association in chace or storage */ - if ($this->_getAssociation( - $url, - $handle, - $macFunc, - $secret, - $expires)) { - return true; - } - - if ($this->_dumbMode) { - /* Use dumb mode */ - return true; - } - - $params = array(); - - if ($version >= 2.0) { - $params = array( - 'openid.ns' => Zend_OpenId::NS_2_0, - 'openid.mode' => 'associate', - 'openid.assoc_type' => 'HMAC-SHA256', - 'openid.session_type' => 'DH-SHA256', - ); - } else { - $params = array( - 'openid.mode' => 'associate', - 'openid.assoc_type' => 'HMAC-SHA1', - 'openid.session_type' => 'DH-SHA1', - ); - } - - $dh = Zend_OpenId::createDhKey(pack('H*', Zend_OpenId::DH_P), - pack('H*', Zend_OpenId::DH_G), - $priv_key); - $dh_details = Zend_OpenId::getDhKeyDetails($dh); - - $params['openid.dh_modulus'] = base64_encode( - Zend_OpenId::btwoc($dh_details['p'])); - $params['openid.dh_gen'] = base64_encode( - Zend_OpenId::btwoc($dh_details['g'])); - $params['openid.dh_consumer_public'] = base64_encode( - Zend_OpenId::btwoc($dh_details['pub_key'])); - - while(1) { - $ret = $this->_httpRequest($url, 'POST', $params, $status); - if ($ret === false) { - $this->_setError("HTTP request failed"); - return false; - } - - $r = array(); - $bad_response = false; - foreach(explode("\n", $ret) as $line) { - $line = trim($line); - if (!empty($line)) { - $x = explode(':', $line, 2); - if (is_array($x) && count($x) == 2) { - list($key, $value) = $x; - $r[trim($key)] = trim($value); - } else { - $bad_response = true; - } - } - } - if ($bad_response && strpos($ret, 'Unknown session type') !== false) { - $r['error_code'] = 'unsupported-type'; - } - $ret = $r; - - if (isset($ret['error_code']) && - $ret['error_code'] == 'unsupported-type') { - if ($params['openid.session_type'] == 'DH-SHA256') { - $params['openid.session_type'] = 'DH-SHA1'; - $params['openid.assoc_type'] = 'HMAC-SHA1'; - } else if ($params['openid.session_type'] == 'DH-SHA1') { - $params['openid.session_type'] = 'no-encryption'; - } else { - $this->_setError("The OpenID service responded with: " . $ret['error_code']); - return false; - } - } else { - break; - } - } - - if ($status != 200) { - $this->_setError("The server responded with status code: " . $status); - return false; - } - - if ($version >= 2.0 && - isset($ret['ns']) && - $ret['ns'] != Zend_OpenId::NS_2_0) { - $this->_setError("Wrong namespace definition in the server response"); - return false; - } - - if (!isset($ret['assoc_handle']) || - !isset($ret['expires_in']) || - !isset($ret['assoc_type']) || - $params['openid.assoc_type'] != $ret['assoc_type']) { - if ($params['openid.assoc_type'] != $ret['assoc_type']) { - $this->_setError("The returned assoc_type differed from the supplied openid.assoc_type"); - } else { - $this->_setError("Missing required data from provider (assoc_handle, expires_in, assoc_type are required)"); - } - return false; - } - - $handle = $ret['assoc_handle']; - $expiresIn = $ret['expires_in']; - - if ($ret['assoc_type'] == 'HMAC-SHA1') { - $macFunc = 'sha1'; - } else if ($ret['assoc_type'] == 'HMAC-SHA256' && - $version >= 2.0) { - $macFunc = 'sha256'; - } else { - $this->_setError("Unsupported assoc_type"); - return false; - } - - if ((empty($ret['session_type']) || - ($version >= 2.0 && $ret['session_type'] == 'no-encryption')) && - isset($ret['mac_key'])) { - $secret = base64_decode($ret['mac_key']); - } else if (isset($ret['session_type']) && - $ret['session_type'] == 'DH-SHA1' && - !empty($ret['dh_server_public']) && - !empty($ret['enc_mac_key'])) { - $dhFunc = 'sha1'; - } else if (isset($ret['session_type']) && - $ret['session_type'] == 'DH-SHA256' && - $version >= 2.0 && - !empty($ret['dh_server_public']) && - !empty($ret['enc_mac_key'])) { - $dhFunc = 'sha256'; - } else { - $this->_setError("Unsupported session_type"); - return false; - } - if (isset($dhFunc)) { - $serverPub = base64_decode($ret['dh_server_public']); - $dhSec = Zend_OpenId::computeDhSecret($serverPub, $dh); - if ($dhSec === false) { - $this->_setError("DH secret comutation failed"); - return false; - } - $sec = Zend_OpenId::digest($dhFunc, $dhSec); - if ($sec === false) { - $this->_setError("Could not create digest"); - return false; - } - $secret = $sec ^ base64_decode($ret['enc_mac_key']); - } - if ($macFunc == 'sha1') { - if (Zend_OpenId::strlen($secret) != 20) { - $this->_setError("The length of the sha1 secret must be 20"); - return false; - } - } else if ($macFunc == 'sha256') { - if (Zend_OpenId::strlen($secret) != 32) { - $this->_setError("The length of the sha256 secret must be 32"); - return false; - } - } - $this->_addAssociation( - $url, - $handle, - $macFunc, - $secret, - time() + $expiresIn); - return true; - } - - /** - * Performs discovery of identity and finds OpenID URL, OpenID server URL - * and OpenID protocol version. Returns true on succees and false on - * failure. - * - * @param string &$id OpenID identity URL - * @param string &$server OpenID server URL - * @param float &$version OpenID protocol version - * @return bool - * @todo OpenID 2.0 (7.3) XRI and Yadis discovery - */ - protected function _discovery(&$id, &$server, &$version) - { - $realId = $id; - if ($this->_storage->getDiscoveryInfo( - $id, - $realId, - $server, - $version, - $expire)) { - $id = $realId; - return true; - } - - $response = $this->_httpRequest($id, 'GET', array(), $status); - if ($status != 200 || !is_string($response)) { - return false; - } - - /* OpenID 2.0 (7.3) XRI and Yadis discovery */ - if (preg_match( - '/]*http-equiv=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?X-XRDS-Location[ \t]*[^"\']*\\1[^>]*content=(["\'])([^"\']+)\\2[^>]*\/?>/i', - $response, - $r)) { - $XRDS = $r[3]; - $version = 2.0; - $response = $this->_httpRequest($XRDS); - if (preg_match( - '/([^\t]*)<\/URI>/i', - $response, - $x)) { - $server = $x[1]; - // $realId - $realId = 'http://specs.openid.net/auth/2.0/identifier_select'; - } - else { - $this->_setError("Unable to get URI for XRDS discovery"); - } - } - - /* HTML-based discovery */ - else if (preg_match( - '/]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.provider[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i', - $response, - $r)) { - $version = 2.0; - $server = $r[3]; - } else if (preg_match( - '/]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.provider[ \t]*[^"\']*\\3[^>]*\/?>/i', - $response, - $r)) { - $version = 2.0; - $server = $r[2]; - } else if (preg_match( - '/]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.server[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i', - $response, - $r)) { - $version = 1.1; - $server = $r[3]; - } else if (preg_match( - '/]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.server[ \t]*[^"\']*\\3[^>]*\/?>/i', - $response, - $r)) { - $version = 1.1; - $server = $r[2]; - } else { - return false; - } - if ($version >= 2.0) { - if (preg_match( - '/]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.local_id[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i', - $response, - $r)) { - $realId = $r[3]; - } else if (preg_match( - '/]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid2.local_id[ \t]*[^"\']*\\3[^>]*\/?>/i', - $response, - $r)) { - $realId = $r[2]; - } - } else { - if (preg_match( - '/]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.delegate[ \t]*[^"\']*\\1[^>]*href=(["\'])([^"\']+)\\2[^>]*\/?>/i', - $response, - $r)) { - $realId = $r[3]; - } else if (preg_match( - '/]*href=(["\'])([^"\']+)\\1[^>]*rel=(["\'])[ \t]*(?:[^ \t"\']+[ \t]+)*?openid.delegate[ \t]*[^"\']*\\3[^>]*\/?>/i', - $response, - $r)) { - $realId = $r[2]; - } - } - - $expire = time() + 60 * 60; - $this->_storage->addDiscoveryInfo($id, $realId, $server, $version, $expire); - $id = $realId; - return true; - } - - /** - * Performs check of OpenID identity. - * - * This is the first step of OpenID authentication process. - * On success the function does not return (it does HTTP redirection to - * server and exits). On failure it returns false. - * - * @param bool $immediate enables or disables interaction with user - * @param string $id OpenID identity - * @param string $returnTo HTTP URL to redirect response from server to - * @param string $root HTTP URL to identify consumer on server - * @param mixed $extensions extension object or array of extensions objects - * @param Zend_Controller_Response_Abstract $response an optional response - * object to perform HTTP or HTML form redirection - * @return bool - */ - protected function _checkId($immediate, $id, $returnTo=null, $root=null, - $extensions=null, Zend_Controller_Response_Abstract $response = null) - { - $this->_setError(''); - - if (!Zend_OpenId::normalize($id)) { - $this->_setError("Normalisation failed"); - return false; - } - $claimedId = $id; - - if (!$this->_discovery($id, $server, $version)) { - $this->_setError("Discovery failed: " . $this->getError()); - return false; - } - if (!$this->_associate($server, $version)) { - $this->_setError("Association failed: " . $this->getError()); - return false; - } - if (!$this->_getAssociation( - $server, - $handle, - $macFunc, - $secret, - $expires)) { - /* Use dumb mode */ - unset($handle); - unset($macFunc); - unset($secret); - unset($expires); - } - - $params = array(); - if ($version >= 2.0) { - $params['openid.ns'] = Zend_OpenId::NS_2_0; - } - - $params['openid.mode'] = $immediate ? - 'checkid_immediate' : 'checkid_setup'; - - $params['openid.identity'] = $id; - - $params['openid.claimed_id'] = $claimedId; - - if ($version <= 2.0) { - if ($this->_session !== null) { - $this->_session->identity = $id; - $this->_session->claimed_id = $claimedId; - } else if (defined('SID')) { - $_SESSION["zend_openid"] = array( - "identity" => $id, - "claimed_id" => $claimedId); - } else { - $this->_session = new Zend_Session_Namespace("zend_openid"); - $this->_session->identity = $id; - $this->_session->claimed_id = $claimedId; - } - } - - if (isset($handle)) { - $params['openid.assoc_handle'] = $handle; - } - - $params['openid.return_to'] = Zend_OpenId::absoluteUrl($returnTo); - - if (empty($root)) { - $root = Zend_OpenId::selfUrl(); - if ($root[strlen($root)-1] != '/') { - $root = dirname($root); - } - } - if ($version >= 2.0) { - $params['openid.realm'] = $root; - } else { - $params['openid.trust_root'] = $root; - } - - if (!Zend_OpenId_Extension::forAll($extensions, 'prepareRequest', $params)) { - $this->_setError("Extension::prepareRequest failure"); - return false; - } - - Zend_OpenId::redirect($server, $params, $response); - return true; - } - - /** - * Sets HTTP client object to make HTTP requests - * - * @param Zend_Http_Client $client HTTP client object to be used - */ - public function setHttpClient($client) { - $this->_httpClient = $client; - } - - /** - * Returns HTTP client object that will be used to make HTTP requests - * - * @return Zend_Http_Client - */ - public function getHttpClient() { - return $this->_httpClient; - } - - /** - * Sets session object to store climed_id - * - * @param Zend_Session_Namespace $session HTTP client object to be used - */ - public function setSession(Zend_Session_Namespace $session) { - $this->_session = $session; - } - - /** - * Returns session object that is used to store climed_id - * - * @return Zend_Session_Namespace - */ - public function getSession() { - return $this->_session; - } - - /** - * Saves error message - * - * @param string $message error message - */ - protected function _setError($message) - { - $this->_error = $message; - } - - /** - * Returns error message that explains failure of login, check or verify - * - * @return string - */ - public function getError() - { - return $this->_error; - } - -} diff --git a/library/vendor/Zend/OpenId/Consumer/Storage.php b/library/vendor/Zend/OpenId/Consumer/Storage.php deleted file mode 100644 index 89b0cd287..000000000 --- a/library/vendor/Zend/OpenId/Consumer/Storage.php +++ /dev/null @@ -1,132 +0,0 @@ -_dir = $dir; - if (!is_dir($this->_dir)) { - if (!@mkdir($this->_dir, 0700, 1)) { - /** - * @see Zend_OpenId_Exception - */ - throw new Zend_OpenId_Exception( - 'Cannot access storage directory ' . $dir, - Zend_OpenId_Exception::ERROR_STORAGE); - } - } - if (($f = fopen($this->_dir.'/assoc.lock', 'w+')) === null) { - /** - * @see Zend_OpenId_Exception - */ - throw new Zend_OpenId_Exception( - 'Cannot create a lock file in the directory ' . $dir, - Zend_OpenId_Exception::ERROR_STORAGE); - } - fclose($f); - if (($f = fopen($this->_dir.'/discovery.lock', 'w+')) === null) { - /** - * @see Zend_OpenId_Exception - */ - throw new Zend_OpenId_Exception( - 'Cannot create a lock file in the directory ' . $dir, - Zend_OpenId_Exception::ERROR_STORAGE); - } - fclose($f); - if (($f = fopen($this->_dir.'/nonce.lock', 'w+')) === null) { - /** - * @see Zend_OpenId_Exception - */ - throw new Zend_OpenId_Exception( - 'Cannot create a lock file in the directory ' . $dir, - Zend_OpenId_Exception::ERROR_STORAGE); - } - fclose($f); - } - - /** - * Stores information about association identified by $url/$handle - * - * @param string $url OpenID server URL - * @param string $handle assiciation handle - * @param string $macFunc HMAC function (sha1 or sha256) - * @param string $secret shared secret - * @param long $expires expiration UNIX time - * @return bool - */ - public function addAssociation($url, $handle, $macFunc, $secret, $expires) - { - $name1 = $this->_dir . '/assoc_url_' . md5($url); - $name2 = $this->_dir . '/assoc_handle_' . md5($handle); - $lock = @fopen($this->_dir . '/assoc.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name1, 'w+'); - if ($f === false) { - fclose($lock); - return false; - } - $data = serialize(array($url, $handle, $macFunc, $secret, $expires)); - fwrite($f, $data); - if (function_exists('symlink')) { - @unlink($name2); - if (symlink($name1, $name2)) { - fclose($f); - fclose($lock); - return true; - } - } - $f2 = @fopen($name2, 'w+'); - if ($f2) { - fwrite($f2, $data); - fclose($f2); - @unlink($name1); - $ret = true; - } else { - $ret = false; - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Gets information about association identified by $url - * Returns true if given association found and not expired and false - * otherwise - * - * @param string $url OpenID server URL - * @param string &$handle assiciation handle - * @param string &$macFunc HMAC function (sha1 or sha256) - * @param string &$secret shared secret - * @param long &$expires expiration UNIX time - * @return bool - */ - public function getAssociation($url, &$handle, &$macFunc, &$secret, &$expires) - { - $name1 = $this->_dir . '/assoc_url_' . md5($url); - $lock = @fopen($this->_dir . '/assoc.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name1, 'r'); - if ($f === false) { - fclose($lock); - return false; - } - $ret = false; - $data = stream_get_contents($f); - if (!empty($data)) { - list($storedUrl, $handle, $macFunc, $secret, $expires) = unserialize($data); - if ($url === $storedUrl && $expires > time()) { - $ret = true; - } else { - $name2 = $this->_dir . '/assoc_handle_' . md5($handle); - fclose($f); - @unlink($name2); - @unlink($name1); - fclose($lock); - return false; - } - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Gets information about association identified by $handle - * Returns true if given association found and not expired and false - * otherwise - * - * @param string $handle assiciation handle - * @param string &$url OpenID server URL - * @param string &$macFunc HMAC function (sha1 or sha256) - * @param string &$secret shared secret - * @param long &$expires expiration UNIX time - * @return bool - */ - public function getAssociationByHandle($handle, &$url, &$macFunc, &$secret, &$expires) - { - $name2 = $this->_dir . '/assoc_handle_' . md5($handle); - $lock = @fopen($this->_dir . '/assoc.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name2, 'r'); - if ($f === false) { - fclose($lock); - return false; - } - $ret = false; - $data = stream_get_contents($f); - if (!empty($data)) { - list($url, $storedHandle, $macFunc, $secret, $expires) = unserialize($data); - if ($handle === $storedHandle && $expires > time()) { - $ret = true; - } else { - fclose($f); - @unlink($name2); - $name1 = $this->_dir . '/assoc_url_' . md5($url); - @unlink($name1); - fclose($lock); - return false; - } - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Deletes association identified by $url - * - * @param string $url OpenID server URL - * @return bool - */ - public function delAssociation($url) - { - $name1 = $this->_dir . '/assoc_url_' . md5($url); - $lock = @fopen($this->_dir . '/assoc.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name1, 'r'); - if ($f === false) { - fclose($lock); - return false; - } - $data = stream_get_contents($f); - if (!empty($data)) { - list($storedUrl, $handle, $macFunc, $secret, $expires) = unserialize($data); - if ($url === $storedUrl) { - $name2 = $this->_dir . '/assoc_handle_' . md5($handle); - fclose($f); - @unlink($name2); - @unlink($name1); - fclose($lock); - return true; - } - } - fclose($f); - fclose($lock); - return true; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Stores information discovered from identity $id - * - * @param string $id identity - * @param string $realId discovered real identity URL - * @param string $server discovered OpenID server URL - * @param float $version discovered OpenID protocol version - * @param long $expires expiration UNIX time - * @return bool - */ - public function addDiscoveryInfo($id, $realId, $server, $version, $expires) - { - $name = $this->_dir . '/discovery_' . md5($id); - $lock = @fopen($this->_dir . '/discovery.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'w+'); - if ($f === false) { - fclose($lock); - return false; - } - $data = serialize(array($id, $realId, $server, $version, $expires)); - fwrite($f, $data); - fclose($f); - fclose($lock); - return true; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Gets information discovered from identity $id - * Returns true if such information exists and false otherwise - * - * @param string $id identity - * @param string &$realId discovered real identity URL - * @param string &$server discovered OpenID server URL - * @param float &$version discovered OpenID protocol version - * @param long &$expires expiration UNIX time - * @return bool - */ - public function getDiscoveryInfo($id, &$realId, &$server, &$version, &$expires) - { - $name = $this->_dir . '/discovery_' . md5($id); - $lock = @fopen($this->_dir . '/discovery.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'r'); - if ($f === false) { - fclose($lock); - return false; - } - $ret = false; - $data = stream_get_contents($f); - if (!empty($data)) { - list($storedId, $realId, $server, $version, $expires) = unserialize($data); - if ($id === $storedId && $expires > time()) { - $ret = true; - } else { - fclose($f); - @unlink($name); - fclose($lock); - return false; - } - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Removes cached information discovered from identity $id - * - * @param string $id identity - * @return bool - */ - public function delDiscoveryInfo($id) - { - $name = $this->_dir . '/discovery_' . md5($id); - $lock = @fopen($this->_dir . '/discovery.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - @unlink($name); - fclose($lock); - return true; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * The function checks the uniqueness of openid.response_nonce - * - * @param string $provider openid.openid_op_endpoint field from authentication response - * @param string $nonce openid.response_nonce field from authentication response - * @return bool - */ - public function isUniqueNonce($provider, $nonce) - { - $name = $this->_dir . '/nonce_' . md5($provider.';'.$nonce); - $lock = @fopen($this->_dir . '/nonce.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'x'); - if ($f === false) { - fclose($lock); - return false; - } - fwrite($f, $provider.';'.$nonce); - fclose($f); - fclose($lock); - return true; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Removes data from the uniqueness database that is older then given date - * - * @param mixed $date date of expired data - */ - public function purgeNonces($date=null) - { - $lock = @fopen($this->_dir . '/nonce.lock', 'w+'); - if ($lock !== false) { - flock($lock, LOCK_EX); - } - try { - if (!is_int($date) && !is_string($date)) { - $nonceFiles = glob($this->_dir . '/nonce_*'); - foreach ((array) $nonceFiles as $name) { - @unlink($name); - } - unset($nonceFiles); - } else { - if (is_string($date)) { - $time = time($date); - } else { - $time = $date; - } - $nonceFiles = glob($this->_dir . '/nonce_*'); - foreach ((array) $nonceFiles as $name) { - if (filemtime($name) < $time) { - @unlink($name); - } - } - unset($nonceFiles); - } - if ($lock !== false) { - fclose($lock); - } - } catch (Exception $e) { - if ($lock !== false) { - fclose($lock); - } - throw $e; - } - } -} diff --git a/library/vendor/Zend/OpenId/Exception.php b/library/vendor/Zend/OpenId/Exception.php deleted file mode 100644 index 343dc668f..000000000 --- a/library/vendor/Zend/OpenId/Exception.php +++ /dev/null @@ -1,57 +0,0 @@ -$func($params)) { - return false; - } - } else { - return false; - } - } - } else if (!is_object($extensions) || - !($extensions instanceof Zend_OpenId_Extension) || - !$extensions->$func($params)) { - return false; - } - } - return true; - } - - /** - * Method to add additional data to OpenId 'checkid_immediate' or - * 'checkid_setup' request. This method addes nothing but inherited class - * may add additional data into request. - * - * @param array &$params request's var/val pairs - * @return bool - */ - public function prepareRequest(&$params) - { - return true; - } - - /** - * Method to parse OpenId 'checkid_immediate' or 'checkid_setup' request - * and initialize object with passed data. This method parses nothing but - * inherited class may override this method to do somthing. - * - * @param array $params request's var/val pairs - * @return bool - */ - public function parseRequest($params) - { - return true; - } - - /** - * Method to add additional data to OpenId 'id_res' response. This method - * addes nothing but inherited class may add additional data into response. - * - * @param array &$params response's var/val pairs - * @return bool - */ - public function prepareResponse(&$params) - { - return true; - } - - /** - * Method to parse OpenId 'id_res' response and initialize object with - * passed data. This method parses nothing but inherited class may override - * this method to do somthing. - * - * @param array $params response's var/val pairs - * @return bool - */ - public function parseResponse($params) - { - return true; - } - - /** - * Method to prepare data to store it in trusted servers database. - * - * @param array &$data data to be stored in tusted servers database - * @return bool - */ - public function getTrustData(&$data) - { - return true; - } - - /** - * Method to check if data from trusted servers database is enough to - * sutisfy request. - * - * @param array $data data from tusted servers database - * @return bool - */ - public function checkTrustData($data) - { - return true; - } -} diff --git a/library/vendor/Zend/OpenId/Extension/Sreg.php b/library/vendor/Zend/OpenId/Extension/Sreg.php deleted file mode 100644 index ae7aa1cbb..000000000 --- a/library/vendor/Zend/OpenId/Extension/Sreg.php +++ /dev/null @@ -1,299 +0,0 @@ -_props = $props; - $this->_policy_url = $policy_url; - $this->_version = $version; - } - - /** - * Returns associative array of SREG variables - * - * @return array - */ - public function getProperties() { - if (is_array($this->_props)) { - return $this->_props; - } else { - return array(); - } - } - - /** - * Returns SREG policy URL - * - * @return string - */ - public function getPolicyUrl() { - return $this->_policy_url; - } - - /** - * Returns SREG protocol version - * - * @return float - */ - public function getVersion() { - return $this->_version; - } - - /** - * Returns array of allowed SREG variable names. - * - * @return array - */ - public static function getSregProperties() - { - return array( - "nickname", - "email", - "fullname", - "dob", - "gender", - "postcode", - "country", - "language", - "timezone" - ); - } - - /** - * Adds additional SREG data to OpenId 'checkid_immediate' or - * 'checkid_setup' request. - * - * @param array &$params request's var/val pairs - * @return bool - */ - public function prepareRequest(&$params) - { - if (is_array($this->_props) && count($this->_props) > 0) { - foreach ($this->_props as $prop => $req) { - if ($req) { - if (isset($required)) { - $required .= ','.$prop; - } else { - $required = $prop; - } - } else { - if (isset($optional)) { - $optional .= ','.$prop; - } else { - $optional = $prop; - } - } - } - if ($this->_version >= 1.1) { - $params['openid.ns.sreg'] = Zend_OpenId_Extension_Sreg::NAMESPACE_1_1; - } - if (!empty($required)) { - $params['openid.sreg.required'] = $required; - } - if (!empty($optional)) { - $params['openid.sreg.optional'] = $optional; - } - if (!empty($this->_policy_url)) { - $params['openid.sreg.policy_url'] = $this->_policy_url; - } - } - return true; - } - - /** - * Parses OpenId 'checkid_immediate' or 'checkid_setup' request, - * extracts SREG variables and sets ovject properties to corresponding - * values. - * - * @param array $params request's var/val pairs - * @return bool - */ - public function parseRequest($params) - { - if (isset($params['openid_ns_sreg']) && - $params['openid_ns_sreg'] === Zend_OpenId_Extension_Sreg::NAMESPACE_1_1) { - $this->_version= 1.1; - } else { - $this->_version= 1.0; - } - if (!empty($params['openid_sreg_policy_url'])) { - $this->_policy_url = $params['openid_sreg_policy_url']; - } else { - $this->_policy_url = null; - } - $props = array(); - if (!empty($params['openid_sreg_optional'])) { - foreach (explode(',', $params['openid_sreg_optional']) as $prop) { - $prop = trim($prop); - $props[$prop] = false; - } - } - if (!empty($params['openid_sreg_required'])) { - foreach (explode(',', $params['openid_sreg_required']) as $prop) { - $prop = trim($prop); - $props[$prop] = true; - } - } - $props2 = array(); - foreach (self::getSregProperties() as $prop) { - if (isset($props[$prop])) { - $props2[$prop] = $props[$prop]; - } - } - - $this->_props = (count($props2) > 0) ? $props2 : null; - return true; - } - - /** - * Adds additional SREG data to OpenId 'id_res' response. - * - * @param array &$params response's var/val pairs - * @return bool - */ - public function prepareResponse(&$params) - { - if (is_array($this->_props) && count($this->_props) > 0) { - if ($this->_version >= 1.1) { - $params['openid.ns.sreg'] = Zend_OpenId_Extension_Sreg::NAMESPACE_1_1; - } - foreach (self::getSregProperties() as $prop) { - if (!empty($this->_props[$prop])) { - $params['openid.sreg.' . $prop] = $this->_props[$prop]; - } - } - } - return true; - } - - /** - * Parses OpenId 'id_res' response and sets object's properties according - * to 'openid.sreg.*' variables in response - * - * @param array $params response's var/val pairs - * @return bool - */ - public function parseResponse($params) - { - if (isset($params['openid_ns_sreg']) && - $params['openid_ns_sreg'] === Zend_OpenId_Extension_Sreg::NAMESPACE_1_1) { - $this->_version= 1.1; - } else { - $this->_version= 1.0; - } - $props = array(); - foreach (self::getSregProperties() as $prop) { - if (!empty($params['openid_sreg_' . $prop])) { - $props[$prop] = $params['openid_sreg_' . $prop]; - } - } - if (isset($this->_props) && is_array($this->_props)) { - foreach (self::getSregProperties() as $prop) { - if (isset($this->_props[$prop]) && - $this->_props[$prop] && - !isset($props[$prop])) { - return false; - } - } - } - $this->_props = (count($props) > 0) ? $props : null; - return true; - } - - /** - * Addes SREG properties that are allowed to be send to consumer to - * the given $data argument. - * - * @param array &$data data to be stored in tusted servers database - * @return bool - */ - public function getTrustData(&$data) - { - $data[get_class()] = $this->getProperties(); - return true; - } - - /** - * Check if given $data contains necessury SREG properties to sutisfy - * OpenId request. On success sets SREG response properties from given - * $data and returns true, on failure returns false. - * - * @param array $data data from tusted servers database - * @return bool - */ - public function checkTrustData($data) - { - if (is_array($this->_props) && count($this->_props) > 0) { - $props = array(); - $name = get_class(); - if (isset($data[$name])) { - $props = $data[$name]; - } else { - $props = array(); - } - $props2 = array(); - foreach ($this->_props as $prop => $req) { - if (empty($props[$prop])) { - if ($req) { - return false; - } - } else { - $props2[$prop] = $props[$prop]; - } - } - $this->_props = (count($props2) > 0) ? $props2 : null; - } - return true; - } -} diff --git a/library/vendor/Zend/OpenId/Provider.php b/library/vendor/Zend/OpenId/Provider.php deleted file mode 100644 index 6580d3f82..000000000 --- a/library/vendor/Zend/OpenId/Provider.php +++ /dev/null @@ -1,799 +0,0 @@ -_loginUrl = $loginUrl; - if ($trustUrl === null) { - $trustUrl = Zend_OpenId::selfUrl() . '?openid.action=trust'; - } else { - $trustUrl = Zend_OpenId::absoluteUrl($trustUrl); - } - $this->_trustUrl = $trustUrl; - if ($user === null) { - $this->_user = new Zend_OpenId_Provider_User_Session(); - } else { - $this->_user = $user; - } - if ($storage === null) { - $this->_storage = new Zend_OpenId_Provider_Storage_File(); - } else { - $this->_storage = $storage; - } - $this->_sessionTtl = $sessionTtl; - } - - /** - * Sets the OP Endpoint URL - * - * @param string $url the OP Endpoint URL - * @return null - */ - public function setOpEndpoint($url) - { - $this->_opEndpoint = $url; - } - - /** - * Registers a new user with given $id and $password - * Returns true in case of success and false if user with given $id already - * exists - * - * @param string $id user identity URL - * @param string $password encoded user password - * @return bool - */ - public function register($id, $password) - { - if (!Zend_OpenId::normalize($id) || empty($id)) { - return false; - } - return $this->_storage->addUser($id, md5($id.$password)); - } - - /** - * Returns true if user with given $id exists and false otherwise - * - * @param string $id user identity URL - * @return bool - */ - public function hasUser($id) { - if (!Zend_OpenId::normalize($id)) { - return false; - } - return $this->_storage->hasUser($id); - } - - /** - * Performs login of user with given $id and $password - * Returns true in case of success and false otherwise - * - * @param string $id user identity URL - * @param string $password user password - * @return bool - */ - public function login($id, $password) - { - if (!Zend_OpenId::normalize($id)) { - return false; - } - if (!$this->_storage->checkUser($id, md5($id.$password))) { - return false; - } - $this->_user->setLoggedInUser($id); - return true; - } - - /** - * Performs logout. Clears information about logged in user. - * - * @return void - */ - public function logout() - { - $this->_user->delLoggedInUser(); - return true; - } - - /** - * Returns identity URL of current logged in user or false - * - * @return mixed - */ - public function getLoggedInUser() { - return $this->_user->getLoggedInUser(); - } - - /** - * Retrieve consumer's root URL from request query. - * Returns URL or false in case of failure - * - * @param array $params query arguments - * @return mixed - */ - public function getSiteRoot($params) - { - $version = 1.1; - if (isset($params['openid_ns']) && - $params['openid_ns'] == Zend_OpenId::NS_2_0) { - $version = 2.0; - } - if ($version >= 2.0 && isset($params['openid_realm'])) { - $root = $params['openid_realm']; - } else if ($version < 2.0 && isset($params['openid_trust_root'])) { - $root = $params['openid_trust_root']; - } else if (isset($params['openid_return_to'])) { - $root = $params['openid_return_to']; - } else { - return false; - } - if (Zend_OpenId::normalizeUrl($root) && !empty($root)) { - return $root; - } - return false; - } - - /** - * Allows consumer with given root URL to authenticate current logged - * in user. Returns true on success and false on error. - * - * @param string $root root URL - * @param mixed $extensions extension object or array of extensions objects - * @return bool - */ - public function allowSite($root, $extensions=null) - { - $id = $this->getLoggedInUser(); - if ($id === false) { - return false; - } - if ($extensions !== null) { - $data = array(); - Zend_OpenId_Extension::forAll($extensions, 'getTrustData', $data); - } else { - $data = true; - } - $this->_storage->addSite($id, $root, $data); - return true; - } - - /** - * Prohibit consumer with given root URL to authenticate current logged - * in user. Returns true on success and false on error. - * - * @param string $root root URL - * @return bool - */ - public function denySite($root) - { - $id = $this->getLoggedInUser(); - if ($id === false) { - return false; - } - $this->_storage->addSite($id, $root, false); - return true; - } - - /** - * Delete consumer with given root URL from known sites of current logged - * in user. Next time this consumer will try to authenticate the user, - * Provider will ask user's confirmation. - * Returns true on success and false on error. - * - * @param string $root root URL - * @return bool - */ - public function delSite($root) - { - $id = $this->getLoggedInUser(); - if ($id === false) { - return false; - } - $this->_storage->addSite($id, $root, null); - return true; - } - - /** - * Returns list of known consumers for current logged in user or false - * if he is not logged in. - * - * @return mixed - */ - public function getTrustedSites() - { - $id = $this->getLoggedInUser(); - if ($id === false) { - return false; - } - return $this->_storage->getTrustedSites($id); - } - - /** - * Handles HTTP request from consumer - * - * @param array $params GET or POST variables. If this parameter is omited - * or set to null, then $_GET or $_POST superglobal variable is used - * according to REQUEST_METHOD. - * @param mixed $extensions extension object or array of extensions objects - * @param Zend_Controller_Response_Abstract $response an optional response - * object to perform HTTP or HTML form redirection - * @return mixed - */ - public function handle($params=null, $extensions=null, - Zend_Controller_Response_Abstract $response = null) - { - if ($params === null) { - if ($_SERVER["REQUEST_METHOD"] == "GET") { - $params = $_GET; - } else if ($_SERVER["REQUEST_METHOD"] == "POST") { - $params = $_POST; - } else { - return false; - } - } - $version = 1.1; - if (isset($params['openid_ns']) && - $params['openid_ns'] == Zend_OpenId::NS_2_0) { - $version = 2.0; - } - if (isset($params['openid_mode'])) { - if ($params['openid_mode'] == 'associate') { - $response = $this->_associate($version, $params); - $ret = ''; - foreach ($response as $key => $val) { - $ret .= $key . ':' . $val . "\n"; - } - return $ret; - } else if ($params['openid_mode'] == 'checkid_immediate') { - $ret = $this->_checkId($version, $params, 1, $extensions, $response); - if (is_bool($ret)) return $ret; - if (!empty($params['openid_return_to'])) { - Zend_OpenId::redirect($params['openid_return_to'], $ret, $response); - } - return true; - } else if ($params['openid_mode'] == 'checkid_setup') { - $ret = $this->_checkId($version, $params, 0, $extensions, $response); - if (is_bool($ret)) return $ret; - if (!empty($params['openid_return_to'])) { - Zend_OpenId::redirect($params['openid_return_to'], $ret, $response); - } - return true; - } else if ($params['openid_mode'] == 'check_authentication') { - $response = $this->_checkAuthentication($version, $params); - $ret = ''; - foreach ($response as $key => $val) { - $ret .= $key . ':' . $val . "\n"; - } - return $ret; - } - } - return false; - } - - /** - * Generates a secret key for given hash function, returns RAW key or false - * if function is not supported - * - * @param string $func hash function (sha1 or sha256) - * @return mixed - */ - protected function _genSecret($func) - { - if ($func == 'sha1') { - $macLen = 20; /* 160 bit */ - } else if ($func == 'sha256') { - $macLen = 32; /* 256 bit */ - } else { - return false; - } - return Zend_OpenId::randomBytes($macLen); - } - - /** - * Processes association request from OpenID consumerm generates secret - * shared key and send it back using Diffie-Hellman encruption. - * Returns array of variables to push back to consumer. - * - * @param float $version OpenID version - * @param array $params GET or POST request variables - * @return array - */ - protected function _associate($version, $params) - { - $ret = array(); - - if ($version >= 2.0) { - $ret['ns'] = Zend_OpenId::NS_2_0; - } - - if (isset($params['openid_assoc_type']) && - $params['openid_assoc_type'] == 'HMAC-SHA1') { - $macFunc = 'sha1'; - } else if (isset($params['openid_assoc_type']) && - $params['openid_assoc_type'] == 'HMAC-SHA256' && - $version >= 2.0) { - $macFunc = 'sha256'; - } else { - $ret['error'] = 'Wrong "openid.assoc_type"'; - $ret['error-code'] = 'unsupported-type'; - return $ret; - } - - $ret['assoc_type'] = $params['openid_assoc_type']; - - $secret = $this->_genSecret($macFunc); - - if (empty($params['openid_session_type']) || - $params['openid_session_type'] == 'no-encryption') { - $ret['mac_key'] = base64_encode($secret); - } else if (isset($params['openid_session_type']) && - $params['openid_session_type'] == 'DH-SHA1') { - $dhFunc = 'sha1'; - } else if (isset($params['openid_session_type']) && - $params['openid_session_type'] == 'DH-SHA256' && - $version >= 2.0) { - $dhFunc = 'sha256'; - } else { - $ret['error'] = 'Wrong "openid.session_type"'; - $ret['error-code'] = 'unsupported-type'; - return $ret; - } - - if (isset($params['openid_session_type'])) { - $ret['session_type'] = $params['openid_session_type']; - } - - if (isset($dhFunc)) { - if (empty($params['openid_dh_consumer_public'])) { - $ret['error'] = 'Wrong "openid.dh_consumer_public"'; - return $ret; - } - if (empty($params['openid_dh_gen'])) { - $g = pack('H*', Zend_OpenId::DH_G); - } else { - $g = base64_decode($params['openid_dh_gen']); - } - if (empty($params['openid_dh_modulus'])) { - $p = pack('H*', Zend_OpenId::DH_P); - } else { - $p = base64_decode($params['openid_dh_modulus']); - } - - $dh = Zend_OpenId::createDhKey($p, $g); - $dh_details = Zend_OpenId::getDhKeyDetails($dh); - - $sec = Zend_OpenId::computeDhSecret( - base64_decode($params['openid_dh_consumer_public']), $dh); - if ($sec === false) { - $ret['error'] = 'Wrong "openid.session_type"'; - $ret['error-code'] = 'unsupported-type'; - return $ret; - } - $sec = Zend_OpenId::digest($dhFunc, $sec); - $ret['dh_server_public'] = base64_encode( - Zend_OpenId::btwoc($dh_details['pub_key'])); - $ret['enc_mac_key'] = base64_encode($secret ^ $sec); - } - - $handle = uniqid(); - $expiresIn = $this->_sessionTtl; - - $ret['assoc_handle'] = $handle; - $ret['expires_in'] = $expiresIn; - - $this->_storage->addAssociation($handle, - $macFunc, $secret, time() + $expiresIn); - - return $ret; - } - - /** - * Performs authentication (or authentication check). - * - * @param float $version OpenID version - * @param array $params GET or POST request variables - * @param bool $immediate enables or disables interaction with user - * @param mixed $extensions extension object or array of extensions objects - * @param Zend_Controller_Response_Abstract $response - * @return array - */ - protected function _checkId($version, $params, $immediate, $extensions=null, - Zend_Controller_Response_Abstract $response = null) - { - $ret = array(); - - if ($version >= 2.0) { - $ret['openid.ns'] = Zend_OpenId::NS_2_0; - } - $root = $this->getSiteRoot($params); - if ($root === false) { - return false; - } - - if (isset($params['openid_identity']) && - !$this->_storage->hasUser($params['openid_identity'])) { - $ret['openid.mode'] = ($immediate && $version >= 2.0) ? 'setup_needed': 'cancel'; - return $ret; - } - - /* Check if user already logged in into the server */ - if (!isset($params['openid_identity']) || - $this->_user->getLoggedInUser() !== $params['openid_identity']) { - $params2 = array(); - foreach ($params as $key => $val) { - if (strpos($key, 'openid_ns_') === 0) { - $key = 'openid.ns.' . substr($key, strlen('openid_ns_')); - } else if (strpos($key, 'openid_sreg_') === 0) { - $key = 'openid.sreg.' . substr($key, strlen('openid_sreg_')); - } else if (strpos($key, 'openid_') === 0) { - $key = 'openid.' . substr($key, strlen('openid_')); - } - $params2[$key] = $val; - } - if ($immediate) { - $params2['openid.mode'] = 'checkid_setup'; - $ret['openid.mode'] = ($version >= 2.0) ? 'setup_needed': 'id_res'; - $ret['openid.user_setup_url'] = $this->_loginUrl - . (strpos($this->_loginUrl, '?') === false ? '?' : '&') - . Zend_OpenId::paramsToQuery($params2); - return $ret; - } else { - /* Redirect to Server Login Screen */ - Zend_OpenId::redirect($this->_loginUrl, $params2, $response); - return true; - } - } - - if (!Zend_OpenId_Extension::forAll($extensions, 'parseRequest', $params)) { - $ret['openid.mode'] = ($immediate && $version >= 2.0) ? 'setup_needed': 'cancel'; - return $ret; - } - - /* Check if user trusts to the consumer */ - $trusted = null; - $sites = $this->_storage->getTrustedSites($params['openid_identity']); - if (isset($params['openid_return_to'])) { - $root = $params['openid_return_to']; - } - if (isset($sites[$root])) { - $trusted = $sites[$root]; - } else { - foreach ($sites as $site => $t) { - if (strpos($root, $site) === 0) { - $trusted = $t; - break; - } else { - /* OpenID 2.0 (9.2) check for realm wild-card matching */ - $n = strpos($site, '://*.'); - if ($n != false) { - $regex = '/^' - . preg_quote(substr($site, 0, $n+3), '/') - . '[A-Za-z1-9_\.]+?' - . preg_quote(substr($site, $n+4), '/') - . '/'; - if (preg_match($regex, $root)) { - $trusted = $t; - break; - } - } - } - } - } - - if (is_array($trusted)) { - if (!Zend_OpenId_Extension::forAll($extensions, 'checkTrustData', $trusted)) { - $trusted = null; - } - } - - if ($trusted === false) { - $ret['openid.mode'] = 'cancel'; - return $ret; - } else if ($trusted === null) { - /* Redirect to Server Trust Screen */ - $params2 = array(); - foreach ($params as $key => $val) { - if (strpos($key, 'openid_ns_') === 0) { - $key = 'openid.ns.' . substr($key, strlen('openid_ns_')); - } else if (strpos($key, 'openid_sreg_') === 0) { - $key = 'openid.sreg.' . substr($key, strlen('openid_sreg_')); - } else if (strpos($key, 'openid_') === 0) { - $key = 'openid.' . substr($key, strlen('openid_')); - } - $params2[$key] = $val; - } - if ($immediate) { - $params2['openid.mode'] = 'checkid_setup'; - $ret['openid.mode'] = ($version >= 2.0) ? 'setup_needed': 'id_res'; - $ret['openid.user_setup_url'] = $this->_trustUrl - . (strpos($this->_trustUrl, '?') === false ? '?' : '&') - . Zend_OpenId::paramsToQuery($params2); - return $ret; - } else { - Zend_OpenId::redirect($this->_trustUrl, $params2, $response); - return true; - } - } - - return $this->_respond($version, $ret, $params, $extensions); - } - - /** - * Perepares information to send back to consumer's authentication request, - * signs it using shared secret and send back through HTTP redirection - * - * @param array $params GET or POST request variables - * @param mixed $extensions extension object or array of extensions objects - * @param Zend_Controller_Response_Abstract $response an optional response - * object to perform HTTP or HTML form redirection - * @return bool - */ - public function respondToConsumer($params, $extensions=null, - Zend_Controller_Response_Abstract $response = null) - { - $version = 1.1; - if (isset($params['openid_ns']) && - $params['openid_ns'] == Zend_OpenId::NS_2_0) { - $version = 2.0; - } - $ret = array(); - if ($version >= 2.0) { - $ret['openid.ns'] = Zend_OpenId::NS_2_0; - } - $ret = $this->_respond($version, $ret, $params, $extensions); - if (!empty($params['openid_return_to'])) { - Zend_OpenId::redirect($params['openid_return_to'], $ret, $response); - } - return true; - } - - /** - * Perepares information to send back to consumer's authentication request - * and signs it using shared secret. - * - * @param float $version OpenID protcol version - * @param array $ret arguments to be send back to consumer - * @param array $params GET or POST request variables - * @param mixed $extensions extension object or array of extensions objects - * @return array - */ - protected function _respond($version, $ret, $params, $extensions=null) - { - if (empty($params['openid_assoc_handle']) || - !$this->_storage->getAssociation($params['openid_assoc_handle'], - $macFunc, $secret, $expires)) { - /* Use dumb mode */ - if (!empty($params['openid_assoc_handle'])) { - $ret['openid.invalidate_handle'] = $params['openid_assoc_handle']; - } - $macFunc = $version >= 2.0 ? 'sha256' : 'sha1'; - $secret = $this->_genSecret($macFunc); - $handle = uniqid(); - $expiresIn = $this->_sessionTtl; - $this->_storage->addAssociation($handle, - $macFunc, $secret, time() + $expiresIn); - $ret['openid.assoc_handle'] = $handle; - } else { - $ret['openid.assoc_handle'] = $params['openid_assoc_handle']; - } - if (isset($params['openid_return_to'])) { - $ret['openid.return_to'] = $params['openid_return_to']; - } - if (isset($params['openid_claimed_id'])) { - $ret['openid.claimed_id'] = $params['openid_claimed_id']; - } - if (isset($params['openid_identity'])) { - $ret['openid.identity'] = $params['openid_identity']; - } - - if ($version >= 2.0) { - if (!empty($this->_opEndpoint)) { - $ret['openid.op_endpoint'] = $this->_opEndpoint; - } else { - $ret['openid.op_endpoint'] = Zend_OpenId::selfUrl(); - } - } - $ret['openid.response_nonce'] = gmdate('Y-m-d\TH:i:s\Z') . uniqid(); - $ret['openid.mode'] = 'id_res'; - - Zend_OpenId_Extension::forAll($extensions, 'prepareResponse', $ret); - - $signed = ''; - $data = ''; - foreach ($ret as $key => $val) { - if (strpos($key, 'openid.') === 0) { - $key = substr($key, strlen('openid.')); - if (!empty($signed)) { - $signed .= ','; - } - $signed .= $key; - $data .= $key . ':' . $val . "\n"; - } - } - $signed .= ',signed'; - $data .= 'signed:' . $signed . "\n"; - $ret['openid.signed'] = $signed; - - $ret['openid.sig'] = base64_encode( - Zend_OpenId::hashHmac($macFunc, $data, $secret)); - - return $ret; - } - - /** - * Performs authentication validation for dumb consumers - * Returns array of variables to push back to consumer. - * It MUST contain 'is_valid' variable with value 'true' or 'false'. - * - * @param float $version OpenID version - * @param array $params GET or POST request variables - * @return array - */ - protected function _checkAuthentication($version, $params) - { - $ret = array(); - if ($version >= 2.0) { - $ret['ns'] = Zend_OpenId::NS_2_0; - } - $ret['openid.mode'] = 'id_res'; - - if (empty($params['openid_assoc_handle']) || - empty($params['openid_signed']) || - empty($params['openid_sig']) || - !$this->_storage->getAssociation($params['openid_assoc_handle'], - $macFunc, $secret, $expires)) { - $ret['is_valid'] = 'false'; - return $ret; - } - - $signed = explode(',', $params['openid_signed']); - $data = ''; - foreach ($signed as $key) { - $data .= $key . ':'; - if ($key == 'mode') { - $data .= "id_res\n"; - } else { - $data .= $params['openid_' . strtr($key,'.','_')]."\n"; - } - } - if ($this->_secureStringCompare(base64_decode($params['openid_sig']), - Zend_OpenId::hashHmac($macFunc, $data, $secret))) { - $ret['is_valid'] = 'true'; - } else { - $ret['is_valid'] = 'false'; - } - return $ret; - } - - /** - * Securely compare two strings for equality while avoided C level memcmp() - * optimisations capable of leaking timing information useful to an attacker - * attempting to iteratively guess the unknown string (e.g. password) being - * compared against. - * - * @param string $a - * @param string $b - * @return bool - */ - protected function _secureStringCompare($a, $b) - { - if (strlen($a) !== strlen($b)) { - return false; - } - $result = 0; - for ($i = 0; $i < strlen($a); $i++) { - $result |= ord($a[$i]) ^ ord($b[$i]); - } - return $result == 0; - } -} diff --git a/library/vendor/Zend/OpenId/Provider/Storage.php b/library/vendor/Zend/OpenId/Provider/Storage.php deleted file mode 100644 index f9bbb1703..000000000 --- a/library/vendor/Zend/OpenId/Provider/Storage.php +++ /dev/null @@ -1,106 +0,0 @@ -_dir = $dir; - if (!is_dir($this->_dir)) { - if (!@mkdir($this->_dir, 0700, 1)) { - throw new Zend_OpenId_Exception( - "Cannot access storage directory $dir", - Zend_OpenId_Exception::ERROR_STORAGE); - } - } - if (($f = fopen($this->_dir.'/assoc.lock', 'w+')) === null) { - throw new Zend_OpenId_Exception( - 'Cannot create a lock file in the directory ' . $dir, - Zend_OpenId_Exception::ERROR_STORAGE); - } - fclose($f); - if (($f = fopen($this->_dir.'/user.lock', 'w+')) === null) { - throw new Zend_OpenId_Exception( - 'Cannot create a lock file in the directory ' . $dir, - Zend_OpenId_Exception::ERROR_STORAGE); - } - fclose($f); - } - - /** - * Stores information about session identified by $handle - * - * @param string $handle assiciation handle - * @param string $macFunc HMAC function (sha1 or sha256) - * @param string $secret shared secret - * @param string $expires expiration UNIX time - * @return bool - */ - public function addAssociation($handle, $macFunc, $secret, $expires) - { - $name = $this->_dir . '/assoc_' . md5($handle); - $lock = @fopen($this->_dir . '/assoc.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'w+'); - if ($f === false) { - fclose($lock); - return false; - } - $data = serialize(array($handle, $macFunc, $secret, $expires)); - fwrite($f, $data); - fclose($f); - fclose($lock); - return true; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Gets information about association identified by $handle - * Returns true if given association found and not expired and false - * otherwise - * - * @param string $handle assiciation handle - * @param string &$macFunc HMAC function (sha1 or sha256) - * @param string &$secret shared secret - * @param string &$expires expiration UNIX time - * @return bool - */ - public function getAssociation($handle, &$macFunc, &$secret, &$expires) - { - $name = $this->_dir . '/assoc_' . md5($handle); - $lock = @fopen($this->_dir . '/assoc.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'r'); - if ($f === false) { - fclose($lock); - return false; - } - $ret = false; - $data = stream_get_contents($f); - if (!empty($data)) { - list($storedHandle, $macFunc, $secret, $expires) = unserialize($data); - if ($handle === $storedHandle && $expires > time()) { - $ret = true; - } else { - fclose($f); - @unlink($name); - fclose($lock); - return false; - } - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Removes information about association identified by $handle - * - * @param string $handle assiciation handle - * @return bool - */ - public function delAssociation($handle) - { - $name = $this->_dir . '/assoc_' . md5($handle); - $lock = @fopen($this->_dir . '/assoc.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - @unlink($name); - fclose($lock); - return true; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Register new user with given $id and $password - * Returns true in case of success and false if user with given $id already - * exists - * - * @param string $id user identity URL - * @param string $password encoded user password - * @return bool - */ - public function addUser($id, $password) - { - $name = $this->_dir . '/user_' . md5($id); - $lock = @fopen($this->_dir . '/user.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'x'); - if ($f === false) { - fclose($lock); - return false; - } - $data = serialize(array($id, $password, array())); - fwrite($f, $data); - fclose($f); - fclose($lock); - return true; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Returns true if user with given $id exists and false otherwise - * - * @param string $id user identity URL - * @return bool - */ - public function hasUser($id) - { - $name = $this->_dir . '/user_' . md5($id); - $lock = @fopen($this->_dir . '/user.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_SH)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'r'); - if ($f === false) { - fclose($lock); - return false; - } - $ret = false; - $data = stream_get_contents($f); - if (!empty($data)) { - list($storedId, $storedPassword, $trusted) = unserialize($data); - if ($id === $storedId) { - $ret = true; - } - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Verify if user with given $id exists and has specified $password - * - * @param string $id user identity URL - * @param string $password user password - * @return bool - */ - public function checkUser($id, $password) - { - $name = $this->_dir . '/user_' . md5($id); - $lock = @fopen($this->_dir . '/user.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_SH)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'r'); - if ($f === false) { - fclose($lock); - return false; - } - $ret = false; - $data = stream_get_contents($f); - if (!empty($data)) { - list($storedId, $storedPassword, $trusted) = unserialize($data); - if ($id === $storedId && $password === $storedPassword) { - $ret = true; - } - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Removes information abou specified user - * - * @param string $id user identity URL - * @return bool - */ - public function delUser($id) - { - $name = $this->_dir . '/user_' . md5($id); - $lock = @fopen($this->_dir . '/user.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - @unlink($name); - fclose($lock); - return true; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Returns array of all trusted/untrusted sites for given user identified - * by $id - * - * @param string $id user identity URL - * @return array - */ - public function getTrustedSites($id) - { - $name = $this->_dir . '/user_' . md5($id); - $lock = @fopen($this->_dir . '/user.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_SH)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'r'); - if ($f === false) { - fclose($lock); - return false; - } - $ret = false; - $data = stream_get_contents($f); - if (!empty($data)) { - list($storedId, $storedPassword, $trusted) = unserialize($data); - if ($id === $storedId) { - $ret = $trusted; - } - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } - - /** - * Stores information about trusted/untrusted site for given user - * - * @param string $id user identity URL - * @param string $site site URL - * @param mixed $trusted trust data from extension or just a boolean value - * @return bool - */ - public function addSite($id, $site, $trusted) - { - $name = $this->_dir . '/user_' . md5($id); - $lock = @fopen($this->_dir . '/user.lock', 'w+'); - if ($lock === false) { - return false; - } - if (!flock($lock, LOCK_EX)) { - fclose($lock); - return false; - } - try { - $f = @fopen($name, 'r+'); - if ($f === false) { - fclose($lock); - return false; - } - $ret = false; - $data = stream_get_contents($f); - if (!empty($data)) { - list($storedId, $storedPassword, $sites) = unserialize($data); - if ($id === $storedId) { - if ($trusted === null) { - unset($sites[$site]); - } else { - $sites[$site] = $trusted; - } - rewind($f); - ftruncate($f, 0); - $data = serialize(array($id, $storedPassword, $sites)); - fwrite($f, $data); - $ret = true; - } - } - fclose($f); - fclose($lock); - return $ret; - } catch (Exception $e) { - fclose($lock); - throw $e; - } - } -} diff --git a/library/vendor/Zend/OpenId/Provider/User.php b/library/vendor/Zend/OpenId/Provider/User.php deleted file mode 100644 index 458c3d4a2..000000000 --- a/library/vendor/Zend/OpenId/Provider/User.php +++ /dev/null @@ -1,57 +0,0 @@ -_session = new Zend_Session_Namespace("openid"); - } else { - $this->_session = $session; - } - } - - /** - * Stores information about logged in user in session data - * - * @param string $id user identity URL - * @return bool - */ - public function setLoggedInUser($id) - { - $this->_session->logged_in = $id; - return true; - } - - /** - * Returns identity URL of logged in user or false - * - * @return mixed - */ - public function getLoggedInUser() - { - if (isset($this->_session->logged_in)) { - return $this->_session->logged_in; - } - return false; - } - - /** - * Performs logout. Clears information about logged in user. - * - * @return bool - */ - public function delLoggedInUser() - { - unset($this->_session->logged_in); - return true; - } - -} diff --git a/library/vendor/Zend/ProgressBar/Adapter/Console.php b/library/vendor/Zend/ProgressBar/Adapter/Console.php deleted file mode 100644 index 2c7c2f15d..000000000 --- a/library/vendor/Zend/ProgressBar/Adapter/Console.php +++ /dev/null @@ -1,527 +0,0 @@ -_width === null) { - $this->setWidth(); - } - } - - /** - * Close local stdout, when open - */ - public function __destruct() - { - if ($this->_outputStream !== null) { - fclose($this->_outputStream); - } - } - - /** - * Set a different output-stream - * - * @param string $resource - * @return Zend_ProgressBar_Adapter_Console - */ - public function setOutputStream($resource) - { - $stream = @fopen($resource, 'w'); - - if ($stream === false) { - throw new Zend_ProgressBar_Adapter_Exception('Unable to open stream'); - } - - if ($this->_outputStream !== null) { - fclose($this->_outputStream); - } - - $this->_outputStream = $stream; - } - - /** - * Get the current output stream - * - * @return resource - */ - public function getOutputStream() - { - if ($this->_outputStream === null) { - if (!defined('STDOUT')) { - $this->_outputStream = fopen('php://stdout', 'w'); - } else { - return STDOUT; - } - } - - return $this->_outputStream; - } - - /** - * Set the width of the progressbar - * - * @param integer $width - * @return Zend_ProgressBar_Adapter_Console - */ - public function setWidth($width = null) - { - if ($width === null || !is_integer($width)) { - if (substr(PHP_OS, 0, 3) === 'WIN') { - // We have to default to 79 on windows, because the windows - // terminal always has a fixed width of 80 characters and the - // cursor is counted to the line, else windows would line break - // after every update. - $this->_width = 79; - } else { - // Set the default width of 80 - $this->_width = 80; - - // Try to determine the width through stty - if (preg_match('#\d+ (\d+)#', @shell_exec('stty size'), $match) === 1) { - $this->_width = (int) $match[1]; - } else if (preg_match('#columns = (\d+);#', @shell_exec('stty'), $match) === 1) { - $this->_width = (int) $match[1]; - } - } - } else { - $this->_width = (int) $width; - } - - $this->_calculateBarWidth(); - - return $this; - } - - /** - * Set the elements to display with the progressbar - * - * @param array $elements - * @throws Zend_ProgressBar_Adapter_Exception When an invalid element is foudn in the array - * @return Zend_ProgressBar_Adapter_Console - */ - public function setElements(array $elements) - { - $allowedElements = array(self::ELEMENT_PERCENT, - self::ELEMENT_BAR, - self::ELEMENT_ETA, - self::ELEMENT_TEXT); - - if (count(array_diff($elements, $allowedElements)) > 0) { - throw new Zend_ProgressBar_Adapter_Exception('Invalid element found in $elements array'); - } - - $this->_elements = $elements; - - $this->_calculateBarWidth(); - - return $this; - } - - /** - * Set the left-hand character for the bar - * - * @param string $char - * @throws Zend_ProgressBar_Adapter_Exception When character is empty - * @return Zend_ProgressBar_Adapter_Console - */ - public function setBarLeftChar($char) - { - if (empty($char)) { - throw new Zend_ProgressBar_Adapter_Exception('Character may not be empty'); - } - - $this->_barLeftChar = (string) $char; - - return $this; - } - - /** - * Set the right-hand character for the bar - * - * @param string $char - * @throws Zend_ProgressBar_Adapter_Exception When character is empty - * @return Zend_ProgressBar_Adapter_Console - */ - public function setBarRightChar($char) - { - if (empty($char)) { - throw new Zend_ProgressBar_Adapter_Exception('Character may not be empty'); - } - - $this->_barRightChar = (string) $char; - - return $this; - } - - /** - * Set the indicator character for the bar - * - * @param string $char - * @return Zend_ProgressBar_Adapter_Console - */ - public function setBarIndicatorChar($char) - { - $this->_barIndicatorChar = (string) $char; - - return $this; - } - - /** - * Set the width of the text element - * - * @param integer $width - * @return Zend_ProgressBar_Adapter_Console - */ - public function setTextWidth($width) - { - $this->_textWidth = (int) $width; - - $this->_calculateBarWidth(); - - return $this; - } - - /** - * Set the charset of the text element - * - * @param string $charset - */ - public function setCharset($charset) - { - $this->_charset = $charset; - } - - /** - * Set the finish action - * - * @param string $action - * @throws Zend_ProgressBar_Adapter_Exception When an invalid action is specified - * @return Zend_ProgressBar_Adapter_Console - */ - public function setFinishAction($action) - { - $allowedActions = array(self::FINISH_ACTION_CLEAR_LINE, - self::FINISH_ACTION_EOL, - self::FINISH_ACTION_NONE); - - if (!in_array($action, $allowedActions)) { - throw new Zend_ProgressBar_Adapter_Exception('Invalid finish action specified'); - } - - $this->_finishAction = $action; - - return $this; - } - - /** - * Defined by Zend_ProgressBar_Adapter_Interface - * - * @param float $current Current progress value - * @param float $max Max progress value - * @param float $percent Current percent value - * @param integer $timeTaken Taken time in seconds - * @param integer $timeRemaining Remaining time in seconds - * @param string $text Status text - * @return void - */ - public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text) - { - // See if we must clear the line - if ($this->_outputStarted) { - $data = str_repeat("\x08", $this->_width); - } else { - $data = ''; - $this->_outputStarted = true; - } - - // Build all elements - $renderedElements = array(); - - foreach ($this->_elements as $element) { - switch ($element) { - case self::ELEMENT_BAR: - $visualWidth = $this->_barWidth - 2; - $bar = '['; - - $indicatorWidth = strlen($this->_barIndicatorChar); - - $doneWidth = min($visualWidth - $indicatorWidth, round($visualWidth * $percent)); - if ($doneWidth > 0) { - $bar .= substr(str_repeat($this->_barLeftChar, ceil($doneWidth / strlen($this->_barLeftChar))), 0, $doneWidth); - } - - $bar .= $this->_barIndicatorChar; - - $leftWidth = $visualWidth - $doneWidth - $indicatorWidth; - if ($leftWidth > 0) { - $bar .= substr(str_repeat($this->_barRightChar, ceil($leftWidth / strlen($this->_barRightChar))), 0, $leftWidth); - } - - $bar .= ']'; - - $renderedElements[] = $bar; - break; - - case self::ELEMENT_PERCENT: - $renderedElements[] = str_pad(round($percent * 100), 3, ' ', STR_PAD_LEFT) . '%'; - break; - - case self::ELEMENT_ETA: - // In the first 5 seconds we don't get accurate results, - // this skipping technique is found in many progressbar - // implementations. - if ($timeTaken < 5) { - $renderedElements[] = str_repeat(' ', 12); - break; - } - - if ($timeRemaining === null || $timeRemaining > 86400) { - $etaFormatted = '??:??:??'; - } else { - $hours = floor($timeRemaining / 3600); - $minutes = floor(($timeRemaining % 3600) / 60); - $seconds = ($timeRemaining % 3600 % 60); - - $etaFormatted = sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds); - } - - $renderedElements[] = 'ETA ' . $etaFormatted; - break; - - case self::ELEMENT_TEXT: - $renderedElements[] = Zend_Text_MultiByte::strPad(substr($text, 0, $this->_textWidth), $this->_textWidth, ' ', STR_PAD_RIGHT, $this->_charset); - break; - } - } - - $data .= implode(' ', $renderedElements); - - // Output line data - $this->_outputData($data); - } - - /** - * Defined by Zend_ProgressBar_Adapter_Interface - * - * @return void - */ - public function finish() - { - switch ($this->_finishAction) { - case self::FINISH_ACTION_EOL: - $this->_outputData(PHP_EOL); - break; - - case self::FINISH_ACTION_CLEAR_LINE: - if ($this->_outputStarted) { - $data = str_repeat("\x08", $this->_width) - . str_repeat(' ', $this->_width) - . str_repeat("\x08", $this->_width); - - $this->_outputData($data); - } - break; - - case self::FINISH_ACTION_NONE: - break; - } - } - - /** - * Calculate the bar width when other elements changed - * - * @return void - */ - protected function _calculateBarWidth() - { - if (in_array(self::ELEMENT_BAR, $this->_elements)) { - $barWidth = $this->_width; - - if (in_array(self::ELEMENT_PERCENT, $this->_elements)) { - $barWidth -= 4; - } - - if (in_array(self::ELEMENT_ETA, $this->_elements)) { - $barWidth -= 12; - } - - if (in_array(self::ELEMENT_TEXT, $this->_elements)) { - $barWidth -= $this->_textWidth; - } - - $this->_barWidth = $barWidth - (count($this->_elements) - 1); - } - } - - /** - * Outputs given data to STDOUT. - * - * This split-off is required for unit-testing. - * - * @param string $data - * @return void - */ - protected function _outputData($data) - { - fwrite($this->getOutputStream(), $data); - } -} diff --git a/library/vendor/Zend/Queue.php b/library/vendor/Zend/Queue.php deleted file mode 100644 index f79fc2beb..000000000 --- a/library/vendor/Zend/Queue.php +++ /dev/null @@ -1,560 +0,0 @@ -createQueue(); - * - * @param string|Zend_Queue_Adapter|array|Zend_Config|null String or adapter instance, or options array or Zend_Config instance - * @param Zend_Config|array $options Zend_Config or a configuration array - * @return void - */ - public function __construct($spec, $options = array()) - { - $adapter = null; - if ($spec instanceof Zend_Queue_Adapter_AdapterInterface) { - $adapter = $spec; - } elseif (is_string($spec)) { - $adapter = $spec; - } elseif ($spec instanceof Zend_Config) { - $options = $spec->toArray(); - } elseif (is_array($spec)) { - $options = $spec; - } - - // last minute error checking - if ((null === $adapter) - && (!is_array($options) && (!$options instanceof Zend_Config)) - ) { - throw new Zend_Queue_Exception('No valid params passed to constructor'); - } - - // Now continue as we would if we were a normal constructor - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } elseif (!is_array($options)) { - $options = array(); - } - - // Make sure we have some defaults to work with - if (!isset($options[self::TIMEOUT])) { - $options[self::TIMEOUT] = self::VISIBILITY_TIMEOUT; - } - - // Make sure all defaults are appropriately set. - if (!array_key_exists('timeout', $options)) { - $options[self::TIMEOUT] = self::VISIBILITY_TIMEOUT; - } - if (array_key_exists('messageClass', $options)) { - $this->setMessageClass($options['messageClass']); - } - if (array_key_exists('messageSetClass', $options)) { - $this->setMessageSetClass($options['messageSetClass']); - } - - $this->setOptions($options); - - // if we were passed an adapter we either build the $adapter or use it - if (null !== $adapter) { - $this->setAdapter($adapter); - } - } - - /** - * Set queue options - * - * @param array $options - * @return Zend_Queue - */ - public function setOptions(array $options) - { - $this->_options = array_merge($this->_options, $options); - return $this; - } - - /** - * Set an individual configuration option - * - * @param string $name - * @param mixed $value - * @return Zend_Queue - */ - public function setOption($name, $value) - { - $this->_options[(string) $name] = $value; - return $this; - } - - /** - * Returns the configuration options for the queue - * - * @return array - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Determine if a requested option has been defined - * - * @param string $name - * @return bool - */ - public function hasOption($name) - { - return array_key_exists($name, $this->_options); - } - - /** - * Retrieve a single option - * - * @param string $name - * @return null|mixed Returns null if option does not exist; option value otherwise - */ - public function getOption($name) - { - if ($this->hasOption($name)) { - return $this->_options[$name]; - } - return null; - } - - /** - * Set the adapter for this queue - * - * @param string|Zend_Queue_Adapter_AdapterInterface $adapter - * @return Zend_Queue Provides a fluent interface - */ - public function setAdapter($adapter) - { - if (is_string($adapter)) { - if (null === ($adapterNamespace = $this->getOption('adapterNamespace'))) { - $adapterNamespace = 'Zend_Queue_Adapter'; - } - - $adapterName = str_replace( - ' ', - '_', - ucwords( - str_replace( - '_', - ' ', - strtolower($adapterNamespace . '_' . $adapter) - ) - ) - ); - - if (!class_exists($adapterName)) { - Zend_Loader::loadClass($adapterName); - } - - /* - * Create an instance of the adapter class. - * Pass the configuration to the adapter class constructor. - */ - $adapter = new $adapterName($this->getOptions(), $this); - } - - if (!$adapter instanceof Zend_Queue_Adapter_AdapterInterface) { - throw new Zend_Queue_Exception("Adapter class '" . get_class($adapterName) . "' does not implement Zend_Queue_Adapter_AdapterInterface"); - } - - $this->_adapter = $adapter; - - $this->_adapter->setQueue($this); - - if (null !== ($name = $this->getOption(self::NAME))) { - $this->_setName($name); - } - - return $this; - } - - /** - * Get the adapter for this queue - * - * @return Zend_Queue_Adapter_AdapterInterface - */ - public function getAdapter() - { - return $this->_adapter; - } - - /** - * @param string $className - * @return Zend_Queue Provides a fluent interface - */ - public function setMessageClass($className) - { - $this->_messageClass = (string) $className; - return $this; - } - - /** - * @return string - */ - public function getMessageClass() - { - return $this->_messageClass; - } - - /** - * @param string $className - * @return Zend_Queue Provides a fluent interface - */ - public function setMessageSetClass($className) - { - $this->_messageSetClass = (string) $className; - return $this; - } - - /** - * @return string - */ - public function getMessageSetClass() - { - return $this->_messageSetClass; - } - - /** - * Get the name of the queue - * - * Note: _setName() used to exist, but it caused confusion with createQueue - * Will evaluate later to see if we should add it back in. - * - * @return string - */ - public function getName() - { - return $this->getOption(self::NAME); - } - - /** - * Create a new queue - * - * @param string $name queue name - * @param integer $timeout default visibility timeout - * @return Zend_Queue|false - * @throws Zend_Queue_Exception - */ - public function createQueue($name, $timeout = null) - { - if (!is_string($name)) { - throw new Zend_Queue_Exception('$name is not a string'); - } - - if ((null !== $timeout) && !is_integer($timeout)) { - throw new Zend_Queue_Exception('$timeout must be an integer'); - } - - // Default to standard timeout - if (null === $timeout) { - $timeout = $this->getOption(self::TIMEOUT); - } - - // Some queues allow you to create on the fly, but cannot return - // a list of queues. Stomp protocol for example. - if ($this->isSupported('create')) { - if ($this->getAdapter()->isExists($name)) { - return false; - } - - if (!$this->getAdapter()->create($name, $timeout)) { - return false; - } - } - - $options = array( - self::NAME => $name, - 'timeout' => $timeout - ); - - return new self($this->getAdapter(), $options); - } - - /** - * Delete the queue this object is working on. - * - * This queue is disabled, regardless of the outcome of the deletion - * of the queue, because the programmers intent is to disable this queue. - * - * @return boolean - */ - public function deleteQueue() - { - if ($this->isSupported('delete')) { - $deleted = $this->getAdapter()->delete($this->getName()); - } - else { - $deleted = true; - } - - /** - * @see Zend_Queue_Adapter_Null - */ - $this->setAdapter(new Zend_Queue_Adapter_Null($this->getOptions())); - - return $deleted; - } - - /** - * Delete a message from the queue - * - * Returns true if the message is deleted, false if the deletion is - * unsuccessful. - * - * Returns true if the adapter doesn't support message deletion. - * - * @param Zend_Queue_Message $message - * @return boolean - * @throws Zend_Queue_Exception - */ - public function deleteMessage(Zend_Queue_Message $message) - { - if ($this->getAdapter()->isSupported('deleteMessage')) { - return $this->getAdapter()->deleteMessage($message); - } - return true; - } - - /** - * Send a message to the queue - * - * @param mixed $message message - * @return Zend_Queue_Message - * @throws Zend_Queue_Exception - */ - public function send($message) - { - return $this->getAdapter()->send($message); - } - - /** - * Returns the approximate number of messages in the queue - * - * @return integer - */ - public function count() - { - if ($this->getAdapter()->isSupported('count')) { - return $this->getAdapter()->count(); - } - return 0; - } - - /** - * Return the first element in the queue - * - * @param integer $maxMessages - * @param integer $timeout - * @return Zend_Queue_Message_Iterator - */ - public function receive($maxMessages=null, $timeout=null) - { - if (($maxMessages !== null) && !is_integer($maxMessages)) { - throw new Zend_Queue_Exception('$maxMessages must be an integer or null'); - } - - if (($timeout !== null) && !is_integer($timeout)) { - throw new Zend_Queue_Exception('$timeout must be an integer or null'); - } - - // Default to returning only one message - if ($maxMessages === null) { - $maxMessages = 1; - } - - // Default to standard timeout - if ($timeout === null) { - $timeout = $this->getOption(self::TIMEOUT); - } - - return $this->getAdapter()->receive($maxMessages, $timeout); - } - - /** - * Return a list of queue capabilities functions - * - * $array['function name'] = true or false - * true is supported, false is not supported. - * - * @param string $name - * @return array - */ - public function getCapabilities() - { - return $this->getAdapter()->getCapabilities(); - } - - /** - * Indicates if a function is supported or not. - * - * @param string $name - * @return boolean - */ - public function isSupported($name) - { - $translation = array( - 'deleteQueue' => 'delete', - 'createQueue' => 'create' - ); - - if (isset($translation[$name])) { - $name = $translation[$name]; - } - - return $this->getAdapter()->isSupported($name); - } - - /** - * Get an array of all available queues - * - * @return array - * @throws Zend_Queue_Exception - */ - public function getQueues() - { - if (!$this->isSupported('getQueues')) { - throw new Zend_Queue_Exception( __FUNCTION__ . '() is not supported by ' . get_class($this->getAdapter())); - } - - return $this->getAdapter()->getQueues(); - } - - /** - * Set the name of the queue - * - * This is AN UNSUPPORTED FUNCTION - * - * @param string $name - * @return Zend_Queue|false Provides a fluent interface - */ - protected function _setName($name) - { - if (!is_string($name)) { - /** - * @see Zend_Queue_Exception - */ - throw new Zend_Queue_Exception("$name is not a string"); - } - - if ($this->getAdapter()->isSupported('create')) { - if (!$this->getAdapter()->isExists($name)) { - $timeout = $this->getOption(self::TIMEOUT); - - if (!$this->getAdapter()->create($name, $timeout)) { - // Unable to create the new queue - return false; - } - } - } - - $this->setOption(self::NAME, $name); - - return $this; - } - - /** - * returns a listing of Zend_Queue details. - * useful for debugging - * - * @return array - */ - public function debugInfo() - { - $info = array(); - $info['self'] = get_class($this); - $info['adapter'] = get_class($this->getAdapter()); - foreach ($this->getAdapter()->getCapabilities() as $feature => $supported) { - $info['adapter-' . $feature] = ($supported) ? 'yes' : 'no'; - } - $info['options'] = $this->getOptions(); - $info['options']['driverOptions'] = '[hidden]'; - $info['currentQueue'] = $this->getName(); - $info['messageClass'] = $this->getMessageClass(); - $info['messageSetClass'] = $this->getMessageSetClass(); - - return $info; - } -} diff --git a/library/vendor/Zend/Queue/Adapter/Activemq.php b/library/vendor/Zend/Queue/Adapter/Activemq.php deleted file mode 100644 index 70313fed8..000000000 --- a/library/vendor/Zend/Queue/Adapter/Activemq.php +++ /dev/null @@ -1,354 +0,0 @@ -_options['driverOptions']; - if (!array_key_exists('scheme', $options)) { - $options['scheme'] = self::DEFAULT_SCHEME; - } - if (!array_key_exists('host', $options)) { - $options['host'] = self::DEFAULT_HOST; - } - if (!array_key_exists('port', $options)) { - $options['port'] = self::DEFAULT_PORT; - } - - if (array_key_exists('stompClient', $options)) { - $this->_client = $options['stompClient']; - } else { - $this->_client = new Zend_Queue_Stomp_Client($options['scheme'], $options['host'], $options['port']); - } - - $connect = $this->_client->createFrame(); - - // Username and password are optional on some messaging servers - // such as Apache's ActiveMQ - $connect->setCommand('CONNECT'); - if (isset($options['username'])) { - $connect->setHeader('login', $options['username']); - $connect->setHeader('passcode', $options['password']); - } - - $response = $this->_client->send($connect)->receive(); - - if ((false !== $response) - && ($response->getCommand() != 'CONNECTED') - ) { - throw new Zend_Queue_Exception("Unable to authenticate to '".$options['scheme'].'://'.$options['host'].':'.$options['port']."'"); - } - } - - /** - * Close the socket explicitly when destructed - * - * @return void - */ - public function __destruct() - { - // Gracefully disconnect - $frame = $this->_client->createFrame(); - $frame->setCommand('DISCONNECT'); - $this->_client->send($frame); - unset($this->_client); - } - - /** - * Create a new queue - * - * @param string $name queue name - * @param integer $timeout default visibility timeout - * @return void - * @throws Zend_Queue_Exception - */ - public function create($name, $timeout=null) - { - throw new Zend_Queue_Exception('create() is not supported in ' . get_class($this)); - } - - /** - * Delete a queue and all of its messages - * - * @param string $name queue name - * @return void - * @throws Zend_Queue_Exception - */ - public function delete($name) - { - throw new Zend_Queue_Exception('delete() is not supported in ' . get_class($this)); - } - - /** - * Delete a message from the queue - * - * Returns true if the message is deleted, false if the deletion is - * unsuccessful. - * - * @param Zend_Queue_Message $message - * @return boolean - */ - public function deleteMessage(Zend_Queue_Message $message) - { - $frame = $this->_client->createFrame(); - $frame->setCommand('ACK'); - $frame->setHeader('message-id', $message->handle); - - $this->_client->send($frame); - - return true; - } - - /** - * Get an array of all available queues - * - * @return void - * @throws Zend_Queue_Exception - */ - public function getQueues() - { - throw new Zend_Queue_Exception('getQueues() is not supported in this adapter'); - } - - /** - * Checks if the client is subscribed to the queue - * - * @param Zend_Queue $queue - * @return boolean - */ - protected function _isSubscribed(Zend_Queue $queue) - { - return isset($this->_subscribed[$queue->getName()]); - } - - /** - * Subscribes the client to the queue. - * - * @param Zend_Queue $queue - * @return void - */ - protected function _subscribe(Zend_Queue $queue) - { - $frame = $this->_client->createFrame(); - $frame->setCommand('SUBSCRIBE'); - $frame->setHeader('destination', $queue->getName()); - $frame->setHeader('ack', 'client'); - $this->_client->send($frame); - $this->_subscribed[$queue->getName()] = true; - } - - /** - * Return the first element in the queue - * - * @param integer $maxMessages - * @param integer $timeout - * @param Zend_Queue $queue - * @return Zend_Queue_Message_Iterator - */ - public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null) - { - if ($maxMessages === null) { - $maxMessages = 1; - } - if ($timeout === null) { - $timeout = self::RECEIVE_TIMEOUT_DEFAULT; - } - if ($queue === null) { - $queue = $this->_queue; - } - - // read - $data = array(); - - // signal that we are reading - if (!$this->_isSubscribed($queue)){ - $this->_subscribe($queue); - } - - if ($maxMessages > 0) { - if ($this->_client->canRead()) { - for ($i = 0; $i < $maxMessages; $i++) { - $response = $this->_client->receive(); - - switch ($response->getCommand()) { - case 'MESSAGE': - $datum = array( - 'message_id' => $response->getHeader('message-id'), - 'handle' => $response->getHeader('message-id'), - 'body' => $response->getBody(), - 'md5' => md5($response->getBody()) - ); - $data[] = $datum; - break; - default: - $block = print_r($response, true); - throw new Zend_Queue_Exception('Invalid response received: ' . $block); - } - } - } - } - - $options = array( - 'queue' => $queue, - 'data' => $data, - 'messageClass' => $queue->getMessageClass() - ); - - $classname = $queue->getMessageSetClass(); - - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Push an element onto the end of the queue - * - * @param string $message message to send to the queue - * @param Zend_Queue $queue - * @return Zend_Queue_Message - */ - public function send($message, Zend_Queue $queue=null) - { - if ($queue === null) { - $queue = $this->_queue; - } - - $frame = $this->_client->createFrame(); - $frame->setCommand('SEND'); - $frame->setHeader('destination', $queue->getName()); - $frame->setHeader('content-length', strlen($message)); - $frame->setBody((string) $message); - $this->_client->send($frame); - - $data = array( - 'message_id' => null, - 'body' => $message, - 'md5' => md5($message), - 'handle' => null - ); - - $options = array( - 'queue' => $queue, - 'data' => $data - ); - - $classname = $queue->getMessageClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Returns the length of the queue - * - * @param Zend_Queue $queue - * @return integer - * @throws Zend_Queue_Exception (not supported) - */ - public function count(Zend_Queue $queue=null) - { - throw new Zend_Queue_Exception('count() is not supported in this adapter'); - } - - /** - * Does a queue already exist? - * - * @param string $name - * @return boolean - * @throws Zend_Queue_Exception (not supported) - */ - public function isExists($name) - { - throw new Zend_Queue_Exception('isExists() is not supported in this adapter'); - } - - /** - * Return a list of queue capabilities functions - * - * $array['function name'] = true or false - * true is supported, false is not supported. - * - * @param string $name - * @return array - */ - public function getCapabilities() - { - return array( - 'create' => false, - 'delete' => false, - 'send' => true, - 'receive' => true, - 'deleteMessage' => true, - 'getQueues' => false, - 'count' => false, - 'isExists' => false, - ); - } -} diff --git a/library/vendor/Zend/Queue/Adapter/AdapterAbstract.php b/library/vendor/Zend/Queue/Adapter/AdapterAbstract.php deleted file mode 100644 index c456a83d1..000000000 --- a/library/vendor/Zend/Queue/Adapter/AdapterAbstract.php +++ /dev/null @@ -1,187 +0,0 @@ - (string) Amazon AWS Access Key - * secret_key => (string) Amazon AWS Secret Key - * dbname => (string) The name of the database to user - * username => (string) Connect to the database as this username. - * password => (string) Password associated with the username. - * host => (string) What host to connect to, defaults to localhost - * port => (string) The port of the database - * - * @param array|Zend_Config $config An array having configuration data - * @param Zend_Queue The Zend_Queue object that created this class - * @return void - * @throws Zend_Queue_Exception - */ - public function __construct($options, Zend_Queue $queue = null) - { - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } - - /* - * Verify that adapter parameters are in an array. - */ - if (!is_array($options)) { - throw new Zend_Queue_Exception('Adapter options must be an array or Zend_Config object'); - } - - // set the queue - if ($queue !== null) { - $this->setQueue($queue); - } - - $adapterOptions = array(); - $driverOptions = array(); - - // Normalize the options and merge with the defaults - if (array_key_exists('options', $options)) { - if (!is_array($options['options'])) { - throw new Zend_Queue_Exception("Configuration array 'options' must be an array"); - } - - // Can't use array_merge() because keys might be integers - foreach ($options['options'] as $key => $value) { - $adapterOptions[$key] = $value; - } - } - if (array_key_exists('driverOptions', $options)) { - // can't use array_merge() because keys might be integers - foreach ((array)$options['driverOptions'] as $key => $value) { - $driverOptions[$key] = $value; - } - } - $this->_options = array_merge($this->_options, $options); - $this->_options['options'] = $adapterOptions; - $this->_options['driverOptions'] = $driverOptions; - } - - /******************************************************************** - * Queue management functions - *********************************************************************/ - /** - * get the Zend_Queue class that is attached to this object - * - * @return Zend_Queue|null - */ - public function getQueue() - { - return $this->_queue; - } - - /** - * set the Zend_Queue class for this object - * - * @param Zend_Queue $queue - * @return Zend_Queue_Adapter_AdapterInterface - */ - public function setQueue(Zend_Queue $queue) - { - $this->_queue = $queue; - return $this; - } - - /** - * Returns the configuration options in this adapter. - * - * @return array - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Indicates if a function is supported or not. - * - * @param string $name - * @return boolean - */ - public function isSupported($name) - { - $list = $this->getCapabilities(); - - return (isset($list[$name]) && $list[$name]); - } -} diff --git a/library/vendor/Zend/Queue/Adapter/AdapterInterface.php b/library/vendor/Zend/Queue/Adapter/AdapterInterface.php deleted file mode 100644 index 749c71415..000000000 --- a/library/vendor/Zend/Queue/Adapter/AdapterInterface.php +++ /dev/null @@ -1,174 +0,0 @@ -_data); - } - - /** - * Create a new queue - * - * Visibility timeout is how long a message is left in the queue "invisible" - * to other readers. If the message is acknowleged (deleted) before the - * timeout, then the message is deleted. However, if the timeout expires - * then the message will be made available to other queue readers. - * - * @param string $name queue name - * @param integer $timeout default visibility timeout - * @return boolean - */ - public function create($name, $timeout=null) - { - if ($this->isExists($name)) { - return false; - } - if ($timeout === null) { - $timeout = self::CREATE_TIMEOUT_DEFAULT; - } - $this->_data[$name] = array(); - - return true; - } - - /** - * Delete a queue and all of it's messages - * - * Returns false if the queue is not found, true if the queue exists - * - * @param string $name queue name - * @return boolean - */ - public function delete($name) - { - $found = isset($this->_data[$name]); - - if ($found) { - unset($this->_data[$name]); - } - - return $found; - } - - /** - * Get an array of all available queues - * - * Not all adapters support getQueues(), use isSupported('getQueues') - * to determine if the adapter supports this feature. - * - * @return array - */ - public function getQueues() - { - return array_keys($this->_data); - } - - /** - * Return the approximate number of messages in the queue - * - * @param Zend_Queue $queue - * @return integer - * @throws Zend_Queue_Exception - */ - public function count(Zend_Queue $queue=null) - { - if ($queue === null) { - $queue = $this->_queue; - } - - if (!isset($this->_data[$queue->getName()])) { - /** - * @see Zend_Queue_Exception - */ - throw new Zend_Queue_Exception('Queue does not exist'); - } - - return count($this->_data[$queue->getName()]); - } - - /******************************************************************** - * Messsage management functions - *********************************************************************/ - - /** - * Send a message to the queue - * - * @param string $message Message to send to the active queue - * @param Zend_Queue $queue - * @return Zend_Queue_Message - * @throws Zend_Queue_Exception - */ - public function send($message, Zend_Queue $queue=null) - { - if ($queue === null) { - $queue = $this->_queue; - } - - if (!$this->isExists($queue->getName())) { - throw new Zend_Queue_Exception('Queue does not exist:' . $queue->getName()); - } - - // create the message - $data = array( - 'message_id' => md5(uniqid(rand(), true)), - 'body' => $message, - 'md5' => md5($message), - 'handle' => null, - 'created' => time(), - 'queue_name' => $queue->getName(), - ); - - // add $data to the "queue" - $this->_data[$queue->getName()][] = $data; - - $options = array( - 'queue' => $queue, - 'data' => $data, - ); - - $classname = $queue->getMessageClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Get messages in the queue - * - * @param integer $maxMessages Maximum number of messages to return - * @param integer $timeout Visibility timeout for these messages - * @param Zend_Queue $queue - * @return Zend_Queue_Message_Iterator - */ - public function receive($maxMessages = null, $timeout = null, Zend_Queue $queue = null) - { - if ($maxMessages === null) { - $maxMessages = 1; - } - if ($timeout === null) { - $timeout = self::RECEIVE_TIMEOUT_DEFAULT; - } - if ($queue === null) { - $queue = $this->_queue; - } - - $data = array(); - if ($maxMessages > 0) { - $start_time = microtime(true); - - $count = 0; - $temp = &$this->_data[$queue->getName()]; - foreach ($temp as $key=>&$msg) { - // count check has to be first, as someone can ask for 0 messages - // ZF-7650 - if ($count >= $maxMessages) { - break; - } - - if (($msg['handle'] === null) - || ($msg['timeout'] + $timeout < $start_time) - ) { - $msg['handle'] = md5(uniqid(rand(), true)); - $msg['timeout'] = microtime(true); - $data[] = $msg; - $count++; - } - - } - } - - $options = array( - 'queue' => $queue, - 'data' => $data, - 'messageClass' => $queue->getMessageClass(), - ); - - $classname = $queue->getMessageSetClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Delete a message from the queue - * - * Returns true if the message is deleted, false if the deletion is - * unsuccessful. - * - * @param Zend_Queue_Message $message - * @return boolean - * @throws Zend_Queue_Exception - */ - public function deleteMessage(Zend_Queue_Message $message) - { - // load the queue - $queue = &$this->_data[$message->queue_name]; - - foreach ($queue as $key => &$msg) { - if ($msg['handle'] == $message->handle) { - unset($queue[$key]); - return true; - } - } - - return false; - } - - /******************************************************************** - * Supporting functions - *********************************************************************/ - - /** - * Return a list of queue capabilities functions - * - * $array['function name'] = true or false - * true is supported, false is not supported. - * - * @param string $name - * @return array - */ - public function getCapabilities() - { - return array( - 'create' => true, - 'delete' => true, - 'send' => true, - 'receive' => true, - 'deleteMessage' => true, - 'getQueues' => true, - 'count' => true, - 'isExists' => true, - ); - } - - /******************************************************************** - * Functions that are not part of the Zend_Queue_Adapter_Abstract - *********************************************************************/ - - /** - * serialize - */ - public function __sleep() - { - return array('_data'); - } - - /* - * These functions are debug helpers. - */ - - /** - * returns underlying _data array - * $queue->getAdapter()->getData(); - * - * @return $this; - */ - public function getData() - { - return $this->_data; - } - - /** - * sets the underlying _data array - * $queue->getAdapter()->setData($data); - * - * @param array $data - * @return $this; - */ - public function setData($data) - { - $this->_data = $data; - return $this; - } -} diff --git a/library/vendor/Zend/Queue/Adapter/Db.php b/library/vendor/Zend/Queue/Adapter/Db.php deleted file mode 100644 index ba6c70628..000000000 --- a/library/vendor/Zend/Queue/Adapter/Db.php +++ /dev/null @@ -1,516 +0,0 @@ -_options['options'][Zend_Db_Select::FOR_UPDATE])) { - // turn off auto update by default - $this->_options['options'][Zend_Db_Select::FOR_UPDATE] = false; - } - - if (!is_bool($this->_options['options'][Zend_Db_Select::FOR_UPDATE])) { - throw new Zend_Queue_Exception('Options array item: Zend_Db_Select::FOR_UPDATE must be boolean'); - } - - if (isset($this->_options['dbAdapter']) - && $this->_options['dbAdapter'] instanceof Zend_Db_Adapter_Abstract) { - $db = $this->_options['dbAdapter']; - } else { - $db = $this->_initDbAdapter(); - } - - $this->_queueTable = new Zend_Queue_Adapter_Db_Queue(array( - 'db' => $db, - )); - - $this->_messageTable = new Zend_Queue_Adapter_Db_Message(array( - 'db' => $db, - )); - - } - - /** - * Initialize Db adapter using 'driverOptions' section of the _options array - * - * Throws an exception if the adapter cannot connect to DB. - * - * @return Zend_Db_Adapter_Abstract - * @throws Zend_Queue_Exception - */ - protected function _initDbAdapter() - { - $options = &$this->_options['driverOptions']; - if (!array_key_exists('type', $options)) { - throw new Zend_Queue_Exception("Configuration array must have a key for 'type' for the database type to use"); - } - - if (!array_key_exists('host', $options)) { - throw new Zend_Queue_Exception("Configuration array must have a key for 'host' for the host to use"); - } - - if (!array_key_exists('username', $options)) { - throw new Zend_Queue_Exception("Configuration array must have a key for 'username' for the username to use"); - } - - if (!array_key_exists('password', $options)) { - throw new Zend_Queue_Exception("Configuration array must have a key for 'password' for the password to use"); - } - - if (!array_key_exists('dbname', $options)) { - throw new Zend_Queue_Exception("Configuration array must have a key for 'dbname' for the database to use"); - } - - $type = $options['type']; - unset($options['type']); - - try { - $db = Zend_Db::factory($type, $options); - } catch (Zend_Db_Exception $e) { - throw new Zend_Queue_Exception('Error connecting to database: ' . $e->getMessage(), $e->getCode(), $e); - } - - return $db; - } - - /******************************************************************** - * Queue management functions - *********************************************************************/ - - /** - * Does a queue already exist? - * - * Throws an exception if the adapter cannot determine if a queue exists. - * use isSupported('isExists') to determine if an adapter can test for - * queue existance. - * - * @param string $name - * @return boolean - * @throws Zend_Queue_Exception - */ - public function isExists($name) - { - $id = 0; - - try { - $id = $this->getQueueId($name); - } catch (Zend_Queue_Exception $e) { - return false; - } - - return ($id > 0); - } - - /** - * Create a new queue - * - * Visibility timeout is how long a message is left in the queue "invisible" - * to other readers. If the message is acknowleged (deleted) before the - * timeout, then the message is deleted. However, if the timeout expires - * then the message will be made available to other queue readers. - * - * @param string $name queue name - * @param integer $timeout default visibility timeout - * @return boolean - * @throws Zend_Queue_Exception - database error - */ - public function create($name, $timeout = null) - { - if ($this->isExists($name)) { - return false; - } - - $queue = $this->_queueTable->createRow(); - $queue->queue_name = $name; - $queue->timeout = ($timeout === null) ? self::CREATE_TIMEOUT_DEFAULT : (int)$timeout; - - try { - if ($queue->save()) { - return true; - } - } catch (Exception $e) { - throw new Zend_Queue_Exception($e->getMessage(), $e->getCode(), $e); - } - - return false; - } - - /** - * Delete a queue and all of it's messages - * - * Returns false if the queue is not found, true if the queue exists - * - * @param string $name queue name - * @return boolean - * @throws Zend_Queue_Exception - database error - */ - public function delete($name) - { - $id = $this->getQueueId($name); // get primary key - - // if the queue does not exist then it must already be deleted. - $list = $this->_queueTable->find($id); - if (count($list) === 0) { - return false; - } - $queue = $list->current(); - - if ($queue instanceof Zend_Db_Table_Row_Abstract) { - try { - $queue->delete(); - } catch (Exception $e) { - throw new Zend_Queue_Exception($e->getMessage(), $e->getCode(), $e); - } - } - - if (array_key_exists($name, $this->_queues)) { - unset($this->_queues[$name]); - } - - return true; - } - - /* - * Get an array of all available queues - * - * Not all adapters support getQueues(), use isSupported('getQueues') - * to determine if the adapter supports this feature. - * - * @return array - * @throws Zend_Queue_Exception - database error - */ - public function getQueues() - { - $query = $this->_queueTable->select(); - $query->from($this->_queueTable, array('queue_id', 'queue_name')); - - $this->_queues = array(); - foreach ($this->_queueTable->fetchAll($query) as $queue) { - $this->_queues[$queue->queue_name] = (int)$queue->queue_id; - } - - $list = array_keys($this->_queues); - - return $list; - } - - /** - * Return the approximate number of messages in the queue - * - * @param Zend_Queue $queue - * @return integer - * @throws Zend_Queue_Exception - */ - public function count(Zend_Queue $queue = null) - { - if ($queue === null) { - $queue = $this->_queue; - } - - $info = $this->_messageTable->info(); - $db = $this->_messageTable->getAdapter(); - $query = $db->select(); - $query->from($info['name'], array(new Zend_Db_Expr('COUNT(1)'))) - ->where('queue_id=?', $this->getQueueId($queue->getName())); - - // return count results - return (int) $db->fetchOne($query); - } - - /******************************************************************** - * Messsage management functions - *********************************************************************/ - - /** - * Send a message to the queue - * - * @param string $message Message to send to the active queue - * @param Zend_Queue $queue - * @return Zend_Queue_Message - * @throws Zend_Queue_Exception - database error - */ - public function send($message, Zend_Queue $queue = null) - { - if ($this->_messageRow === null) { - $this->_messageRow = $this->_messageTable->createRow(); - } - - if ($queue === null) { - $queue = $this->_queue; - } - - if (is_scalar($message)) { - $message = (string) $message; - } - if (is_string($message)) { - $message = trim($message); - } - - if (!$this->isExists($queue->getName())) { - throw new Zend_Queue_Exception('Queue does not exist:' . $queue->getName()); - } - - $msg = clone $this->_messageRow; - $msg->queue_id = $this->getQueueId($queue->getName()); - $msg->created = time(); - $msg->body = $message; - $msg->md5 = md5($message); - // $msg->timeout = ??? @TODO - - try { - $msg->save(); - } catch (Exception $e) { - throw new Zend_Queue_Exception($e->getMessage(), $e->getCode(), $e); - } - - $options = array( - 'queue' => $queue, - 'data' => $msg->toArray(), - ); - - $classname = $queue->getMessageClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Get messages in the queue - * - * @param integer $maxMessages Maximum number of messages to return - * @param integer $timeout Visibility timeout for these messages - * @param Zend_Queue $queue - * @return Zend_Queue_Message_Iterator - * @throws Zend_Queue_Exception - database error - */ - public function receive($maxMessages = null, $timeout = null, Zend_Queue $queue = null) - { - if ($maxMessages === null) { - $maxMessages = 1; - } - if ($timeout === null) { - $timeout = self::RECEIVE_TIMEOUT_DEFAULT; - } - if ($queue === null) { - $queue = $this->_queue; - } - - $msgs = array(); - $info = $this->_messageTable->info(); - $microtime = microtime(true); // cache microtime - $db = $this->_messageTable->getAdapter(); - - // start transaction handling - try { - if ( $maxMessages > 0 ) { // ZF-7666 LIMIT 0 clause not included. - $db->beginTransaction(); - - $query = $db->select(); - if ($this->_options['options'][Zend_Db_Select::FOR_UPDATE]) { - // turn on forUpdate - $query->forUpdate(); - } - $query->from($info['name'], array('*')) - ->where('queue_id=?', $this->getQueueId($queue->getName())) - ->where('handle IS NULL OR timeout+' . (int)$timeout . ' < ' . (int)$microtime) - ->limit($maxMessages); - - foreach ($db->fetchAll($query) as $data) { - // setup our changes to the message - $data['handle'] = md5(uniqid(rand(), true)); - - $update = array( - 'handle' => $data['handle'], - 'timeout' => $microtime, - ); - - // update the database - $where = array(); - $where[] = $db->quoteInto('message_id=?', $data['message_id']); - $where[] = 'handle IS NULL OR timeout+' . (int)$timeout . ' < ' . (int)$microtime; - - $count = $db->update($info['name'], $update, $where); - - // we check count to make sure no other thread has gotten - // the rows after our select, but before our update. - if ($count > 0) { - $msgs[] = $data; - } - } - $db->commit(); - } - } catch (Exception $e) { - $db->rollBack(); - - throw new Zend_Queue_Exception($e->getMessage(), $e->getCode(), $e); - } - - $options = array( - 'queue' => $queue, - 'data' => $msgs, - 'messageClass' => $queue->getMessageClass(), - ); - - $classname = $queue->getMessageSetClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Delete a message from the queue - * - * Returns true if the message is deleted, false if the deletion is - * unsuccessful. - * - * @param Zend_Queue_Message $message - * @return boolean - * @throws Zend_Queue_Exception - database error - */ - public function deleteMessage(Zend_Queue_Message $message) - { - $db = $this->_messageTable->getAdapter(); - $where = $db->quoteInto('handle=?', $message->handle); - - if ($this->_messageTable->delete($where)) { - return true; - } - - return false; - } - - /******************************************************************** - * Supporting functions - *********************************************************************/ - - /** - * Return a list of queue capabilities functions - * - * $array['function name'] = true or false - * true is supported, false is not supported. - * - * @param string $name - * @return array - */ - public function getCapabilities() - { - return array( - 'create' => true, - 'delete' => true, - 'send' => true, - 'receive' => true, - 'deleteMessage' => true, - 'getQueues' => true, - 'count' => true, - 'isExists' => true, - ); - } - - /******************************************************************** - * Functions that are not part of the Zend_Queue_Adapter_Abstract - *********************************************************************/ - /** - * Get the queue ID - * - * Returns the queue's row identifier. - * - * @param string $name - * @return integer|null - * @throws Zend_Queue_Exception - */ - protected function getQueueId($name) - { - if (array_key_exists($name, $this->_queues)) { - return $this->_queues[$name]; - } - - $query = $this->_queueTable->select(); - $query->from($this->_queueTable, array('queue_id')) - ->where('queue_name=?', $name); - - $queue = $this->_queueTable->fetchRow($query); - - if ($queue === null) { - throw new Zend_Queue_Exception('Queue does not exist: ' . $name); - } - - $this->_queues[$name] = (int)$queue->queue_id; - - return $this->_queues[$name]; - } -} diff --git a/library/vendor/Zend/Queue/Adapter/Db/Message.php b/library/vendor/Zend/Queue/Adapter/Db/Message.php deleted file mode 100644 index 89f14f478..000000000 --- a/library/vendor/Zend/Queue/Adapter/Db/Message.php +++ /dev/null @@ -1,50 +0,0 @@ -_options['driverOptions']; - - if (!array_key_exists('host', $options)) { - $options['host'] = self::DEFAULT_HOST; - } - if (!array_key_exists('port', $options)) { - $options['port'] = self::DEFAULT_PORT; - } - - $this->_cache = new Memcache(); - - $result = $this->_cache->connect($options['host'], $options['port']); - - if ($result === false) { - throw new Zend_Queue_Exception('Could not connect to MemcacheQ'); - } - - $this->_host = $options['host']; - $this->_port = (int)$options['port']; - } - - /** - * Destructor - * - * @return void - */ - public function __destruct() - { - if ($this->_cache instanceof Memcache) { - $this->_cache->close(); - } - if (is_resource($this->_socket)) { - $cmd = 'quit' . self::EOL; - fwrite($this->_socket, $cmd); - fclose($this->_socket); - } - } - - /******************************************************************** - * Queue management functions - *********************************************************************/ - - /** - * Does a queue already exist? - * - * Throws an exception if the adapter cannot determine if a queue exists. - * use isSupported('isExists') to determine if an adapter can test for - * queue existance. - * - * @param string $name - * @return boolean - * @throws Zend_Queue_Exception - */ - public function isExists($name) - { - if (empty($this->_queues)) { - $this->getQueues(); - } - - return in_array($name, $this->_queues); - } - - /** - * Create a new queue - * - * Visibility timeout is how long a message is left in the queue "invisible" - * to other readers. If the message is acknowleged (deleted) before the - * timeout, then the message is deleted. However, if the timeout expires - * then the message will be made available to other queue readers. - * - * @param string $name queue name - * @param integer $timeout default visibility timeout - * @return boolean - * @throws Zend_Queue_Exception - */ - public function create($name, $timeout=null) - { - if ($this->isExists($name)) { - return false; - } - if ($timeout === null) { - $timeout = self::CREATE_TIMEOUT_DEFAULT; - } - - // MemcacheQ does not have a method to "create" a queue - // queues are created upon sending a packet. - // We cannot use the send() and receive() functions because those - // depend on the current name. - $result = $this->_cache->set($name, 'creating queue', 0, 15); - $result = $this->_cache->get($name); - - $this->_queues[] = $name; - - return true; - } - - /** - * Delete a queue and all of it's messages - * - * Returns false if the queue is not found, true if the queue exists - * - * @param string $name queue name - * @return boolean - * @throws Zend_Queue_Exception - */ - public function delete($name) - { - $response = $this->_sendCommand('delete ' . $name, array('DELETED', 'NOT_FOUND'), true); - - if (in_array('DELETED', $response)) { - $key = array_search($name, $this->_queues); - - if ($key !== false) { - unset($this->_queues[$key]); - } - return true; - } - - return false; - } - - /** - * Get an array of all available queues - * - * Not all adapters support getQueues(), use isSupported('getQueues') - * to determine if the adapter supports this feature. - * - * @return array - * @throws Zend_Queue_Exception - */ - public function getQueues() - { - $this->_queues = array(); - - $response = $this->_sendCommand('stats queue', array('END')); - - foreach ($response as $i => $line) { - $this->_queues[] = str_replace('STAT ', '', $line); - } - - return $this->_queues; - } - - /** - * Return the approximate number of messages in the queue - * - * @param Zend_Queue $queue - * @return integer - * @throws Zend_Queue_Exception (not supported) - */ - public function count(Zend_Queue $queue=null) - { - throw new Zend_Queue_Exception('count() is not supported in this adapter'); - } - - /******************************************************************** - * Messsage management functions - *********************************************************************/ - - /** - * Send a message to the queue - * - * @param string $message Message to send to the active queue - * @param Zend_Queue $queue - * @return Zend_Queue_Message - * @throws Zend_Queue_Exception - */ - public function send($message, Zend_Queue $queue=null) - { - if ($queue === null) { - $queue = $this->_queue; - } - - if (!$this->isExists($queue->getName())) { - throw new Zend_Queue_Exception('Queue does not exist:' . $queue->getName()); - } - - $message = (string) $message; - $data = array( - 'message_id' => md5(uniqid(rand(), true)), - 'handle' => null, - 'body' => $message, - 'md5' => md5($message), - ); - - $result = $this->_cache->set($queue->getName(), $message, 0, 0); - if ($result === false) { - throw new Zend_Queue_Exception('failed to insert message into queue:' . $queue->getName()); - } - - $options = array( - 'queue' => $queue, - 'data' => $data, - ); - - $classname = $queue->getMessageClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Get messages in the queue - * - * @param integer $maxMessages Maximum number of messages to return - * @param integer $timeout Visibility timeout for these messages - * @param Zend_Queue $queue - * @return Zend_Queue_Message_Iterator - * @throws Zend_Queue_Exception - */ - public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null) - { - if ($maxMessages === null) { - $maxMessages = 1; - } - - if ($timeout === null) { - $timeout = self::RECEIVE_TIMEOUT_DEFAULT; - } - if ($queue === null) { - $queue = $this->_queue; - } - - $msgs = array(); - if ($maxMessages > 0 ) { - for ($i = 0; $i < $maxMessages; $i++) { - $data = array( - 'handle' => md5(uniqid(rand(), true)), - 'body' => $this->_cache->get($queue->getName()), - ); - - $msgs[] = $data; - } - } - - $options = array( - 'queue' => $queue, - 'data' => $msgs, - 'messageClass' => $queue->getMessageClass(), - ); - - $classname = $queue->getMessageSetClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Delete a message from the queue - * - * Returns true if the message is deleted, false if the deletion is - * unsuccessful. - * - * @param Zend_Queue_Message $message - * @return boolean - * @throws Zend_Queue_Exception (unsupported) - */ - public function deleteMessage(Zend_Queue_Message $message) - { - throw new Zend_Queue_Exception('deleteMessage() is not supported in ' . get_class($this)); - } - - /******************************************************************** - * Supporting functions - *********************************************************************/ - - /** - * Return a list of queue capabilities functions - * - * $array['function name'] = true or false - * true is supported, false is not supported. - * - * @param string $name - * @return array - */ - public function getCapabilities() - { - return array( - 'create' => true, - 'delete' => true, - 'send' => true, - 'receive' => true, - 'deleteMessage' => false, - 'getQueues' => true, - 'count' => false, - 'isExists' => true, - ); - } - - /******************************************************************** - * Functions that are not part of the Zend_Queue_Adapter_Abstract - *********************************************************************/ - - /** - * sends a command to MemcacheQ - * - * The memcache functions by php cannot handle all types of requests - * supported by MemcacheQ - * Non-standard requests are handled by this function. - * - * @param string $command - command to send to memcacheQ - * @param array $terminator - strings to indicate end of memcacheQ response - * @param boolean $include_term - include terminator in response - * @return array - * @throws Zend_Queue_Exception if connection cannot be opened - */ - protected function _sendCommand($command, array $terminator, $include_term=false) - { - if (!is_resource($this->_socket)) { - $this->_socket = fsockopen($this->_host, $this->_port, $errno, $errstr, 10); - } - if ($this->_socket === false) { - throw new Zend_Queue_Exception("Could not open a connection to $this->_host:$this->_port errno=$errno : $errstr"); - } - - $response = array(); - - $cmd = $command . self::EOL; - fwrite($this->_socket, $cmd); - - $continue_reading = true; - while (!feof($this->_socket) && $continue_reading) { - $resp = trim(fgets($this->_socket, 1024)); - if (in_array($resp, $terminator)) { - if ($include_term) { - $response[] = $resp; - } - $continue_reading = false; - } else { - $response[] = $resp; - } - } - - return $response; - } -} diff --git a/library/vendor/Zend/Queue/Adapter/Null.php b/library/vendor/Zend/Queue/Adapter/Null.php deleted file mode 100644 index f3622bd32..000000000 --- a/library/vendor/Zend/Queue/Adapter/Null.php +++ /dev/null @@ -1,165 +0,0 @@ - false, - 'delete' => false, - 'send' => false, - 'receive' => false, - 'deleteMessage' => false, - 'getQueues' => false, - 'count' => false, - 'isExists' => false, - ); - } -} diff --git a/library/vendor/Zend/Queue/Adapter/PlatformJobQueue.php b/library/vendor/Zend/Queue/Adapter/PlatformJobQueue.php deleted file mode 100644 index c2becb188..000000000 --- a/library/vendor/Zend/Queue/Adapter/PlatformJobQueue.php +++ /dev/null @@ -1,322 +0,0 @@ -_options['daemonOptions'])) { - throw new Zend_Queue_Exception('Job Queue host and password should be provided'); - } - - $options = $this->_options['daemonOptions']; - - if (!array_key_exists('host', $options)) { - throw new Zend_Queue_Exception('Platform Job Queue host should be provided'); - } - if (!array_key_exists('password', $options)) { - throw new Zend_Queue_Exception('Platform Job Queue password should be provided'); - } - - $this->_zendQueue = new ZendApi_Queue($options['host']); - - if (!$this->_zendQueue) { - throw new Zend_Queue_Exception('Platform Job Queue connection failed'); - } - if (!$this->_zendQueue->login($options['password'])) { - throw new Zend_Queue_Exception('Job Queue login failed'); - } - - if ($this->_queue) { - $this->_queue->setMessageClass('Zend_Queue_Message_PlatformJob'); - } - } - - /******************************************************************** - * Queue management functions - ********************************************************************/ - - /** - * Does a queue already exist? - * - * @param string $name - * @return boolean - * @throws Zend_Queue_Exception (not supported) - */ - public function isExists($name) - { - throw new Zend_Queue_Exception('isExists() is not supported in this adapter'); - } - - /** - * Create a new queue - * - * @param string $name queue name - * @param integer $timeout default visibility timeout - * @return void - * @throws Zend_Queue_Exception - */ - public function create($name, $timeout=null) - { - throw new Zend_Queue_Exception('create() is not supported in ' . get_class($this)); - } - - /** - * Delete a queue and all of its messages - * - * @param string $name queue name - * @return void - * @throws Zend_Queue_Exception - */ - public function delete($name) - { - throw new Zend_Queue_Exception('delete() is not supported in ' . get_class($this)); - } - - /** - * Get an array of all available queues - * - * @return void - * @throws Zend_Queue_Exception - */ - public function getQueues() - { - throw new Zend_Queue_Exception('getQueues() is not supported in this adapter'); - } - - /** - * Return the approximate number of messages in the queue - * - * @param Zend_Queue|null $queue - * @return integer - */ - public function count(Zend_Queue $queue = null) - { - if ($queue !== null) { - throw new Zend_Queue_Exception('Queue parameter is not supported'); - } - - return $this->_zendQueue->getNumOfJobsInQueue(); - } - - /******************************************************************** - * Messsage management functions - ********************************************************************/ - - /** - * Send a message to the queue - * - * @param array | ZendAPI_job $message Message to send to the active queue - * @param Zend_Queue $queue Not supported - * @return Zend_Queue_Message - * @throws Zend_Queue_Exception - */ - public function send($message, Zend_Queue $queue = null) - { - if ($queue !== null) { - throw new Zend_Queue_Exception('Queue parameter is not supported'); - } - - // This adapter can work only for this message type - $classname = $this->_queue->getMessageClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - - if ($message instanceof ZendAPI_Job) { - $message = array('data' => $message); - } - - $zendApiJob = new $classname($message); - - // Unfortunately, the Platform JQ API is PHP4-style... - $platformJob = $zendApiJob->getJob(); - - $jobId = $this->_zendQueue->addJob($platformJob); - - if (!$jobId) { - throw new Zend_Queue_Exception('Failed to add a job to queue: ' - . $this->_zendQueue->getLastError()); - } - - $zendApiJob->setJobId($jobId); - return $zendApiJob; - } - - /** - * Get messages in the queue - * - * @param integer $maxMessages Maximum number of messages to return - * @param integer $timeout Ignored - * @param Zend_Queue $queue Not supported - * @throws Zend_Queue_Exception - * @return ArrayIterator - */ - public function receive($maxMessages = null, $timeout = null, Zend_Queue $queue = null) - { - if ($maxMessages === null) { - $maxMessages = 1; - } - - if ($queue !== null) { - throw new Zend_Queue_Exception('Queue shouldn\'t be set'); - } - - $jobs = $this->_zendQueue->getJobsInQueue(null, $maxMessages, true); - - $classname = $this->_queue->getMessageClass(); - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - - $options = array( - 'queue' => $this->_queue, - 'data' => $jobs, - 'messageClass' => $this->_queue->getMessageClass(), - ); - - $classname = $this->_queue->getMessageSetClass(); - - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - return new $classname($options); - } - - /** - * Delete a message from the queue - * - * Returns true if the message is deleted, false if the deletion is - * unsuccessful. - * - * @param Zend_Queue_Message $message - * @return boolean - * @throws Zend_Queue_Exception - */ - public function deleteMessage(Zend_Queue_Message $message) - { - if (get_class($message) != $this->_queue->getMessageClass()) { - throw new Zend_Queue_Exception( - 'Failed to remove job from the queue; only messages of type ' - . 'Zend_Queue_Message_PlatformJob may be used' - ); - } - - return $this->_zendQueue->removeJob($message->getJobId()); - } - - public function isJobIdExist($id) - { - return (($this->_zendQueue->getJob($id))? true : false); - } - - /******************************************************************** - * Supporting functions - ********************************************************************/ - - /** - * Return a list of queue capabilities functions - * - * $array['function name'] = true or false - * true is supported, false is not supported. - * - * @param string $name - * @return array - */ - public function getCapabilities() - { - return array( - 'create' => false, - 'delete' => false, - 'getQueues' => false, - 'isExists' => false, - 'count' => true, - 'send' => true, - 'receive' => true, - 'deleteMessage' => true, - ); - } - - /******************************************************************** - * Functions that are not part of the Zend_Queue_Adapter_AdapterAbstract - ********************************************************************/ - - /** - * Serialize - * - * @return array - */ - public function __sleep() - { - return array('_options'); - } - - /** - * Unserialize - * - * @return void - */ - public function __wakeup() - { - $options = $this->_options['daemonOptions']; - - $this->_zendQueue = new ZendApi_Queue($options['host']); - - if (!$this->_zendQueue) { - throw new Zend_Queue_Exception('Platform Job Queue connection failed'); - } - if (!$this->_zendQueue->login($options['password'])) { - throw new Zend_Queue_Exception('Job Queue login failed'); - } - } -} diff --git a/library/vendor/Zend/Queue/Exception.php b/library/vendor/Zend/Queue/Exception.php deleted file mode 100644 index 46dcc7a89..000000000 --- a/library/vendor/Zend/Queue/Exception.php +++ /dev/null @@ -1,34 +0,0 @@ -_queue = $options['queue']; - $this->_queueClass = get_class($this->_queue); - } else { - $result = gettype($options['queue']); - if ($result === 'object') { - $result = get_class($options['queue']); - } - - throw new Zend_Queue_Exception( - '$options[\'queue\'] = ' - . $result - . ': must be instanceof Zend_Queue' - ); - } - } - if (isset($options['data'])) { - if (!is_array($options['data'])) { - throw new Zend_Queue_Exception('Data must be an array'); - } - $this->_data = $options['data']; - } - } - - /** - * Retrieve message field value - * - * @param string $key The user-specified key name. - * @return string The corresponding key value. - * @throws Zend_Queue_Exception if the $key is not a column in the message. - */ - public function __get($key) - { - if (!array_key_exists($key, $this->_data)) { - throw new Zend_Queue_Exception("Specified field \"$key\" is not in the message"); - } - return $this->_data[$key]; - } - - /** - * Set message field value - * - * @param string $key The message key. - * @param mixed $value The value for the property. - * @return void - * @throws Zend_Queue_Exception - */ - public function __set($key, $value) - { - if (!array_key_exists($key, $this->_data)) { - throw new Zend_Queue_Exception("Specified field \"$key\" is not in the message"); - } - $this->_data[$key] = $value; - } - - /** - * Test existence of message field - * - * @param string $key The column key. - * @return boolean - */ - public function __isset($key) - { - return array_key_exists($key, $this->_data); - } - - /* - * Serialize - */ - - /** - * Store queue and data in serialized object - * - * @return array - */ - public function __sleep() - { - return array('_queueClass', '_data'); - } - - /** - * Setup to do on wakeup. - * A de-serialized Message should not be assumed to have access to a live - * queue connection, so set _connected = false. - * - * @return void - */ - public function __wakeup() - { - $this->_connected = false; - } - - /** - * Returns the queue object, or null if this is disconnected message - * - * @return Zend_Queue|null - */ - public function getQueue() - { - return $this->_queue; - } - - /** - * Set the queue object, to re-establish a live connection - * to the queue for a Message that has been de-serialized. - * - * @param Zend_Queue $queue - * @return boolean - */ - public function setQueue(Zend_Queue $queue) - { - $queueClass = get_class($queue); - $this->_queue = $queue; - $this->_queueClass = $queueClass; - $this->_connected = true; - return true; - } - - /** - * Query the class name of the Queue object for which this - * Message was created. - * - * @return string - */ - public function getQueueClass() - { - return $this->_queueClass; - } - - /** - * Returns the column/value data as an array. - * - * @return array - */ - public function toArray() - { - return $this->_data; - } - - /** - * Sets all data in the row from an array. - * - * @param array $data - * @return Zend_Queue_Message Provides a fluent interface - */ - public function setFromArray(array $data) - { - foreach ($data as $columnName => $value) { - $this->$columnName = $value; - } - - return $this; - } -} diff --git a/library/vendor/Zend/Queue/Message/Iterator.php b/library/vendor/Zend/Queue/Message/Iterator.php deleted file mode 100644 index 6f0914207..000000000 --- a/library/vendor/Zend/Queue/Message/Iterator.php +++ /dev/null @@ -1,283 +0,0 @@ -array()); - * @return void - */ - public function __construct(array $options = array()) - { - if (isset($options['queue'])) { - $this->_queue = $options['queue']; - $this->_queueClass = get_class($this->_queue); - $this->_connected = true; - } else { - $this->_connected = false; - } - if (isset($options['messageClass'])) { - $this->_messageClass = $options['messageClass']; - } - - if (!is_array($options['data'])) { - throw new Zend_Queue_Exception('array optionsuration must have $options[\'data\'] = array'); - } - - // load the message class - $classname = $this->_messageClass; - if (!class_exists($classname)) { - Zend_Loader::loadClass($classname); - } - - // for each of the messages - foreach ($options['data'] as $data) { - // construct the message parameters - $message = array('data' => $data); - - // If queue has not been set, then use the default. - if (empty($message['queue'])) { - $message['queue'] = $this->_queue; - } - - // construct the message and add it to _data[]; - $this->_data[] = new $classname($message); - } - } - - /** - * Store queue and data in serialized object - * - * @return array - */ - public function __sleep() - { - return array('_data', '_queueClass', '_messageClass', '_pointer'); - } - - /** - * Setup to do on wakeup. - * A de-serialized Message should not be assumed to have access to a live - * queue connection, so set _connected = false. - * - * @return void - */ - public function __wakeup() - { - $this->_connected = false; - } - - /** - * Returns all data as an array. - * - * Used for debugging. - * - * @return array - */ - public function toArray() - { - // @todo This works only if we have iterated through - // the result set once to instantiate the messages. - foreach ($this->_data as $i => $message) { - $this->_data[$i] = $message->toArray(); - } - return $this->_data; - } - - /** - * Returns the queue object, or null if this is disconnected message set - * - * @return Zend_Queue|null - */ - public function getQueue() - { - return $this->_queue; - } - - /** - * Set the queue object, to re-establish a live connection - * to the queue for a Message that has been de-serialized. - * - * @param Zend_Queue_Adapter_AdapterInterface $queue - * @return boolean - * @throws Zend_Queue_Exception - */ - public function setQueue(Zend_Queue $queue) - { - $this->_queue = $queue; - $this->_connected = false; - - // @todo This works only if we have iterated through - // the result set once to instantiate the rows. - foreach ($this->_data as $i => $message) { - $this->_connected = $this->_connected || $message->setQueue($queue); - } - - return $this->_connected; - } - - /** - * Query the class name of the Queue object for which this - * Message was created. - * - * @return string - */ - public function getQueueClass() - { - return $this->_queueClass; - } - - /* - * Iterator implementation - */ - - /** - * Rewind the Iterator to the first element. - * Similar to the reset() function for arrays in PHP. - * Required by interface Iterator. - * - * @return void - */ - public function rewind() - { - $this->_pointer = 0; - } - - /** - * Return the current element. - * Similar to the current() function for arrays in PHP - * Required by interface Iterator. - * - * @return Zend_Queue_Message current element from the collection - */ - public function current() - { - return (($this->valid() === false) - ? null - : $this->_data[$this->_pointer]); // return the messages object - } - - /** - * Return the identifying key of the current element. - * Similar to the key() function for arrays in PHP. - * Required by interface Iterator. - * - * @return integer - */ - public function key() - { - return $this->_pointer; - } - - /** - * Move forward to next element. - * Similar to the next() function for arrays in PHP. - * Required by interface Iterator. - * - * @return void - */ - public function next() - { - ++$this->_pointer; - } - - /** - * Check if there is a current element after calls to rewind() or next(). - * Used to check if we've iterated to the end of the collection. - * Required by interface Iterator. - * - * @return bool False if there's nothing more to iterate over - */ - public function valid() - { - return $this->_pointer < count($this); - } - - /* - * Countable Implementation - */ - - /** - * Returns the number of elements in the collection. - * - * Implements Countable::count() - * - * @return integer - */ - public function count() - { - return count($this->_data); - } -} diff --git a/library/vendor/Zend/Queue/Message/PlatformJob.php b/library/vendor/Zend/Queue/Message/PlatformJob.php deleted file mode 100644 index 98dd4af11..000000000 --- a/library/vendor/Zend/Queue/Message/PlatformJob.php +++ /dev/null @@ -1,191 +0,0 @@ -_job = $options['data']; - parent::__construct($this->_job->getProperties()); - } else { - parent::__construct($options); - - if (!isset($options['script'])) { - throw new Zend_Queue_Exception('The script is mandatory data'); - } - - $this->_job = new ZendApi_Job($options['script']); - $this->_setJobProperties(); - } - } - - /** - * Set the job identifier - * - * Used within Zend_Queue only. - * - * @param string $id - * @return Zend_Queue_Message_PlatformJob - */ - public function setJobId($id) - { - $this->_id = $id; - return $this; - } - - /** - * Retrieve the job identifier - * - * @return string - */ - public function getJobId() - { - return (($this->_id) ? $this->_id : $this->_job->getID()); - } - - /** - * Retrieve the internal ZendApi_Job instance - * - * @return ZendApi_Job - */ - public function getJob() - { - return $this->_job; - } - - /** - * Store queue and data in serialized object - * - * @return array - */ - public function __sleep() - { - return serialize('_job', '_id', '_data'); - } - - /** - * Query the class name of the Queue object for which this - * Message was created. - * - * @return string - */ - public function getQueueClass() - { - return 'Zend_Queue_Adapter_Platform_JQ'; - } - - /** - * Sets properties on the ZendApi_Job instance - * - * Any options in the {@link $_data} array will be checked. Those matching - * options in ZendApi_Job will be used to set those options in that - * instance. - * - * @return void - */ - protected function _setJobProperties() { - - if (isset($this->_data['script'])) { - $this->_job->setScript($this->_data['script']); - } - - if (isset($this->_data['priority'])) { - $this->_job->setJobPriority($this->_data['priority']); - } - - if (isset($this->_data['name'])) { - $this->_job->setJobName($this->_data['name']); - } - - if (isset($this->_data['predecessor'])) { - $this->_job->setJobDependency($this->_data['predecessor']); - } - - if (isset($this->_data['preserved'])) { - $this->_job->setPreserved($this->_data['preserved']); - } - - if (isset($this->_data['user_variables'])) { - $this->_job->setUserVariables($this->_data['user_variables']); - } - - if (!empty($this->_data['interval'])) { - $endTime = isset($this->_data['end_time']) ? $this->_data['end_time'] : null; - $this->_job->setRecurrenceData($this->_data['interval'], $endTime); - } elseif (isset($this->_data['interval']) && ($this->_data['interval'] === '')) { - $this->_job->setRecurrenceData(0,0); - } - - if (isset($this->_data['scheduled_time'])) { - $this->_job->setScheduledTime($this->_data['scheduled_time']); - } - - if (isset($this->_data['application_id'])) { - $this->_job->setApplicationID($this->_data['application_id']); - } - } -} diff --git a/library/vendor/Zend/Queue/Stomp/Client.php b/library/vendor/Zend/Queue/Stomp/Client.php deleted file mode 100644 index 6b5d0e346..000000000 --- a/library/vendor/Zend/Queue/Stomp/Client.php +++ /dev/null @@ -1,172 +0,0 @@ -addConnection($scheme, $host, $port, $connectionClass); - $this->getConnection()->setFrameClass($frameClass); - } - } - - /** - * Shutdown - * - * @return void - */ - public function __destruct() - { - if ($this->getConnection()) { - $this->getConnection()->close(true); - } - } - - /** - * Add a connection to this client. - * - * Attempts to add this class to the client. Returns a boolean value - * indicating success of operation. - * - * You cannot add more than 1 connection to the client at this time. - * - * @param string $scheme ['tcp', 'udp'] - * @param string host - * @param integer port - * @param string class - create a connection with this class; class must support Zend_Queue_Stomp_Client_ConnectionInterface - * @return boolean - */ - public function addConnection($scheme, $host, $port, $class = 'Zend_Queue_Stomp_Client_Connection') - { - if (!class_exists($class)) { - Zend_Loader::loadClass($class); - } - - $connection = new $class(); - - if ($connection->open($scheme, $host, $port)) { - $this->setConnection($connection); - return true; - } - - $connection->close(); - return false; - } - - /** - * Set client connection - * - * @param Zend_Queue_Stomp_Client_ConnectionInterface $connection - * @return void - */ - public function setConnection(Zend_Queue_Stomp_Client_ConnectionInterface $connection) - { - $this->_connection = $connection; - return $this; - } - - /** - * Get client connection - * - * @return Zend_Queue_Stomp_Client_ConnectionInterface|null - */ - public function getConnection() - { - return $this->_connection; - } - - /** - * Send a stomp frame - * - * Returns true if the frame was successfully sent. - * - * @param Zend_Queue_Stomp_FrameInterface $frame - * @return boolean - */ - public function send(Zend_Queue_Stomp_FrameInterface $frame) - { - $this->getConnection()->write($frame); - return $this; - } - - /** - * Receive a frame - * - * Returns a frame or false if none were to be read. - * - * @return Zend_Queue_Stomp_FrameInterface|boolean - */ - public function receive() - { - return $this->getConnection()->read(); - } - - /** - * canRead() - * - * @return boolean - */ - public function canRead() - { - return $this->getConnection()->canRead(); - } - - /** - * creates a frame class - * - * @return Zend_Queue_Stomp_FrameInterface - */ - public function createFrame() - { - return $this->getConnection()->createFrame(); - } -} diff --git a/library/vendor/Zend/Queue/Stomp/Client/Connection.php b/library/vendor/Zend/Queue/Stomp/Client/Connection.php deleted file mode 100644 index 6bd165688..000000000 --- a/library/vendor/Zend/Queue/Stomp/Client/Connection.php +++ /dev/null @@ -1,273 +0,0 @@ -_socket = fsockopen($str, $port, $errno, $errstr); - - if ($this->_socket === false) { - // aparently there is some reason that fsockopen will return false - // but it normally throws an error. - throw new Zend_Queue_Exception("Unable to connect to $str; error = $errstr ( errno = $errno )"); - } - - stream_set_blocking($this->_socket, 0); // non blocking - - if (!isset($options['timeout_sec'])) { - $options['timeout_sec'] = self::READ_TIMEOUT_DEFAULT_SEC; - } - if (! isset($options['timeout_usec'])) { - $options['timeout_usec'] = self::READ_TIMEOUT_DEFAULT_USEC; - } - - $this->_options = $options; - - return true; - } - - /** - * Close the socket explicitly when destructed - * - * @return void - */ - public function __destruct() - { - } - - /** - * Close connection - * - * @param boolean $destructor - * @return void - */ - public function close($destructor = false) - { - // Gracefully disconnect - if (!$destructor) { - $frame = $this->createFrame(); - $frame->setCommand('DISCONNECT'); - $this->write($frame); - } - - // @todo: Should be fixed. - // When the socket is "closed", it will trigger the below error when php exits - // Fatal error: Exception thrown without a stack frame in Unknown on line 0 - - // Danlo: I suspect this is because this has already been claimed by the interpeter - // thus trying to shutdown this resources, which is already shutdown is a problem. - if (is_resource($this->_socket)) { - // fclose($this->_socket); - } - - // $this->_socket = null; - } - - /** - * Check whether we are connected to the server - * - * @return true - * @throws Zend_Queue_Exception - */ - public function ping() - { - if (!is_resource($this->_socket)) { - throw new Zend_Queue_Exception('Not connected to Stomp server'); - } - return true; - } - - /** - * Write a frame to the stomp server - * - * example: $response = $client->write($frame)->read(); - * - * @param Zend_Queue_Stom_FrameInterface $frame - * @return $this - */ - public function write(Zend_Queue_Stomp_FrameInterface $frame) - { - $this->ping(); - $output = $frame->toFrame(); - - $bytes = fwrite($this->_socket, $output, strlen($output)); - if ($bytes === false || $bytes == 0) { - throw new Zend_Queue_Exception('No bytes written'); - } - - return $this; - } - - /** - * Tests the socket to see if there is data for us - * - * @return boolean - */ - public function canRead() - { - $read = array($this->_socket); - $write = null; - $except = null; - - return stream_select( - $read, - $write, - $except, - $this->_options['timeout_sec'], - $this->_options['timeout_usec'] - ) == 1; - // see http://us.php.net/manual/en/function.stream-select.php - } - - /** - * Reads in a frame from the socket or returns false. - * - * @return Zend_Queue_Stomp_FrameInterface|false - * @throws Zend_Queue_Exception - */ - public function read() - { - $this->ping(); - - $response = ''; - $prev = ''; - - // while not end of file. - while (!feof($this->_socket)) { - // read in one character until "\0\n" is found - $data = fread($this->_socket, 1); - - // check to make sure that the connection is not lost. - if ($data === false) { - throw new Zend_Queue_Exception('Connection lost'); - } - - // append last character read to $response - $response .= $data; - - // is this \0 (prev) \n (data)? END_OF_FRAME - if (ord($data) == 10 && ord($prev) == 0) { - break; - } - $prev = $data; - } - - if ($response === '') { - return false; - } - - $frame = $this->createFrame(); - $frame->fromFrame($response); - return $frame; - } - - /** - * Set the frameClass to be used - * - * This must be a Zend_Queue_Stomp_FrameInterface. - * - * @param string $classname - class is an instance of Zend_Queue_Stomp_FrameInterface - * @return $this; - */ - public function setFrameClass($classname) - { - $this->_options['frameClass'] = $classname; - return $this; - } - - /** - * Get the frameClass - * - * @return string - */ - public function getFrameClass() - { - return isset($this->_options['frameClass']) - ? $this->_options['frameClass'] - : 'Zend_Queue_Stomp_Frame'; - } - - /** - * Create an empty frame - * - * @return Zend_Queue_Stomp_FrameInterface - */ - public function createFrame() - { - $class = $this->getFrameClass(); - - if (!class_exists($class)) { - Zend_Loader::loadClass($class); - } - - $frame = new $class(); - - if (!$frame instanceof Zend_Queue_Stomp_FrameInterface) { - throw new Zend_Queue_Exception('Invalid Frame class provided; must implement Zend_Queue_Stomp_FrameInterface'); - } - - return $frame; - } -} diff --git a/library/vendor/Zend/Queue/Stomp/Client/ConnectionInterface.php b/library/vendor/Zend/Queue/Stomp/Client/ConnectionInterface.php deleted file mode 100644 index a8a8b4a97..000000000 --- a/library/vendor/Zend/Queue/Stomp/Client/ConnectionInterface.php +++ /dev/null @@ -1,103 +0,0 @@ -write($frame)->read(); - * - * @param Zend_Queue_Stomp_FrameInterface $frame - * @return $this - */ - public function write(Zend_Queue_Stomp_FrameInterface $frame); - - /** - * tests the socket to see if there is data for us - */ - public function canRead(); - - /** - * reads in a frame from the socket or returns false. - * - * @return Zend_Queue_Stomp_Frame|false - * @throws Zend_Queue_Exception - */ - public function read(); - - /** - * Set the frame class to be used - * - * This must be a Zend_Queue_Stomp_FrameInterface. - * - * @param string $class - * @return Zend_Queue_Stomp_Client_ConnectionInterface; - */ - public function setFrameClass($class); - - /** - * Get the frameClass - * - * @return string - */ - public function getFrameClass(); - - /** - * create an empty frame - * - * @return Zend_Queue_Stomp_FrameInterface class - */ - public function createFrame(); -} diff --git a/library/vendor/Zend/Queue/Stomp/Frame.php b/library/vendor/Zend/Queue/Stomp/Frame.php deleted file mode 100644 index 44cef7a27..000000000 --- a/library/vendor/Zend/Queue/Stomp/Frame.php +++ /dev/null @@ -1,354 +0,0 @@ -setHeaders(array()); - $this->setBody(null); - $this->setCommand(null); - $this->setAutoContentLength(true); - } - - /** - * get the status of the auto content length - * - * If AutoContentLength is true this code will automatically put the - * content-length header in, even if it is already set by the user. - * - * This is done to make the message sending more reliable. - * - * @return boolean - */ - public function getAutoContentLength() - { - return $this->_autoContentLength; - } - - /** - * setAutoContentLength() - * - * Set the value on or off. - * - * @param boolean $auto - * @return $this; - * @throws Zend_Queue_Exception - */ - public function setAutoContentLength($auto) - { - if (!is_bool($auto)) { - throw new Zend_Queue_Exception('$auto is not a boolean'); - } - - $this->_autoContentLength = $auto; - return $this; - } - - /** - * Get the headers - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * Set the headers - * - * Throws an exception if the array values are not strings. - * - * @param array $headers - * @return $this - * @throws Zend_Queue_Exception - */ - public function setHeaders(array $headers) - { - foreach ($headers as $header => $value) { - $this->setHeader($header, $value); - } - - return $this; - } - - /** - * Sets a value for a header - * - * @param string $header - * @param string $value - * @return Zend_Queue_Stomp_Frame - * @throws Zend_Queue_Exception - */ - public function setHeader($header, $value) { - if (!is_string($header)) { - throw new Zend_Queue_Exception('$header is not a string: ' . print_r($header, true)); - } - - if (!is_scalar($value)) { - throw new Zend_Queue_Exception('$value is not a string: ' . print_r($value, true)); - } - - $this->_headers[$header] = $value; - return $this; - } - - - /** - * Returns a value for a header - * - * Returns false if the header does not exist. - * - * @param string $header - * @return string|false - * @throws Zend_Queue_Exception - */ - public function getHeader($header) - { - if (!is_string($header)) { - throw new Zend_Queue_Exception('$header is not a string'); - } - - return isset($this->_headers[$header]) - ? $this->_headers[$header] - : false; - } - - /** - * Return the body for this frame - * - * Returns false if the body does not exist - * - * @return false|string - */ - public function getBody() - { - return $this->_body === null - ? false - : $this->_body; - } - - /** - * Set the body for this frame - * - * Set to null for no body. - * - * @param string|null $body - * @return Zend_Queue_Stomp_Frame - * @throws Zend_Queue_Exception - */ - public function setBody($body) - { - if (!is_string($body) && $body !== null) { - throw new Zend_Queue_Exception('$body is not a string or null'); - } - - $this->_body = $body; - return $this; - } - - /** - * Return the command for this frame - * - * Return false if the command does not exist - * - * @return string|false - */ - public function getCommand() - { - return $this->_command === null - ? false - : $this->_command; - } - - /** - * Set the body for this frame - * - * @param string|null - * @return Zend_Queue_Stomp_Frame - * @throws Zend_Queue_Exception - */ - public function setCommand($command) - { - if (!is_string($command) && $command !== null) { - throw new Zend_Queue_Exception('$command is not a string or null'); - } - - $this->_command = $command; - return $this; - } - - /** - * Takes the current parameters and returns a Stomp Frame - * - * @return string - * @throws Zend_Queue_Exception - */ - public function toFrame() - { - if ($this->getCommand() === false) { - throw new Zend_Queue_Exception('You must set the command'); - } - - $command = $this->getCommand(); - $headers = $this->getHeaders(); - $body = $this->getBody(); - $frame = ''; - - // add a content-length to the SEND command. - // @see http://stomp.codehaus.org/Protocol - if ($this->getAutoContentLength()) { - $headers[self::CONTENT_LENGTH] = strlen($this->getBody()); - } - - // Command - $frame = $command . self::EOL; - - // Headers - foreach ($headers as $key=>$value) { - $frame .= $key . ': ' . $value . self::EOL; - } - - // Seperator - $frame .= self::EOL; // blank line required by protocol - - // add the body if any - if ($body !== false) { - $frame .= $body; - } - $frame .= self::END_OF_FRAME; - - return $frame; - } - - /** - * @see toFrame() - * @return string - */ - public function __toString() - { - try { - $return = $this->toFrame(); - } catch (Zend_Queue_Exception $e) { - $return = ''; - } - return $return; - } - - /** - * Accepts a frame and deconstructs the frame into its component parts - * - * @param string $frame - a stomp frame - * @return $this - */ - public function fromFrame($frame) - { - if (!is_string($frame)) { - throw new Zend_Queue_Exception('$frame is not a string'); - } - - $headers = array(); - $body = null; - $command = false; - $header = ''; - - // separate the headers and the body - $match = self::EOL . self::EOL; - if (preg_match('/' . $match . '/', $frame)) { - list ($header, $body) = explode($match, $frame, 2); - } else { - $header = $frame; - } - - // blow up headers - $headers = explode(self::EOL, $header); - unset($header); - - // get the command (first line) - $this->setCommand(array_shift($headers)); - - // set each of the headers. - foreach ($headers as $header) { - if (strpos($header, ':') > 0) { - list($name, $value) = explode(':', $header, 2); - $this->setHeader($name, $value); - } - } - - // crop the body if content-length is present - if ($this->getHeader(self::CONTENT_LENGTH) !== false ) { - $length = (int) $this->getHeader(self::CONTENT_LENGTH); - $body = substr($body, 0, $length); - } - - $this->setBody($body); - return $this; - } -} diff --git a/library/vendor/Zend/Queue/Stomp/FrameInterface.php b/library/vendor/Zend/Queue/Stomp/FrameInterface.php deleted file mode 100644 index a9ba302b5..000000000 --- a/library/vendor/Zend/Queue/Stomp/FrameInterface.php +++ /dev/null @@ -1,154 +0,0 @@ -getFileName()); - if (!$instance instanceof Zend_Reflection_File) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_File'); - } - return $instance; - } - - /** - * Return the classes Docblock reflection object - * - * @param string $reflectionClass Name of reflection class to use - * @return Zend_Reflection_Docblock - * @throws Zend_Reflection_Exception for missing docblock or invalid reflection class - */ - public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock') - { - if ('' == $this->getDocComment()) { - throw new Zend_Reflection_Exception($this->getName() . ' does not have a docblock'); - } - - $instance = new $reflectionClass($this); - if (!$instance instanceof Zend_Reflection_Docblock) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Docblock'); - } - return $instance; - } - - /** - * Return the start line of the class - * - * @param bool $includeDocComment - * @return int - */ - public function getStartLine($includeDocComment = false) - { - if ($includeDocComment) { - if ($this->getDocComment() != '') { - return $this->getDocblock()->getStartLine(); - } - } - - return parent::getStartLine(); - } - - /** - * Return the contents of the class - * - * @param bool $includeDocblock - * @return string - */ - public function getContents($includeDocblock = true) - { - $filename = $this->getFileName(); - $filelines = file($filename); - $startnum = $this->getStartLine($includeDocblock); - $endnum = $this->getEndLine() - $this->getStartLine(); - - return implode('', array_splice($filelines, $startnum, $endnum, true)); - } - - /** - * Get all reflection objects of implemented interfaces - * - * @param string $reflectionClass Name of reflection class to use - * @return array Array of Zend_Reflection_Class - */ - public function getInterfaces($reflectionClass = 'Zend_Reflection_Class') - { - $phpReflections = parent::getInterfaces(); - $zendReflections = array(); - while ($phpReflections && ($phpReflection = array_shift($phpReflections))) { - $instance = new $reflectionClass($phpReflection->getName()); - if (!$instance instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Class'); - } - $zendReflections[] = $instance; - unset($phpReflection); - } - unset($phpReflections); - return $zendReflections; - } - - /** - * Return method reflection by name - * - * @param string $name - * @param string $reflectionClass Reflection class to utilize - * @return Zend_Reflection_Method - */ - public function getMethod($name, $reflectionClass = 'Zend_Reflection_Method') - { - $phpReflection = parent::getMethod($name); - $zendReflection = new $reflectionClass($this->getName(), $phpReflection->getName()); - - if (!$zendReflection instanceof Zend_Reflection_Method) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Method'); - } - - unset($phpReflection); - return $zendReflection; - } - - /** - * Get reflection objects of all methods - * - * @param string $filter - * @param string $reflectionClass Reflection class to use for methods - * @return array Array of Zend_Reflection_Method objects - */ - public function getMethods($filter = -1, $reflectionClass = 'Zend_Reflection_Method') - { - $phpReflections = parent::getMethods($filter); - $zendReflections = array(); - while ($phpReflections && ($phpReflection = array_shift($phpReflections))) { - $instance = new $reflectionClass($this->getName(), $phpReflection->getName()); - if (!$instance instanceof Zend_Reflection_Method) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Method'); - } - $zendReflections[] = $instance; - unset($phpReflection); - } - unset($phpReflections); - return $zendReflections; - } - - /** - * Get parent reflection class of reflected class - * - * @param string $reflectionClass Name of Reflection class to use - * @return Zend_Reflection_Class - */ - public function getParentClass($reflectionClass = 'Zend_Reflection_Class') - { - $phpReflection = parent::getParentClass(); - if ($phpReflection) { - $zendReflection = new $reflectionClass($phpReflection->getName()); - if (!$zendReflection instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Class'); - } - unset($phpReflection); - return $zendReflection; - } else { - return false; - } - } - - /** - * Return reflection property of this class by name - * - * @param string $name - * @param string $reflectionClass Name of reflection class to use - * @return Zend_Reflection_Property - */ - public function getProperty($name, $reflectionClass = 'Zend_Reflection_Property') - { - $phpReflection = parent::getProperty($name); - $zendReflection = new $reflectionClass($this->getName(), $phpReflection->getName()); - if (!$zendReflection instanceof Zend_Reflection_Property) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Property'); - } - unset($phpReflection); - return $zendReflection; - } - - /** - * Return reflection properties of this class - * - * @param int $filter - * @param string $reflectionClass Name of reflection class to use - * @return array Array of Zend_Reflection_Property - */ - public function getProperties($filter = -1, $reflectionClass = 'Zend_Reflection_Property') - { - $phpReflections = parent::getProperties($filter); - $zendReflections = array(); - while ($phpReflections && ($phpReflection = array_shift($phpReflections))) { - $instance = new $reflectionClass($this->getName(), $phpReflection->getName()); - if (!$instance instanceof Zend_Reflection_Property) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Property'); - } - $zendReflections[] = $instance; - unset($phpReflection); - } - unset($phpReflections); - return $zendReflections; - } -} diff --git a/library/vendor/Zend/Reflection/Docblock.php b/library/vendor/Zend/Reflection/Docblock.php deleted file mode 100644 index 85d806813..000000000 --- a/library/vendor/Zend/Reflection/Docblock.php +++ /dev/null @@ -1,290 +0,0 @@ -_tags)."] {".PHP_EOL; - - foreach($this->_tags AS $tag) { - $str .= " ".$tag; - } - - $str .= " }".PHP_EOL; - $str .= "}".PHP_EOL; - - return $str; - } - - /** - * Constructor - * - * @param Reflector|string $commentOrReflector - */ - public function __construct($commentOrReflector) - { - if ($commentOrReflector instanceof Reflector) { - $this->_reflector = $commentOrReflector; - if (!method_exists($commentOrReflector, 'getDocComment')) { - throw new Zend_Reflection_Exception('Reflector must contain method "getDocComment"'); - } - $docComment = $commentOrReflector->getDocComment(); - - $lineCount = substr_count($docComment, "\n"); - - $this->_startLine = $this->_reflector->getStartLine() - $lineCount - 1; - $this->_endLine = $this->_reflector->getStartLine() - 1; - - } elseif (is_string($commentOrReflector)) { - $docComment = $commentOrReflector; - } else { - throw new Zend_Reflection_Exception(get_class($this) . ' must have a (string) DocComment or a Reflector in the constructor'); - } - - if ($docComment == '') { - throw new Zend_Reflection_Exception('DocComment cannot be empty'); - } - - $this->_docComment = $docComment; - $this->_parse(); - } - - /** - * Retrieve contents of docblock - * - * @return string - */ - public function getContents() - { - return $this->_cleanDocComment; - } - - /** - * Get start line (position) of docblock - * - * @return int - */ - public function getStartLine() - { - return $this->_startLine; - } - - /** - * Get last line (position) of docblock - * - * @return int - */ - public function getEndLine() - { - return $this->_endLine; - } - - /** - * Get docblock short description - * - * @return string - */ - public function getShortDescription() - { - return $this->_shortDescription; - } - - /** - * Get docblock long description - * - * @return string - */ - public function getLongDescription() - { - return $this->_longDescription; - } - - /** - * Does the docblock contain the given annotation tag? - * - * @param string $name - * @return bool - */ - public function hasTag($name) - { - foreach ($this->_tags as $tag) { - if ($tag->getName() == $name) { - return true; - } - } - return false; - } - - /** - * Retrieve the given docblock tag - * - * @param string $name - * @return Zend_Reflection_Docblock_Tag|false - */ - public function getTag($name) - { - foreach ($this->_tags as $tag) { - if ($tag->getName() == $name) { - return $tag; - } - } - - return false; - } - - /** - * Get all docblock annotation tags - * - * @param string $filter - * @return array Array of Zend_Reflection_Docblock_Tag - */ - public function getTags($filter = null) - { - if ($filter === null || !is_string($filter)) { - return $this->_tags; - } - - $returnTags = array(); - foreach ($this->_tags as $tag) { - if ($tag->getName() == $filter) { - $returnTags[] = $tag; - } - } - return $returnTags; - } - - /** - * Parse the docblock - * - * @return void - */ - protected function _parse() - { - $docComment = $this->_docComment; - - // First remove doc block line starters - $docComment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ ]{0,1}(.*)?#', '$1', $docComment); - $docComment = ltrim($docComment, "\r\n"); // @todo should be changed to remove first and last empty line - - $this->_cleanDocComment = $docComment; - - // Next parse out the tags and descriptions - $parsedDocComment = $docComment; - $lineNumber = $firstBlandLineEncountered = 0; - while (($newlinePos = strpos($parsedDocComment, "\n")) !== false) { - $lineNumber++; - $line = substr($parsedDocComment, 0, $newlinePos); - - $matches = array(); - - if ((strpos($line, '@') === 0) && (preg_match('#^(@\w+.*?)(\n)(?:@|\r?\n|$)#s', $parsedDocComment, $matches))) { - $this->_tags[] = Zend_Reflection_Docblock_Tag::factory($matches[1]); - $parsedDocComment = str_replace($matches[1] . $matches[2], '', $parsedDocComment); - } else { - if ($lineNumber < 3 && !$firstBlandLineEncountered) { - $this->_shortDescription .= $line . "\n"; - } else { - $this->_longDescription .= $line . "\n"; - } - - if ($line == '') { - $firstBlandLineEncountered = true; - } - - $parsedDocComment = substr($parsedDocComment, $newlinePos + 1); - } - - } - - $this->_shortDescription = rtrim($this->_shortDescription); - $this->_longDescription = rtrim($this->_longDescription); - } -} diff --git a/library/vendor/Zend/Reflection/Docblock/Tag.php b/library/vendor/Zend/Reflection/Docblock/Tag.php deleted file mode 100644 index e9cf71286..000000000 --- a/library/vendor/Zend/Reflection/Docblock/Tag.php +++ /dev/null @@ -1,142 +0,0 @@ - 'Zend_Reflection_Docblock_Tag_Param', - 'return' => 'Zend_Reflection_Docblock_Tag_Return', - ); - - /** - * @var string - */ - protected $_name = null; - - /** - * @var string - */ - protected $_description = null; - - /** - * Factory: Create the appropriate annotation tag object - * - * @param string $tagDocblockLine - * @return Zend_Reflection_Docblock_Tag - */ - public static function factory($tagDocblockLine) - { - $matches = array(); - - if (!preg_match('#^@(\w+)(\s|$)#', $tagDocblockLine, $matches)) { - throw new Zend_Reflection_Exception('No valid tag name found within provided docblock line.'); - } - - $tagName = $matches[1]; - if (array_key_exists($tagName, self::$_tagClasses)) { - $tagClass = self::$_tagClasses[$tagName]; - if (!class_exists($tagClass)) { - Zend_Loader::loadClass($tagClass); - } - return new $tagClass($tagDocblockLine); - } - return new self($tagDocblockLine); - } - - /** - * Export reflection - * - * Required by Reflector - * - * @todo What should this do? - * @return void - */ - public static function export() - { - } - - /** - * Serialize to string - * - * Required by Reflector - * - * @todo What should this do? - * @return string - */ - public function __toString() - { - $str = "Docblock Tag [ * @".$this->_name." ]".PHP_EOL; - - return $str; - } - - /** - * Constructor - * - * @param string $tagDocblockLine - * @return void - */ - public function __construct($tagDocblockLine) - { - $matches = array(); - - // find the line - if (!preg_match('#^@(\w+)(?:\s+([^\s].*)|$)?#', $tagDocblockLine, $matches)) { - throw new Zend_Reflection_Exception('Provided docblock line does not contain a valid tag'); - } - - $this->_name = $matches[1]; - if (isset($matches[2]) && $matches[2]) { - $this->_description = $matches[2]; - } - } - - /** - * Get annotation tag name - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * Get annotation tag description - * - * @return string - */ - public function getDescription() - { - return $this->_description; - } -} diff --git a/library/vendor/Zend/Reflection/Docblock/Tag/Param.php b/library/vendor/Zend/Reflection/Docblock/Tag/Param.php deleted file mode 100644 index 2f2cb4028..000000000 --- a/library/vendor/Zend/Reflection/Docblock/Tag/Param.php +++ /dev/null @@ -1,90 +0,0 @@ -_name = 'param'; - $this->_type = $matches[2]; - - if (isset($matches[3])) { - $this->_variableName = $matches[3]; - } - - if (isset($matches[4])) { - $this->_description = preg_replace('#\s+#', ' ', $matches[4]); - } - } - - /** - * Get parameter variable type - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * Get parameter name - * - * @return string - */ - public function getVariableName() - { - return $this->_variableName; - } -} diff --git a/library/vendor/Zend/Reflection/Docblock/Tag/Return.php b/library/vendor/Zend/Reflection/Docblock/Tag/Return.php deleted file mode 100644 index 44b7e7ef5..000000000 --- a/library/vendor/Zend/Reflection/Docblock/Tag/Return.php +++ /dev/null @@ -1,69 +0,0 @@ -_name = 'return'; - $this->_type = $matches[2]; - if (isset($matches[3])) { - $this->_description = $matches[3]; - } - } - - /** - * Get return variable type - * - * @return string - */ - public function getType() - { - return $this->_type; - } -} diff --git a/library/vendor/Zend/Reflection/Exception.php b/library/vendor/Zend/Reflection/Exception.php deleted file mode 100644 index 1a81cb2c2..000000000 --- a/library/vendor/Zend/Reflection/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ -getName()); - if (!$instance instanceof Zend_Reflection_Function) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Function'); - } - $zendReflections[] = $instance; - unset($phpReflection); - } - unset($phpReflections); - return $zendReflections; - } - - /** - * Get extension class reflection objects - * - * @param string $reflectionClass Name of reflection class to use - * @return array Array of Zend_Reflection_Class objects - */ - public function getClasses($reflectionClass = 'Zend_Reflection_Class') - { - $phpReflections = parent::getClasses(); - $zendReflections = array(); - while ($phpReflections && ($phpReflection = array_shift($phpReflections))) { - $instance = new $reflectionClass($phpReflection->getName()); - if (!$instance instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class'); - } - $zendReflections[] = $instance; - unset($phpReflection); - } - unset($phpReflections); - return $zendReflections; - } -} diff --git a/library/vendor/Zend/Reflection/File.php b/library/vendor/Zend/Reflection/File.php deleted file mode 100644 index 5768b810c..000000000 --- a/library/vendor/Zend/Reflection/File.php +++ /dev/null @@ -1,422 +0,0 @@ -_fileName = $fileRealpath; - $this->_contents = file_get_contents($this->_fileName); - $this->_reflect(); - } - - /** - * Find realpath of file based on include_path - * - * @param string $fileName - * @return string - */ - public static function findRealpathInIncludePath($fileName) - { - $includePaths = Zend_Loader::explodeIncludePath(); - while (count($includePaths) > 0) { - $filePath = array_shift($includePaths) . DIRECTORY_SEPARATOR . $fileName; - - if ( ($foundRealpath = realpath($filePath)) !== false) { - break; - } - } - - return $foundRealpath; - } - - /** - * Export - * - * Required by the Reflector interface. - * - * @todo What should this do? - * @return null - */ - public static function export() - { - return null; - } - - /** - * Return the file name of the reflected file - * - * @return string - */ - public function getFileName() - { - return $this->_fileName; - } - - /** - * Get the start line - Always 1, staying consistent with the Reflection API - * - * @return int - */ - public function getStartLine() - { - return $this->_startLine; - } - - /** - * Get the end line / number of lines - * - * @return int - */ - public function getEndLine() - { - return $this->_endLine; - } - - /** - * Return the doc comment - * - * @return string - */ - public function getDocComment() - { - return $this->_docComment; - } - - /** - * Return the docblock - * - * @param string $reflectionClass Reflection class to use - * @return Zend_Reflection_Docblock - */ - public function getDocblock($reflectionClass = 'Zend_Reflection_Docblock') - { - $instance = new $reflectionClass($this); - if (!$instance instanceof Zend_Reflection_Docblock) { - throw new Zend_Reflection_Exception('Invalid reflection class specified; must extend Zend_Reflection_Docblock'); - } - return $instance; - } - - /** - * Return the reflection classes of the classes found inside this file - * - * @param string $reflectionClass Name of reflection class to use for instances - * @return array Array of Zend_Reflection_Class instances - */ - public function getClasses($reflectionClass = 'Zend_Reflection_Class') - { - $classes = array(); - foreach ($this->_classes as $class) { - $instance = new $reflectionClass($class); - if (!$instance instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class'); - } - $classes[] = $instance; - } - return $classes; - } - - /** - * Return the reflection functions of the functions found inside this file - * - * @param string $reflectionClass Name of reflection class to use for instances - * @return array Array of Zend_Reflection_Functions - */ - public function getFunctions($reflectionClass = 'Zend_Reflection_Function') - { - $functions = array(); - foreach ($this->_functions as $function) { - $instance = new $reflectionClass($function); - if (!$instance instanceof Zend_Reflection_Function) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Function'); - } - $functions[] = $instance; - } - return $functions; - } - - /** - * Retrieve the reflection class of a given class found in this file - * - * @param null|string $name - * @param string $reflectionClass Reflection class to use when creating reflection instance - * @return Zend_Reflection_Class - * @throws Zend_Reflection_Exception for invalid class name or invalid reflection class - */ - public function getClass($name = null, $reflectionClass = 'Zend_Reflection_Class') - { - if ($name === null) { - reset($this->_classes); - $selected = current($this->_classes); - $instance = new $reflectionClass($selected); - if (!$instance instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class given; must extend Zend_Reflection_Class'); - } - return $instance; - } - - if (in_array($name, $this->_classes)) { - $instance = new $reflectionClass($name); - if (!$instance instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class given; must extend Zend_Reflection_Class'); - } - return $instance; - } - - throw new Zend_Reflection_Exception('Class by name ' . $name . ' not found.'); - } - - /** - * Return the full contents of file - * - * @return string - */ - public function getContents() - { - return $this->_contents; - } - - /** - * Serialize to string - * - * Required by the Reflector interface - * - * @todo What should this serialization look like? - * @return string - */ - public function __toString() - { - return ''; - } - - /** - * This method does the work of "reflecting" the file - * - * Uses PHP's tokenizer to perform file reflection. - * - * @return void - */ - protected function _reflect() - { - $contents = $this->_contents; - $tokens = token_get_all($contents); - - $functionTrapped = false; - $classTrapped = false; - $requireTrapped = false; - $embeddedVariableTrapped = false; - $openBraces = 0; - - $this->_checkFileDocBlock($tokens); - - foreach ($tokens as $token) { - /* - * Tokens are characters representing symbols or arrays - * representing strings. The keys/values in the arrays are - * - * - 0 => token id, - * - 1 => string, - * - 2 => line number - * - * Token ID's are explained here: - * http://www.php.net/manual/en/tokens.php. - */ - - if (is_array($token)) { - $type = $token[0]; - $value = $token[1]; - $lineNum = $token[2]; - } else { - // It's a symbol - // Maintain the count of open braces - if ($token == '{') { - $openBraces++; - } else if ($token == '}') { - if ( $embeddedVariableTrapped ) { - $embeddedVariableTrapped = false; - } else { - $openBraces--; - } - } - - continue; - } - - switch ($type) { - case T_STRING_VARNAME: - case T_DOLLAR_OPEN_CURLY_BRACES: - case T_CURLY_OPEN: - $embeddedVariableTrapped = true; - continue; - - // Name of something - case T_STRING: - if ($functionTrapped) { - $this->_functions[] = $value; - $functionTrapped = false; - } elseif ($classTrapped) { - $this->_classes[] = $value; - $classTrapped = false; - } - continue; - - // Required file names are T_CONSTANT_ENCAPSED_STRING - case T_CONSTANT_ENCAPSED_STRING: - if ($requireTrapped) { - $this->_requiredFiles[] = $value ."\n"; - $requireTrapped = false; - } - continue; - - // Functions - case T_FUNCTION: - if ($openBraces == 0) { - $functionTrapped = true; - } - break; - - // Classes - case T_CLASS: - case T_INTERFACE: - $classTrapped = true; - break; - - // All types of requires - case T_REQUIRE: - case T_REQUIRE_ONCE: - case T_INCLUDE: - case T_INCLUDE_ONCE: - $requireTrapped = true; - break; - - // Default case: do nothing - default: - break; - } - } - - $this->_endLine = count(explode("\n", $this->_contents)); - } - - /** - * Validate / check a file level docblock - * - * @param array $tokens Array of tokenizer tokens - * @return void - */ - protected function _checkFileDocBlock($tokens) { - foreach ($tokens as $token) { - $type = $token[0]; - $value = $token[1]; - $lineNum = $token[2]; - if(($type == T_OPEN_TAG) || ($type == T_WHITESPACE)) { - continue; - } elseif ($type == T_DOC_COMMENT) { - $this->_docComment = $value; - $this->_startLine = $lineNum + substr_count($value, "\n") + 1; - return; - } else { - // Only whitespace is allowed before file docblocks - return; - } - } - } -} diff --git a/library/vendor/Zend/Reflection/Function.php b/library/vendor/Zend/Reflection/Function.php deleted file mode 100644 index 0ee56a176..000000000 --- a/library/vendor/Zend/Reflection/Function.php +++ /dev/null @@ -1,124 +0,0 @@ -getDocComment())) { - throw new Zend_Reflection_Exception($this->getName() . ' does not have a docblock'); - } - $instance = new $reflectionClass($comment); - if (!$instance instanceof Zend_Reflection_Docblock) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock'); - } - return $instance; - } - - /** - * Get start line (position) of function - * - * @param bool $includeDocComment - * @return int - */ - public function getStartLine($includeDocComment = false) - { - if ($includeDocComment) { - if ($this->getDocComment() != '') { - return $this->getDocblock()->getStartLine(); - } - } - - return parent::getStartLine(); - } - - /** - * Get contents of function - * - * @param bool $includeDocblock - * @return string - */ - public function getContents($includeDocblock = true) - { - return implode("\n", - array_splice( - file($this->getFileName()), - $this->getStartLine($includeDocblock), - ($this->getEndLine() - $this->getStartLine()), - true - ) - ); - } - - /** - * Get function parameters - * - * @param string $reflectionClass Name of reflection class to use - * @return array Array of Zend_Reflection_Parameter - */ - public function getParameters($reflectionClass = 'Zend_Reflection_Parameter') - { - $phpReflections = parent::getParameters(); - $zendReflections = array(); - while ($phpReflections && ($phpReflection = array_shift($phpReflections))) { - $instance = new $reflectionClass($this->getName(), $phpReflection->getName()); - if (!$instance instanceof Zend_Reflection_Parameter) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Parameter'); - } - $zendReflections[] = $instance; - unset($phpReflection); - } - unset($phpReflections); - return $zendReflections; - } - - /** - * Get return type tag - * - * @return Zend_Reflection_Docblock_Tag_Return - */ - public function getReturn() - { - $docblock = $this->getDocblock(); - if (!$docblock->hasTag('return')) { - throw new Zend_Reflection_Exception('Function does not specify an @return annotation tag; cannot determine return type'); - } - $tag = $docblock->getTag('return'); - $return = Zend_Reflection_Docblock_Tag::factory('@return ' . $tag->getDescription()); - return $return; - } -} diff --git a/library/vendor/Zend/Reflection/Method.php b/library/vendor/Zend/Reflection/Method.php deleted file mode 100644 index 613fcd137..000000000 --- a/library/vendor/Zend/Reflection/Method.php +++ /dev/null @@ -1,180 +0,0 @@ -getDocComment()) { - throw new Zend_Reflection_Exception($this->getName() . ' does not have a docblock'); - } - - $instance = new $reflectionClass($this); - if (!$instance instanceof Zend_Reflection_Docblock) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock'); - } - return $instance; - } - - /** - * Get start line (position) of method - * - * @param bool $includeDocComment - * @return int - */ - public function getStartLine($includeDocComment = false) - { - if ($includeDocComment) { - if ($this->getDocComment() != '') { - return $this->getDocblock()->getStartLine(); - } - } - - return parent::getStartLine(); - } - - /** - * Get reflection of declaring class - * - * @param string $reflectionClass Name of reflection class to use - * @return Zend_Reflection_Class - */ - public function getDeclaringClass($reflectionClass = 'Zend_Reflection_Class') - { - $phpReflection = parent::getDeclaringClass(); - $zendReflection = new $reflectionClass($phpReflection->getName()); - if (!$zendReflection instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class'); - } - unset($phpReflection); - return $zendReflection; - } - - /** - * Get all method parameter reflection objects - * - * @param string $reflectionClass Name of reflection class to use - * @return array of Zend_Reflection_Parameter objects - */ - public function getParameters($reflectionClass = 'Zend_Reflection_Parameter') - { - $phpReflections = parent::getParameters(); - $zendReflections = array(); - while ($phpReflections && ($phpReflection = array_shift($phpReflections))) { - $instance = new $reflectionClass(array($this->getDeclaringClass()->getName(), $this->getName()), $phpReflection->getName()); - if (!$instance instanceof Zend_Reflection_Parameter) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Parameter'); - } - $zendReflections[] = $instance; - unset($phpReflection); - } - unset($phpReflections); - return $zendReflections; - } - - /** - * Get method contents - * - * @param bool $includeDocblock - * @return string - */ - public function getContents($includeDocblock = true) - { - $fileContents = file($this->getFileName()); - $startNum = $this->getStartLine($includeDocblock); - $endNum = ($this->getEndLine() - $this->getStartLine()); - - return implode("\n", array_splice($fileContents, $startNum, $endNum, true)); - } - - /** - * Get method body - * - * @return string - */ - public function getBody() - { - $lines = array_slice( - file($this->getDeclaringClass()->getFileName(), FILE_IGNORE_NEW_LINES), - $this->getStartLine()-1, - ($this->getEndLine() - $this->getStartLine()) + 1, - true - ); - - // Strip off lines until we come to a closing bracket - do { - if (count($lines) == 0) break; - $firstLine = array_shift($lines); - } while (strpos($firstLine, ')') === false); - - // If the opening brace isn't on the same line as method - // signature, then we should pop off more lines until we find it - if (strpos($firstLine,'{') === false) { - do { - if (count($lines) == 0) break; - $firstLine = array_shift($lines); - } while (strpos($firstLine, '{') === false); - } - - // If there are more characters on the line after the opening brace, - // push them back onto the lines stack as they are part of the body - $restOfFirstLine = trim(substr($firstLine, strpos($firstLine, '{')+1)); - if (!empty($restOfFirstLine)) { - array_unshift($lines, $restOfFirstLine); - } - - $lastLine = array_pop($lines); - - // If there are more characters on the line before the closing brace, - // push them back onto the lines stack as they are part of the body - $restOfLastLine = trim(substr($lastLine, 0, strrpos($lastLine, '}')-1)); - if (!empty($restOfLastLine)) { - array_push($lines, $restOfLastLine); - } - - // just in case we had code on the bracket lines - return implode("\n", $lines); - } -} diff --git a/library/vendor/Zend/Reflection/Parameter.php b/library/vendor/Zend/Reflection/Parameter.php deleted file mode 100644 index 37bb63eb5..000000000 --- a/library/vendor/Zend/Reflection/Parameter.php +++ /dev/null @@ -1,120 +0,0 @@ -getName()); - if (!$zendReflection instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class'); - } - unset($phpReflection); - return $zendReflection; - } - - /** - * Get class reflection object - * - * @param string $reflectionClass Reflection class to use - * @return Zend_Reflection_Class - */ - public function getClass($reflectionClass = 'Zend_Reflection_Class') - { - $phpReflection = parent::getClass(); - if($phpReflection == null) { - return null; - } - - $zendReflection = new $reflectionClass($phpReflection->getName()); - if (!$zendReflection instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class'); - } - unset($phpReflection); - return $zendReflection; - } - - /** - * Get declaring function reflection object - * - * @param string $reflectionClass Reflection class to use - * @return Zend_Reflection_Function|Zend_Reflection_Method - */ - public function getDeclaringFunction($reflectionClass = null) - { - $phpReflection = parent::getDeclaringFunction(); - if ($phpReflection instanceof ReflectionMethod) { - $baseClass = 'Zend_Reflection_Method'; - if (null === $reflectionClass) { - $reflectionClass = $baseClass; - } - $zendReflection = new $reflectionClass($this->getDeclaringClass()->getName(), $phpReflection->getName()); - } else { - $baseClass = 'Zend_Reflection_Function'; - if (null === $reflectionClass) { - $reflectionClass = $baseClass; - } - $zendReflection = new $reflectionClass($phpReflection->getName()); - } - if (!$zendReflection instanceof $baseClass) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend ' . $baseClass); - } - unset($phpReflection); - return $zendReflection; - } - - /** - * Get parameter type - * - * @return string - */ - public function getType() - { - if ($docblock = $this->getDeclaringFunction()->getDocblock()) { - $params = $docblock->getTags('param'); - - if (isset($params[$this->getPosition()])) { - return $params[$this->getPosition()]->getType(); - } - - } - - return null; - } -} diff --git a/library/vendor/Zend/Reflection/Property.php b/library/vendor/Zend/Reflection/Property.php deleted file mode 100644 index bdeaf09df..000000000 --- a/library/vendor/Zend/Reflection/Property.php +++ /dev/null @@ -1,66 +0,0 @@ -getName()); - if (!$zendReflection instanceof Zend_Reflection_Class) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Class'); - } - unset($phpReflection); - return $zendReflection; - } - - /** - * Get docblock comment - * - * @param string $reflectionClass - * @return Zend_Reflection_Docblock|false False if no docblock defined - */ - public function getDocComment($reflectionClass = 'Zend_Reflection_Docblock') - { - $docblock = parent::getDocComment(); - if (!$docblock) { - return false; - } - - $r = new $reflectionClass($docblock); - if (!$r instanceof Zend_Reflection_Docblock) { - throw new Zend_Reflection_Exception('Invalid reflection class provided; must extend Zend_Reflection_Docblock'); - } - return $r; - } -} diff --git a/library/vendor/Zend/Rest/Client.php b/library/vendor/Zend/Rest/Client.php deleted file mode 100644 index c9ebe1f51..000000000 --- a/library/vendor/Zend/Rest/Client.php +++ /dev/null @@ -1,283 +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 - * @throws Zend_Rest_Client_Exception - * @return void - */ - 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 boolean $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 - * @throws Zend_Http_Client_Exception - * @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 - * @throws Zend_Http_Client_Exception - * @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 - * @throws Zend_Http_Client_Exception - * @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 - * @throws Zend_Http_Client_Exception - * @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_Result|Zend_Rest_Client Zend_Rest_Client if using - * a remote method, Zend_Rest_Client_Result if using an HTTP request method - */ - public function __call($method, $args) - { - $methods = array('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 = array();//Initializes for next Rest method. - return new Zend_Rest_Client_Result($response->getBody()); - } else { - // 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/vendor/Zend/Rest/Client/Exception.php b/library/vendor/Zend/Rest/Client/Exception.php deleted file mode 100644 index 14ae028ec..000000000 --- a/library/vendor/Zend/Rest/Client/Exception.php +++ /dev/null @@ -1,39 +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 - * @param array $errcontext - * @return true - */ - public function handleXmlErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null) - { - $this->_errstr = $errstr; - return true; - } - - /** - * Casts a SimpleXMLElement to its appropriate PHP value - * - * @param SimpleXMLElement $value - * @return mixed - */ - public function toValue(SimpleXMLElement $value) - { - $node = dom_import_simplexml($value); - return $node->nodeValue; - } - - /** - * Get Property Overload - * - * @param string $name - * @return null|SimpleXMLElement|array 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 = count($result); - - if ($count == 0) { - return null; - } elseif ($count == 1) { - return $result[0]; - } else { - 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); - } else { - $return = array(); - foreach ($value as $element) { - $return[] = $this->toValue($element); - } - return $return; - } - } - - return null; - } - - - /** - * Isset Overload - * - * @param string $name - * @return boolean - */ - 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() - { - return $this->_sxml; - } - - /** - * Get Request Status - * - * @return boolean - */ - 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; - } elseif (ctype_alpha($status) && $status != 'success') { - return false; - } else { - return (bool) $status; - } - } - - public function isError() - { - $status = $this->getStatus(); - if ($status) { - return false; - } else { - return true; - } - } - - public function isSuccess() - { - $status = $this->getStatus(); - if ($status) { - return true; - } else { - 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]; - } else { - $result = $this->_sxml->xpath('//response'); - if (sizeof($result) > 1) { - return (string) "An error occured."; - } else { - return (string) $result[0]; - } - } - } -} diff --git a/library/vendor/Zend/Rest/Client/Result/Exception.php b/library/vendor/Zend/Rest/Client/Result/Exception.php deleted file mode 100644 index e84076b5c..000000000 --- a/library/vendor/Zend/Rest/Client/Result/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ -Controllers to receive RESTful routes - * @var array - */ - protected $_restfulControllers = null; - - /** - * @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(), - array $responders = array() - ) { - $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 = array(); - $restfulConfigArray = array(); - 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 - * @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 = array(); - $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], array('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 = isset($path[$i + 1]) ? $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 - * @return string Route path with user submitted parameters - */ - public function assemble($data = array(), $reset = false, $encode = true) - { - if (!$this->_keysSet) { - if (null === $this->_request) { - $this->_request = $this->_front->getRequest(); - } - $this->_setRequestKeys(); - } - - $params = (!$reset) ? $this->_values : array(); - - 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], array('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/vendor/Zend/Rest/Server.php b/library/vendor/Zend/Rest/Server.php deleted file mode 100644 index 402edac98..000000000 --- a/library/vendor/Zend/Rest/Server.php +++ /dev/null @@ -1,668 +0,0 @@ -_reflection = new Zend_Server_Reflection(); - } - - /** - * Set XML encoding - * - * @param string $encoding - * @return Zend_Rest_Server - */ - public function setEncoding($encoding) - { - $this->_encoding = (string) $encoding; - return $this; - } - - /** - * Get XML encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Lowercase a string - * - * Lowercase's a string by reference - * - * @param string $value - * @param string $key - * @return string Lower cased string - */ - public static function lowerCase(&$value, &$key) - { - return $value = strtolower($value); - } - - /** - * Whether or not to return a response - * - * If called without arguments, returns the value of the flag. If called - * with an argument, sets the flag. - * - * When 'return response' is true, {@link handle()} will not send output, - * but will instead return the response from the dispatched function/method. - * - * @param boolean $flag - * @return boolean|Zend_Rest_Server Returns Zend_Rest_Server when used to set the flag; returns boolean flag value otherwise. - */ - public function returnResponse($flag = null) - { - if (null === $flag) { - return $this->_returnResponse; - } - - $this->_returnResponse = ($flag) ? true : false; - return $this; - } - - /** - * Implement Zend_Server_Interface::handle() - * - * @param array $request - * @throws Zend_Rest_Server_Exception - * @return string|void - */ - public function handle($request = false) - { - $this->_headers = array('Content-Type: text/xml'); - if (!$request) { - $request = $_REQUEST; - } - if (isset($request['method'])) { - $this->_method = $request['method']; - if (isset($this->_functions[$this->_method])) { - if ($this->_functions[$this->_method] instanceof - Zend_Server_Reflection_Function - || $this->_functions[$this->_method] instanceof - Zend_Server_Reflection_Method - && $this->_functions[$this->_method]->isPublic() - ) { - $requestKeys = array_keys($request); - array_walk($requestKeys, array(__CLASS__, "lowerCase")); - $request = array_combine($requestKeys, $request); - - $funcArgs = $this->_functions[$this->_method]->getParameters(); - - // calling_args will be a zero-based array of the parameters - $callingArgs = array(); - $missingArgs = array(); - foreach ($funcArgs as $i => $arg) { - if (isset($request[strtolower($arg->getName())])) { - $callingArgs[$i] = $request[strtolower($arg->getName())]; - } elseif ($arg->isOptional()) { - $callingArgs[$i] = $arg->getDefaultValue(); - } else { - $missingArgs[] = $arg->getName(); - } - } - - $anonymousArgs = array(); - foreach ($request as $key => $value) { - if (substr($key, 0, 3) == 'arg') { - $key = str_replace('arg', '', $key); - $anonymousArgs[$key] = $value; - if (($index = array_search($key, $missingArgs)) !== false) { - unset($missingArgs[$index]); - } - } - } - - // re-key the $anonymousArgs to be zero-based, and add in - // any values already set in calling_args (optional defaults) - ksort($anonymousArgs); - $callingArgs = array_values($anonymousArgs) + $callingArgs; - - // Sort arguments by key -- @see ZF-2279 - ksort($callingArgs); - - $result = false; - if (count($callingArgs) < count($funcArgs)) { - $result = $this->fault( - new Zend_Rest_Server_Exception( - 'Invalid Method Call to ' . $this->_method - . '. Missing argument(s): ' . implode( - ', ', $missingArgs - ) . '.' - ), 400 - ); - } - - if (!$result && $this->_functions[$this->_method] instanceof - Zend_Server_Reflection_Method - ) { - // Get class - $class = $this->_functions[$this->_method]->getDeclaringClass()->getName(); - - if ($this->_functions[$this->_method]->isStatic()) { - // for some reason, invokeArgs() does not work the same as - // invoke(), and expects the first argument to be an object. - // So, using a callback if the method is static. - $result = $this->_callStaticMethod( - $class, - $callingArgs - ); - } else { - // Object method - $result = $this->_callObjectMethod( - $class, - $callingArgs - ); - } - } elseif (!$result) { - try { - $result = call_user_func_array( - $this->_functions[$this->_method]->getName(), - $callingArgs - ); - } catch (Exception $e) { - $result = $this->fault($e); - } - } - } else { - $result = $this->fault( - new Zend_Rest_Server_Exception( - "Unknown Method '$this->_method'." - ), - 404 - ); - } - } else { - $result = $this->fault( - new Zend_Rest_Server_Exception( - "Unknown Method '$this->_method'." - ), - 404 - ); - } - } else { - $result = $this->fault( - new Zend_Rest_Server_Exception("No Method Specified."), - 404 - ); - } - - if ($result instanceof SimpleXMLElement) { - $response = $result->asXML(); - } elseif ($result instanceof DOMDocument) { - $response = $result->saveXML(); - } elseif ($result instanceof DOMNode) { - $response = $result->ownerDocument->saveXML($result); - } elseif (is_array($result) || is_object($result)) { - $response = $this->_handleStruct($result); - } else { - $response = $this->_handleScalar($result); - } - - if (!$this->returnResponse()) { - if (!headers_sent()) { - foreach ($this->_headers as $header) { - header($header); - } - } - - echo $response; - return; - } - - return $response; - } - - /** - * Implement Zend_Server_Interface::setClass() - * - * @param string $classname Class name - * @param string $namespace Class namespace (unused) - * @param array $argv An array of Constructor Arguments - */ - public function setClass($classname, $namespace = '', $argv = array()) - { - $this->_args = $argv; - foreach ($this->_reflection->reflectClass($classname, $argv)->getMethods() as $method) { - $this->_functions[$method->getName()] = $method; - } - } - - /** - * Handle an array or object result - * - * @param array|object $struct Result Value - * @return string XML Response - */ - protected function _handleStruct($struct) - { - $function = $this->_functions[$this->_method]; - if ($function instanceof Zend_Server_Reflection_Method) { - $class = $function->getDeclaringClass()->getName(); - } else { - $class = false; - } - - $method = $function->getName(); - - $dom = new DOMDocument('1.0', $this->getEncoding()); - if ($class) { - $root = $dom->createElement($class); - $method = $dom->createElement($method); - $root->appendChild($method); - } else { - $root = $dom->createElement($method); - $method = $root; - } - $root->setAttribute('generator', 'zend'); - $root->setAttribute('version', '1.0'); - $dom->appendChild($root); - - $this->_structValue($struct, $dom, $method); - - $struct = (array) $struct; - if (!isset($struct['status'])) { - $status = $dom->createElement('status', 'success'); - $method->appendChild($status); - } - - return $dom->saveXML(); - } - - /** - * Recursively iterate through a struct - * - * Recursively iterates through an associative array or object's properties - * to build XML response. - * - * @param mixed $struct - * @param DOMDocument $dom - * @param DOMElement $parent - * @return void - */ - protected function _structValue( - $struct, DOMDocument $dom, DOMElement $parent - ) - { - $struct = (array)$struct; - - foreach ($struct as $key => $value) { - if ($value === false) { - $value = 0; - } elseif ($value === true) { - $value = 1; - } - - if (ctype_digit((string)$key)) { - $key = 'key_' . $key; - } - - if (is_array($value) || is_object($value)) { - $element = $dom->createElement($key); - $this->_structValue($value, $dom, $element); - } else { - $element = $dom->createElement($key); - $element->appendChild($dom->createTextNode($value)); - } - - $parent->appendChild($element); - } - } - - /** - * Handle a single value - * - * @param string|int|boolean $value Result value - * @return string XML Response - */ - protected function _handleScalar($value) - { - $function = $this->_functions[$this->_method]; - if ($function instanceof Zend_Server_Reflection_Method) { - $class = $function->getDeclaringClass()->getName(); - } else { - $class = false; - } - - $method = $function->getName(); - - $dom = new DOMDocument('1.0', $this->getEncoding()); - if ($class) { - $xml = $dom->createElement($class); - $methodNode = $dom->createElement($method); - $xml->appendChild($methodNode); - } else { - $xml = $dom->createElement($method); - $methodNode = $xml; - } - $xml->setAttribute('generator', 'zend'); - $xml->setAttribute('version', '1.0'); - $dom->appendChild($xml); - - if ($value === false) { - $value = 0; - } elseif ($value === true) { - $value = 1; - } - - if (isset($value)) { - $element = $dom->createElement('response'); - $element->appendChild($dom->createTextNode($value)); - $methodNode->appendChild($element); - } else { - $methodNode->appendChild($dom->createElement('response')); - } - - $methodNode->appendChild($dom->createElement('status', 'success')); - - return $dom->saveXML(); - } - - /** - * Implement Zend_Server_Interface::fault() - * - * Creates XML error response, returning DOMDocument with response. - * - * @param string|Exception $fault Message - * @param int $code Error Code - * @return DOMDocument - */ - public function fault($exception = null, $code = null) - { - if (isset($this->_functions[$this->_method])) { - $function = $this->_functions[$this->_method]; - } elseif (isset($this->_method)) { - $function = $this->_method; - } else { - $function = 'rest'; - } - - if ($function instanceof Zend_Server_Reflection_Method) { - $class = $function->getDeclaringClass()->getName(); - } else { - $class = false; - } - - if ($function instanceof Zend_Server_Reflection_Function_Abstract) { - $method = $function->getName(); - } else { - $method = $function; - } - - $dom = new DOMDocument('1.0', $this->getEncoding()); - if ($class) { - $xml = $dom->createElement($class); - $xmlMethod = $dom->createElement($method); - $xml->appendChild($xmlMethod); - } else { - $xml = $dom->createElement($method); - $xmlMethod = $xml; - } - $xml->setAttribute('generator', 'zend'); - $xml->setAttribute('version', '1.0'); - $dom->appendChild($xml); - - $xmlResponse = $dom->createElement('response'); - $xmlMethod->appendChild($xmlResponse); - - if ($exception instanceof Exception) { - $element = $dom->createElement('message'); - $element->appendChild( - $dom->createTextNode($exception->getMessage()) - ); - $xmlResponse->appendChild($element); - $code = $exception->getCode(); - } elseif (($exception !== null) || 'rest' == $function) { - $xmlResponse->appendChild( - $dom->createElement( - 'message', 'An unknown error occured. Please try again.' - ) - ); - } else { - $xmlResponse->appendChild( - $dom->createElement( - 'message', 'Call to ' . $method . ' failed.' - ) - ); - } - - $xmlMethod->appendChild($xmlResponse); - $xmlMethod->appendChild($dom->createElement('status', 'failed')); - - // Headers to send - if ($code === null || (404 != $code)) { - $this->_headers[] = 'HTTP/1.0 400 Bad Request'; - } else { - $this->_headers[] = 'HTTP/1.0 404 File Not Found'; - } - - return $dom; - } - - /** - * Retrieve any HTTP extra headers set by the server - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * Implement Zend_Server_Interface::addFunction() - * - * @param string $function Function Name - * @param string $namespace Function namespace (unused) - */ - public function addFunction($function, $namespace = '') - { - if (!is_array($function)) { - $function = (array) $function; - } - - foreach ($function as $func) { - if (is_callable($func) && !in_array($func, self::$magicMethods)) { - $this->_functions[$func] = $this->_reflection->reflectFunction($func); - } else { - throw new Zend_Rest_Server_Exception( - "Invalid Method Added to Service." - ); - } - } - } - - /** - * Implement Zend_Server_Interface::getFunctions() - * - * @return array An array of Zend_Server_Reflection_Method's - */ - public function getFunctions() - { - return $this->_functions; - } - - /** - * Implement Zend_Server_Interface::loadFunctions() - * - * @todo Implement - * @param array $functions - */ - public function loadFunctions($functions) - { - } - - /** - * Implement Zend_Server_Interface::setPersistence() - * - * @todo Implement - * @param int $mode - */ - public function setPersistence($mode) - { - } - - /** - * Call a static class method and return the result - * - * @param string $class - * @param array $args - * @return mixed - */ - protected function _callStaticMethod($class, array $args) - { - try { - $result = call_user_func_array( - array( - $class, - $this->_functions[$this->_method]->getName() - ), - $args - ); - } catch (Exception $e) { - $result = $this->fault($e); - } - return $result; - } - - /** - * Call an instance method of an object - * - * @param string $class - * @param array $args - * @return mixed - * @throws Zend_Rest_Server_Exception For invalid class name - */ - protected function _callObjectMethod($class, array $args) - { - try { - if ($this->_functions[$this->_method]->getDeclaringClass()->getConstructor()) { - $object = $this->_functions[$this->_method]->getDeclaringClass()->newInstanceArgs($this->_args); - } else { - $object = $this->_functions[$this->_method]->getDeclaringClass()->newInstance(); - } - } catch (Exception $e) { - throw new Zend_Rest_Server_Exception( - 'Error instantiating class ' . $class . - ' to invoke method ' - . $this->_functions[$this->_method]->getName() . - ' (' . $e->getMessage() . ') ', - 500, - $e - ); - } - - try { - $result = $this->_functions[$this->_method]->invokeArgs( - $object, - $args - ); - } catch (Exception $e) { - $result = $this->fault($e); - } - - return $result; - } -} diff --git a/library/vendor/Zend/Rest/Server/Exception.php b/library/vendor/Zend/Rest/Server/Exception.php deleted file mode 100644 index 6a1274c3f..000000000 --- a/library/vendor/Zend/Rest/Server/Exception.php +++ /dev/null @@ -1,40 +0,0 @@ -getFileObject('segments.gen', false); - - $format = $genFile->readInt(); - if ($format != (int)0xFFFFFFFE) { - throw new Zend_Search_Lucene_Exception('Wrong segments.gen file format'); - } - - $gen1 = $genFile->readLong(); - $gen2 = $genFile->readLong(); - - if ($gen1 == $gen2) { - return $gen1; - } - - usleep(self::GENERATION_RETRIEVE_PAUSE * 1000); - } - - // All passes are failed - throw new Zend_Search_Lucene_Exception('Index is under processing now'); - } catch (Zend_Search_Lucene_Exception $e) { - if (strpos($e->getMessage(), 'is not readable') !== false) { - try { - // Try to open old style segments file - $segmentsFile = $directory->getFileObject('segments', false); - - // It's pre-2.1 index - return 0; - } catch (Zend_Search_Lucene_Exception $e) { - if (strpos($e->getMessage(), 'is not readable') !== false) { - return -1; - } else { - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - } - } else { - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - } - - return -1; - } - - /** - * Get generation number associated with this index instance - * - * The same generation number in pair with document number or query string - * guarantees to give the same result while index retrieving. - * So it may be used for search result caching. - * - * @return integer - */ - public function getGeneration() - { - return $this->_generation; - } - - - /** - * Get segments file name - * - * @param integer $generation - * @return string - */ - public static function getSegmentFileName($generation) - { - if ($generation == 0) { - return 'segments'; - } - - return 'segments_' . base_convert($generation, 10, 36); - } - - /** - * Get index format version - * - * @return integer - */ - public function getFormatVersion() - { - return $this->_formatVersion; - } - - /** - * Set index format version. - * Index is converted to this format at the nearest upfdate time - * - * @param int $formatVersion - * @throws Zend_Search_Lucene_Exception - */ - public function setFormatVersion($formatVersion) - { - if ($formatVersion != self::FORMAT_PRE_2_1 && - $formatVersion != self::FORMAT_2_1 && - $formatVersion != self::FORMAT_2_3) { - throw new Zend_Search_Lucene_Exception('Unsupported index format'); - } - - $this->_formatVersion = $formatVersion; - } - - /** - * Read segments file for pre-2.1 Lucene index format - * - * @throws Zend_Search_Lucene_Exception - */ - private function _readPre21SegmentsFile() - { - $segmentsFile = $this->_directory->getFileObject('segments'); - - $format = $segmentsFile->readInt(); - - if ($format != (int)0xFFFFFFFF) { - throw new Zend_Search_Lucene_Exception('Wrong segments file format'); - } - - // read version - $segmentsFile->readLong(); - - // read segment name counter - $segmentsFile->readInt(); - - $segments = $segmentsFile->readInt(); - - $this->_docCount = 0; - - // read segmentInfos - for ($count = 0; $count < $segments; $count++) { - $segName = $segmentsFile->readString(); - $segSize = $segmentsFile->readInt(); - $this->_docCount += $segSize; - - $this->_segmentInfos[$segName] = - new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, - $segName, - $segSize); - } - - // Use 2.1 as a target version. Index will be reorganized at update time. - $this->_formatVersion = self::FORMAT_2_1; - } - - /** - * Read segments file - * - * @throws Zend_Search_Lucene_Exception - */ - private function _readSegmentsFile() - { - $segmentsFile = $this->_directory->getFileObject(self::getSegmentFileName($this->_generation)); - - $format = $segmentsFile->readInt(); - - if ($format == (int)0xFFFFFFFC) { - $this->_formatVersion = self::FORMAT_2_3; - } else if ($format == (int)0xFFFFFFFD) { - $this->_formatVersion = self::FORMAT_2_1; - } else { - throw new Zend_Search_Lucene_Exception('Unsupported segments file format'); - } - - // read version - $segmentsFile->readLong(); - - // read segment name counter - $segmentsFile->readInt(); - - $segments = $segmentsFile->readInt(); - - $this->_docCount = 0; - - // read segmentInfos - for ($count = 0; $count < $segments; $count++) { - $segName = $segmentsFile->readString(); - $segSize = $segmentsFile->readInt(); - - // 2.1+ specific properties - $delGen = $segmentsFile->readLong(); - - if ($this->_formatVersion == self::FORMAT_2_3) { - $docStoreOffset = $segmentsFile->readInt(); - - if ($docStoreOffset != (int)0xFFFFFFFF) { - $docStoreSegment = $segmentsFile->readString(); - $docStoreIsCompoundFile = $segmentsFile->readByte(); - - $docStoreOptions = array('offset' => $docStoreOffset, - 'segment' => $docStoreSegment, - 'isCompound' => ($docStoreIsCompoundFile == 1)); - } else { - $docStoreOptions = null; - } - } else { - $docStoreOptions = null; - } - - $hasSingleNormFile = $segmentsFile->readByte(); - $numField = $segmentsFile->readInt(); - - $normGens = array(); - if ($numField != (int)0xFFFFFFFF) { - for ($count1 = 0; $count1 < $numField; $count1++) { - $normGens[] = $segmentsFile->readLong(); - } - - throw new Zend_Search_Lucene_Exception('Separate norm files are not supported. Optimize index to use it with Zend_Search_Lucene.'); - } - - $isCompoundByte = $segmentsFile->readByte(); - - if ($isCompoundByte == 0xFF) { - // The segment is not a compound file - $isCompound = false; - } else if ($isCompoundByte == 0x00) { - // The status is unknown - $isCompound = null; - } else if ($isCompoundByte == 0x01) { - // The segment is a compound file - $isCompound = true; - } - - $this->_docCount += $segSize; - - $this->_segmentInfos[$segName] = - new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, - $segName, - $segSize, - $delGen, - $docStoreOptions, - $hasSingleNormFile, - $isCompound); - } - } - - /** - * Opens the index. - * - * IndexReader constructor needs Directory as a parameter. It should be - * a string with a path to the index folder or a Directory object. - * - * @param Zend_Search_Lucene_Storage_Directory_Filesystem|string $directory - * @throws Zend_Search_Lucene_Exception - */ - public function __construct($directory = null, $create = false) - { - if ($directory === null) { - throw new Zend_Search_Exception('No index directory specified'); - } - - if (is_string($directory)) { - $this->_directory = new Zend_Search_Lucene_Storage_Directory_Filesystem($directory); - $this->_closeDirOnExit = true; - } else { - $this->_directory = $directory; - $this->_closeDirOnExit = false; - } - - $this->_segmentInfos = array(); - - // Mark index as "under processing" to prevent other processes from premature index cleaning - Zend_Search_Lucene_LockManager::obtainReadLock($this->_directory); - - $this->_generation = self::getActualGeneration($this->_directory); - - if ($create) { - try { - Zend_Search_Lucene_LockManager::obtainWriteLock($this->_directory); - } catch (Zend_Search_Lucene_Exception $e) { - Zend_Search_Lucene_LockManager::releaseReadLock($this->_directory); - - if (strpos($e->getMessage(), 'Can\'t obtain exclusive index lock') === false) { - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } else { - throw new Zend_Search_Lucene_Exception('Can\'t create index. It\'s under processing now', 0, $e); - } - } - - if ($this->_generation == -1) { - // Directory doesn't contain existing index, start from 1 - $this->_generation = 1; - $nameCounter = 0; - } else { - // Directory contains existing index - $segmentsFile = $this->_directory->getFileObject(self::getSegmentFileName($this->_generation)); - $segmentsFile->seek(12); // 12 = 4 (int, file format marker) + 8 (long, index version) - - $nameCounter = $segmentsFile->readInt(); - $this->_generation++; - } - - Zend_Search_Lucene_Index_Writer::createIndex($this->_directory, $this->_generation, $nameCounter); - - Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); - } - - if ($this->_generation == -1) { - throw new Zend_Search_Lucene_Exception('Index doesn\'t exists in the specified directory.'); - } else if ($this->_generation == 0) { - $this->_readPre21SegmentsFile(); - } else { - $this->_readSegmentsFile(); - } - } - - /** - * Close current index and free resources - */ - private function _close() - { - if ($this->_closed) { - // index is already closed and resources are cleaned up - return; - } - - $this->commit(); - - // Release "under processing" flag - Zend_Search_Lucene_LockManager::releaseReadLock($this->_directory); - - if ($this->_closeDirOnExit) { - $this->_directory->close(); - } - - $this->_directory = null; - $this->_writer = null; - $this->_segmentInfos = null; - - $this->_closed = true; - } - - /** - * Add reference to the index object - * - * @internal - */ - public function addReference() - { - $this->_refCount++; - } - - /** - * Remove reference from the index object - * - * When reference count becomes zero, index is closed and resources are cleaned up - * - * @internal - */ - public function removeReference() - { - $this->_refCount--; - - if ($this->_refCount == 0) { - $this->_close(); - } - } - - /** - * Object destructor - */ - public function __destruct() - { - $this->_close(); - } - - /** - * Returns an instance of Zend_Search_Lucene_Index_Writer for the index - * - * @return Zend_Search_Lucene_Index_Writer - */ - private function _getIndexWriter() - { - if ($this->_writer === null) { - $this->_writer = new Zend_Search_Lucene_Index_Writer($this->_directory, - $this->_segmentInfos, - $this->_formatVersion); - } - - return $this->_writer; - } - - - /** - * Returns the Zend_Search_Lucene_Storage_Directory instance for this index. - * - * @return Zend_Search_Lucene_Storage_Directory - */ - public function getDirectory() - { - return $this->_directory; - } - - - /** - * Returns the total number of documents in this index (including deleted documents). - * - * @return integer - */ - public function count() - { - return $this->_docCount; - } - - /** - * Returns one greater than the largest possible document number. - * This may be used to, e.g., determine how big to allocate a structure which will have - * an element for every document number in an index. - * - * @return integer - */ - public function maxDoc() - { - return $this->count(); - } - - /** - * Returns the total number of non-deleted documents in this index. - * - * @return integer - */ - public function numDocs() - { - $numDocs = 0; - - foreach ($this->_segmentInfos as $segmentInfo) { - $numDocs += $segmentInfo->numDocs(); - } - - return $numDocs; - } - - /** - * Checks, that document is deleted - * - * @param integer $id - * @return boolean - * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range - */ - public function isDeleted($id) - { - $this->commit(); - - if ($id >= $this->_docCount) { - throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); - } - - $segmentStartId = 0; - foreach ($this->_segmentInfos as $segmentInfo) { - if ($segmentStartId + $segmentInfo->count() > $id) { - break; - } - - $segmentStartId += $segmentInfo->count(); - } - - return $segmentInfo->isDeleted($id - $segmentStartId); - } - - /** - * Set default search field. - * - * Null means, that search is performed through all fields by default - * - * Default value is null - * - * @param string $fieldName - */ - public static function setDefaultSearchField($fieldName) - { - self::$_defaultSearchField = $fieldName; - } - - /** - * Get default search field. - * - * Null means, that search is performed through all fields by default - * - * @return string - */ - public static function getDefaultSearchField() - { - return self::$_defaultSearchField; - } - - /** - * Set result set limit. - * - * 0 (default) means no limit - * - * @param integer $limit - */ - public static function setResultSetLimit($limit) - { - self::$_resultSetLimit = $limit; - } - - /** - * Get result set limit. - * - * 0 means no limit - * - * @return integer - */ - public static function getResultSetLimit() - { - return self::$_resultSetLimit; - } - - /** - * Set terms per query limit. - * - * 0 means no limit - * - * @param integer $limit - */ - public static function setTermsPerQueryLimit($limit) - { - self::$_termsPerQueryLimit = $limit; - } - - /** - * Get result set limit. - * - * 0 (default) means no limit - * - * @return integer - */ - public static function getTermsPerQueryLimit() - { - return self::$_termsPerQueryLimit; - } - - /** - * Retrieve index maxBufferedDocs option - * - * maxBufferedDocs is a minimal number of documents required before - * the buffered in-memory documents are written into a new Segment - * - * Default value is 10 - * - * @return integer - */ - public function getMaxBufferedDocs() - { - return $this->_getIndexWriter()->maxBufferedDocs; - } - - /** - * Set index maxBufferedDocs option - * - * maxBufferedDocs is a minimal number of documents required before - * the buffered in-memory documents are written into a new Segment - * - * Default value is 10 - * - * @param integer $maxBufferedDocs - */ - public function setMaxBufferedDocs($maxBufferedDocs) - { - $this->_getIndexWriter()->maxBufferedDocs = $maxBufferedDocs; - } - - /** - * Retrieve index maxMergeDocs option - * - * maxMergeDocs is a largest number of documents ever merged by addDocument(). - * Small values (e.g., less than 10,000) are best for interactive indexing, - * as this limits the length of pauses while indexing to a few seconds. - * Larger values are best for batched indexing and speedier searches. - * - * Default value is PHP_INT_MAX - * - * @return integer - */ - public function getMaxMergeDocs() - { - return $this->_getIndexWriter()->maxMergeDocs; - } - - /** - * Set index maxMergeDocs option - * - * maxMergeDocs is a largest number of documents ever merged by addDocument(). - * Small values (e.g., less than 10,000) are best for interactive indexing, - * as this limits the length of pauses while indexing to a few seconds. - * Larger values are best for batched indexing and speedier searches. - * - * Default value is PHP_INT_MAX - * - * @param integer $maxMergeDocs - */ - public function setMaxMergeDocs($maxMergeDocs) - { - $this->_getIndexWriter()->maxMergeDocs = $maxMergeDocs; - } - - /** - * Retrieve index mergeFactor option - * - * mergeFactor determines how often segment indices are merged by addDocument(). - * With smaller values, less RAM is used while indexing, - * and searches on unoptimized indices are faster, - * but indexing speed is slower. - * With larger values, more RAM is used during indexing, - * and while searches on unoptimized indices are slower, - * indexing is faster. - * Thus larger values (> 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @return integer - */ - public function getMergeFactor() - { - return $this->_getIndexWriter()->mergeFactor; - } - - /** - * Set index mergeFactor option - * - * mergeFactor determines how often segment indices are merged by addDocument(). - * With smaller values, less RAM is used while indexing, - * and searches on unoptimized indices are faster, - * but indexing speed is slower. - * With larger values, more RAM is used during indexing, - * and while searches on unoptimized indices are slower, - * indexing is faster. - * Thus larger values (> 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @param integer $maxMergeDocs - */ - public function setMergeFactor($mergeFactor) - { - $this->_getIndexWriter()->mergeFactor = $mergeFactor; - } - - /** - * Performs a query against the index and returns an array - * of Zend_Search_Lucene_Search_QueryHit objects. - * Input is a string or Zend_Search_Lucene_Search_Query. - * - * @param Zend_Search_Lucene_Search_QueryParser|string $query - * @return array Zend_Search_Lucene_Search_QueryHit - * @throws Zend_Search_Lucene_Exception - */ - public function find($query) - { - if (is_string($query)) { - - $query = Zend_Search_Lucene_Search_QueryParser::parse($query); - } - - if (!$query instanceof Zend_Search_Lucene_Search_Query) { - throw new Zend_Search_Lucene_Exception('Query must be a string or Zend_Search_Lucene_Search_Query object'); - } - - $this->commit(); - - $hits = array(); - $scores = array(); - $ids = array(); - - $query = $query->rewrite($this)->optimize($this); - - $query->execute($this); - - $topScore = 0; - - /** Zend_Search_Lucene_Search_QueryHit */ - - foreach ($query->matchedDocs() as $id => $num) { - $docScore = $query->score($id, $this); - if( $docScore != 0 ) { - $hit = new Zend_Search_Lucene_Search_QueryHit($this); - $hit->id = $id; - $hit->score = $docScore; - - $hits[] = $hit; - $ids[] = $id; - $scores[] = $docScore; - - if ($docScore > $topScore) { - $topScore = $docScore; - } - } - - if (self::$_resultSetLimit != 0 && count($hits) >= self::$_resultSetLimit) { - break; - } - } - - if (count($hits) == 0) { - // skip sorting, which may cause a error on empty index - return array(); - } - - if ($topScore > 1) { - foreach ($hits as $hit) { - $hit->score /= $topScore; - } - } - - if (func_num_args() == 1) { - // sort by scores - array_multisort($scores, SORT_DESC, SORT_NUMERIC, - $ids, SORT_ASC, SORT_NUMERIC, - $hits); - } else { - // sort by given field names - - $argList = func_get_args(); - $fieldNames = $this->getFieldNames(); - $sortArgs = array(); - - // PHP 5.3 now expects all arguments to array_multisort be passed by - // reference (if it's invoked through call_user_func_array()); - // since constants can't be passed by reference, create some placeholder variables. - $sortReg = SORT_REGULAR; - $sortAsc = SORT_ASC; - $sortNum = SORT_NUMERIC; - - $sortFieldValues = array(); - - for ($count = 1; $count < count($argList); $count++) { - $fieldName = $argList[$count]; - - if (!is_string($fieldName)) { - throw new Zend_Search_Lucene_Exception('Field name must be a string.'); - } - - if (strtolower($fieldName) == 'score') { - $sortArgs[] = &$scores; - } else { - if (!in_array($fieldName, $fieldNames)) { - throw new Zend_Search_Lucene_Exception('Wrong field name.'); - } - - if (!isset($sortFieldValues[$fieldName])) { - $valuesArray = array(); - foreach ($hits as $hit) { - try { - $value = $hit->getDocument()->getFieldValue($fieldName); - } catch (Zend_Search_Lucene_Exception $e) { - if (strpos($e->getMessage(), 'not found') === false) { - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } else { - $value = null; - } - } - - $valuesArray[] = $value; - } - - // Collect loaded values in $sortFieldValues - // Required for PHP 5.3 which translates references into values when source - // variable is destroyed - $sortFieldValues[$fieldName] = $valuesArray; - } - - $sortArgs[] = &$sortFieldValues[$fieldName]; - } - - if ($count + 1 < count($argList) && is_integer($argList[$count+1])) { - $count++; - $sortArgs[] = &$argList[$count]; - - if ($count + 1 < count($argList) && is_integer($argList[$count+1])) { - $count++; - $sortArgs[] = &$argList[$count]; - } else { - if ($argList[$count] == SORT_ASC || $argList[$count] == SORT_DESC) { - $sortArgs[] = &$sortReg; - } else { - $sortArgs[] = &$sortAsc; - } - } - } else { - $sortArgs[] = &$sortAsc; - $sortArgs[] = &$sortReg; - } - } - - // Sort by id's if values are equal - $sortArgs[] = &$ids; - $sortArgs[] = &$sortAsc; - $sortArgs[] = &$sortNum; - - // Array to be sorted - $sortArgs[] = &$hits; - - // Do sort - call_user_func_array('array_multisort', $sortArgs); - } - - return $hits; - } - - - /** - * Returns a list of all unique field names that exist in this index. - * - * @param boolean $indexed - * @return array - */ - public function getFieldNames($indexed = false) - { - $result = array(); - foreach( $this->_segmentInfos as $segmentInfo ) { - $result = array_merge($result, $segmentInfo->getFields($indexed)); - } - return $result; - } - - - /** - * Returns a Zend_Search_Lucene_Document object for the document - * number $id in this index. - * - * @param integer|Zend_Search_Lucene_Search_QueryHit $id - * @return Zend_Search_Lucene_Document - * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range - */ - public function getDocument($id) - { - if ($id instanceof Zend_Search_Lucene_Search_QueryHit) { - /* @var $id Zend_Search_Lucene_Search_QueryHit */ - $id = $id->id; - } - - if ($id >= $this->_docCount) { - throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); - } - - $segmentStartId = 0; - foreach ($this->_segmentInfos as $segmentInfo) { - if ($segmentStartId + $segmentInfo->count() > $id) { - break; - } - - $segmentStartId += $segmentInfo->count(); - } - - $fdxFile = $segmentInfo->openCompoundFile('.fdx'); - $fdxFile->seek(($id-$segmentStartId)*8, SEEK_CUR); - $fieldValuesPosition = $fdxFile->readLong(); - - $fdtFile = $segmentInfo->openCompoundFile('.fdt'); - $fdtFile->seek($fieldValuesPosition, SEEK_CUR); - $fieldCount = $fdtFile->readVInt(); - - $doc = new Zend_Search_Lucene_Document(); - for ($count = 0; $count < $fieldCount; $count++) { - $fieldNum = $fdtFile->readVInt(); - $bits = $fdtFile->readByte(); - - $fieldInfo = $segmentInfo->getField($fieldNum); - - if (!($bits & 2)) { // Text data - $field = new Zend_Search_Lucene_Field($fieldInfo->name, - $fdtFile->readString(), - 'UTF-8', - true, - $fieldInfo->isIndexed, - $bits & 1 ); - } else { // Binary data - $field = new Zend_Search_Lucene_Field($fieldInfo->name, - $fdtFile->readBinary(), - '', - true, - $fieldInfo->isIndexed, - $bits & 1, - true ); - } - - $doc->addField($field); - } - - return $doc; - } - - - /** - * Returns true if index contain documents with specified term. - * - * Is used for query optimization. - * - * @param Zend_Search_Lucene_Index_Term $term - * @return boolean - */ - public function hasTerm(Zend_Search_Lucene_Index_Term $term) - { - foreach ($this->_segmentInfos as $segInfo) { - if ($segInfo->getTermInfo($term) !== null) { - return true; - } - } - - return false; - } - - /** - * Returns IDs of all documents containing term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - */ - public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - $subResults = array(); - $segmentStartDocId = 0; - - foreach ($this->_segmentInfos as $segmentInfo) { - $subResults[] = $segmentInfo->termDocs($term, $segmentStartDocId, $docsFilter); - - $segmentStartDocId += $segmentInfo->count(); - } - - if (count($subResults) == 0) { - return array(); - } else if (count($subResults) == 1) { - // Index is optimized (only one segment) - // Do not perform array reindexing - return reset($subResults); - } else { - $result = call_user_func_array('array_merge', $subResults); - } - - return $result; - } - - /** - * Returns documents filter for all documents containing term. - * - * It performs the same operation as termDocs, but return result as - * Zend_Search_Lucene_Index_DocsFilter object - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return Zend_Search_Lucene_Index_DocsFilter - */ - public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - $segmentStartDocId = 0; - $result = new Zend_Search_Lucene_Index_DocsFilter(); - - foreach ($this->_segmentInfos as $segmentInfo) { - $subResults[] = $segmentInfo->termDocs($term, $segmentStartDocId, $docsFilter); - - $segmentStartDocId += $segmentInfo->count(); - } - - if (count($subResults) == 0) { - return array(); - } else if (count($subResults) == 1) { - // Index is optimized (only one segment) - // Do not perform array reindexing - return reset($subResults); - } else { - $result = call_user_func_array('array_merge', $subResults); - } - - return $result; - } - - - /** - * Returns an array of all term freqs. - * Result array structure: array(docId => freq, ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return integer - */ - public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - $result = array(); - $segmentStartDocId = 0; - foreach ($this->_segmentInfos as $segmentInfo) { - $result += $segmentInfo->termFreqs($term, $segmentStartDocId, $docsFilter); - - $segmentStartDocId += $segmentInfo->count(); - } - - return $result; - } - - /** - * Returns an array of all term positions in the documents. - * Result array structure: array(docId => array(pos1, pos2, ...), ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - */ - public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - $result = array(); - $segmentStartDocId = 0; - foreach ($this->_segmentInfos as $segmentInfo) { - $result += $segmentInfo->termPositions($term, $segmentStartDocId, $docsFilter); - - $segmentStartDocId += $segmentInfo->count(); - } - - return $result; - } - - - /** - * Returns the number of documents in this index containing the $term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @return integer - */ - public function docFreq(Zend_Search_Lucene_Index_Term $term) - { - $result = 0; - foreach ($this->_segmentInfos as $segInfo) { - $termInfo = $segInfo->getTermInfo($term); - if ($termInfo !== null) { - $result += $termInfo->docFreq; - } - } - - return $result; - } - - - /** - * Retrive similarity used by index reader - * - * @return Zend_Search_Lucene_Search_Similarity - */ - public function getSimilarity() - { - /** Zend_Search_Lucene_Search_Similarity */ - - return Zend_Search_Lucene_Search_Similarity::getDefault(); - } - - - /** - * Returns a normalization factor for "field, document" pair. - * - * @param integer $id - * @param string $fieldName - * @return float - */ - public function norm($id, $fieldName) - { - if ($id >= $this->_docCount) { - return null; - } - - $segmentStartId = 0; - foreach ($this->_segmentInfos as $segInfo) { - if ($segmentStartId + $segInfo->count() > $id) { - break; - } - - $segmentStartId += $segInfo->count(); - } - - if ($segInfo->isDeleted($id - $segmentStartId)) { - return 0; - } - - return $segInfo->norm($id - $segmentStartId, $fieldName); - } - - /** - * Returns true if any documents have been deleted from this index. - * - * @return boolean - */ - public function hasDeletions() - { - foreach ($this->_segmentInfos as $segmentInfo) { - if ($segmentInfo->hasDeletions()) { - return true; - } - } - - return false; - } - - - /** - * Deletes a document from the index. - * $id is an internal document id - * - * @param integer|Zend_Search_Lucene_Search_QueryHit $id - * @throws Zend_Search_Lucene_Exception - */ - public function delete($id) - { - if ($id instanceof Zend_Search_Lucene_Search_QueryHit) { - /* @var $id Zend_Search_Lucene_Search_QueryHit */ - $id = $id->id; - } - - if ($id >= $this->_docCount) { - throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); - } - - $segmentStartId = 0; - foreach ($this->_segmentInfos as $segmentInfo) { - if ($segmentStartId + $segmentInfo->count() > $id) { - break; - } - - $segmentStartId += $segmentInfo->count(); - } - $segmentInfo->delete($id - $segmentStartId); - - $this->_hasChanges = true; - } - - - - /** - * Adds a document to this index. - * - * @param Zend_Search_Lucene_Document $document - */ - public function addDocument(Zend_Search_Lucene_Document $document) - { - $this->_getIndexWriter()->addDocument($document); - $this->_docCount++; - - $this->_hasChanges = true; - } - - - /** - * Update document counter - */ - private function _updateDocCount() - { - $this->_docCount = 0; - foreach ($this->_segmentInfos as $segInfo) { - $this->_docCount += $segInfo->count(); - } - } - - /** - * Commit changes resulting from delete() or undeleteAll() operations. - * - * @todo undeleteAll processing. - */ - public function commit() - { - if ($this->_hasChanges) { - $this->_getIndexWriter()->commit(); - - $this->_updateDocCount(); - - $this->_hasChanges = false; - } - } - - - /** - * Optimize index. - * - * Merges all segments into one - */ - public function optimize() - { - // Commit changes if any changes have been made - $this->commit(); - - if (count($this->_segmentInfos) > 1 || $this->hasDeletions()) { - $this->_getIndexWriter()->optimize(); - $this->_updateDocCount(); - } - } - - - /** - * Returns an array of all terms in this index. - * - * @return array - */ - public function terms() - { - $result = array(); - - /** Zend_Search_Lucene_Index_TermsPriorityQueue */ - - $segmentInfoQueue = new Zend_Search_Lucene_Index_TermsPriorityQueue(); - - foreach ($this->_segmentInfos as $segmentInfo) { - $segmentInfo->resetTermsStream(); - - // Skip "empty" segments - if ($segmentInfo->currentTerm() !== null) { - $segmentInfoQueue->put($segmentInfo); - } - } - - while (($segmentInfo = $segmentInfoQueue->pop()) !== null) { - if ($segmentInfoQueue->top() === null || - $segmentInfoQueue->top()->currentTerm()->key() != - $segmentInfo->currentTerm()->key()) { - // We got new term - $result[] = $segmentInfo->currentTerm(); - } - - if ($segmentInfo->nextTerm() !== null) { - // Put segment back into the priority queue - $segmentInfoQueue->put($segmentInfo); - } - } - - return $result; - } - - - /** - * Terms stream priority queue object - * - * @var Zend_Search_Lucene_TermStreamsPriorityQueue - */ - private $_termsStream = null; - - /** - * Reset terms stream. - */ - public function resetTermsStream() - { - if ($this->_termsStream === null) { - /** Zend_Search_Lucene_TermStreamsPriorityQueue */ - - $this->_termsStream = new Zend_Search_Lucene_TermStreamsPriorityQueue($this->_segmentInfos); - } else { - $this->_termsStream->resetTermsStream(); - } - } - - /** - * Skip terms stream up to the specified term preffix. - * - * Prefix contains fully specified field info and portion of searched term - * - * @param Zend_Search_Lucene_Index_Term $prefix - */ - public function skipTo(Zend_Search_Lucene_Index_Term $prefix) - { - $this->_termsStream->skipTo($prefix); - } - - /** - * Scans terms dictionary and returns next term - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function nextTerm() - { - return $this->_termsStream->nextTerm(); - } - - /** - * Returns term in current position - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function currentTerm() - { - return $this->_termsStream->currentTerm(); - } - - /** - * Close terms stream - * - * Should be used for resources clean up if stream is not read up to the end - */ - public function closeTermsStream() - { - $this->_termsStream->closeTermsStream(); - $this->_termsStream = null; - } - - - /************************************************************************* - @todo UNIMPLEMENTED - *************************************************************************/ - /** - * Undeletes all documents currently marked as deleted in this index. - * - * @todo Implementation - */ - public function undeleteAll() - {} -} diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer.php deleted file mode 100644 index 080253395..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer.php +++ /dev/null @@ -1,166 +0,0 @@ -setInput($data, $encoding); - - $tokenList = array(); - while (($nextToken = $this->nextToken()) !== null) { - $tokenList[] = $nextToken; - } - - return $tokenList; - } - - - /** - * Tokenization stream API - * Set input - * - * @param string $data - */ - public function setInput($data, $encoding = '') - { - $this->_input = $data; - $this->_encoding = $encoding; - $this->reset(); - } - - /** - * Reset token stream - */ - abstract public function reset(); - - /** - * Tokenization stream API - * Get next token - * Returns null at the end of stream - * - * Tokens are returned in UTF-8 (internal Zend_Search_Lucene encoding) - * - * @return Zend_Search_Lucene_Analysis_Token|null - */ - abstract public function nextToken(); - - - - - /** - * Set the default Analyzer implementation used by indexing code. - * - * @param Zend_Search_Lucene_Analysis_Analyzer $similarity - */ - public static function setDefault(Zend_Search_Lucene_Analysis_Analyzer $analyzer) - { - self::$_defaultImpl = $analyzer; - } - - - /** - * Return the default Analyzer implementation used by indexing code. - * - * @return Zend_Search_Lucene_Analysis_Analyzer - */ - public static function getDefault() - { - /** Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive */ - - if (!self::$_defaultImpl instanceof Zend_Search_Lucene_Analysis_Analyzer) { - self::$_defaultImpl = new Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive(); - } - - return self::$_defaultImpl; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common.php deleted file mode 100644 index ad4e28214..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common.php +++ /dev/null @@ -1,91 +0,0 @@ -_filters[] = $filter; - } - - /** - * Apply filters to the token. Can return null when the token was removed. - * - * @param Zend_Search_Lucene_Analysis_Token $token - * @return Zend_Search_Lucene_Analysis_Token - */ - public function normalize(Zend_Search_Lucene_Analysis_Token $token) - { - foreach ($this->_filters as $filter) { - $token = $filter->normalize($token); - - // resulting token can be null if the filter removes it - if ($token === null) { - return null; - } - } - - return $token; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php deleted file mode 100644 index 662aa878f..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php +++ /dev/null @@ -1,95 +0,0 @@ -_position = 0; - - if ($this->_input === null) { - return; - } - - // convert input into ascii - if (PHP_OS != 'AIX') { - $this->_input = iconv($this->_encoding, 'ASCII//TRANSLIT', $this->_input); - } - $this->_encoding = 'ASCII'; - } - - /** - * Tokenization stream API - * Get next token - * Returns null at the end of stream - * - * @return Zend_Search_Lucene_Analysis_Token|null - */ - public function nextToken() - { - if ($this->_input === null) { - return null; - } - - - do { - if (! preg_match('/[a-zA-Z]+/', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_position)) { - // It covers both cases a) there are no matches (preg_match(...) === 0) - // b) error occured (preg_match(...) === FALSE) - return null; - } - - $str = $match[0][0]; - $pos = $match[0][1]; - $endpos = $pos + strlen($str); - - $this->_position = $endpos; - - $token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($str, $pos, $endpos)); - } while ($token === null); // try again if token is skipped - - return $token; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php deleted file mode 100644 index 10e8e06ce..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php +++ /dev/null @@ -1,45 +0,0 @@ -addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_LowerCase()); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php deleted file mode 100644 index 24177f871..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php +++ /dev/null @@ -1,94 +0,0 @@ -_position = 0; - - if ($this->_input === null) { - return; - } - - // convert input into ascii - if (PHP_OS != 'AIX') { - $this->_input = iconv($this->_encoding, 'ASCII//TRANSLIT', $this->_input); - } - $this->_encoding = 'ASCII'; - } - - /** - * Tokenization stream API - * Get next token - * Returns null at the end of stream - * - * @return Zend_Search_Lucene_Analysis_Token|null - */ - public function nextToken() - { - if ($this->_input === null) { - return null; - } - - do { - if (! preg_match('/[a-zA-Z0-9]+/', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_position)) { - // It covers both cases a) there are no matches (preg_match(...) === 0) - // b) error occured (preg_match(...) === FALSE) - return null; - } - - $str = $match[0][0]; - $pos = $match[0][1]; - $endpos = $pos + strlen($str); - - $this->_position = $endpos; - - $token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($str, $pos, $endpos)); - } while ($token === null); // try again if token is skipped - - return $token; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php deleted file mode 100644 index 7ecdc087b..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php +++ /dev/null @@ -1,45 +0,0 @@ -addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_LowerCase()); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php deleted file mode 100644 index 3810729a5..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php +++ /dev/null @@ -1,124 +0,0 @@ -_position = 0; - $this->_bytePosition = 0; - - // convert input into UTF-8 - if (strcasecmp($this->_encoding, 'utf8' ) != 0 && - strcasecmp($this->_encoding, 'utf-8') != 0 ) { - $this->_input = iconv($this->_encoding, 'UTF-8', $this->_input); - $this->_encoding = 'UTF-8'; - } - } - - /** - * Tokenization stream API - * Get next token - * Returns null at the end of stream - * - * @return Zend_Search_Lucene_Analysis_Token|null - */ - public function nextToken() - { - if ($this->_input === null) { - return null; - } - - do { - if (! preg_match('/[\p{L}]+/u', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_bytePosition)) { - // It covers both cases a) there are no matches (preg_match(...) === 0) - // b) error occured (preg_match(...) === FALSE) - return null; - } - - // matched string - $matchedWord = $match[0][0]; - - // binary position of the matched word in the input stream - $binStartPos = $match[0][1]; - - // character position of the matched word in the input stream - $startPos = $this->_position + - iconv_strlen(substr($this->_input, - $this->_bytePosition, - $binStartPos - $this->_bytePosition), - 'UTF-8'); - // character postion of the end of matched word in the input stream - $endPos = $startPos + iconv_strlen($matchedWord, 'UTF-8'); - - $this->_bytePosition = $binStartPos + strlen($matchedWord); - $this->_position = $endPos; - - $token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($matchedWord, $startPos, $endPos)); - } while ($token === null); // try again if token is skipped - - return $token; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php deleted file mode 100644 index fbe5a8a2c..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php +++ /dev/null @@ -1,47 +0,0 @@ -addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_LowerCaseUtf8()); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php deleted file mode 100644 index 47d377f3b..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php +++ /dev/null @@ -1,124 +0,0 @@ -_position = 0; - $this->_bytePosition = 0; - - // convert input into UTF-8 - if (strcasecmp($this->_encoding, 'utf8' ) != 0 && - strcasecmp($this->_encoding, 'utf-8') != 0 ) { - $this->_input = iconv($this->_encoding, 'UTF-8', $this->_input); - $this->_encoding = 'UTF-8'; - } - } - - /** - * Tokenization stream API - * Get next token - * Returns null at the end of stream - * - * @return Zend_Search_Lucene_Analysis_Token|null - */ - public function nextToken() - { - if ($this->_input === null) { - return null; - } - - do { - if (! preg_match('/[\p{L}\p{N}]+/u', $this->_input, $match, PREG_OFFSET_CAPTURE, $this->_bytePosition)) { - // It covers both cases a) there are no matches (preg_match(...) === 0) - // b) error occured (preg_match(...) === FALSE) - return null; - } - - // matched string - $matchedWord = $match[0][0]; - - // binary position of the matched word in the input stream - $binStartPos = $match[0][1]; - - // character position of the matched word in the input stream - $startPos = $this->_position + - iconv_strlen(substr($this->_input, - $this->_bytePosition, - $binStartPos - $this->_bytePosition), - 'UTF-8'); - // character postion of the end of matched word in the input stream - $endPos = $startPos + iconv_strlen($matchedWord, 'UTF-8'); - - $this->_bytePosition = $binStartPos + strlen($matchedWord); - $this->_position = $endPos; - - $token = $this->normalize(new Zend_Search_Lucene_Analysis_Token($matchedWord, $startPos, $endPos)); - } while ($token === null); // try again if token is skipped - - return $token; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php b/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php deleted file mode 100644 index 46aff0272..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php +++ /dev/null @@ -1,47 +0,0 @@ -addFilter(new Zend_Search_Lucene_Analysis_TokenFilter_LowerCaseUtf8()); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/Token.php b/library/vendor/Zend/Search/Lucene/Analysis/Token.php deleted file mode 100644 index dc900d16c..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/Token.php +++ /dev/null @@ -1,166 +0,0 @@ -_termText = $text; - $this->_startOffset = $start; - $this->_endOffset = $end; - - $this->_positionIncrement = 1; - } - - - /** - * positionIncrement setter - * - * @param integer $positionIncrement - */ - public function setPositionIncrement($positionIncrement) - { - $this->_positionIncrement = $positionIncrement; - } - - /** - * Returns the position increment of this Token. - * - * @return integer - */ - public function getPositionIncrement() - { - return $this->_positionIncrement; - } - - /** - * Returns the Token's term text. - * - * @return string - */ - public function getTermText() - { - return $this->_termText; - } - - /** - * Sets the Token's term text. - * - * @param string $text - * @return this - */ - public function setTermText($text) - { - $this->_termText = $text; - return $this; - } - - /** - * Returns this Token's starting offset, the position of the first character - * corresponding to this token in the source text. - * - * Note: - * The difference between getEndOffset() and getStartOffset() may not be equal - * to strlen(Zend_Search_Lucene_Analysis_Token::getTermText()), as the term text may have been altered - * by a stemmer or some other filter. - * - * @return integer - */ - public function getStartOffset() - { - return $this->_startOffset; - } - - /** - * Returns this Token's ending offset, one greater than the position of the - * last character corresponding to this token in the source text. - * - * @return integer - */ - public function getEndOffset() - { - return $this->_endOffset; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter.php b/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter.php deleted file mode 100644 index c1705971e..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter.php +++ /dev/null @@ -1,46 +0,0 @@ -setTermText(strtolower($srcToken->getTermText())); - return $srcToken; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php b/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php deleted file mode 100644 index 94b877de3..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php +++ /dev/null @@ -1,62 +0,0 @@ -setTermText(mb_strtolower($srcToken->getTermText(), 'UTF-8')); - return $srcToken; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php b/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php deleted file mode 100644 index 6931ec1ca..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php +++ /dev/null @@ -1,68 +0,0 @@ -length = $length; - } - - /** - * Normalize Token or remove it (if null is returned) - * - * @param Zend_Search_Lucene_Analysis_Token $srcToken - * @return Zend_Search_Lucene_Analysis_Token - */ - public function normalize(Zend_Search_Lucene_Analysis_Token $srcToken) { - if (strlen($srcToken->getTermText()) < $this->length) { - return null; - } else { - return $srcToken; - } - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php b/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php deleted file mode 100644 index a9cca5333..000000000 --- a/library/vendor/Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php +++ /dev/null @@ -1,97 +0,0 @@ - 1, 'an' => '1'); - * - * We do recommend to provide all words in lowercase and concatenate this class after the lowercase filter. - * - * @category Zend - * @package Zend_Search_Lucene - * @subpackage Analysis - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ - -class Zend_Search_Lucene_Analysis_TokenFilter_StopWords extends Zend_Search_Lucene_Analysis_TokenFilter -{ - /** - * Stop Words - * @var array - */ - private $_stopSet; - - /** - * Constructs new instance of this filter. - * - * @param array $stopwords array (set) of words that will be filtered out - */ - public function __construct($stopwords = array()) { - $this->_stopSet = array_flip($stopwords); - } - - /** - * Normalize Token or remove it (if null is returned) - * - * @param Zend_Search_Lucene_Analysis_Token $srcToken - * @return Zend_Search_Lucene_Analysis_Token - */ - public function normalize(Zend_Search_Lucene_Analysis_Token $srcToken) { - if (array_key_exists($srcToken->getTermText(), $this->_stopSet)) { - return null; - } else { - return $srcToken; - } - } - - /** - * Fills stopwords set from a text file. Each line contains one stopword, lines with '#' in the first - * column are ignored (as comments). - * - * You can call this method one or more times. New stopwords are always added to current set. - * - * @param string $filepath full path for text file with stopwords - * @throws Zend_Search_Exception When the file doesn`t exists or is not readable. - */ - public function loadFromFile($filepath = null) { - if (! $filepath || ! file_exists($filepath)) { - throw new Zend_Search_Lucene_Exception('You have to provide valid file path'); - } - $fd = fopen($filepath, "r"); - if (! $fd) { - throw new Zend_Search_Lucene_Exception('Cannot open file ' . $filepath); - } - while (!feof ($fd)) { - $buffer = trim(fgets($fd)); - if (strlen($buffer) > 0 && $buffer[0] != '#') { - $this->_stopSet[$buffer] = 1; - } - } - if (!fclose($fd)) { - throw new Zend_Search_Lucene_Exception('Cannot close file ' . $filepath); - } - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Document.php b/library/vendor/Zend/Search/Lucene/Document.php deleted file mode 100644 index 8158c7096..000000000 --- a/library/vendor/Zend/Search/Lucene/Document.php +++ /dev/null @@ -1,129 +0,0 @@ -getFieldValue($offset); - } - - - /** - * Add a field object to this document. - * - * @param Zend_Search_Lucene_Field $field - * @return Zend_Search_Lucene_Document - */ - public function addField(Zend_Search_Lucene_Field $field) - { - $this->_fields[$field->name] = $field; - - return $this; - } - - - /** - * Return an array with the names of the fields in this document. - * - * @return array - */ - public function getFieldNames() - { - return array_keys($this->_fields); - } - - - /** - * Returns Zend_Search_Lucene_Field object for a named field in this document. - * - * @param string $fieldName - * @return Zend_Search_Lucene_Field - */ - public function getField($fieldName) - { - if (!array_key_exists($fieldName, $this->_fields)) { - throw new Zend_Search_Lucene_Exception("Field name \"$fieldName\" not found in document."); - } - return $this->_fields[$fieldName]; - } - - - /** - * Returns the string value of a named field in this document. - * - * @see __get() - * @return string - */ - public function getFieldValue($fieldName) - { - return $this->getField($fieldName)->value; - } - - /** - * Returns the string value of a named field in UTF-8 encoding. - * - * @see __get() - * @return string - */ - public function getFieldUtf8Value($fieldName) - { - return $this->getField($fieldName)->getUtf8Value(); - } -} diff --git a/library/vendor/Zend/Search/Lucene/Document/Docx.php b/library/vendor/Zend/Search/Lucene/Document/Docx.php deleted file mode 100644 index 697298ba7..000000000 --- a/library/vendor/Zend/Search/Lucene/Document/Docx.php +++ /dev/null @@ -1,149 +0,0 @@ -open($fileName); - - // Read relations and search for officeDocument - $relationsXml = $package->getFromName('_rels/.rels'); - if ($relationsXml === false) { - throw new Zend_Search_Lucene_Exception('Invalid archive or corrupted .docx file.'); - } - $relations = Zend_Xml_Security::scan($relationsXml); - foreach($relations->Relationship as $rel) { - if ($rel ["Type"] == Zend_Search_Lucene_Document_OpenXml::SCHEMA_OFFICEDOCUMENT) { - // Found office document! Read in contents... - $contents = Zend_Xml_Security::scan($package->getFromName( - $this->absoluteZipPath(dirname($rel['Target']) - . '/' - . basename($rel['Target'])) - )); - - $contents->registerXPathNamespace('w', Zend_Search_Lucene_Document_Docx::SCHEMA_WORDPROCESSINGML); - $paragraphs = $contents->xpath('//w:body/w:p'); - - foreach ($paragraphs as $paragraph) { - $runs = $paragraph->xpath('.//w:r/*[name() = "w:t" or name() = "w:br"]'); - - if ($runs === false) { - // Paragraph doesn't contain any text or breaks - continue; - } - - foreach ($runs as $run) { - if ($run->getName() == 'br') { - // Break element - $documentBody[] = ' '; - } else { - $documentBody[] = (string)$run; - } - } - - // Add space after each paragraph. So they are not bound together. - $documentBody[] = ' '; - } - - break; - } - } - - // Read core properties - $coreProperties = $this->extractMetaData($package); - - // Close file - $package->close(); - - // Store filename - $this->addField(Zend_Search_Lucene_Field::Text('filename', $fileName, 'UTF-8')); - - // Store contents - if ($storeContent) { - $this->addField(Zend_Search_Lucene_Field::Text('body', implode('', $documentBody), 'UTF-8')); - } else { - $this->addField(Zend_Search_Lucene_Field::UnStored('body', implode('', $documentBody), 'UTF-8')); - } - - // Store meta data properties - foreach ($coreProperties as $key => $value) { - $this->addField(Zend_Search_Lucene_Field::Text($key, $value, 'UTF-8')); - } - - // Store title (if not present in meta data) - if (! isset($coreProperties['title'])) { - $this->addField(Zend_Search_Lucene_Field::Text('title', $fileName, 'UTF-8')); - } - } - - /** - * Load Docx document from a file - * - * @param string $fileName - * @param boolean $storeContent - * @return Zend_Search_Lucene_Document_Docx - * @throws Zend_Search_Lucene_Document_Exception - */ - public static function loadDocxFile($fileName, $storeContent = false) { - if (!is_readable($fileName)) { - throw new Zend_Search_Lucene_Document_Exception('Provided file \'' . $fileName . '\' is not readable.'); - } - - return new Zend_Search_Lucene_Document_Docx($fileName, $storeContent); - } -} diff --git a/library/vendor/Zend/Search/Lucene/Document/Exception.php b/library/vendor/Zend/Search/Lucene/Document/Exception.php deleted file mode 100644 index 836774d53..000000000 --- a/library/vendor/Zend/Search/Lucene/Document/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ -_doc = new DOMDocument(); - $this->_doc->substituteEntities = true; - - if ($isFile) { - $htmlData = file_get_contents($data); - } else { - $htmlData = $data; - } - @$this->_doc->loadHTML($htmlData); - - if ($this->_doc->encoding === null) { - // Document encoding is not recognized - - /** @todo improve HTML vs HTML fragment recognition */ - if (preg_match('/]*>/i', $htmlData, $matches, PREG_OFFSET_CAPTURE)) { - // It's an HTML document - // Add additional HEAD section and recognize document - $htmlTagOffset = $matches[0][1] + strlen($matches[0][0]); - - @$this->_doc->loadHTML(iconv($defaultEncoding, 'UTF-8//IGNORE', substr($htmlData, 0, $htmlTagOffset)) - . '' - . iconv($defaultEncoding, 'UTF-8//IGNORE', substr($htmlData, $htmlTagOffset))); - - // Remove additional HEAD section - $xpath = new DOMXPath($this->_doc); - $head = $xpath->query('/html/head')->item(0); - $head->parentNode->removeChild($head); - } else { - // It's an HTML fragment - @$this->_doc->loadHTML('' - . iconv($defaultEncoding, 'UTF-8//IGNORE', $htmlData) - . ''); - } - - } - /** @todo Add correction of wrong HTML encoding recognition processing - * The case is: - * Content-type HTTP-EQUIV meta tag is presented, but ISO-8859-5 encoding is actually used, - * even $this->_doc->encoding demonstrates another recognized encoding - */ - - $xpath = new DOMXPath($this->_doc); - - $docTitle = ''; - $titleNodes = $xpath->query('/html/head/title'); - foreach ($titleNodes as $titleNode) { - // title should always have only one entry, but we process all nodeset entries - $docTitle .= $titleNode->nodeValue . ' '; - } - $this->addField(Zend_Search_Lucene_Field::Text('title', $docTitle, 'UTF-8')); - - $metaNodes = $xpath->query('/html/head/meta[@name]'); - foreach ($metaNodes as $metaNode) { - $this->addField(Zend_Search_Lucene_Field::Text($metaNode->getAttribute('name'), - $metaNode->getAttribute('content'), - 'UTF-8')); - } - - $docBody = ''; - $bodyNodes = $xpath->query('/html/body'); - foreach ($bodyNodes as $bodyNode) { - // body should always have only one entry, but we process all nodeset entries - $this->_retrieveNodeText($bodyNode, $docBody); - } - if ($storeContent) { - $this->addField(Zend_Search_Lucene_Field::Text('body', $docBody, 'UTF-8')); - } else { - $this->addField(Zend_Search_Lucene_Field::UnStored('body', $docBody, 'UTF-8')); - } - - $linkNodes = $this->_doc->getElementsByTagName('a'); - foreach ($linkNodes as $linkNode) { - if (($href = $linkNode->getAttribute('href')) != '' && - (!self::$_excludeNoFollowLinks || strtolower($linkNode->getAttribute('rel')) != 'nofollow' ) - ) { - $this->_links[] = $href; - } - } - $linkNodes = $this->_doc->getElementsByTagName('area'); - foreach ($linkNodes as $linkNode) { - if (($href = $linkNode->getAttribute('href')) != '' && - (!self::$_excludeNoFollowLinks || strtolower($linkNode->getAttribute('rel')) != 'nofollow' ) - ) { - $this->_links[] = $href; - } - } - $this->_links = array_unique($this->_links); - - $linkNodes = $xpath->query('/html/head/link'); - foreach ($linkNodes as $linkNode) { - if (($href = $linkNode->getAttribute('href')) != '') { - $this->_headerLinks[] = $href; - } - } - $this->_headerLinks = array_unique($this->_headerLinks); - } - - /** - * Set exclude nofollow links flag - * - * @param boolean $newValue - */ - public static function setExcludeNoFollowLinks($newValue) - { - self::$_excludeNoFollowLinks = $newValue; - } - - /** - * Get exclude nofollow links flag - * - * @return boolean - */ - public static function getExcludeNoFollowLinks() - { - return self::$_excludeNoFollowLinks; - } - - /** - * Get node text - * - * We should exclude scripts, which may be not included into comment tags, CDATA sections, - * - * @param DOMNode $node - * @param string &$text - */ - private function _retrieveNodeText(DOMNode $node, &$text) - { - if ($node->nodeType == XML_TEXT_NODE) { - $text .= $node->nodeValue; - if(!in_array($node->parentNode->tagName, $this->_inlineTags)) { - $text .= ' '; - } - } else if ($node->nodeType == XML_ELEMENT_NODE && $node->nodeName != 'script') { - foreach ($node->childNodes as $childNode) { - $this->_retrieveNodeText($childNode, $text); - } - } - } - - /** - * Get document HREF links - * - * @return array - */ - public function getLinks() - { - return $this->_links; - } - - /** - * Get document header links - * - * @return array - */ - public function getHeaderLinks() - { - return $this->_headerLinks; - } - - /** - * Load HTML document from a string - * - * @param string $data - * @param boolean $storeContent - * @param string $defaultEncoding HTML encoding, is used if it's not specified using Content-type HTTP-EQUIV meta tag. - * @return Zend_Search_Lucene_Document_Html - */ - public static function loadHTML($data, $storeContent = false, $defaultEncoding = '') - { - return new Zend_Search_Lucene_Document_Html($data, false, $storeContent, $defaultEncoding); - } - - /** - * Load HTML document from a file - * - * @param string $file - * @param boolean $storeContent - * @param string $defaultEncoding HTML encoding, is used if it's not specified using Content-type HTTP-EQUIV meta tag. - * @return Zend_Search_Lucene_Document_Html - */ - public static function loadHTMLFile($file, $storeContent = false, $defaultEncoding = '') - { - return new Zend_Search_Lucene_Document_Html($file, true, $storeContent, $defaultEncoding); - } - - - /** - * Highlight text in text node - * - * @param DOMText $node - * @param array $wordsToHighlight - * @param callback $callback Callback method, used to transform (highlighting) text. - * @param array $params Array of additionall callback parameters (first non-optional parameter is a text to transform) - * @throws Zend_Search_Lucene_Exception - */ - protected function _highlightTextNode(DOMText $node, $wordsToHighlight, $callback, $params) - { - /** Zend_Search_Lucene_Analysis_Analyzer */ - - $analyzer = Zend_Search_Lucene_Analysis_Analyzer::getDefault(); - $analyzer->setInput($node->nodeValue, 'UTF-8'); - - $matchedTokens = array(); - - while (($token = $analyzer->nextToken()) !== null) { - if (isset($wordsToHighlight[$token->getTermText()])) { - $matchedTokens[] = $token; - } - } - - if (count($matchedTokens) == 0) { - return; - } - - $matchedTokens = array_reverse($matchedTokens); - - foreach ($matchedTokens as $token) { - // Cut text after matched token - $node->splitText($token->getEndOffset()); - - // Cut matched node - $matchedWordNode = $node->splitText($token->getStartOffset()); - - // Retrieve HTML string representation for highlihted word - $fullCallbackparamsList = $params; - array_unshift($fullCallbackparamsList, $matchedWordNode->nodeValue); - $highlightedWordNodeSetHtml = call_user_func_array($callback, $fullCallbackparamsList); - - // Transform HTML string to a DOM representation and automatically transform retrieved string - // into valid XHTML (It's automatically done by loadHTML() method) - $highlightedWordNodeSetDomDocument = new DOMDocument('1.0', 'UTF-8'); - $success = @$highlightedWordNodeSetDomDocument-> - loadHTML('' - . $highlightedWordNodeSetHtml - . ''); - if (!$success) { - throw new Zend_Search_Lucene_Exception("Error occured while loading highlighted text fragment: '$highlightedWordNodeSetHtml'."); - } - $highlightedWordNodeSetXpath = new DOMXPath($highlightedWordNodeSetDomDocument); - $highlightedWordNodeSet = $highlightedWordNodeSetXpath->query('/html/body')->item(0)->childNodes; - - for ($count = 0; $count < $highlightedWordNodeSet->length; $count++) { - $nodeToImport = $highlightedWordNodeSet->item($count); - $node->parentNode->insertBefore($this->_doc->importNode($nodeToImport, true /* deep copy */), - $matchedWordNode); - } - - $node->parentNode->removeChild($matchedWordNode); - } - } - - - /** - * highlight words in content of the specified node - * - * @param DOMNode $contextNode - * @param array $wordsToHighlight - * @param callback $callback Callback method, used to transform (highlighting) text. - * @param array $params Array of additionall callback parameters (first non-optional parameter is a text to transform) - */ - protected function _highlightNodeRecursive(DOMNode $contextNode, $wordsToHighlight, $callback, $params) - { - $textNodes = array(); - - if (!$contextNode->hasChildNodes()) { - return; - } - - foreach ($contextNode->childNodes as $childNode) { - if ($childNode->nodeType == XML_TEXT_NODE) { - // process node later to leave childNodes structure untouched - $textNodes[] = $childNode; - } else { - // Process node if it's not a script node - if ($childNode->nodeName != 'script') { - $this->_highlightNodeRecursive($childNode, $wordsToHighlight, $callback, $params); - } - } - } - - foreach ($textNodes as $textNode) { - $this->_highlightTextNode($textNode, $wordsToHighlight, $callback, $params); - } - } - - /** - * Standard callback method used to highlight words. - * - * @param string $stringToHighlight - * @return string - * @internal - */ - public function applyColour($stringToHighlight, $colour) - { - return '' . $stringToHighlight . ''; - } - - /** - * Highlight text with specified color - * - * @param string|array $words - * @param string $colour - * @return string - */ - public function highlight($words, $colour = '#66ffff') - { - return $this->highlightExtended($words, array($this, 'applyColour'), array($colour)); - } - - - - /** - * Highlight text using specified View helper or callback function. - * - * @param string|array $words Words to highlight. Words could be organized using the array or string. - * @param callback $callback Callback method, used to transform (highlighting) text. - * @param array $params Array of additionall callback parameters passed through into it - * (first non-optional parameter is an HTML fragment for highlighting) - * @return string - * @throws Zend_Search_Lucene_Exception - */ - public function highlightExtended($words, $callback, $params = array()) - { - /** Zend_Search_Lucene_Analysis_Analyzer */ - - if (!is_array($words)) { - $words = array($words); - } - - $wordsToHighlightList = array(); - $analyzer = Zend_Search_Lucene_Analysis_Analyzer::getDefault(); - foreach ($words as $wordString) { - $wordsToHighlightList[] = $analyzer->tokenize($wordString); - } - $wordsToHighlight = call_user_func_array('array_merge', $wordsToHighlightList); - - if (count($wordsToHighlight) == 0) { - return $this->_doc->saveHTML(); - } - - $wordsToHighlightFlipped = array(); - foreach ($wordsToHighlight as $id => $token) { - $wordsToHighlightFlipped[$token->getTermText()] = $id; - } - - if (!is_callable($callback)) { - throw new Zend_Search_Lucene_Exception('$viewHelper parameter must be a View Helper name, View Helper object or callback.'); - } - - $xpath = new DOMXPath($this->_doc); - - $matchedNodes = $xpath->query("/html/body"); - foreach ($matchedNodes as $matchedNode) { - $this->_highlightNodeRecursive($matchedNode, $wordsToHighlightFlipped, $callback, $params); - } - } - - - /** - * Get HTML - * - * @return string - */ - public function getHTML() - { - return $this->_doc->saveHTML(); - } - - /** - * Get HTML body - * - * @return string - */ - public function getHtmlBody() - { - $xpath = new DOMXPath($this->_doc); - $bodyNodes = $xpath->query('/html/body')->item(0)->childNodes; - - $outputFragments = array(); - for ($count = 0; $count < $bodyNodes->length; $count++) { - $outputFragments[] = $this->_doc->saveXML($bodyNodes->item($count)); - } - - return implode($outputFragments); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Document/OpenXml.php b/library/vendor/Zend/Search/Lucene/Document/OpenXml.php deleted file mode 100644 index 7c86ad264..000000000 --- a/library/vendor/Zend/Search/Lucene/Document/OpenXml.php +++ /dev/null @@ -1,129 +0,0 @@ -getFromName("_rels/.rels")); - foreach ($relations->Relationship as $rel) { - if ($rel["Type"] == Zend_Search_Lucene_Document_OpenXml::SCHEMA_COREPROPERTIES) { - // Found core properties! Read in contents... - $contents = Zend_Xml_Security::scan( - $package->getFromName(dirname($rel["Target"]) . "/" . basename($rel["Target"])) - ); - - foreach ($contents->children(Zend_Search_Lucene_Document_OpenXml::SCHEMA_DUBLINCORE) as $child) { - $coreProperties[$child->getName()] = (string)$child; - } - foreach ($contents->children(Zend_Search_Lucene_Document_OpenXml::SCHEMA_COREPROPERTIES) as $child) { - $coreProperties[$child->getName()] = (string)$child; - } - foreach ($contents->children(Zend_Search_Lucene_Document_OpenXml::SCHEMA_DUBLINCORETERMS) as $child) { - $coreProperties[$child->getName()] = (string)$child; - } - } - } - - return $coreProperties; - } - - /** - * Determine absolute zip path - * - * @param string $path - * @return string - */ - protected function absoluteZipPath($path) { - $path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path); - $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen'); - $absolutes = array(); - foreach ($parts as $part) { - if ('.' == $part) continue; - if ('..' == $part) { - array_pop($absolutes); - } else { - $absolutes[] = $part; - } - } - return implode('/', $absolutes); - } -} diff --git a/library/vendor/Zend/Search/Lucene/Document/Pptx.php b/library/vendor/Zend/Search/Lucene/Document/Pptx.php deleted file mode 100644 index 48aede0b7..000000000 --- a/library/vendor/Zend/Search/Lucene/Document/Pptx.php +++ /dev/null @@ -1,198 +0,0 @@ -open($fileName); - - // Read relations and search for officeDocument - $relationsXml = $package->getFromName('_rels/.rels'); - if ($relationsXml === false) { - throw new Zend_Search_Lucene_Exception('Invalid archive or corrupted .pptx file.'); - } - $relations = Zend_Xml_Security::scan($relationsXml); - foreach ($relations->Relationship as $rel) { - if ($rel["Type"] == Zend_Search_Lucene_Document_OpenXml::SCHEMA_OFFICEDOCUMENT) { - // Found office document! Search for slides... - $slideRelations = Zend_Xml_Security::scan($package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/_rels/" . basename($rel["Target"]) . ".rels")) ); - foreach ($slideRelations->Relationship as $slideRel) { - if ($slideRel["Type"] == Zend_Search_Lucene_Document_Pptx::SCHEMA_SLIDERELATION) { - // Found slide! - $slides[ str_replace( 'rId', '', (string)$slideRel["Id"] ) ] = Zend_Xml_Security::scan( - $package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($slideRel["Target"]) . "/" . basename($slideRel["Target"])) ) - ); - - // Search for slide notes - $slideNotesRelations = Zend_Xml_Security::scan($package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($slideRel["Target"]) . "/_rels/" . basename($slideRel["Target"]) . ".rels")) ); - foreach ($slideNotesRelations->Relationship as $slideNoteRel) { - if ($slideNoteRel["Type"] == Zend_Search_Lucene_Document_Pptx::SCHEMA_SLIDENOTESRELATION) { - // Found slide notes! - $slideNotes[ str_replace( 'rId', '', (string)$slideRel["Id"] ) ] = Zend_Xml_Security::scan( - $package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($slideRel["Target"]) . "/" . dirname($slideNoteRel["Target"]) . "/" . basename($slideNoteRel["Target"])) ) - ); - - break; - } - } - } - } - - break; - } - } - - // Sort slides - ksort($slides); - ksort($slideNotes); - - // Extract contents from slides - foreach ($slides as $slideKey => $slide) { - // Register namespaces - $slide->registerXPathNamespace("p", Zend_Search_Lucene_Document_Pptx::SCHEMA_PRESENTATIONML); - $slide->registerXPathNamespace("a", Zend_Search_Lucene_Document_Pptx::SCHEMA_DRAWINGML); - - // Fetch all text - $textElements = $slide->xpath('//a:t'); - foreach ($textElements as $textElement) { - $documentBody[] = (string)$textElement; - } - - // Extract contents from slide notes - if (isset($slideNotes[$slideKey])) { - // Fetch slide note - $slideNote = $slideNotes[$slideKey]; - - // Register namespaces - $slideNote->registerXPathNamespace("p", Zend_Search_Lucene_Document_Pptx::SCHEMA_PRESENTATIONML); - $slideNote->registerXPathNamespace("a", Zend_Search_Lucene_Document_Pptx::SCHEMA_DRAWINGML); - - // Fetch all text - $textElements = $slideNote->xpath('//a:t'); - foreach ($textElements as $textElement) { - $documentBody[] = (string)$textElement; - } - } - } - - // Read core properties - $coreProperties = $this->extractMetaData($package); - - // Close file - $package->close(); - - // Store filename - $this->addField(Zend_Search_Lucene_Field::Text('filename', $fileName, 'UTF-8')); - - // Store contents - if ($storeContent) { - $this->addField(Zend_Search_Lucene_Field::Text('body', implode(' ', $documentBody), 'UTF-8')); - } else { - $this->addField(Zend_Search_Lucene_Field::UnStored('body', implode(' ', $documentBody), 'UTF-8')); - } - - // Store meta data properties - foreach ($coreProperties as $key => $value) - { - $this->addField(Zend_Search_Lucene_Field::Text($key, $value, 'UTF-8')); - } - - // Store title (if not present in meta data) - if (!isset($coreProperties['title'])) - { - $this->addField(Zend_Search_Lucene_Field::Text('title', $fileName, 'UTF-8')); - } - } - - /** - * Load Pptx document from a file - * - * @param string $fileName - * @param boolean $storeContent - * @return Zend_Search_Lucene_Document_Pptx - */ - public static function loadPptxFile($fileName, $storeContent = false) - { - return new Zend_Search_Lucene_Document_Pptx($fileName, $storeContent); - } -} diff --git a/library/vendor/Zend/Search/Lucene/Document/Xlsx.php b/library/vendor/Zend/Search/Lucene/Document/Xlsx.php deleted file mode 100644 index 5b8b318c7..000000000 --- a/library/vendor/Zend/Search/Lucene/Document/Xlsx.php +++ /dev/null @@ -1,262 +0,0 @@ -open($fileName); - - // Read relations and search for officeDocument - $relationsXml = $package->getFromName('_rels/.rels'); - if ($relationsXml === false) { - throw new Zend_Search_Lucene_Exception('Invalid archive or corrupted .xlsx file.'); - } - $relations = Zend_Xml_Security::scan($relationsXml); - foreach ($relations->Relationship as $rel) { - if ($rel["Type"] == Zend_Search_Lucene_Document_OpenXml::SCHEMA_OFFICEDOCUMENT) { - // Found office document! Read relations for workbook... - $workbookRelations = Zend_Xml_Security::scan($package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/_rels/" . basename($rel["Target"]) . ".rels")) ); - $workbookRelations->registerXPathNamespace("rel", Zend_Search_Lucene_Document_OpenXml::SCHEMA_RELATIONSHIP); - - // Read shared strings - $sharedStringsPath = $workbookRelations->xpath("rel:Relationship[@Type='" . Zend_Search_Lucene_Document_Xlsx::SCHEMA_SHAREDSTRINGS . "']"); - $sharedStringsPath = (string)$sharedStringsPath[0]['Target']; - $xmlStrings = Zend_Xml_Security::scan($package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . $sharedStringsPath)) ); - if (isset($xmlStrings) && isset($xmlStrings->si)) { - foreach ($xmlStrings->si as $val) { - if (isset($val->t)) { - $sharedStrings[] = (string)$val->t; - } elseif (isset($val->r)) { - $sharedStrings[] = $this->_parseRichText($val); - } - } - } - - // Loop relations for workbook and extract worksheets... - foreach ($workbookRelations->Relationship as $workbookRelation) { - if ($workbookRelation["Type"] == Zend_Search_Lucene_Document_Xlsx::SCHEMA_WORKSHEETRELATION) { - $worksheets[ str_replace( 'rId', '', (string)$workbookRelation["Id"]) ] = Zend_Xml_Security::scan( - $package->getFromName( $this->absoluteZipPath(dirname($rel["Target"]) . "/" . dirname($workbookRelation["Target"]) . "/" . basename($workbookRelation["Target"])) ) - ); - } - } - - break; - } - } - - // Sort worksheets - ksort($worksheets); - - // Extract contents from worksheets - foreach ($worksheets as $sheetKey => $worksheet) { - foreach ($worksheet->sheetData->row as $row) { - foreach ($row->c as $c) { - // Determine data type - $dataType = (string)$c["t"]; - switch ($dataType) { - case "s": - // Value is a shared string - if ((string)$c->v != '') { - $value = $sharedStrings[intval($c->v)]; - } else { - $value = ''; - } - - break; - - case "b": - // Value is boolean - $value = (string)$c->v; - if ($value == '0') { - $value = false; - } else if ($value == '1') { - $value = true; - } else { - $value = (bool)$c->v; - } - - break; - - case "inlineStr": - // Value is rich text inline - $value = $this->_parseRichText($c->is); - - break; - - case "e": - // Value is an error message - if ((string)$c->v != '') { - $value = (string)$c->v; - } else { - $value = ''; - } - - break; - - default: - // Value is a string - $value = (string)$c->v; - - // Check for numeric values - if (is_numeric($value) && $dataType != 's') { - if ($value == (int)$value) $value = (int)$value; - elseif ($value == (float)$value) $value = (float)$value; - elseif ($value == (double)$value) $value = (double)$value; - } - } - - $documentBody[] = $value; - } - } - } - - // Read core properties - $coreProperties = $this->extractMetaData($package); - - // Close file - $package->close(); - - // Store filename - $this->addField(Zend_Search_Lucene_Field::Text('filename', $fileName, 'UTF-8')); - - // Store contents - if ($storeContent) { - $this->addField(Zend_Search_Lucene_Field::Text('body', implode(' ', $documentBody), 'UTF-8')); - } else { - $this->addField(Zend_Search_Lucene_Field::UnStored('body', implode(' ', $documentBody), 'UTF-8')); - } - - // Store meta data properties - foreach ($coreProperties as $key => $value) - { - $this->addField(Zend_Search_Lucene_Field::Text($key, $value, 'UTF-8')); - } - - // Store title (if not present in meta data) - if (!isset($coreProperties['title'])) - { - $this->addField(Zend_Search_Lucene_Field::Text('title', $fileName, 'UTF-8')); - } - } - - /** - * Parse rich text XML - * - * @param SimpleXMLElement $is - * @return string - */ - private function _parseRichText($is = null) { - $value = array(); - - if (isset($is->t)) { - $value[] = (string)$is->t; - } else { - foreach ($is->r as $run) { - $value[] = (string)$run->t; - } - } - - return implode('', $value); - } - - /** - * Load Xlsx document from a file - * - * @param string $fileName - * @param boolean $storeContent - * @return Zend_Search_Lucene_Document_Xlsx - */ - public static function loadXlsxFile($fileName, $storeContent = false) - { - return new Zend_Search_Lucene_Document_Xlsx($fileName, $storeContent); - } -} diff --git a/library/vendor/Zend/Search/Lucene/Exception.php b/library/vendor/Zend/Search/Lucene/Exception.php deleted file mode 100644 index dcb82b30c..000000000 --- a/library/vendor/Zend/Search/Lucene/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ - targetState - * - * @var array - */ - private $_rules = array(); - - /** - * List of entry actions - * Each action executes when entering the state - * - * [state] => action - * - * @var array - */ - private $_entryActions = array(); - - /** - * List of exit actions - * Each action executes when exiting the state - * - * [state] => action - * - * @var array - */ - private $_exitActions = array(); - - /** - * List of input actions - * Each action executes when entering the state - * - * [state][input] => action - * - * @var array - */ - private $_inputActions = array(); - - /** - * List of input actions - * Each action executes when entering the state - * - * [state1][state2] => action - * - * @var array - */ - private $_transitionActions = array(); - - /** - * Finite State machine constructor - * - * $states is an array of integers or strings with a list of possible machine states - * constructor treats fist list element as a sturt state (assignes it to $_current state). - * It may be reassigned by setState() call. - * States list may be empty and can be extended later by addState() or addStates() calls. - * - * $inputAphabet is the same as $states, but represents input alphabet - * it also may be extended later by addInputSymbols() or addInputSymbol() calls. - * - * $rules parameter describes FSM transitions and has a structure: - * array( array(sourseState, input, targetState[, inputAction]), - * array(sourseState, input, targetState[, inputAction]), - * array(sourseState, input, targetState[, inputAction]), - * ... - * ) - * Rules also can be added later by addRules() and addRule() calls. - * - * FSM actions are very flexible and may be defined by addEntryAction(), addExitAction(), - * addInputAction() and addTransitionAction() calls. - * - * @param array $states - * @param array $inputAphabet - * @param array $rules - */ - public function __construct($states = array(), $inputAphabet = array(), $rules = array()) - { - $this->addStates($states); - $this->addInputSymbols($inputAphabet); - $this->addRules($rules); - } - - /** - * Add states to the state machine - * - * @param array $states - */ - public function addStates($states) - { - foreach ($states as $state) { - $this->addState($state); - } - } - - /** - * Add state to the state machine - * - * @param integer|string $state - */ - public function addState($state) - { - $this->_states[$state] = $state; - - if ($this->_currentState === null) { - $this->_currentState = $state; - } - } - - /** - * Set FSM state. - * No any action is invoked - * - * @param integer|string $state - * @throws Zend_Search_Exception - */ - public function setState($state) - { - if (!isset($this->_states[$state])) { - throw new Zend_Search_Exception('State \'' . $state . '\' is not on of the possible FSM states.'); - } - - $this->_currentState = $state; - } - - /** - * Get FSM state. - * - * @return integer|string $state|null - */ - public function getState() - { - return $this->_currentState; - } - - /** - * Add symbols to the input alphabet - * - * @param array $inputAphabet - */ - public function addInputSymbols($inputAphabet) - { - foreach ($inputAphabet as $inputSymbol) { - $this->addInputSymbol($inputSymbol); - } - } - - /** - * Add symbol to the input alphabet - * - * @param integer|string $inputSymbol - */ - public function addInputSymbol($inputSymbol) - { - $this->_inputAphabet[$inputSymbol] = $inputSymbol; - } - - - /** - * Add transition rules - * - * array structure: - * array( array(sourseState, input, targetState[, inputAction]), - * array(sourseState, input, targetState[, inputAction]), - * array(sourseState, input, targetState[, inputAction]), - * ... - * ) - * - * @param array $rules - */ - public function addRules($rules) - { - foreach ($rules as $rule) { - $this->addrule($rule[0], $rule[1], $rule[2], isset($rule[3])?$rule[3]:null); - } - } - - /** - * Add symbol to the input alphabet - * - * @param integer|string $sourceState - * @param integer|string $input - * @param integer|string $targetState - * @param Zend_Search_Lucene_FSMAction|null $inputAction - * @throws Zend_Search_Exception - */ - public function addRule($sourceState, $input, $targetState, $inputAction = null) - { - if (!isset($this->_states[$sourceState])) { - throw new Zend_Search_Exception('Undefined source state (' . $sourceState . ').'); - } - if (!isset($this->_states[$targetState])) { - throw new Zend_Search_Exception('Undefined target state (' . $targetState . ').'); - } - if (!isset($this->_inputAphabet[$input])) { - throw new Zend_Search_Exception('Undefined input symbol (' . $input . ').'); - } - - if (!isset($this->_rules[$sourceState])) { - $this->_rules[$sourceState] = array(); - } - if (isset($this->_rules[$sourceState][$input])) { - throw new Zend_Search_Exception('Rule for {state,input} pair (' . $sourceState . ', '. $input . ') is already defined.'); - } - - $this->_rules[$sourceState][$input] = $targetState; - - - if ($inputAction !== null) { - $this->addInputAction($sourceState, $input, $inputAction); - } - } - - - /** - * Add state entry action. - * Several entry actions are allowed. - * Action execution order is defined by addEntryAction() calls - * - * @param integer|string $state - * @param Zend_Search_Lucene_FSMAction $action - */ - public function addEntryAction($state, Zend_Search_Lucene_FSMAction $action) - { - if (!isset($this->_states[$state])) { - throw new Zend_Search_Exception('Undefined state (' . $state. ').'); - } - - if (!isset($this->_entryActions[$state])) { - $this->_entryActions[$state] = array(); - } - - $this->_entryActions[$state][] = $action; - } - - /** - * Add state exit action. - * Several exit actions are allowed. - * Action execution order is defined by addEntryAction() calls - * - * @param integer|string $state - * @param Zend_Search_Lucene_FSMAction $action - */ - public function addExitAction($state, Zend_Search_Lucene_FSMAction $action) - { - if (!isset($this->_states[$state])) { - throw new Zend_Search_Exception('Undefined state (' . $state. ').'); - } - - if (!isset($this->_exitActions[$state])) { - $this->_exitActions[$state] = array(); - } - - $this->_exitActions[$state][] = $action; - } - - /** - * Add input action (defined by {state, input} pair). - * Several input actions are allowed. - * Action execution order is defined by addInputAction() calls - * - * @param integer|string $state - * @param integer|string $input - * @param Zend_Search_Lucene_FSMAction $action - */ - public function addInputAction($state, $inputSymbol, Zend_Search_Lucene_FSMAction $action) - { - if (!isset($this->_states[$state])) { - throw new Zend_Search_Exception('Undefined state (' . $state. ').'); - } - if (!isset($this->_inputAphabet[$inputSymbol])) { - throw new Zend_Search_Exception('Undefined input symbol (' . $inputSymbol. ').'); - } - - if (!isset($this->_inputActions[$state])) { - $this->_inputActions[$state] = array(); - } - if (!isset($this->_inputActions[$state][$inputSymbol])) { - $this->_inputActions[$state][$inputSymbol] = array(); - } - - $this->_inputActions[$state][$inputSymbol][] = $action; - } - - /** - * Add transition action (defined by {state, input} pair). - * Several transition actions are allowed. - * Action execution order is defined by addTransitionAction() calls - * - * @param integer|string $sourceState - * @param integer|string $targetState - * @param Zend_Search_Lucene_FSMAction $action - */ - public function addTransitionAction($sourceState, $targetState, Zend_Search_Lucene_FSMAction $action) - { - if (!isset($this->_states[$sourceState])) { - throw new Zend_Search_Exception('Undefined source state (' . $sourceState. ').'); - } - if (!isset($this->_states[$targetState])) { - throw new Zend_Search_Exception('Undefined source state (' . $targetState. ').'); - } - - if (!isset($this->_transitionActions[$sourceState])) { - $this->_transitionActions[$sourceState] = array(); - } - if (!isset($this->_transitionActions[$sourceState][$targetState])) { - $this->_transitionActions[$sourceState][$targetState] = array(); - } - - $this->_transitionActions[$sourceState][$targetState][] = $action; - } - - - /** - * Process an input - * - * @param mixed $input - * @throws Zend_Search_Exception - */ - public function process($input) - { - if (!isset($this->_rules[$this->_currentState])) { - throw new Zend_Search_Exception('There is no any rule for current state (' . $this->_currentState . ').'); - } - if (!isset($this->_rules[$this->_currentState][$input])) { - throw new Zend_Search_Exception('There is no any rule for {current state, input} pair (' . $this->_currentState . ', ' . $input . ').'); - } - - $sourceState = $this->_currentState; - $targetState = $this->_rules[$this->_currentState][$input]; - - if ($sourceState != $targetState && isset($this->_exitActions[$sourceState])) { - foreach ($this->_exitActions[$sourceState] as $action) { - $action->doAction(); - } - } - if (isset($this->_inputActions[$sourceState]) && - isset($this->_inputActions[$sourceState][$input])) { - foreach ($this->_inputActions[$sourceState][$input] as $action) { - $action->doAction(); - } - } - - - $this->_currentState = $targetState; - - if (isset($this->_transitionActions[$sourceState]) && - isset($this->_transitionActions[$sourceState][$targetState])) { - foreach ($this->_transitionActions[$sourceState][$targetState] as $action) { - $action->doAction(); - } - } - if ($sourceState != $targetState && isset($this->_entryActions[$targetState])) { - foreach ($this->_entryActions[$targetState] as $action) { - $action->doAction(); - } - } - } - - public function reset() - { - if (count($this->_states) == 0) { - throw new Zend_Search_Exception('There is no any state defined for FSM.'); - } - - $this->_currentState = $this->_states[0]; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/FSMAction.php b/library/vendor/Zend/Search/Lucene/FSMAction.php deleted file mode 100644 index aee126320..000000000 --- a/library/vendor/Zend/Search/Lucene/FSMAction.php +++ /dev/null @@ -1,66 +0,0 @@ -_object = $object; - $this->_method = $method; - } - - public function doAction() - { - $methodName = $this->_method; - $this->_object->$methodName(); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Field.php b/library/vendor/Zend/Search/Lucene/Field.php deleted file mode 100644 index 2c187dcea..000000000 --- a/library/vendor/Zend/Search/Lucene/Field.php +++ /dev/null @@ -1,226 +0,0 @@ -name = $name; - $this->value = $value; - - if (!$isBinary) { - $this->encoding = $encoding; - $this->isTokenized = $isTokenized; - } else { - $this->encoding = ''; - $this->isTokenized = false; - } - - $this->isStored = $isStored; - $this->isIndexed = $isIndexed; - $this->isBinary = $isBinary; - - $this->storeTermVector = false; - $this->boost = 1.0; - } - - - /** - * Constructs a String-valued Field that is not tokenized, but is indexed - * and stored. Useful for non-text fields, e.g. date or url. - * - * @param string $name - * @param string $value - * @param string $encoding - * @return Zend_Search_Lucene_Field - */ - public static function keyword($name, $value, $encoding = '') - { - return new self($name, $value, $encoding, true, true, false); - } - - - /** - * Constructs a String-valued Field that is not tokenized nor indexed, - * but is stored in the index, for return with hits. - * - * @param string $name - * @param string $value - * @param string $encoding - * @return Zend_Search_Lucene_Field - */ - public static function unIndexed($name, $value, $encoding = '') - { - return new self($name, $value, $encoding, true, false, false); - } - - - /** - * Constructs a Binary String valued Field that is not tokenized nor indexed, - * but is stored in the index, for return with hits. - * - * @param string $name - * @param string $value - * @param string $encoding - * @return Zend_Search_Lucene_Field - */ - public static function binary($name, $value) - { - return new self($name, $value, '', true, false, false, true); - } - - /** - * Constructs a String-valued Field that is tokenized and indexed, - * and is stored in the index, for return with hits. Useful for short text - * fields, like "title" or "subject". Term vector will not be stored for this field. - * - * @param string $name - * @param string $value - * @param string $encoding - * @return Zend_Search_Lucene_Field - */ - public static function text($name, $value, $encoding = '') - { - return new self($name, $value, $encoding, true, true, true); - } - - - /** - * Constructs a String-valued Field that is tokenized and indexed, - * but that is not stored in the index. - * - * @param string $name - * @param string $value - * @param string $encoding - * @return Zend_Search_Lucene_Field - */ - public static function unStored($name, $value, $encoding = '') - { - return new self($name, $value, $encoding, false, true, true); - } - - /** - * Get field value in UTF-8 encoding - * - * @return string - */ - public function getUtf8Value() - { - if (strcasecmp($this->encoding, 'utf8' ) == 0 || - strcasecmp($this->encoding, 'utf-8') == 0 ) { - return $this->value; - } else { - - return (PHP_OS != 'AIX') ? iconv($this->encoding, 'UTF-8', $this->value) : iconv('ISO8859-1', 'UTF-8', $this->value); - } - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/DictionaryLoader.php b/library/vendor/Zend/Search/Lucene/Index/DictionaryLoader.php deleted file mode 100644 index f76c88c1b..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/DictionaryLoader.php +++ /dev/null @@ -1,264 +0,0 @@ -.tii index file data and - * returns two arrays - term and tremInfo lists. - * - * See Zend_Search_Lucene_Index_SegmintInfo class for details - * - * @param string $data - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public static function load($data) - { - $termDictionary = array(); - $termInfos = array(); - $pos = 0; - - // $tiVersion = $tiiFile->readInt(); - $tiVersion = ord($data[0]) << 24 | ord($data[1]) << 16 | ord($data[2]) << 8 | ord($data[3]); - $pos += 4; - if ($tiVersion != (int)0xFFFFFFFE /* pre-2.1 format */ && - $tiVersion != (int)0xFFFFFFFD /* 2.1+ format */) { - throw new Zend_Search_Lucene_Exception('Wrong TermInfoIndexFile file format'); - } - - // $indexTermCount = $tiiFile->readLong(); - if (PHP_INT_SIZE > 4) { - $indexTermCount = ord($data[$pos]) << 56 | - ord($data[$pos+1]) << 48 | - ord($data[$pos+2]) << 40 | - ord($data[$pos+3]) << 32 | - ord($data[$pos+4]) << 24 | - ord($data[$pos+5]) << 16 | - ord($data[$pos+6]) << 8 | - ord($data[$pos+7]); - } else { - if ((ord($data[$pos]) != 0) || - (ord($data[$pos+1]) != 0) || - (ord($data[$pos+2]) != 0) || - (ord($data[$pos+3]) != 0) || - ((ord($data[$pos+4]) & 0x80) != 0)) { - throw new Zend_Search_Lucene_Exception('Largest supported segment size (for 32-bit mode) is 2Gb'); - } - - $indexTermCount = ord($data[$pos+4]) << 24 | - ord($data[$pos+5]) << 16 | - ord($data[$pos+6]) << 8 | - ord($data[$pos+7]); - } - $pos += 8; - - // $tiiFile->readInt(); // IndexInterval - $pos += 4; - - // $skipInterval = $tiiFile->readInt(); - $skipInterval = ord($data[$pos]) << 24 | ord($data[$pos+1]) << 16 | ord($data[$pos+2]) << 8 | ord($data[$pos+3]); - $pos += 4; - if ($indexTermCount < 1) { - throw new Zend_Search_Lucene_Exception('Wrong number of terms in a term dictionary index'); - } - - if ($tiVersion == (int)0xFFFFFFFD /* 2.1+ format */) { - /* Skip MaxSkipLevels value */ - $pos += 4; - } - - $prevTerm = ''; - $freqPointer = 0; - $proxPointer = 0; - $indexPointer = 0; - for ($count = 0; $count < $indexTermCount; $count++) { - //$termPrefixLength = $tiiFile->readVInt(); - $nbyte = ord($data[$pos++]); - $termPrefixLength = $nbyte & 0x7F; - for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { - $nbyte = ord($data[$pos++]); - $termPrefixLength |= ($nbyte & 0x7F) << $shift; - } - - // $termSuffix = $tiiFile->readString(); - $nbyte = ord($data[$pos++]); - $len = $nbyte & 0x7F; - for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { - $nbyte = ord($data[$pos++]); - $len |= ($nbyte & 0x7F) << $shift; - } - if ($len == 0) { - $termSuffix = ''; - } else { - $termSuffix = substr($data, $pos, $len); - $pos += $len; - for ($count1 = 0; $count1 < $len; $count1++ ) { - if (( ord($termSuffix[$count1]) & 0xC0 ) == 0xC0) { - $addBytes = 1; - if (ord($termSuffix[$count1]) & 0x20 ) { - $addBytes++; - - // Never used for Java Lucene created index. - // Java2 doesn't encode strings in four bytes - if (ord($termSuffix[$count1]) & 0x10 ) { - $addBytes++; - } - } - $termSuffix .= substr($data, $pos, $addBytes); - $pos += $addBytes; - $len += $addBytes; - - // Check for null character. Java2 encodes null character - // in two bytes. - if (ord($termSuffix[$count1]) == 0xC0 && - ord($termSuffix[$count1+1]) == 0x80 ) { - $termSuffix[$count1] = 0; - $termSuffix = substr($termSuffix,0,$count1+1) - . substr($termSuffix,$count1+2); - } - $count1 += $addBytes; - } - } - } - - // $termValue = Zend_Search_Lucene_Index_Term::getPrefix($prevTerm, $termPrefixLength) . $termSuffix; - $pb = 0; $pc = 0; - while ($pb < strlen($prevTerm) && $pc < $termPrefixLength) { - $charBytes = 1; - if ((ord($prevTerm[$pb]) & 0xC0) == 0xC0) { - $charBytes++; - if (ord($prevTerm[$pb]) & 0x20 ) { - $charBytes++; - if (ord($prevTerm[$pb]) & 0x10 ) { - $charBytes++; - } - } - } - - if ($pb + $charBytes > strlen($data)) { - // wrong character - break; - } - - $pc++; - $pb += $charBytes; - } - $termValue = substr($prevTerm, 0, $pb) . $termSuffix; - - // $termFieldNum = $tiiFile->readVInt(); - $nbyte = ord($data[$pos++]); - $termFieldNum = $nbyte & 0x7F; - for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { - $nbyte = ord($data[$pos++]); - $termFieldNum |= ($nbyte & 0x7F) << $shift; - } - - // $docFreq = $tiiFile->readVInt(); - $nbyte = ord($data[$pos++]); - $docFreq = $nbyte & 0x7F; - for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { - $nbyte = ord($data[$pos++]); - $docFreq |= ($nbyte & 0x7F) << $shift; - } - - // $freqPointer += $tiiFile->readVInt(); - $nbyte = ord($data[$pos++]); - $vint = $nbyte & 0x7F; - for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { - $nbyte = ord($data[$pos++]); - $vint |= ($nbyte & 0x7F) << $shift; - } - $freqPointer += $vint; - - // $proxPointer += $tiiFile->readVInt(); - $nbyte = ord($data[$pos++]); - $vint = $nbyte & 0x7F; - for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { - $nbyte = ord($data[$pos++]); - $vint |= ($nbyte & 0x7F) << $shift; - } - $proxPointer += $vint; - - if( $docFreq >= $skipInterval ) { - // $skipDelta = $tiiFile->readVInt(); - $nbyte = ord($data[$pos++]); - $vint = $nbyte & 0x7F; - for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { - $nbyte = ord($data[$pos++]); - $vint |= ($nbyte & 0x7F) << $shift; - } - $skipDelta = $vint; - } else { - $skipDelta = 0; - } - - // $indexPointer += $tiiFile->readVInt(); - $nbyte = ord($data[$pos++]); - $vint = $nbyte & 0x7F; - for ($shift=7; ($nbyte & 0x80) != 0; $shift += 7) { - $nbyte = ord($data[$pos++]); - $vint |= ($nbyte & 0x7F) << $shift; - } - $indexPointer += $vint; - - - // $this->_termDictionary[] = new Zend_Search_Lucene_Index_Term($termValue, $termFieldNum); - $termDictionary[] = array($termFieldNum, $termValue); - - $termInfos[] = - // new Zend_Search_Lucene_Index_TermInfo($docFreq, $freqPointer, $proxPointer, $skipDelta, $indexPointer); - array($docFreq, $freqPointer, $proxPointer, $skipDelta, $indexPointer); - - $prevTerm = $termValue; - } - - // Check special index entry mark - if ($termDictionary[0][0] != (int)0xFFFFFFFF) { - throw new Zend_Search_Lucene_Exception('Wrong TermInfoIndexFile file format'); - } - - if (PHP_INT_SIZE > 4) { - // Treat 64-bit 0xFFFFFFFF as -1 - $termDictionary[0][0] = -1; - } - - return array($termDictionary, $termInfos); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/DocsFilter.php b/library/vendor/Zend/Search/Lucene/Index/DocsFilter.php deleted file mode 100644 index 17d9e4e29..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/DocsFilter.php +++ /dev/null @@ -1,59 +0,0 @@ - => array( => , - * => , - * => , - * ... ), - * => array( => , - * => , - * => , - * ... ), - * => array( => , - * => , - * => , - * ... ), - * ... - * ) - * - * @var array - */ - public $segmentFilters = array(); -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/FieldInfo.php b/library/vendor/Zend/Search/Lucene/Index/FieldInfo.php deleted file mode 100644 index 7eeaba242..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/FieldInfo.php +++ /dev/null @@ -1,50 +0,0 @@ -name = $name; - $this->isIndexed = $isIndexed; - $this->number = $number; - $this->storeTermVector = $storeTermVector; - $this->normsOmitted = $normsOmitted; - $this->payloadsStored = $payloadsStored; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/SegmentInfo.php b/library/vendor/Zend/Search/Lucene/Index/SegmentInfo.php deleted file mode 100644 index 655d0ddb7..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/SegmentInfo.php +++ /dev/null @@ -1,2110 +0,0 @@ - $termValue - * [1] -> $termFieldNum - * - * Corresponding Zend_Search_Lucene_Index_TermInfo object stored in the $_termDictionaryInfos - * - * @var array - */ - private $_termDictionary; - - /** - * Term Dictionary Index TermInfos - * - * Array of arrays (Zend_Search_Lucene_Index_TermInfo objects are represented as arrays because - * of performance considerations) - * [0] -> $docFreq - * [1] -> $freqPointer - * [2] -> $proxPointer - * [3] -> $skipOffset - * [4] -> $indexPointer - * - * @var array - */ - private $_termDictionaryInfos; - - /** - * Segment fields. Array of Zend_Search_Lucene_Index_FieldInfo objects for this segment - * - * @var array - */ - private $_fields; - - /** - * Field positions in a dictionary. - * (Term dictionary contains filelds ordered by names) - * - * @var array - */ - private $_fieldsDicPositions; - - - /** - * Associative array where the key is the file name and the value is data offset - * in a compound segment file (.csf). - * - * @var array - */ - private $_segFiles; - - /** - * Associative array where the key is the file name and the value is file size (.csf). - * - * @var array - */ - private $_segFileSizes; - - /** - * Delete file generation number - * - * -2 means autodetect latest delete generation - * -1 means 'there is no delete file' - * 0 means pre-2.1 format delete file - * X specifies used delete file - * - * @var integer - */ - private $_delGen; - - /** - * Segment has single norms file - * - * If true then one .nrm file is used for all fields - * Otherwise .fN files are used - * - * @var boolean - */ - private $_hasSingleNormFile; - - /** - * Use compound segment file (*.cfs) to collect all other segment files - * (excluding .del files) - * - * @var boolean - */ - private $_isCompound; - - - /** - * File system adapter. - * - * @var Zend_Search_Lucene_Storage_Directory_Filesystem - */ - private $_directory; - - /** - * Normalization factors. - * An array fieldName => normVector - * normVector is a binary string. - * Each byte corresponds to an indexed document in a segment and - * encodes normalization factor (float value, encoded by - * Zend_Search_Lucene_Search_Similarity::encodeNorm()) - * - * @var array - */ - private $_norms = array(); - - /** - * List of deleted documents. - * bitset if bitset extension is loaded or array otherwise. - * - * @var mixed - */ - private $_deleted = null; - - /** - * $this->_deleted update flag - * - * @var boolean - */ - private $_deletedDirty = false; - - /** - * True if segment uses shared doc store - * - * @var boolean - */ - private $_usesSharedDocStore; - - /* - * Shared doc store options. - * It's an assotiative array with the following items: - * - 'offset' => $docStoreOffset The starting document in the shared doc store files where this segment's documents begin - * - 'segment' => $docStoreSegment The name of the segment that has the shared doc store files. - * - 'isCompound' => $docStoreIsCompoundFile True, if compound file format is used for the shared doc store files (.cfx file). - */ - private $_sharedDocStoreOptions; - - - /** - * Zend_Search_Lucene_Index_SegmentInfo constructor - * - * @param Zend_Search_Lucene_Storage_Directory $directory - * @param string $name - * @param integer $docCount - * @param integer $delGen - * @param array|null $docStoreOptions - * @param boolean $hasSingleNormFile - * @param boolean $isCompound - */ - public function __construct(Zend_Search_Lucene_Storage_Directory $directory, $name, $docCount, $delGen = 0, $docStoreOptions = null, $hasSingleNormFile = false, $isCompound = null) - { - $this->_directory = $directory; - $this->_name = $name; - $this->_docCount = $docCount; - - if ($docStoreOptions !== null) { - $this->_usesSharedDocStore = true; - $this->_sharedDocStoreOptions = $docStoreOptions; - - if ($docStoreOptions['isCompound']) { - $cfxFile = $this->_directory->getFileObject($docStoreOptions['segment'] . '.cfx'); - $cfxFilesCount = $cfxFile->readVInt(); - - $cfxFiles = array(); - $cfxFileSizes = array(); - - for ($count = 0; $count < $cfxFilesCount; $count++) { - $dataOffset = $cfxFile->readLong(); - if ($count != 0) { - $cfxFileSizes[$fileName] = $dataOffset - end($cfxFiles); - } - $fileName = $cfxFile->readString(); - $cfxFiles[$fileName] = $dataOffset; - } - if ($count != 0) { - $cfxFileSizes[$fileName] = $this->_directory->fileLength($docStoreOptions['segment'] . '.cfx') - $dataOffset; - } - - $this->_sharedDocStoreOptions['files'] = $cfxFiles; - $this->_sharedDocStoreOptions['fileSizes'] = $cfxFileSizes; - } - } - - $this->_hasSingleNormFile = $hasSingleNormFile; - $this->_delGen = $delGen; - $this->_termDictionary = null; - - - if ($isCompound !== null) { - $this->_isCompound = $isCompound; - } else { - // It's a pre-2.1 segment or isCompound is set to 'unknown' - // Detect if segment uses compound file - try { - // Try to open compound file - $this->_directory->getFileObject($name . '.cfs'); - - // Compound file is found - $this->_isCompound = true; - } catch (Zend_Search_Lucene_Exception $e) { - if (strpos($e->getMessage(), 'is not readable') !== false) { - // Compound file is not found or is not readable - $this->_isCompound = false; - } else { - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - } - } - - $this->_segFiles = array(); - if ($this->_isCompound) { - $cfsFile = $this->_directory->getFileObject($name . '.cfs'); - $segFilesCount = $cfsFile->readVInt(); - - for ($count = 0; $count < $segFilesCount; $count++) { - $dataOffset = $cfsFile->readLong(); - if ($count != 0) { - $this->_segFileSizes[$fileName] = $dataOffset - end($this->_segFiles); - } - $fileName = $cfsFile->readString(); - $this->_segFiles[$fileName] = $dataOffset; - } - if ($count != 0) { - $this->_segFileSizes[$fileName] = $this->_directory->fileLength($name . '.cfs') - $dataOffset; - } - } - - $fnmFile = $this->openCompoundFile('.fnm'); - $fieldsCount = $fnmFile->readVInt(); - $fieldNames = array(); - $fieldNums = array(); - $this->_fields = array(); - - for ($count=0; $count < $fieldsCount; $count++) { - $fieldName = $fnmFile->readString(); - $fieldBits = $fnmFile->readByte(); - $this->_fields[$count] = new Zend_Search_Lucene_Index_FieldInfo($fieldName, - $fieldBits & 0x01 /* field is indexed */, - $count, - $fieldBits & 0x02 /* termvectors are stored */, - $fieldBits & 0x10 /* norms are omitted */, - $fieldBits & 0x20 /* payloads are stored */); - if ($fieldBits & 0x10) { - // norms are omitted for the indexed field - $this->_norms[$count] = str_repeat(chr(Zend_Search_Lucene_Search_Similarity::encodeNorm(1.0)), $docCount); - } - - $fieldNums[$count] = $count; - $fieldNames[$count] = $fieldName; - } - array_multisort($fieldNames, SORT_ASC, SORT_REGULAR, $fieldNums); - $this->_fieldsDicPositions = array_flip($fieldNums); - - if ($this->_delGen == -2) { - // SegmentInfo constructor is invoked from index writer - // Autodetect current delete file generation number - $this->_delGen = $this->_detectLatestDelGen(); - } - - // Load deletions - $this->_deleted = $this->_loadDelFile(); - } - - /** - * Load detetions file - * - * Returns bitset or an array depending on bitset extension availability - * - * @return mixed - * @throws Zend_Search_Lucene_Exception - */ - private function _loadDelFile() - { - if ($this->_delGen == -1) { - // There is no delete file for this segment - return null; - } else if ($this->_delGen == 0) { - // It's a segment with pre-2.1 format delete file - // Try to load deletions file - return $this->_loadPre21DelFile(); - } else { - // It's 2.1+ format deleteions file - return $this->_load21DelFile(); - } - } - - /** - * Load pre-2.1 detetions file - * - * Returns bitset or an array depending on bitset extension availability - * - * @return mixed - * @throws Zend_Search_Lucene_Exception - */ - private function _loadPre21DelFile() - { - try { - // '.del' files always stored in a separate file - // Segment compound is not used - $delFile = $this->_directory->getFileObject($this->_name . '.del'); - - $byteCount = $delFile->readInt(); - $byteCount = ceil($byteCount/8); - $bitCount = $delFile->readInt(); - - if ($bitCount == 0) { - $delBytes = ''; - } else { - $delBytes = $delFile->readBytes($byteCount); - } - - if (extension_loaded('bitset')) { - return $delBytes; - } else { - $deletions = array(); - for ($count = 0; $count < $byteCount; $count++) { - $byte = ord($delBytes[$count]); - for ($bit = 0; $bit < 8; $bit++) { - if ($byte & (1<<$bit)) { - $deletions[$count*8 + $bit] = 1; - } - } - } - - return $deletions; - } - } catch(Zend_Search_Lucene_Exception $e) { - if (strpos($e->getMessage(), 'is not readable') === false) { - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - // There is no deletion file - $this->_delGen = -1; - - return null; - } - } - - /** - * Load 2.1+ format detetions file - * - * Returns bitset or an array depending on bitset extension availability - * - * @return mixed - */ - private function _load21DelFile() - { - $delFile = $this->_directory->getFileObject($this->_name . '_' . base_convert($this->_delGen, 10, 36) . '.del'); - - $format = $delFile->readInt(); - - if ($format == (int)0xFFFFFFFF) { - if (extension_loaded('bitset')) { - $deletions = bitset_empty(); - } else { - $deletions = array(); - } - - $byteCount = $delFile->readInt(); - $bitCount = $delFile->readInt(); - - $delFileSize = $this->_directory->fileLength($this->_name . '_' . base_convert($this->_delGen, 10, 36) . '.del'); - $byteNum = 0; - - do { - $dgap = $delFile->readVInt(); - $nonZeroByte = $delFile->readByte(); - - $byteNum += $dgap; - - - if (extension_loaded('bitset')) { - for ($bit = 0; $bit < 8; $bit++) { - if ($nonZeroByte & (1<<$bit)) { - bitset_incl($deletions, $byteNum*8 + $bit); - } - } - return $deletions; - } else { - for ($bit = 0; $bit < 8; $bit++) { - if ($nonZeroByte & (1<<$bit)) { - $deletions[$byteNum*8 + $bit] = 1; - } - } - return (count($deletions) > 0) ? $deletions : null; - } - - } while ($delFile->tell() < $delFileSize); - } else { - // $format is actually byte count - $byteCount = ceil($format/8); - $bitCount = $delFile->readInt(); - - if ($bitCount == 0) { - $delBytes = ''; - } else { - $delBytes = $delFile->readBytes($byteCount); - } - - if (extension_loaded('bitset')) { - return $delBytes; - } else { - $deletions = array(); - for ($count = 0; $count < $byteCount; $count++) { - $byte = ord($delBytes[$count]); - for ($bit = 0; $bit < 8; $bit++) { - if ($byte & (1<<$bit)) { - $deletions[$count*8 + $bit] = 1; - } - } - } - - return (count($deletions) > 0) ? $deletions : null; - } - } - } - - /** - * Opens index file stoted within compound index file - * - * @param string $extension - * @param boolean $shareHandler - * @throws Zend_Search_Lucene_Exception - * @return Zend_Search_Lucene_Storage_File - */ - public function openCompoundFile($extension, $shareHandler = true) - { - if (($extension == '.fdx' || $extension == '.fdt') && $this->_usesSharedDocStore) { - $fdxFName = $this->_sharedDocStoreOptions['segment'] . '.fdx'; - $fdtFName = $this->_sharedDocStoreOptions['segment'] . '.fdt'; - - if (!$this->_sharedDocStoreOptions['isCompound']) { - $fdxFile = $this->_directory->getFileObject($fdxFName, $shareHandler); - $fdxFile->seek($this->_sharedDocStoreOptions['offset']*8, SEEK_CUR); - - if ($extension == '.fdx') { - // '.fdx' file is requested - return $fdxFile; - } else { - // '.fdt' file is requested - $fdtStartOffset = $fdxFile->readLong(); - - $fdtFile = $this->_directory->getFileObject($fdtFName, $shareHandler); - $fdtFile->seek($fdtStartOffset, SEEK_CUR); - - return $fdtFile; - } - } - - if( !isset($this->_sharedDocStoreOptions['files'][$fdxFName]) ) { - throw new Zend_Search_Lucene_Exception('Shared doc storage segment compound file doesn\'t contain ' - . $fdxFName . ' file.' ); - } - if( !isset($this->_sharedDocStoreOptions['files'][$fdtFName]) ) { - throw new Zend_Search_Lucene_Exception('Shared doc storage segment compound file doesn\'t contain ' - . $fdtFName . ' file.' ); - } - - // Open shared docstore segment file - $cfxFile = $this->_directory->getFileObject($this->_sharedDocStoreOptions['segment'] . '.cfx', $shareHandler); - // Seek to the start of '.fdx' file within compound file - $cfxFile->seek($this->_sharedDocStoreOptions['files'][$fdxFName]); - // Seek to the start of current segment documents section - $cfxFile->seek($this->_sharedDocStoreOptions['offset']*8, SEEK_CUR); - - if ($extension == '.fdx') { - // '.fdx' file is requested - return $cfxFile; - } else { - // '.fdt' file is requested - $fdtStartOffset = $cfxFile->readLong(); - - // Seek to the start of '.fdt' file within compound file - $cfxFile->seek($this->_sharedDocStoreOptions['files'][$fdtFName]); - // Seek to the start of current segment documents section - $cfxFile->seek($fdtStartOffset, SEEK_CUR); - - return $fdtFile; - } - } - - $filename = $this->_name . $extension; - - if (!$this->_isCompound) { - return $this->_directory->getFileObject($filename, $shareHandler); - } - - if( !isset($this->_segFiles[$filename]) ) { - throw new Zend_Search_Lucene_Exception('Segment compound file doesn\'t contain ' - . $filename . ' file.' ); - } - - $file = $this->_directory->getFileObject($this->_name . '.cfs', $shareHandler); - $file->seek($this->_segFiles[$filename]); - return $file; - } - - /** - * Get compound file length - * - * @param string $extension - * @return integer - */ - public function compoundFileLength($extension) - { - if (($extension == '.fdx' || $extension == '.fdt') && $this->_usesSharedDocStore) { - $filename = $this->_sharedDocStoreOptions['segment'] . $extension; - - if (!$this->_sharedDocStoreOptions['isCompound']) { - return $this->_directory->fileLength($filename); - } - - if( !isset($this->_sharedDocStoreOptions['fileSizes'][$filename]) ) { - throw new Zend_Search_Lucene_Exception('Shared doc store compound file doesn\'t contain ' - . $filename . ' file.' ); - } - - return $this->_sharedDocStoreOptions['fileSizes'][$filename]; - } - - - $filename = $this->_name . $extension; - - // Try to get common file first - if ($this->_directory->fileExists($filename)) { - return $this->_directory->fileLength($filename); - } - - if( !isset($this->_segFileSizes[$filename]) ) { - throw new Zend_Search_Lucene_Exception('Index compound file doesn\'t contain ' - . $filename . ' file.' ); - } - - return $this->_segFileSizes[$filename]; - } - - /** - * Returns field index or -1 if field is not found - * - * @param string $fieldName - * @return integer - */ - public function getFieldNum($fieldName) - { - foreach( $this->_fields as $field ) { - if( $field->name == $fieldName ) { - return $field->number; - } - } - - return -1; - } - - /** - * Returns field info for specified field - * - * @param integer $fieldNum - * @return Zend_Search_Lucene_Index_FieldInfo - */ - public function getField($fieldNum) - { - return $this->_fields[$fieldNum]; - } - - /** - * Returns array of fields. - * if $indexed parameter is true, then returns only indexed fields. - * - * @param boolean $indexed - * @return array - */ - public function getFields($indexed = false) - { - $result = array(); - foreach( $this->_fields as $field ) { - if( (!$indexed) || $field->isIndexed ) { - $result[ $field->name ] = $field->name; - } - } - return $result; - } - - /** - * Returns array of FieldInfo objects. - * - * @return array - */ - public function getFieldInfos() - { - return $this->_fields; - } - - /** - * Returns actual deletions file generation number. - * - * @return integer - */ - public function getDelGen() - { - return $this->_delGen; - } - - /** - * Returns the total number of documents in this segment (including deleted documents). - * - * @return integer - */ - public function count() - { - return $this->_docCount; - } - - /** - * Returns number of deleted documents. - * - * @return integer - */ - private function _deletedCount() - { - if ($this->_deleted === null) { - return 0; - } - - if (extension_loaded('bitset')) { - return count(bitset_to_array($this->_deleted)); - } else { - return count($this->_deleted); - } - } - - /** - * Returns the total number of non-deleted documents in this segment. - * - * @return integer - */ - public function numDocs() - { - if ($this->hasDeletions()) { - return $this->_docCount - $this->_deletedCount(); - } else { - return $this->_docCount; - } - } - - /** - * Get field position in a fields dictionary - * - * @param integer $fieldNum - * @return integer - */ - private function _getFieldPosition($fieldNum) { - // Treat values which are not in a translation table as a 'direct value' - return isset($this->_fieldsDicPositions[$fieldNum]) ? - $this->_fieldsDicPositions[$fieldNum] : $fieldNum; - } - - /** - * Return segment name - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - - /** - * TermInfo cache - * - * Size is 1024. - * Numbers are used instead of class constants because of performance considerations - * - * @var array - */ - private $_termInfoCache = array(); - - private function _cleanUpTermInfoCache() - { - // Clean 256 term infos - foreach ($this->_termInfoCache as $key => $termInfo) { - unset($this->_termInfoCache[$key]); - - // leave 768 last used term infos - if (count($this->_termInfoCache) == 768) { - break; - } - } - } - - /** - * Load terms dictionary index - * - * @throws Zend_Search_Lucene_Exception - */ - private function _loadDictionaryIndex() - { - // Check, if index is already serialized - if ($this->_directory->fileExists($this->_name . '.sti')) { - // Load serialized dictionary index data - $stiFile = $this->_directory->getFileObject($this->_name . '.sti'); - $stiFileData = $stiFile->readBytes($this->_directory->fileLength($this->_name . '.sti')); - - // Load dictionary index data - if (($unserializedData = @unserialize($stiFileData)) !== false) { - list($this->_termDictionary, $this->_termDictionaryInfos) = $unserializedData; - return; - } - } - - // Load data from .tii file and generate .sti file - - // Prefetch dictionary index data - $tiiFile = $this->openCompoundFile('.tii'); - $tiiFileData = $tiiFile->readBytes($this->compoundFileLength('.tii')); - - /** Zend_Search_Lucene_Index_DictionaryLoader */ - - // Load dictionary index data - list($this->_termDictionary, $this->_termDictionaryInfos) = - Zend_Search_Lucene_Index_DictionaryLoader::load($tiiFileData); - - $stiFileData = serialize(array($this->_termDictionary, $this->_termDictionaryInfos)); - $stiFile = $this->_directory->createFile($this->_name . '.sti'); - $stiFile->writeBytes($stiFileData); - } - - /** - * Scans terms dictionary and returns term info - * - * @param Zend_Search_Lucene_Index_Term $term - * @return Zend_Search_Lucene_Index_TermInfo - */ - public function getTermInfo(Zend_Search_Lucene_Index_Term $term) - { - $termKey = $term->key(); - if (isset($this->_termInfoCache[$termKey])) { - $termInfo = $this->_termInfoCache[$termKey]; - - // Move termInfo to the end of cache - unset($this->_termInfoCache[$termKey]); - $this->_termInfoCache[$termKey] = $termInfo; - - return $termInfo; - } - - - if ($this->_termDictionary === null) { - $this->_loadDictionaryIndex(); - } - - $searchField = $this->getFieldNum($term->field); - - if ($searchField == -1) { - return null; - } - $searchDicField = $this->_getFieldPosition($searchField); - - // search for appropriate value in dictionary - $lowIndex = 0; - $highIndex = count($this->_termDictionary)-1; - while ($highIndex >= $lowIndex) { - // $mid = ($highIndex - $lowIndex)/2; - $mid = ($highIndex + $lowIndex) >> 1; - $midTerm = $this->_termDictionary[$mid]; - - $fieldNum = $this->_getFieldPosition($midTerm[0] /* field */); - $delta = $searchDicField - $fieldNum; - if ($delta == 0) { - $delta = strcmp($term->text, $midTerm[1] /* text */); - } - - if ($delta < 0) { - $highIndex = $mid-1; - } elseif ($delta > 0) { - $lowIndex = $mid+1; - } else { - // return $this->_termDictionaryInfos[$mid]; // We got it! - $a = $this->_termDictionaryInfos[$mid]; - $termInfo = new Zend_Search_Lucene_Index_TermInfo($a[0], $a[1], $a[2], $a[3], $a[4]); - - // Put loaded termInfo into cache - $this->_termInfoCache[$termKey] = $termInfo; - - return $termInfo; - } - } - - if ($highIndex == -1) { - // Term is out of the dictionary range - return null; - } - - $prevPosition = $highIndex; - $prevTerm = $this->_termDictionary[$prevPosition]; - $prevTermInfo = $this->_termDictionaryInfos[$prevPosition]; - - $tisFile = $this->openCompoundFile('.tis'); - $tiVersion = $tisFile->readInt(); - if ($tiVersion != (int)0xFFFFFFFE /* pre-2.1 format */ && - $tiVersion != (int)0xFFFFFFFD /* 2.1+ format */) { - throw new Zend_Search_Lucene_Exception('Wrong TermInfoFile file format'); - } - - $termCount = $tisFile->readLong(); - $indexInterval = $tisFile->readInt(); - $skipInterval = $tisFile->readInt(); - if ($tiVersion == (int)0xFFFFFFFD /* 2.1+ format */) { - $maxSkipLevels = $tisFile->readInt(); - } - - $tisFile->seek($prevTermInfo[4] /* indexPointer */ - (($tiVersion == (int)0xFFFFFFFD)? 24 : 20) /* header size*/, SEEK_CUR); - - $termValue = $prevTerm[1] /* text */; - $termFieldNum = $prevTerm[0] /* field */; - $freqPointer = $prevTermInfo[1] /* freqPointer */; - $proxPointer = $prevTermInfo[2] /* proxPointer */; - for ($count = $prevPosition*$indexInterval + 1; - $count <= $termCount && - ( $this->_getFieldPosition($termFieldNum) < $searchDicField || - ($this->_getFieldPosition($termFieldNum) == $searchDicField && - strcmp($termValue, $term->text) < 0) ); - $count++) { - $termPrefixLength = $tisFile->readVInt(); - $termSuffix = $tisFile->readString(); - $termFieldNum = $tisFile->readVInt(); - $termValue = Zend_Search_Lucene_Index_Term::getPrefix($termValue, $termPrefixLength) . $termSuffix; - - $docFreq = $tisFile->readVInt(); - $freqPointer += $tisFile->readVInt(); - $proxPointer += $tisFile->readVInt(); - if( $docFreq >= $skipInterval ) { - $skipOffset = $tisFile->readVInt(); - } else { - $skipOffset = 0; - } - } - - if ($termFieldNum == $searchField && $termValue == $term->text) { - $termInfo = new Zend_Search_Lucene_Index_TermInfo($docFreq, $freqPointer, $proxPointer, $skipOffset); - } else { - $termInfo = null; - } - - // Put loaded termInfo into cache - $this->_termInfoCache[$termKey] = $termInfo; - - if (count($this->_termInfoCache) == 1024) { - $this->_cleanUpTermInfoCache(); - } - - return $termInfo; - } - - /** - * Returns IDs of all the documents containing term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @param integer $shift - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - */ - public function termDocs(Zend_Search_Lucene_Index_Term $term, $shift = 0, $docsFilter = null) - { - $termInfo = $this->getTermInfo($term); - - if (!$termInfo instanceof Zend_Search_Lucene_Index_TermInfo) { - if ($docsFilter !== null && $docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { - $docsFilter->segmentFilters[$this->_name] = array(); - } - return array(); - } - - $frqFile = $this->openCompoundFile('.frq'); - $frqFile->seek($termInfo->freqPointer,SEEK_CUR); - $docId = 0; - $result = array(); - - if ($docsFilter !== null) { - if (!$docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { - throw new Zend_Search_Lucene_Exception('Documents filter must be an instance of Zend_Search_Lucene_Index_DocsFilter or null.'); - } - - if (isset($docsFilter->segmentFilters[$this->_name])) { - // Filter already has some data for the current segment - - // Make short name for the filter (which doesn't need additional dereferencing) - $filter = &$docsFilter->segmentFilters[$this->_name]; - - // Check if filter is not empty - if (count($filter) == 0) { - return array(); - } - - if ($this->_docCount/count($filter) < self::FULL_SCAN_VS_FETCH_BOUNDARY) { - // Perform fetching -// --------------------------------------------------------------- - $updatedFilterData = array(); - - for( $count=0; $count < $termInfo->docFreq; $count++ ) { - $docDelta = $frqFile->readVInt(); - if( $docDelta % 2 == 1 ) { - $docId += ($docDelta-1)/2; - } else { - $docId += $docDelta/2; - // read freq - $frqFile->readVInt(); - } - - if (isset($filter[$docId])) { - $result[] = $shift + $docId; - $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - } - } - $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; -// --------------------------------------------------------------- - } else { - // Perform full scan - $updatedFilterData = array(); - - for( $count=0; $count < $termInfo->docFreq; $count++ ) { - $docDelta = $frqFile->readVInt(); - if( $docDelta % 2 == 1 ) { - $docId += ($docDelta-1)/2; - } else { - $docId += $docDelta/2; - // read freq - $frqFile->readVInt(); - } - - if (isset($filter[$docId])) { - $result[] = $shift + $docId; - $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - } - } - $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; - } - } else { - // Filter is present, but doesn't has data for the current segment yet - $filterData = array(); - for( $count=0; $count < $termInfo->docFreq; $count++ ) { - $docDelta = $frqFile->readVInt(); - if( $docDelta % 2 == 1 ) { - $docId += ($docDelta-1)/2; - } else { - $docId += $docDelta/2; - // read freq - $frqFile->readVInt(); - } - - $result[] = $shift + $docId; - $filterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - } - $docsFilter->segmentFilters[$this->_name] = $filterData; - } - } else { - for( $count=0; $count < $termInfo->docFreq; $count++ ) { - $docDelta = $frqFile->readVInt(); - if( $docDelta % 2 == 1 ) { - $docId += ($docDelta-1)/2; - } else { - $docId += $docDelta/2; - // read freq - $frqFile->readVInt(); - } - - $result[] = $shift + $docId; - } - } - - return $result; - } - - /** - * Returns term freqs array. - * Result array structure: array(docId => freq, ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param integer $shift - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return Zend_Search_Lucene_Index_TermInfo - */ - public function termFreqs(Zend_Search_Lucene_Index_Term $term, $shift = 0, $docsFilter = null) - { - $termInfo = $this->getTermInfo($term); - - if (!$termInfo instanceof Zend_Search_Lucene_Index_TermInfo) { - if ($docsFilter !== null && $docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { - $docsFilter->segmentFilters[$this->_name] = array(); - } - return array(); - } - - $frqFile = $this->openCompoundFile('.frq'); - $frqFile->seek($termInfo->freqPointer,SEEK_CUR); - $result = array(); - $docId = 0; - - $result = array(); - - if ($docsFilter !== null) { - if (!$docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { - throw new Zend_Search_Lucene_Exception('Documents filter must be an instance of Zend_Search_Lucene_Index_DocsFilter or null.'); - } - - if (isset($docsFilter->segmentFilters[$this->_name])) { - // Filter already has some data for the current segment - - // Make short name for the filter (which doesn't need additional dereferencing) - $filter = &$docsFilter->segmentFilters[$this->_name]; - - // Check if filter is not empty - if (count($filter) == 0) { - return array(); - } - - - if ($this->_docCount/count($filter) < self::FULL_SCAN_VS_FETCH_BOUNDARY) { - // Perform fetching -// --------------------------------------------------------------- - $updatedFilterData = array(); - - for ($count = 0; $count < $termInfo->docFreq; $count++) { - $docDelta = $frqFile->readVInt(); - if ($docDelta % 2 == 1) { - $docId += ($docDelta-1)/2; - if (isset($filter[$docId])) { - $result[$shift + $docId] = 1; - $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - } - } else { - $docId += $docDelta/2; - $freq = $frqFile->readVInt(); - if (isset($filter[$docId])) { - $result[$shift + $docId] = $freq; - $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - } - } - } - $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; -// --------------------------------------------------------------- - } else { - // Perform full scan - $updatedFilterData = array(); - - for ($count = 0; $count < $termInfo->docFreq; $count++) { - $docDelta = $frqFile->readVInt(); - if ($docDelta % 2 == 1) { - $docId += ($docDelta-1)/2; - if (isset($filter[$docId])) { - $result[$shift + $docId] = 1; - $updatedFilterData[$docId] = 1; // 1 is just some constant value, so we don't need additional var dereference here - } - } else { - $docId += $docDelta/2; - $freq = $frqFile->readVInt(); - if (isset($filter[$docId])) { - $result[$shift + $docId] = $freq; - $updatedFilterData[$docId] = 1; // 1 is just some constant value, so we don't need additional var dereference here - } - } - } - $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; - } - } else { - // Filter doesn't has data for current segment - $filterData = array(); - - for ($count = 0; $count < $termInfo->docFreq; $count++) { - $docDelta = $frqFile->readVInt(); - if ($docDelta % 2 == 1) { - $docId += ($docDelta-1)/2; - $result[$shift + $docId] = 1; - $filterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - } else { - $docId += $docDelta/2; - $result[$shift + $docId] = $frqFile->readVInt(); - $filterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - } - } - - $docsFilter->segmentFilters[$this->_name] = $filterData; - } - } else { - for ($count = 0; $count < $termInfo->docFreq; $count++) { - $docDelta = $frqFile->readVInt(); - if ($docDelta % 2 == 1) { - $docId += ($docDelta-1)/2; - $result[$shift + $docId] = 1; - } else { - $docId += $docDelta/2; - $result[$shift + $docId] = $frqFile->readVInt(); - } - } - } - - return $result; - } - - /** - * Returns term positions array. - * Result array structure: array(docId => array(pos1, pos2, ...), ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param integer $shift - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return Zend_Search_Lucene_Index_TermInfo - */ - public function termPositions(Zend_Search_Lucene_Index_Term $term, $shift = 0, $docsFilter = null) - { - $termInfo = $this->getTermInfo($term); - - if (!$termInfo instanceof Zend_Search_Lucene_Index_TermInfo) { - if ($docsFilter !== null && $docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { - $docsFilter->segmentFilters[$this->_name] = array(); - } - return array(); - } - - $frqFile = $this->openCompoundFile('.frq'); - $frqFile->seek($termInfo->freqPointer,SEEK_CUR); - - $docId = 0; - $freqs = array(); - - - if ($docsFilter !== null) { - if (!$docsFilter instanceof Zend_Search_Lucene_Index_DocsFilter) { - throw new Zend_Search_Lucene_Exception('Documents filter must be an instance of Zend_Search_Lucene_Index_DocsFilter or null.'); - } - - if (isset($docsFilter->segmentFilters[$this->_name])) { - // Filter already has some data for the current segment - - // Make short name for the filter (which doesn't need additional dereferencing) - $filter = &$docsFilter->segmentFilters[$this->_name]; - - // Check if filter is not empty - if (count($filter) == 0) { - return array(); - } - - if ($this->_docCount/count($filter) < self::FULL_SCAN_VS_FETCH_BOUNDARY) { - // Perform fetching -// --------------------------------------------------------------- - for ($count = 0; $count < $termInfo->docFreq; $count++) { - $docDelta = $frqFile->readVInt(); - if ($docDelta % 2 == 1) { - $docId += ($docDelta-1)/2; - $freqs[$docId] = 1; - } else { - $docId += $docDelta/2; - $freqs[$docId] = $frqFile->readVInt(); - } - } - - $updatedFilterData = array(); - $result = array(); - $prxFile = $this->openCompoundFile('.prx'); - $prxFile->seek($termInfo->proxPointer, SEEK_CUR); - foreach ($freqs as $docId => $freq) { - $termPosition = 0; - $positions = array(); - - // we have to read .prx file to get right position for next doc - // even filter doesn't match current document - for ($count = 0; $count < $freq; $count++ ) { - $termPosition += $prxFile->readVInt(); - $positions[] = $termPosition; - } - - // Include into updated filter and into result only if doc is matched by filter - if (isset($filter[$docId])) { - $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - $result[$shift + $docId] = $positions; - } - } - - $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; -// --------------------------------------------------------------- - } else { - // Perform full scan - for ($count = 0; $count < $termInfo->docFreq; $count++) { - $docDelta = $frqFile->readVInt(); - if ($docDelta % 2 == 1) { - $docId += ($docDelta-1)/2; - $freqs[$docId] = 1; - } else { - $docId += $docDelta/2; - $freqs[$docId] = $frqFile->readVInt(); - } - } - - $updatedFilterData = array(); - $result = array(); - $prxFile = $this->openCompoundFile('.prx'); - $prxFile->seek($termInfo->proxPointer, SEEK_CUR); - foreach ($freqs as $docId => $freq) { - $termPosition = 0; - $positions = array(); - - // we have to read .prx file to get right position for next doc - // even filter doesn't match current document - for ($count = 0; $count < $freq; $count++ ) { - $termPosition += $prxFile->readVInt(); - $positions[] = $termPosition; - } - - // Include into updated filter and into result only if doc is matched by filter - if (isset($filter[$docId])) { - $updatedFilterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - $result[$shift + $docId] = $positions; - } - } - - $docsFilter->segmentFilters[$this->_name] = $updatedFilterData; - } - } else { - // Filter doesn't has data for current segment - for ($count = 0; $count < $termInfo->docFreq; $count++) { - $docDelta = $frqFile->readVInt(); - if ($docDelta % 2 == 1) { - $docId += ($docDelta-1)/2; - $freqs[$docId] = 1; - } else { - $docId += $docDelta/2; - $freqs[$docId] = $frqFile->readVInt(); - } - } - - $filterData = array(); - $result = array(); - $prxFile = $this->openCompoundFile('.prx'); - $prxFile->seek($termInfo->proxPointer, SEEK_CUR); - foreach ($freqs as $docId => $freq) { - $filterData[$docId] = 1; // 1 is just a some constant value, so we don't need additional var dereference here - - $termPosition = 0; - $positions = array(); - - for ($count = 0; $count < $freq; $count++ ) { - $termPosition += $prxFile->readVInt(); - $positions[] = $termPosition; - } - - $result[$shift + $docId] = $positions; - } - - $docsFilter->segmentFilters[$this->_name] = $filterData; - } - } else { - for ($count = 0; $count < $termInfo->docFreq; $count++) { - $docDelta = $frqFile->readVInt(); - if ($docDelta % 2 == 1) { - $docId += ($docDelta-1)/2; - $freqs[$docId] = 1; - } else { - $docId += $docDelta/2; - $freqs[$docId] = $frqFile->readVInt(); - } - } - - $result = array(); - $prxFile = $this->openCompoundFile('.prx'); - $prxFile->seek($termInfo->proxPointer, SEEK_CUR); - foreach ($freqs as $docId => $freq) { - $termPosition = 0; - $positions = array(); - - for ($count = 0; $count < $freq; $count++ ) { - $termPosition += $prxFile->readVInt(); - $positions[] = $termPosition; - } - - $result[$shift + $docId] = $positions; - } - } - - return $result; - } - - /** - * Load normalizatin factors from an index file - * - * @param integer $fieldNum - * @throws Zend_Search_Lucene_Exception - */ - private function _loadNorm($fieldNum) - { - if ($this->_hasSingleNormFile) { - $normfFile = $this->openCompoundFile('.nrm'); - - $header = $normfFile->readBytes(3); - $headerFormatVersion = $normfFile->readByte(); - - if ($header != 'NRM' || $headerFormatVersion != (int)0xFF) { - throw new Zend_Search_Lucene_Exception('Wrong norms file format.'); - } - - foreach ($this->_fields as $fNum => $fieldInfo) { - if ($fieldInfo->isIndexed) { - $this->_norms[$fNum] = $normfFile->readBytes($this->_docCount); - } - } - } else { - $fFile = $this->openCompoundFile('.f' . $fieldNum); - $this->_norms[$fieldNum] = $fFile->readBytes($this->_docCount); - } - } - - /** - * Returns normalization factor for specified documents - * - * @param integer $id - * @param string $fieldName - * @return float - */ - public function norm($id, $fieldName) - { - $fieldNum = $this->getFieldNum($fieldName); - - if ( !($this->_fields[$fieldNum]->isIndexed) ) { - return null; - } - - if (!isset($this->_norms[$fieldNum])) { - $this->_loadNorm($fieldNum); - } - - return Zend_Search_Lucene_Search_Similarity::decodeNorm( ord($this->_norms[$fieldNum][$id]) ); - } - - /** - * Returns norm vector, encoded in a byte string - * - * @param string $fieldName - * @return string - */ - public function normVector($fieldName) - { - $fieldNum = $this->getFieldNum($fieldName); - - if ($fieldNum == -1 || !($this->_fields[$fieldNum]->isIndexed)) { - $similarity = Zend_Search_Lucene_Search_Similarity::getDefault(); - - return str_repeat(chr($similarity->encodeNorm( $similarity->lengthNorm($fieldName, 0) )), - $this->_docCount); - } - - if (!isset($this->_norms[$fieldNum])) { - $this->_loadNorm($fieldNum); - } - - return $this->_norms[$fieldNum]; - } - - - /** - * Returns true if any documents have been deleted from this index segment. - * - * @return boolean - */ - public function hasDeletions() - { - return $this->_deleted !== null; - } - - - /** - * Returns true if segment has single norms file. - * - * @return boolean - */ - public function hasSingleNormFile() - { - return $this->_hasSingleNormFile ? true : false; - } - - /** - * Returns true if segment is stored using compound segment file. - * - * @return boolean - */ - public function isCompound() - { - return $this->_isCompound; - } - - /** - * Deletes a document from the index segment. - * $id is an internal document id - * - * @param integer - */ - public function delete($id) - { - $this->_deletedDirty = true; - - if (extension_loaded('bitset')) { - if ($this->_deleted === null) { - $this->_deleted = bitset_empty($id); - } - bitset_incl($this->_deleted, $id); - } else { - if ($this->_deleted === null) { - $this->_deleted = array(); - } - - $this->_deleted[$id] = 1; - } - } - - /** - * Checks, that document is deleted - * - * @param integer - * @return boolean - */ - public function isDeleted($id) - { - if ($this->_deleted === null) { - return false; - } - - if (extension_loaded('bitset')) { - return bitset_in($this->_deleted, $id); - } else { - return isset($this->_deleted[$id]); - } - } - - /** - * Detect latest delete generation - * - * Is actualy used from writeChanges() method or from the constructor if it's invoked from - * Index writer. In both cases index write lock is already obtained, so we shouldn't care - * about it - * - * @return integer - */ - private function _detectLatestDelGen() - { - $delFileList = array(); - foreach ($this->_directory->fileList() as $file) { - if ($file == $this->_name . '.del') { - // Matches .del file name - $delFileList[] = 0; - } else if (preg_match('/^' . $this->_name . '_([a-zA-Z0-9]+)\.del$/i', $file, $matches)) { - // Matches _NNN.del file names - $delFileList[] = (int)base_convert($matches[1], 36, 10); - } - } - - if (count($delFileList) == 0) { - // There is no deletions file for current segment in the directory - // Set deletions file generation number to 1 - return -1; - } else { - // There are some deletions files for current segment in the directory - // Set deletions file generation number to the highest nuber - return max($delFileList); - } - } - - /** - * Write changes if it's necessary. - * - * This method must be invoked only from the Writer _updateSegments() method, - * so index Write lock has to be already obtained. - * - * @internal - * @throws Zend_Search_Lucene_Exceptions - */ - public function writeChanges() - { - // Get new generation number - $latestDelGen = $this->_detectLatestDelGen(); - - if (!$this->_deletedDirty) { - // There was no deletions by current process - - if ($latestDelGen == $this->_delGen) { - // Delete file hasn't been updated by any concurrent process - return; - } else if ($latestDelGen > $this->_delGen) { - // Delete file has been updated by some concurrent process - // Reload deletions file - $this->_delGen = $latestDelGen; - $this->_deleted = $this->_loadDelFile(); - - return; - } else { - throw new Zend_Search_Lucene_Exception('Delete file processing workflow is corrupted for the segment \'' . $this->_name . '\'.'); - } - } - - if ($latestDelGen > $this->_delGen) { - // Merge current deletions with latest deletions file - $this->_delGen = $latestDelGen; - - $latestDelete = $this->_loadDelFile(); - - if (extension_loaded('bitset')) { - $this->_deleted = bitset_union($this->_deleted, $latestDelete); - } else { - $this->_deleted += $latestDelete; - } - } - - if (extension_loaded('bitset')) { - $delBytes = $this->_deleted; - $bitCount = count(bitset_to_array($delBytes)); - } else { - $byteCount = floor($this->_docCount/8)+1; - $delBytes = str_repeat(chr(0), $byteCount); - for ($count = 0; $count < $byteCount; $count++) { - $byte = 0; - for ($bit = 0; $bit < 8; $bit++) { - if (isset($this->_deleted[$count*8 + $bit])) { - $byte |= (1<<$bit); - } - } - $delBytes[$count] = chr($byte); - } - $bitCount = count($this->_deleted); - } - - if ($this->_delGen == -1) { - // Set delete file generation number to 1 - $this->_delGen = 1; - } else { - // Increase delete file generation number by 1 - $this->_delGen++; - } - - $delFile = $this->_directory->createFile($this->_name . '_' . base_convert($this->_delGen, 10, 36) . '.del'); - $delFile->writeInt($this->_docCount); - $delFile->writeInt($bitCount); - $delFile->writeBytes($delBytes); - - $this->_deletedDirty = false; - } - - - /** - * Term Dictionary File object for stream like terms reading - * - * @var Zend_Search_Lucene_Storage_File - */ - private $_tisFile = null; - - /** - * Actual offset of the .tis file data - * - * @var integer - */ - private $_tisFileOffset; - - /** - * Frequencies File object for stream like terms reading - * - * @var Zend_Search_Lucene_Storage_File - */ - private $_frqFile = null; - - /** - * Actual offset of the .frq file data - * - * @var integer - */ - private $_frqFileOffset; - - /** - * Positions File object for stream like terms reading - * - * @var Zend_Search_Lucene_Storage_File - */ - private $_prxFile = null; - - /** - * Actual offset of the .prx file in the compound file - * - * @var integer - */ - private $_prxFileOffset; - - - /** - * Actual number of terms in term stream - * - * @var integer - */ - private $_termCount = 0; - - /** - * Overall number of terms in term stream - * - * @var integer - */ - private $_termNum = 0; - - /** - * Segment index interval - * - * @var integer - */ - private $_indexInterval; - - /** - * Segment skip interval - * - * @var integer - */ - private $_skipInterval; - - /** - * Last TermInfo in a terms stream - * - * @var Zend_Search_Lucene_Index_TermInfo - */ - private $_lastTermInfo = null; - - /** - * Last Term in a terms stream - * - * @var Zend_Search_Lucene_Index_Term - */ - private $_lastTerm = null; - - /** - * Map of the document IDs - * Used to get new docID after removing deleted documents. - * It's not very effective from memory usage point of view, - * but much more faster, then other methods - * - * @var array|null - */ - private $_docMap = null; - - /** - * An array of all term positions in the documents. - * Array structure: array( docId => array( pos1, pos2, ...), ...) - * - * Is set to null if term positions loading has to be skipped - * - * @var array|null - */ - private $_lastTermPositions; - - - /** - * Terms scan mode - * - * Values: - * - * self::SM_TERMS_ONLY - terms are scanned, no additional info is retrieved - * self::SM_FULL_INFO - terms are scanned, frequency and position info is retrieved - * self::SM_MERGE_INFO - terms are scanned, frequency and position info is retrieved - * document numbers are compacted (shifted if segment has deleted documents) - * - * @var integer - */ - private $_termsScanMode; - - /** Scan modes */ - const SM_TERMS_ONLY = 0; // terms are scanned, no additional info is retrieved - const SM_FULL_INFO = 1; // terms are scanned, frequency and position info is retrieved - const SM_MERGE_INFO = 2; // terms are scanned, frequency and position info is retrieved - // document numbers are compacted (shifted if segment contains deleted documents) - - /** - * Reset terms stream - * - * $startId - id for the fist document - * $compact - remove deleted documents - * - * Returns start document id for the next segment - * - * @param integer $startId - * @param integer $mode - * @throws Zend_Search_Lucene_Exception - * @return integer - */ - public function resetTermsStream(/** $startId = 0, $mode = self::SM_TERMS_ONLY */) - { - /** - * SegmentInfo->resetTermsStream() method actually takes two optional parameters: - * $startId (default value is 0) - * $mode (default value is self::SM_TERMS_ONLY) - */ - $argList = func_get_args(); - if (count($argList) > 2) { - throw new Zend_Search_Lucene_Exception('Wrong number of arguments'); - } else if (count($argList) == 2) { - $startId = $argList[0]; - $mode = $argList[1]; - } else if (count($argList) == 1) { - $startId = $argList[0]; - $mode = self::SM_TERMS_ONLY; - } else { - $startId = 0; - $mode = self::SM_TERMS_ONLY; - } - - if ($this->_tisFile !== null) { - $this->_tisFile = null; - } - - $this->_tisFile = $this->openCompoundFile('.tis', false); - $this->_tisFileOffset = $this->_tisFile->tell(); - - $tiVersion = $this->_tisFile->readInt(); - if ($tiVersion != (int)0xFFFFFFFE /* pre-2.1 format */ && - $tiVersion != (int)0xFFFFFFFD /* 2.1+ format */) { - throw new Zend_Search_Lucene_Exception('Wrong TermInfoFile file format'); - } - - $this->_termCount = - $this->_termNum = $this->_tisFile->readLong(); // Read terms count - $this->_indexInterval = $this->_tisFile->readInt(); // Read Index interval - $this->_skipInterval = $this->_tisFile->readInt(); // Read skip interval - if ($tiVersion == (int)0xFFFFFFFD /* 2.1+ format */) { - $maxSkipLevels = $this->_tisFile->readInt(); - } - - if ($this->_frqFile !== null) { - $this->_frqFile = null; - } - if ($this->_prxFile !== null) { - $this->_prxFile = null; - } - $this->_docMap = array(); - - $this->_lastTerm = new Zend_Search_Lucene_Index_Term('', -1); - $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo(0, 0, 0, 0); - $this->_lastTermPositions = null; - - $this->_termsScanMode = $mode; - - switch ($mode) { - case self::SM_TERMS_ONLY: - // Do nothing - break; - - case self::SM_FULL_INFO: - // break intentionally omitted - case self::SM_MERGE_INFO: - $this->_frqFile = $this->openCompoundFile('.frq', false); - $this->_frqFileOffset = $this->_frqFile->tell(); - - $this->_prxFile = $this->openCompoundFile('.prx', false); - $this->_prxFileOffset = $this->_prxFile->tell(); - - for ($count = 0; $count < $this->_docCount; $count++) { - if (!$this->isDeleted($count)) { - $this->_docMap[$count] = $startId + (($mode == self::SM_MERGE_INFO) ? count($this->_docMap) : $count); - } - } - break; - - default: - throw new Zend_Search_Lucene_Exception('Wrong terms scaning mode specified.'); - break; - } - - // Calculate next segment start id (since $this->_docMap structure may be cleaned by $this->nextTerm() call) - $nextSegmentStartId = $startId + (($mode == self::SM_MERGE_INFO) ? count($this->_docMap) : $this->_docCount); - $this->nextTerm(); - - return $nextSegmentStartId; - } - - - /** - * Skip terms stream up to the specified term preffix. - * - * Prefix contains fully specified field info and portion of searched term - * - * @param Zend_Search_Lucene_Index_Term $prefix - * @throws Zend_Search_Lucene_Exception - */ - public function skipTo(Zend_Search_Lucene_Index_Term $prefix) - { - if ($this->_termDictionary === null) { - $this->_loadDictionaryIndex(); - } - - $searchField = $this->getFieldNum($prefix->field); - - if ($searchField == -1) { - /** - * Field is not presented in this segment - * Go to the end of dictionary - */ - $this->_tisFile = null; - $this->_frqFile = null; - $this->_prxFile = null; - - $this->_lastTerm = null; - $this->_lastTermInfo = null; - $this->_lastTermPositions = null; - - return; - } - $searchDicField = $this->_getFieldPosition($searchField); - - // search for appropriate value in dictionary - $lowIndex = 0; - $highIndex = count($this->_termDictionary)-1; - while ($highIndex >= $lowIndex) { - // $mid = ($highIndex - $lowIndex)/2; - $mid = ($highIndex + $lowIndex) >> 1; - $midTerm = $this->_termDictionary[$mid]; - - $fieldNum = $this->_getFieldPosition($midTerm[0] /* field */); - $delta = $searchDicField - $fieldNum; - if ($delta == 0) { - $delta = strcmp($prefix->text, $midTerm[1] /* text */); - } - - if ($delta < 0) { - $highIndex = $mid-1; - } elseif ($delta > 0) { - $lowIndex = $mid+1; - } else { - // We have reached term we are looking for - break; - } - } - - if ($highIndex == -1) { - // Term is out of the dictionary range - $this->_tisFile = null; - $this->_frqFile = null; - $this->_prxFile = null; - - $this->_lastTerm = null; - $this->_lastTermInfo = null; - $this->_lastTermPositions = null; - - return; - } - - $prevPosition = $highIndex; - $prevTerm = $this->_termDictionary[$prevPosition]; - $prevTermInfo = $this->_termDictionaryInfos[$prevPosition]; - - if ($this->_tisFile === null) { - // The end of terms stream is reached and terms dictionary file is closed - // Perform mini-reset operation - $this->_tisFile = $this->openCompoundFile('.tis', false); - - if ($this->_termsScanMode == self::SM_FULL_INFO || $this->_termsScanMode == self::SM_MERGE_INFO) { - $this->_frqFile = $this->openCompoundFile('.frq', false); - $this->_prxFile = $this->openCompoundFile('.prx', false); - } - } - $this->_tisFile->seek($this->_tisFileOffset + $prevTermInfo[4], SEEK_SET); - - $this->_lastTerm = new Zend_Search_Lucene_Index_Term($prevTerm[1] /* text */, - ($prevTerm[0] == -1) ? '' : $this->_fields[$prevTerm[0] /* field */]->name); - $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo($prevTermInfo[0] /* docFreq */, - $prevTermInfo[1] /* freqPointer */, - $prevTermInfo[2] /* proxPointer */, - $prevTermInfo[3] /* skipOffset */); - $this->_termCount = $this->_termNum - $prevPosition*$this->_indexInterval; - - if ($highIndex == 0) { - // skip start entry - $this->nextTerm(); - } else if ($prefix->field == $this->_lastTerm->field && $prefix->text == $this->_lastTerm->text) { - // We got exact match in the dictionary index - - if ($this->_termsScanMode == self::SM_FULL_INFO || $this->_termsScanMode == self::SM_MERGE_INFO) { - $this->_lastTermPositions = array(); - - $this->_frqFile->seek($this->_lastTermInfo->freqPointer + $this->_frqFileOffset, SEEK_SET); - $freqs = array(); $docId = 0; - for( $count = 0; $count < $this->_lastTermInfo->docFreq; $count++ ) { - $docDelta = $this->_frqFile->readVInt(); - if( $docDelta % 2 == 1 ) { - $docId += ($docDelta-1)/2; - $freqs[ $docId ] = 1; - } else { - $docId += $docDelta/2; - $freqs[ $docId ] = $this->_frqFile->readVInt(); - } - } - - $this->_prxFile->seek($this->_lastTermInfo->proxPointer + $this->_prxFileOffset, SEEK_SET); - foreach ($freqs as $docId => $freq) { - $termPosition = 0; $positions = array(); - - for ($count = 0; $count < $freq; $count++ ) { - $termPosition += $this->_prxFile->readVInt(); - $positions[] = $termPosition; - } - - if (isset($this->_docMap[$docId])) { - $this->_lastTermPositions[$this->_docMap[$docId]] = $positions; - } - } - } - - return; - } - - // Search term matching specified prefix - while ($this->_lastTerm !== null) { - if ( strcmp($this->_lastTerm->field, $prefix->field) > 0 || - ($prefix->field == $this->_lastTerm->field && strcmp($this->_lastTerm->text, $prefix->text) >= 0) ) { - // Current term matches or greate than the pattern - return; - } - - $this->nextTerm(); - } - } - - - /** - * Scans terms dictionary and returns next term - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function nextTerm() - { - if ($this->_tisFile === null || $this->_termCount == 0) { - $this->_lastTerm = null; - $this->_lastTermInfo = null; - $this->_lastTermPositions = null; - $this->_docMap = null; - - // may be necessary for "empty" segment - $this->_tisFile = null; - $this->_frqFile = null; - $this->_prxFile = null; - - return null; - } - - $termPrefixLength = $this->_tisFile->readVInt(); - $termSuffix = $this->_tisFile->readString(); - $termFieldNum = $this->_tisFile->readVInt(); - $termValue = Zend_Search_Lucene_Index_Term::getPrefix($this->_lastTerm->text, $termPrefixLength) . $termSuffix; - - $this->_lastTerm = new Zend_Search_Lucene_Index_Term($termValue, $this->_fields[$termFieldNum]->name); - - $docFreq = $this->_tisFile->readVInt(); - $freqPointer = $this->_lastTermInfo->freqPointer + $this->_tisFile->readVInt(); - $proxPointer = $this->_lastTermInfo->proxPointer + $this->_tisFile->readVInt(); - if ($docFreq >= $this->_skipInterval) { - $skipOffset = $this->_tisFile->readVInt(); - } else { - $skipOffset = 0; - } - - $this->_lastTermInfo = new Zend_Search_Lucene_Index_TermInfo($docFreq, $freqPointer, $proxPointer, $skipOffset); - - - if ($this->_termsScanMode == self::SM_FULL_INFO || $this->_termsScanMode == self::SM_MERGE_INFO) { - $this->_lastTermPositions = array(); - - $this->_frqFile->seek($this->_lastTermInfo->freqPointer + $this->_frqFileOffset, SEEK_SET); - $freqs = array(); $docId = 0; - for( $count = 0; $count < $this->_lastTermInfo->docFreq; $count++ ) { - $docDelta = $this->_frqFile->readVInt(); - if( $docDelta % 2 == 1 ) { - $docId += ($docDelta-1)/2; - $freqs[ $docId ] = 1; - } else { - $docId += $docDelta/2; - $freqs[ $docId ] = $this->_frqFile->readVInt(); - } - } - - $this->_prxFile->seek($this->_lastTermInfo->proxPointer + $this->_prxFileOffset, SEEK_SET); - foreach ($freqs as $docId => $freq) { - $termPosition = 0; $positions = array(); - - for ($count = 0; $count < $freq; $count++ ) { - $termPosition += $this->_prxFile->readVInt(); - $positions[] = $termPosition; - } - - if (isset($this->_docMap[$docId])) { - $this->_lastTermPositions[$this->_docMap[$docId]] = $positions; - } - } - } - - $this->_termCount--; - if ($this->_termCount == 0) { - $this->_tisFile = null; - $this->_frqFile = null; - $this->_prxFile = null; - } - - return $this->_lastTerm; - } - - /** - * Close terms stream - * - * Should be used for resources clean up if stream is not read up to the end - */ - public function closeTermsStream() - { - $this->_tisFile = null; - $this->_frqFile = null; - $this->_prxFile = null; - - $this->_lastTerm = null; - $this->_lastTermInfo = null; - $this->_lastTermPositions = null; - - $this->_docMap = null; - } - - - /** - * Returns term in current position - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function currentTerm() - { - return $this->_lastTerm; - } - - - /** - * Returns an array of all term positions in the documents. - * Return array structure: array( docId => array( pos1, pos2, ...), ...) - * - * @return array - */ - public function currentTermPositions() - { - return $this->_lastTermPositions; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/SegmentMerger.php b/library/vendor/Zend/Search/Lucene/Index/SegmentMerger.php deleted file mode 100644 index 153d972fe..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/SegmentMerger.php +++ /dev/null @@ -1,266 +0,0 @@ -][] => - * - * @var array - */ - private $_fieldsMap = array(); - - - - /** - * Object constructor. - * - * Creates new segment merger with $directory as target to merge segments into - * and $name as a name of new segment - * - * @param Zend_Search_Lucene_Storage_Directory $directory - * @param string $name - */ - public function __construct($directory, $name) - { - /** Zend_Search_Lucene_Index_SegmentWriter_StreamWriter */ - $this->_writer = new Zend_Search_Lucene_Index_SegmentWriter_StreamWriter($directory, $name); - } - - - /** - * Add segmnet to a collection of segments to be merged - * - * @param Zend_Search_Lucene_Index_SegmentInfo $segment - */ - public function addSource(Zend_Search_Lucene_Index_SegmentInfo $segmentInfo) - { - $this->_segmentInfos[$segmentInfo->getName()] = $segmentInfo; - } - - - /** - * Do merge. - * - * Returns number of documents in newly created segment - * - * @return Zend_Search_Lucene_Index_SegmentInfo - * @throws Zend_Search_Lucene_Exception - */ - public function merge() - { - if ($this->_mergeDone) { - throw new Zend_Search_Lucene_Exception('Merge is already done.'); - } - - if (count($this->_segmentInfos) < 1) { - throw new Zend_Search_Lucene_Exception('Wrong number of segments to be merged (' - . count($this->_segmentInfos) - . ').'); - } - - $this->_mergeFields(); - $this->_mergeNorms(); - $this->_mergeStoredFields(); - $this->_mergeTerms(); - - $this->_mergeDone = true; - - return $this->_writer->close(); - } - - - /** - * Merge fields information - */ - private function _mergeFields() - { - foreach ($this->_segmentInfos as $segName => $segmentInfo) { - foreach ($segmentInfo->getFieldInfos() as $fieldInfo) { - $this->_fieldsMap[$segName][$fieldInfo->number] = $this->_writer->addFieldInfo($fieldInfo); - } - } - } - - /** - * Merge field's normalization factors - */ - private function _mergeNorms() - { - foreach ($this->_writer->getFieldInfos() as $fieldInfo) { - if ($fieldInfo->isIndexed) { - foreach ($this->_segmentInfos as $segName => $segmentInfo) { - if ($segmentInfo->hasDeletions()) { - $srcNorm = $segmentInfo->normVector($fieldInfo->name); - $norm = ''; - $docs = $segmentInfo->count(); - for ($count = 0; $count < $docs; $count++) { - if (!$segmentInfo->isDeleted($count)) { - $norm .= $srcNorm[$count]; - } - } - $this->_writer->addNorm($fieldInfo->name, $norm); - } else { - $this->_writer->addNorm($fieldInfo->name, $segmentInfo->normVector($fieldInfo->name)); - } - } - } - } - } - - /** - * Merge fields information - */ - private function _mergeStoredFields() - { - $this->_docCount = 0; - - foreach ($this->_segmentInfos as $segName => $segmentInfo) { - $fdtFile = $segmentInfo->openCompoundFile('.fdt'); - - for ($count = 0; $count < $segmentInfo->count(); $count++) { - $fieldCount = $fdtFile->readVInt(); - $storedFields = array(); - - for ($count2 = 0; $count2 < $fieldCount; $count2++) { - $fieldNum = $fdtFile->readVInt(); - $bits = $fdtFile->readByte(); - $fieldInfo = $segmentInfo->getField($fieldNum); - - if (!($bits & 2)) { // Text data - $storedFields[] = - new Zend_Search_Lucene_Field($fieldInfo->name, - $fdtFile->readString(), - 'UTF-8', - true, - $fieldInfo->isIndexed, - $bits & 1 ); - } else { // Binary data - $storedFields[] = - new Zend_Search_Lucene_Field($fieldInfo->name, - $fdtFile->readBinary(), - '', - true, - $fieldInfo->isIndexed, - $bits & 1, - true); - } - } - - if (!$segmentInfo->isDeleted($count)) { - $this->_docCount++; - $this->_writer->addStoredFields($storedFields); - } - } - } - } - - - /** - * Merge fields information - */ - private function _mergeTerms() - { - /** Zend_Search_Lucene_Index_TermsPriorityQueue */ - - $segmentInfoQueue = new Zend_Search_Lucene_Index_TermsPriorityQueue(); - - $segmentStartId = 0; - foreach ($this->_segmentInfos as $segName => $segmentInfo) { - $segmentStartId = $segmentInfo->resetTermsStream($segmentStartId, Zend_Search_Lucene_Index_SegmentInfo::SM_MERGE_INFO); - - // Skip "empty" segments - if ($segmentInfo->currentTerm() !== null) { - $segmentInfoQueue->put($segmentInfo); - } - } - - $this->_writer->initializeDictionaryFiles(); - - $termDocs = array(); - while (($segmentInfo = $segmentInfoQueue->pop()) !== null) { - // Merge positions array - $termDocs += $segmentInfo->currentTermPositions(); - - if ($segmentInfoQueue->top() === null || - $segmentInfoQueue->top()->currentTerm()->key() != - $segmentInfo->currentTerm()->key()) { - // We got new term - ksort($termDocs, SORT_NUMERIC); - - // Add term if it's contained in any document - if (count($termDocs) > 0) { - $this->_writer->addTerm($segmentInfo->currentTerm(), $termDocs); - } - $termDocs = array(); - } - - $segmentInfo->nextTerm(); - // check, if segment dictionary is finished - if ($segmentInfo->currentTerm() !== null) { - // Put segment back into the priority queue - $segmentInfoQueue->put($segmentInfo); - } - } - - $this->_writer->closeDictionaryFiles(); - } -} diff --git a/library/vendor/Zend/Search/Lucene/Index/SegmentWriter.php b/library/vendor/Zend/Search/Lucene/Index/SegmentWriter.php deleted file mode 100644 index a014751c8..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/SegmentWriter.php +++ /dev/null @@ -1,631 +0,0 @@ - normVector - * normVector is a binary string. - * Each byte corresponds to an indexed document in a segment and - * encodes normalization factor (float value, encoded by - * Zend_Search_Lucene_Search_Similarity::encodeNorm()) - * - * @var array - */ - protected $_norms = array(); - - - /** - * '.fdx' file - Stored Fields, the field index. - * - * @var Zend_Search_Lucene_Storage_File - */ - protected $_fdxFile = null; - - /** - * '.fdt' file - Stored Fields, the field data. - * - * @var Zend_Search_Lucene_Storage_File - */ - protected $_fdtFile = null; - - - /** - * Object constructor. - * - * @param Zend_Search_Lucene_Storage_Directory $directory - * @param string $name - */ - public function __construct(Zend_Search_Lucene_Storage_Directory $directory, $name) - { - $this->_directory = $directory; - $this->_name = $name; - } - - - /** - * Add field to the segment - * - * Returns actual field number - * - * @param Zend_Search_Lucene_Field $field - * @return integer - */ - public function addField(Zend_Search_Lucene_Field $field) - { - if (!isset($this->_fields[$field->name])) { - $fieldNumber = count($this->_fields); - $this->_fields[$field->name] = - new Zend_Search_Lucene_Index_FieldInfo($field->name, - $field->isIndexed, - $fieldNumber, - $field->storeTermVector); - - return $fieldNumber; - } else { - $this->_fields[$field->name]->isIndexed |= $field->isIndexed; - $this->_fields[$field->name]->storeTermVector |= $field->storeTermVector; - - return $this->_fields[$field->name]->number; - } - } - - /** - * Add fieldInfo to the segment - * - * Returns actual field number - * - * @param Zend_Search_Lucene_Index_FieldInfo $fieldInfo - * @return integer - */ - public function addFieldInfo(Zend_Search_Lucene_Index_FieldInfo $fieldInfo) - { - if (!isset($this->_fields[$fieldInfo->name])) { - $fieldNumber = count($this->_fields); - $this->_fields[$fieldInfo->name] = - new Zend_Search_Lucene_Index_FieldInfo($fieldInfo->name, - $fieldInfo->isIndexed, - $fieldNumber, - $fieldInfo->storeTermVector); - - return $fieldNumber; - } else { - $this->_fields[$fieldInfo->name]->isIndexed |= $fieldInfo->isIndexed; - $this->_fields[$fieldInfo->name]->storeTermVector |= $fieldInfo->storeTermVector; - - return $this->_fields[$fieldInfo->name]->number; - } - } - - /** - * Returns array of FieldInfo objects. - * - * @return array - */ - public function getFieldInfos() - { - return $this->_fields; - } - - /** - * Add stored fields information - * - * @param array $storedFields array of Zend_Search_Lucene_Field objects - */ - public function addStoredFields($storedFields) - { - if (!isset($this->_fdxFile)) { - $this->_fdxFile = $this->_directory->createFile($this->_name . '.fdx'); - $this->_fdtFile = $this->_directory->createFile($this->_name . '.fdt'); - - $this->_files[] = $this->_name . '.fdx'; - $this->_files[] = $this->_name . '.fdt'; - } - - $this->_fdxFile->writeLong($this->_fdtFile->tell()); - $this->_fdtFile->writeVInt(count($storedFields)); - foreach ($storedFields as $field) { - $this->_fdtFile->writeVInt($this->_fields[$field->name]->number); - $fieldBits = ($field->isTokenized ? 0x01 : 0x00) | - ($field->isBinary ? 0x02 : 0x00) | - 0x00; /* 0x04 - third bit, compressed (ZLIB) */ - $this->_fdtFile->writeByte($fieldBits); - if ($field->isBinary) { - $this->_fdtFile->writeVInt(strlen($field->value)); - $this->_fdtFile->writeBytes($field->value); - } else { - $this->_fdtFile->writeString($field->getUtf8Value()); - } - } - - $this->_docCount++; - } - - /** - * Returns the total number of documents in this segment. - * - * @return integer - */ - public function count() - { - return $this->_docCount; - } - - /** - * Return segment name - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * Dump Field Info (.fnm) segment file - */ - protected function _dumpFNM() - { - $fnmFile = $this->_directory->createFile($this->_name . '.fnm'); - $fnmFile->writeVInt(count($this->_fields)); - - $nrmFile = $this->_directory->createFile($this->_name . '.nrm'); - // Write header - $nrmFile->writeBytes('NRM'); - // Write format specifier - $nrmFile->writeByte((int)0xFF); - - foreach ($this->_fields as $field) { - $fnmFile->writeString($field->name); - $fnmFile->writeByte(($field->isIndexed ? 0x01 : 0x00) | - ($field->storeTermVector ? 0x02 : 0x00) -// not supported yet 0x04 /* term positions are stored with the term vectors */ | -// not supported yet 0x08 /* term offsets are stored with the term vectors */ | - ); - - if ($field->isIndexed) { - // pre-2.1 index mode (not used now) - // $normFileName = $this->_name . '.f' . $field->number; - // $fFile = $this->_directory->createFile($normFileName); - // $fFile->writeBytes($this->_norms[$field->name]); - // $this->_files[] = $normFileName; - - $nrmFile->writeBytes($this->_norms[$field->name]); - } - } - - $this->_files[] = $this->_name . '.fnm'; - $this->_files[] = $this->_name . '.nrm'; - } - - - - /** - * Term Dictionary file - * - * @var Zend_Search_Lucene_Storage_File - */ - private $_tisFile = null; - - /** - * Term Dictionary index file - * - * @var Zend_Search_Lucene_Storage_File - */ - private $_tiiFile = null; - - /** - * Frequencies file - * - * @var Zend_Search_Lucene_Storage_File - */ - private $_frqFile = null; - - /** - * Positions file - * - * @var Zend_Search_Lucene_Storage_File - */ - private $_prxFile = null; - - /** - * Number of written terms - * - * @var integer - */ - private $_termCount; - - - /** - * Last saved term - * - * @var Zend_Search_Lucene_Index_Term - */ - private $_prevTerm; - - /** - * Last saved term info - * - * @var Zend_Search_Lucene_Index_TermInfo - */ - private $_prevTermInfo; - - /** - * Last saved index term - * - * @var Zend_Search_Lucene_Index_Term - */ - private $_prevIndexTerm; - - /** - * Last saved index term info - * - * @var Zend_Search_Lucene_Index_TermInfo - */ - private $_prevIndexTermInfo; - - /** - * Last term dictionary file position - * - * @var integer - */ - private $_lastIndexPosition; - - /** - * Create dicrionary, frequency and positions files and write necessary headers - */ - public function initializeDictionaryFiles() - { - $this->_tisFile = $this->_directory->createFile($this->_name . '.tis'); - $this->_tisFile->writeInt((int)0xFFFFFFFD); - $this->_tisFile->writeLong(0 /* dummy data for terms count */); - $this->_tisFile->writeInt(self::$indexInterval); - $this->_tisFile->writeInt(self::$skipInterval); - $this->_tisFile->writeInt(self::$maxSkipLevels); - - $this->_tiiFile = $this->_directory->createFile($this->_name . '.tii'); - $this->_tiiFile->writeInt((int)0xFFFFFFFD); - $this->_tiiFile->writeLong(0 /* dummy data for terms count */); - $this->_tiiFile->writeInt(self::$indexInterval); - $this->_tiiFile->writeInt(self::$skipInterval); - $this->_tiiFile->writeInt(self::$maxSkipLevels); - - /** Dump dictionary header */ - $this->_tiiFile->writeVInt(0); // preffix length - $this->_tiiFile->writeString(''); // suffix - $this->_tiiFile->writeInt((int)0xFFFFFFFF); // field number - $this->_tiiFile->writeByte((int)0x0F); - $this->_tiiFile->writeVInt(0); // DocFreq - $this->_tiiFile->writeVInt(0); // FreqDelta - $this->_tiiFile->writeVInt(0); // ProxDelta - $this->_tiiFile->writeVInt(24); // IndexDelta - - $this->_frqFile = $this->_directory->createFile($this->_name . '.frq'); - $this->_prxFile = $this->_directory->createFile($this->_name . '.prx'); - - $this->_files[] = $this->_name . '.tis'; - $this->_files[] = $this->_name . '.tii'; - $this->_files[] = $this->_name . '.frq'; - $this->_files[] = $this->_name . '.prx'; - - $this->_prevTerm = null; - $this->_prevTermInfo = null; - $this->_prevIndexTerm = null; - $this->_prevIndexTermInfo = null; - $this->_lastIndexPosition = 24; - $this->_termCount = 0; - - } - - /** - * Add term - * - * Term positions is an array( docId => array(pos1, pos2, pos3, ...), ... ) - * - * @param Zend_Search_Lucene_Index_Term $termEntry - * @param array $termDocs - */ - public function addTerm($termEntry, $termDocs) - { - $freqPointer = $this->_frqFile->tell(); - $proxPointer = $this->_prxFile->tell(); - - $prevDoc = 0; - foreach ($termDocs as $docId => $termPositions) { - $docDelta = ($docId - $prevDoc)*2; - $prevDoc = $docId; - if (count($termPositions) > 1) { - $this->_frqFile->writeVInt($docDelta); - $this->_frqFile->writeVInt(count($termPositions)); - } else { - $this->_frqFile->writeVInt($docDelta + 1); - } - - $prevPosition = 0; - foreach ($termPositions as $position) { - $this->_prxFile->writeVInt($position - $prevPosition); - $prevPosition = $position; - } - } - - if (count($termDocs) >= self::$skipInterval) { - /** - * @todo Write Skip Data to a freq file. - * It's not used now, but make index more optimal - */ - $skipOffset = $this->_frqFile->tell() - $freqPointer; - } else { - $skipOffset = 0; - } - - $term = new Zend_Search_Lucene_Index_Term($termEntry->text, - $this->_fields[$termEntry->field]->number); - $termInfo = new Zend_Search_Lucene_Index_TermInfo(count($termDocs), - $freqPointer, $proxPointer, $skipOffset); - - $this->_dumpTermDictEntry($this->_tisFile, $this->_prevTerm, $term, $this->_prevTermInfo, $termInfo); - - if (($this->_termCount + 1) % self::$indexInterval == 0) { - $this->_dumpTermDictEntry($this->_tiiFile, $this->_prevIndexTerm, $term, $this->_prevIndexTermInfo, $termInfo); - - $indexPosition = $this->_tisFile->tell(); - $this->_tiiFile->writeVInt($indexPosition - $this->_lastIndexPosition); - $this->_lastIndexPosition = $indexPosition; - - } - $this->_termCount++; - } - - /** - * Close dictionary - */ - public function closeDictionaryFiles() - { - $this->_tisFile->seek(4); - $this->_tisFile->writeLong($this->_termCount); - - $this->_tiiFile->seek(4); - // + 1 is used to count an additional special index entry (empty term at the start of the list) - $this->_tiiFile->writeLong(($this->_termCount - $this->_termCount % self::$indexInterval)/self::$indexInterval + 1); - } - - - /** - * Dump Term Dictionary segment file entry. - * Used to write entry to .tis or .tii files - * - * @param Zend_Search_Lucene_Storage_File $dicFile - * @param Zend_Search_Lucene_Index_Term $prevTerm - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_TermInfo $prevTermInfo - * @param Zend_Search_Lucene_Index_TermInfo $termInfo - */ - protected function _dumpTermDictEntry(Zend_Search_Lucene_Storage_File $dicFile, - &$prevTerm, Zend_Search_Lucene_Index_Term $term, - &$prevTermInfo, Zend_Search_Lucene_Index_TermInfo $termInfo) - { - if (isset($prevTerm) && $prevTerm->field == $term->field) { - $matchedBytes = 0; - $maxBytes = min(strlen($prevTerm->text), strlen($term->text)); - while ($matchedBytes < $maxBytes && - $prevTerm->text[$matchedBytes] == $term->text[$matchedBytes]) { - $matchedBytes++; - } - - // Calculate actual matched UTF-8 pattern - $prefixBytes = 0; - $prefixChars = 0; - while ($prefixBytes < $matchedBytes) { - $charBytes = 1; - if ((ord($term->text[$prefixBytes]) & 0xC0) == 0xC0) { - $charBytes++; - if (ord($term->text[$prefixBytes]) & 0x20 ) { - $charBytes++; - if (ord($term->text[$prefixBytes]) & 0x10 ) { - $charBytes++; - } - } - } - - if ($prefixBytes + $charBytes > $matchedBytes) { - // char crosses matched bytes boundary - // skip char - break; - } - - $prefixChars++; - $prefixBytes += $charBytes; - } - - // Write preffix length - $dicFile->writeVInt($prefixChars); - // Write suffix - $dicFile->writeString(substr($term->text, $prefixBytes)); - } else { - // Write preffix length - $dicFile->writeVInt(0); - // Write suffix - $dicFile->writeString($term->text); - } - // Write field number - $dicFile->writeVInt($term->field); - // DocFreq (the count of documents which contain the term) - $dicFile->writeVInt($termInfo->docFreq); - - $prevTerm = $term; - - if (!isset($prevTermInfo)) { - // Write FreqDelta - $dicFile->writeVInt($termInfo->freqPointer); - // Write ProxDelta - $dicFile->writeVInt($termInfo->proxPointer); - } else { - // Write FreqDelta - $dicFile->writeVInt($termInfo->freqPointer - $prevTermInfo->freqPointer); - // Write ProxDelta - $dicFile->writeVInt($termInfo->proxPointer - $prevTermInfo->proxPointer); - } - // Write SkipOffset - it's not 0 when $termInfo->docFreq > self::$skipInterval - if ($termInfo->skipOffset != 0) { - $dicFile->writeVInt($termInfo->skipOffset); - } - - $prevTermInfo = $termInfo; - } - - - /** - * Generate compound index file - */ - protected function _generateCFS() - { - $cfsFile = $this->_directory->createFile($this->_name . '.cfs'); - $cfsFile->writeVInt(count($this->_files)); - - $dataOffsetPointers = array(); - foreach ($this->_files as $fileName) { - $dataOffsetPointers[$fileName] = $cfsFile->tell(); - $cfsFile->writeLong(0); // write dummy data - $cfsFile->writeString($fileName); - } - - foreach ($this->_files as $fileName) { - // Get actual data offset - $dataOffset = $cfsFile->tell(); - // Seek to the data offset pointer - $cfsFile->seek($dataOffsetPointers[$fileName]); - // Write actual data offset value - $cfsFile->writeLong($dataOffset); - // Seek back to the end of file - $cfsFile->seek($dataOffset); - - $dataFile = $this->_directory->getFileObject($fileName); - - $byteCount = $this->_directory->fileLength($fileName); - while ($byteCount > 0) { - $data = $dataFile->readBytes(min($byteCount, 131072 /*128Kb*/)); - $byteCount -= strlen($data); - $cfsFile->writeBytes($data); - } - - $this->_directory->deleteFile($fileName); - } - } - - - /** - * Close segment, write it to disk and return segment info - * - * @return Zend_Search_Lucene_Index_SegmentInfo - */ - abstract public function close(); -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php b/library/vendor/Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php deleted file mode 100644 index 54e041a7a..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php +++ /dev/null @@ -1,225 +0,0 @@ -_termDocs = array(); - $this->_termDictionary = array(); - } - - - /** - * Adds a document to this segment. - * - * @param Zend_Search_Lucene_Document $document - * @throws Zend_Search_Lucene_Exception - */ - public function addDocument(Zend_Search_Lucene_Document $document) - { - /** Zend_Search_Lucene_Search_Similarity */ - - $storedFields = array(); - $docNorms = array(); - $similarity = Zend_Search_Lucene_Search_Similarity::getDefault(); - - foreach ($document->getFieldNames() as $fieldName) { - $field = $document->getField($fieldName); - - if ($field->storeTermVector) { - /** - * @todo term vector storing support - */ - throw new Zend_Search_Lucene_Exception('Store term vector functionality is not supported yet.'); - } - - if ($field->isIndexed) { - if ($field->isTokenized) { - /** Zend_Search_Lucene_Analysis_Analyzer */ - - $analyzer = Zend_Search_Lucene_Analysis_Analyzer::getDefault(); - $analyzer->setInput($field->value, $field->encoding); - - $position = 0; - $tokenCounter = 0; - while (($token = $analyzer->nextToken()) !== null) { - $tokenCounter++; - - $term = new Zend_Search_Lucene_Index_Term($token->getTermText(), $field->name); - $termKey = $term->key(); - - if (!isset($this->_termDictionary[$termKey])) { - // New term - $this->_termDictionary[$termKey] = $term; - $this->_termDocs[$termKey] = array(); - $this->_termDocs[$termKey][$this->_docCount] = array(); - } else if (!isset($this->_termDocs[$termKey][$this->_docCount])) { - // Existing term, but new term entry - $this->_termDocs[$termKey][$this->_docCount] = array(); - } - $position += $token->getPositionIncrement(); - $this->_termDocs[$termKey][$this->_docCount][] = $position; - } - - if ($tokenCounter == 0) { - // Field contains empty value. Treat it as non-indexed and non-tokenized - $field = clone($field); - $field->isIndexed = $field->isTokenized = false; - } else { - $docNorms[$field->name] = chr($similarity->encodeNorm( $similarity->lengthNorm($field->name, - $tokenCounter)* - $document->boost* - $field->boost )); - } - } else if (($fieldUtf8Value = $field->getUtf8Value()) == '') { - // Field contains empty value. Treat it as non-indexed and non-tokenized - $field = clone($field); - $field->isIndexed = $field->isTokenized = false; - } else { - $term = new Zend_Search_Lucene_Index_Term($fieldUtf8Value, $field->name); - $termKey = $term->key(); - - if (!isset($this->_termDictionary[$termKey])) { - // New term - $this->_termDictionary[$termKey] = $term; - $this->_termDocs[$termKey] = array(); - $this->_termDocs[$termKey][$this->_docCount] = array(); - } else if (!isset($this->_termDocs[$termKey][$this->_docCount])) { - // Existing term, but new term entry - $this->_termDocs[$termKey][$this->_docCount] = array(); - } - $this->_termDocs[$termKey][$this->_docCount][] = 0; // position - - $docNorms[$field->name] = chr($similarity->encodeNorm( $similarity->lengthNorm($field->name, 1)* - $document->boost* - $field->boost )); - } - } - - if ($field->isStored) { - $storedFields[] = $field; - } - - $this->addField($field); - } - - foreach ($this->_fields as $fieldName => $field) { - if (!$field->isIndexed) { - continue; - } - - if (!isset($this->_norms[$fieldName])) { - $this->_norms[$fieldName] = str_repeat(chr($similarity->encodeNorm( $similarity->lengthNorm($fieldName, 0) )), - $this->_docCount); - } - - if (isset($docNorms[$fieldName])){ - $this->_norms[$fieldName] .= $docNorms[$fieldName]; - } else { - $this->_norms[$fieldName] .= chr($similarity->encodeNorm( $similarity->lengthNorm($fieldName, 0) )); - } - } - - $this->addStoredFields($storedFields); - } - - - /** - * Dump Term Dictionary (.tis) and Term Dictionary Index (.tii) segment files - */ - protected function _dumpDictionary() - { - ksort($this->_termDictionary, SORT_STRING); - - $this->initializeDictionaryFiles(); - - foreach ($this->_termDictionary as $termId => $term) { - $this->addTerm($term, $this->_termDocs[$termId]); - } - - $this->closeDictionaryFiles(); - } - - - /** - * Close segment, write it to disk and return segment info - * - * @return Zend_Search_Lucene_Index_SegmentInfo - */ - public function close() - { - if ($this->_docCount == 0) { - return null; - } - - $this->_dumpFNM(); - $this->_dumpDictionary(); - - $this->_generateCFS(); - - /** Zend_Search_Lucene_Index_SegmentInfo */ - - return new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, - $this->_name, - $this->_docCount, - -1, - null, - true, - true); - } - -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php b/library/vendor/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php deleted file mode 100644 index fcc882a04..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php +++ /dev/null @@ -1,92 +0,0 @@ -_fdxFile = $this->_directory->createFile($this->_name . '.fdx'); - $this->_fdtFile = $this->_directory->createFile($this->_name . '.fdt'); - - $this->_files[] = $this->_name . '.fdx'; - $this->_files[] = $this->_name . '.fdt'; - } - - public function addNorm($fieldName, $normVector) - { - if (isset($this->_norms[$fieldName])) { - $this->_norms[$fieldName] .= $normVector; - } else { - $this->_norms[$fieldName] = $normVector; - } - } - - /** - * Close segment, write it to disk and return segment info - * - * @return Zend_Search_Lucene_Index_SegmentInfo - */ - public function close() - { - if ($this->_docCount == 0) { - return null; - } - - $this->_dumpFNM(); - $this->_generateCFS(); - - /** Zend_Search_Lucene_Index_SegmentInfo */ - - return new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, - $this->_name, - $this->_docCount, - -1, - null, - true, - true); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/Term.php b/library/vendor/Zend/Search/Lucene/Index/Term.php deleted file mode 100644 index b2328384d..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/Term.php +++ /dev/null @@ -1,144 +0,0 @@ -field = ($field === null)? Zend_Search_Lucene::getDefaultSearchField() : $field; - $this->text = $text; - } - - - /** - * Returns term key - * - * @return string - */ - public function key() - { - return $this->field . chr(0) . $this->text; - } - - /** - * Get term prefix - * - * @param string $str - * @param integer $length - * @return string - */ - public static function getPrefix($str, $length) - { - $prefixBytes = 0; - $prefixChars = 0; - while ($prefixBytes < strlen($str) && $prefixChars < $length) { - $charBytes = 1; - if ((ord($str[$prefixBytes]) & 0xC0) == 0xC0) { - $charBytes++; - if (ord($str[$prefixBytes]) & 0x20 ) { - $charBytes++; - if (ord($str[$prefixBytes]) & 0x10 ) { - $charBytes++; - } - } - } - - if ($prefixBytes + $charBytes > strlen($str)) { - // wrong character - break; - } - - $prefixChars++; - $prefixBytes += $charBytes; - } - - return substr($str, 0, $prefixBytes); - } - - /** - * Get UTF-8 string length - * - * @param string $str - * @return string - */ - public static function getLength($str) - { - $bytes = 0; - $chars = 0; - while ($bytes < strlen($str)) { - $charBytes = 1; - if ((ord($str[$bytes]) & 0xC0) == 0xC0) { - $charBytes++; - if (ord($str[$bytes]) & 0x20 ) { - $charBytes++; - if (ord($str[$bytes]) & 0x10 ) { - $charBytes++; - } - } - } - - if ($bytes + $charBytes > strlen($str)) { - // wrong character - break; - } - - $chars++; - $bytes += $charBytes; - } - - return $chars; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/TermInfo.php b/library/vendor/Zend/Search/Lucene/Index/TermInfo.php deleted file mode 100644 index 824980883..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/TermInfo.php +++ /dev/null @@ -1,80 +0,0 @@ -docFreq = $docFreq; - $this->freqPointer = $freqPointer; - $this->proxPointer = $proxPointer; - $this->skipOffset = $skipOffset; - $this->indexPointer = $indexPointer; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Index/TermsPriorityQueue.php b/library/vendor/Zend/Search/Lucene/Index/TermsPriorityQueue.php deleted file mode 100644 index 2703d69f7..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/TermsPriorityQueue.php +++ /dev/null @@ -1,48 +0,0 @@ -currentTerm()->key(), $termsStream2->currentTerm()->key()) < 0; - } - -} diff --git a/library/vendor/Zend/Search/Lucene/Index/TermsStream/Interface.php b/library/vendor/Zend/Search/Lucene/Index/TermsStream/Interface.php deleted file mode 100644 index 67952bbf8..000000000 --- a/library/vendor/Zend/Search/Lucene/Index/TermsStream/Interface.php +++ /dev/null @@ -1,66 +0,0 @@ - 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @var integer - */ - public $mergeFactor = 10; - - /** - * File system adapter. - * - * @var Zend_Search_Lucene_Storage_Directory - */ - private $_directory = null; - - - /** - * Changes counter. - * - * @var integer - */ - private $_versionUpdate = 0; - - /** - * List of the segments, created by index writer - * Array of Zend_Search_Lucene_Index_SegmentInfo objects - * - * @var array - */ - private $_newSegments = array(); - - /** - * List of segments to be deleted on commit - * - * @var array - */ - private $_segmentsToDelete = array(); - - /** - * Current segment to add documents - * - * @var Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter - */ - private $_currentSegment = null; - - /** - * Array of Zend_Search_Lucene_Index_SegmentInfo objects for this index. - * - * It's a reference to the corresponding Zend_Search_Lucene::$_segmentInfos array - * - * @var array Zend_Search_Lucene_Index_SegmentInfo - */ - private $_segmentInfos; - - /** - * Index target format version - * - * @var integer - */ - private $_targetFormatVersion; - - /** - * List of indexfiles extensions - * - * @var array - */ - private static $_indexExtensions = array('.cfs' => '.cfs', - '.cfx' => '.cfx', - '.fnm' => '.fnm', - '.fdx' => '.fdx', - '.fdt' => '.fdt', - '.tis' => '.tis', - '.tii' => '.tii', - '.frq' => '.frq', - '.prx' => '.prx', - '.tvx' => '.tvx', - '.tvd' => '.tvd', - '.tvf' => '.tvf', - '.del' => '.del', - '.sti' => '.sti' ); - - - /** - * Create empty index - * - * @param Zend_Search_Lucene_Storage_Directory $directory - * @param integer $generation - * @param integer $nameCount - */ - public static function createIndex(Zend_Search_Lucene_Storage_Directory $directory, $generation, $nameCount) - { - if ($generation == 0) { - // Create index in pre-2.1 mode - foreach ($directory->fileList() as $file) { - if ($file == 'deletable' || - $file == 'segments' || - isset(self::$_indexExtensions[ substr($file, strlen($file)-4)]) || - preg_match('/\.f\d+$/i', $file) /* matches .f file names */) { - $directory->deleteFile($file); - } - } - - $segmentsFile = $directory->createFile('segments'); - $segmentsFile->writeInt((int)0xFFFFFFFF); - - // write version (initialized by current time) - $segmentsFile->writeLong(round(microtime(true))); - - // write name counter - $segmentsFile->writeInt($nameCount); - // write segment counter - $segmentsFile->writeInt(0); - - $deletableFile = $directory->createFile('deletable'); - // write counter - $deletableFile->writeInt(0); - } else { - $genFile = $directory->createFile('segments.gen'); - - $genFile->writeInt((int)0xFFFFFFFE); - // Write generation two times - $genFile->writeLong($generation); - $genFile->writeLong($generation); - - $segmentsFile = $directory->createFile(Zend_Search_Lucene::getSegmentFileName($generation)); - $segmentsFile->writeInt((int)0xFFFFFFFD); - - // write version (initialized by current time) - $segmentsFile->writeLong(round(microtime(true))); - - // write name counter - $segmentsFile->writeInt($nameCount); - // write segment counter - $segmentsFile->writeInt(0); - } - } - - /** - * Open the index for writing - * - * @param Zend_Search_Lucene_Storage_Directory $directory - * @param array $segmentInfos - * @param integer $targetFormatVersion - * @param Zend_Search_Lucene_Storage_File $cleanUpLock - */ - public function __construct(Zend_Search_Lucene_Storage_Directory $directory, &$segmentInfos, $targetFormatVersion) - { - $this->_directory = $directory; - $this->_segmentInfos = &$segmentInfos; - $this->_targetFormatVersion = $targetFormatVersion; - } - - /** - * Adds a document to this index. - * - * @param Zend_Search_Lucene_Document $document - */ - public function addDocument(Zend_Search_Lucene_Document $document) - { - /** Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter */ - - if ($this->_currentSegment === null) { - $this->_currentSegment = - new Zend_Search_Lucene_Index_SegmentWriter_DocumentWriter($this->_directory, $this->_newSegmentName()); - } - $this->_currentSegment->addDocument($document); - - if ($this->_currentSegment->count() >= $this->maxBufferedDocs) { - $this->commit(); - } - - $this->_maybeMergeSegments(); - - $this->_versionUpdate++; - } - - - /** - * Check if we have anything to merge - * - * @return boolean - */ - private function _hasAnythingToMerge() - { - $segmentSizes = array(); - foreach ($this->_segmentInfos as $segName => $segmentInfo) { - $segmentSizes[$segName] = $segmentInfo->count(); - } - - $mergePool = array(); - $poolSize = 0; - $sizeToMerge = $this->maxBufferedDocs; - asort($segmentSizes, SORT_NUMERIC); - foreach ($segmentSizes as $segName => $size) { - // Check, if segment comes into a new merging block - while ($size >= $sizeToMerge) { - // Merge previous block if it's large enough - if ($poolSize >= $sizeToMerge) { - return true; - } - $mergePool = array(); - $poolSize = 0; - - $sizeToMerge *= $this->mergeFactor; - - if ($sizeToMerge > $this->maxMergeDocs) { - return false; - } - } - - $mergePool[] = $this->_segmentInfos[$segName]; - $poolSize += $size; - } - - if ($poolSize >= $sizeToMerge) { - return true; - } - - return false; - } - - /** - * Merge segments if necessary - */ - private function _maybeMergeSegments() - { - if (Zend_Search_Lucene_LockManager::obtainOptimizationLock($this->_directory) === false) { - return; - } - - if (!$this->_hasAnythingToMerge()) { - Zend_Search_Lucene_LockManager::releaseOptimizationLock($this->_directory); - return; - } - - // Update segments list to be sure all segments are not merged yet by another process - // - // Segment merging functionality is concentrated in this class and surrounded - // by optimization lock obtaining/releasing. - // _updateSegments() refreshes segments list from the latest index generation. - // So only new segments can be added to the index while we are merging some already existing - // segments. - // Newly added segments will be also included into the index by the _updateSegments() call - // either by another process or by the current process with the commit() call at the end of _mergeSegments() method. - // That's guaranteed by the serialisation of _updateSegments() execution using exclusive locks. - $this->_updateSegments(); - - // Perform standard auto-optimization procedure - $segmentSizes = array(); - foreach ($this->_segmentInfos as $segName => $segmentInfo) { - $segmentSizes[$segName] = $segmentInfo->count(); - } - - $mergePool = array(); - $poolSize = 0; - $sizeToMerge = $this->maxBufferedDocs; - asort($segmentSizes, SORT_NUMERIC); - foreach ($segmentSizes as $segName => $size) { - // Check, if segment comes into a new merging block - while ($size >= $sizeToMerge) { - // Merge previous block if it's large enough - if ($poolSize >= $sizeToMerge) { - $this->_mergeSegments($mergePool); - } - $mergePool = array(); - $poolSize = 0; - - $sizeToMerge *= $this->mergeFactor; - - if ($sizeToMerge > $this->maxMergeDocs) { - Zend_Search_Lucene_LockManager::releaseOptimizationLock($this->_directory); - return; - } - } - - $mergePool[] = $this->_segmentInfos[$segName]; - $poolSize += $size; - } - - if ($poolSize >= $sizeToMerge) { - $this->_mergeSegments($mergePool); - } - - Zend_Search_Lucene_LockManager::releaseOptimizationLock($this->_directory); - } - - /** - * Merge specified segments - * - * $segments is an array of SegmentInfo objects - * - * @param array $segments - */ - private function _mergeSegments($segments) - { - $newName = $this->_newSegmentName(); - - /** Zend_Search_Lucene_Index_SegmentMerger */ - $merger = new Zend_Search_Lucene_Index_SegmentMerger($this->_directory, - $newName); - foreach ($segments as $segmentInfo) { - $merger->addSource($segmentInfo); - $this->_segmentsToDelete[$segmentInfo->getName()] = $segmentInfo->getName(); - } - - $newSegment = $merger->merge(); - if ($newSegment !== null) { - $this->_newSegments[$newSegment->getName()] = $newSegment; - } - - $this->commit(); - } - - /** - * Update segments file by adding current segment to a list - * - * @throws Zend_Search_Lucene_Exception - */ - private function _updateSegments() - { - // Get an exclusive index lock - Zend_Search_Lucene_LockManager::obtainWriteLock($this->_directory); - - // Write down changes for the segments - foreach ($this->_segmentInfos as $segInfo) { - $segInfo->writeChanges(); - } - - - $generation = Zend_Search_Lucene::getActualGeneration($this->_directory); - $segmentsFile = $this->_directory->getFileObject(Zend_Search_Lucene::getSegmentFileName($generation), false); - $newSegmentFile = $this->_directory->createFile(Zend_Search_Lucene::getSegmentFileName(++$generation), false); - - try { - $genFile = $this->_directory->getFileObject('segments.gen', false); - } catch (Zend_Search_Lucene_Exception $e) { - if (strpos($e->getMessage(), 'is not readable') !== false) { - $genFile = $this->_directory->createFile('segments.gen'); - } else { - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - } - - $genFile->writeInt((int)0xFFFFFFFE); - // Write generation (first copy) - $genFile->writeLong($generation); - - try { - // Write format marker - if ($this->_targetFormatVersion == Zend_Search_Lucene::FORMAT_2_1) { - $newSegmentFile->writeInt((int)0xFFFFFFFD); - } else if ($this->_targetFormatVersion == Zend_Search_Lucene::FORMAT_2_3) { - $newSegmentFile->writeInt((int)0xFFFFFFFC); - } - - // Read src file format identifier - $format = $segmentsFile->readInt(); - if ($format == (int)0xFFFFFFFF) { - $srcFormat = Zend_Search_Lucene::FORMAT_PRE_2_1; - } else if ($format == (int)0xFFFFFFFD) { - $srcFormat = Zend_Search_Lucene::FORMAT_2_1; - } else if ($format == (int)0xFFFFFFFC) { - $srcFormat = Zend_Search_Lucene::FORMAT_2_3; - } else { - throw new Zend_Search_Lucene_Exception('Unsupported segments file format'); - } - - $version = $segmentsFile->readLong() + $this->_versionUpdate; - $this->_versionUpdate = 0; - $newSegmentFile->writeLong($version); - - // Write segment name counter - $newSegmentFile->writeInt($segmentsFile->readInt()); - - // Get number of segments offset - $numOfSegmentsOffset = $newSegmentFile->tell(); - // Write dummy data (segment counter) - $newSegmentFile->writeInt(0); - - // Read number of segemnts - $segmentsCount = $segmentsFile->readInt(); - - $segments = array(); - for ($count = 0; $count < $segmentsCount; $count++) { - $segName = $segmentsFile->readString(); - $segSize = $segmentsFile->readInt(); - - if ($srcFormat == Zend_Search_Lucene::FORMAT_PRE_2_1) { - // pre-2.1 index format - $delGen = 0; - $hasSingleNormFile = false; - $numField = (int)0xFFFFFFFF; - $isCompoundByte = 0; - $docStoreOptions = null; - } else { - $delGen = $segmentsFile->readLong(); - - if ($srcFormat == Zend_Search_Lucene::FORMAT_2_3) { - $docStoreOffset = $segmentsFile->readInt(); - - if ($docStoreOffset != (int)0xFFFFFFFF) { - $docStoreSegment = $segmentsFile->readString(); - $docStoreIsCompoundFile = $segmentsFile->readByte(); - - $docStoreOptions = array('offset' => $docStoreOffset, - 'segment' => $docStoreSegment, - 'isCompound' => ($docStoreIsCompoundFile == 1)); - } else { - $docStoreOptions = null; - } - } else { - $docStoreOptions = null; - } - - $hasSingleNormFile = $segmentsFile->readByte(); - $numField = $segmentsFile->readInt(); - - $normGens = array(); - if ($numField != (int)0xFFFFFFFF) { - for ($count1 = 0; $count1 < $numField; $count1++) { - $normGens[] = $segmentsFile->readLong(); - } - } - $isCompoundByte = $segmentsFile->readByte(); - } - - if (!in_array($segName, $this->_segmentsToDelete)) { - // Load segment if necessary - if (!isset($this->_segmentInfos[$segName])) { - if ($isCompoundByte == 0xFF) { - // The segment is not a compound file - $isCompound = false; - } else if ($isCompoundByte == 0x00) { - // The status is unknown - $isCompound = null; - } else if ($isCompoundByte == 0x01) { - // The segment is a compound file - $isCompound = true; - } - - /** Zend_Search_Lucene_Index_SegmentInfo */ - $this->_segmentInfos[$segName] = - new Zend_Search_Lucene_Index_SegmentInfo($this->_directory, - $segName, - $segSize, - $delGen, - $docStoreOptions, - $hasSingleNormFile, - $isCompound); - } else { - // Retrieve actual deletions file generation number - $delGen = $this->_segmentInfos[$segName]->getDelGen(); - } - - $newSegmentFile->writeString($segName); - $newSegmentFile->writeInt($segSize); - $newSegmentFile->writeLong($delGen); - if ($this->_targetFormatVersion == Zend_Search_Lucene::FORMAT_2_3) { - if ($docStoreOptions !== null) { - $newSegmentFile->writeInt($docStoreOffset); - $newSegmentFile->writeString($docStoreSegment); - $newSegmentFile->writeByte($docStoreIsCompoundFile); - } else { - // Set DocStoreOffset to -1 - $newSegmentFile->writeInt((int)0xFFFFFFFF); - } - } else if ($docStoreOptions !== null) { - // Release index write lock - Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); - - throw new Zend_Search_Lucene_Exception('Index conversion to lower format version is not supported.'); - } - - $newSegmentFile->writeByte($hasSingleNormFile); - $newSegmentFile->writeInt($numField); - if ($numField != (int)0xFFFFFFFF) { - foreach ($normGens as $normGen) { - $newSegmentFile->writeLong($normGen); - } - } - $newSegmentFile->writeByte($isCompoundByte); - - $segments[$segName] = $segSize; - } - } - $segmentsFile->close(); - - $segmentsCount = count($segments) + count($this->_newSegments); - - foreach ($this->_newSegments as $segName => $segmentInfo) { - $newSegmentFile->writeString($segName); - $newSegmentFile->writeInt($segmentInfo->count()); - - // delete file generation: -1 (there is no delete file yet) - $newSegmentFile->writeInt((int)0xFFFFFFFF);$newSegmentFile->writeInt((int)0xFFFFFFFF); - if ($this->_targetFormatVersion == Zend_Search_Lucene::FORMAT_2_3) { - // docStoreOffset: -1 (segment doesn't use shared doc store) - $newSegmentFile->writeInt((int)0xFFFFFFFF); - } - // HasSingleNormFile - $newSegmentFile->writeByte($segmentInfo->hasSingleNormFile()); - // NumField - $newSegmentFile->writeInt((int)0xFFFFFFFF); - // IsCompoundFile - $newSegmentFile->writeByte($segmentInfo->isCompound() ? 1 : -1); - - $segments[$segmentInfo->getName()] = $segmentInfo->count(); - $this->_segmentInfos[$segName] = $segmentInfo; - } - $this->_newSegments = array(); - - $newSegmentFile->seek($numOfSegmentsOffset); - $newSegmentFile->writeInt($segmentsCount); // Update segments count - $newSegmentFile->close(); - } catch (Exception $e) { - /** Restore previous index generation */ - $generation--; - $genFile->seek(4, SEEK_SET); - // Write generation number twice - $genFile->writeLong($generation); $genFile->writeLong($generation); - - // Release index write lock - Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); - - // Throw the exception - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - - // Write generation (second copy) - $genFile->writeLong($generation); - - - // Check if another update or read process is not running now - // If yes, skip clean-up procedure - if (Zend_Search_Lucene_LockManager::escalateReadLock($this->_directory)) { - /** - * Clean-up directory - */ - $filesToDelete = array(); - $filesTypes = array(); - $filesNumbers = array(); - - // list of .del files of currently used segments - // each segment can have several generations of .del files - // only last should not be deleted - $delFiles = array(); - - foreach ($this->_directory->fileList() as $file) { - if ($file == 'deletable') { - // 'deletable' file - $filesToDelete[] = $file; - $filesTypes[] = 0; // delete this file first, since it's not used starting from Lucene v2.1 - $filesNumbers[] = 0; - } else if ($file == 'segments') { - // 'segments' file - $filesToDelete[] = $file; - $filesTypes[] = 1; // second file to be deleted "zero" version of segments file (Lucene pre-2.1) - $filesNumbers[] = 0; - } else if (preg_match('/^segments_[a-zA-Z0-9]+$/i', $file)) { - // 'segments_xxx' file - // Check if it's not a just created generation file - if ($file != Zend_Search_Lucene::getSegmentFileName($generation)) { - $filesToDelete[] = $file; - $filesTypes[] = 2; // first group of files for deletions - $filesNumbers[] = (int)base_convert(substr($file, 9), 36, 10); // ordered by segment generation numbers - } - } else if (preg_match('/(^_([a-zA-Z0-9]+))\.f\d+$/i', $file, $matches)) { - // one of per segment files ('.f') - // Check if it's not one of the segments in the current segments set - if (!isset($segments[$matches[1]])) { - $filesToDelete[] = $file; - $filesTypes[] = 3; // second group of files for deletions - $filesNumbers[] = (int)base_convert($matches[2], 36, 10); // order by segment number - } - } else if (preg_match('/(^_([a-zA-Z0-9]+))(_([a-zA-Z0-9]+))\.del$/i', $file, $matches)) { - // one of per segment files ('_.del' where is '_') - // Check if it's not one of the segments in the current segments set - if (!isset($segments[$matches[1]])) { - $filesToDelete[] = $file; - $filesTypes[] = 3; // second group of files for deletions - $filesNumbers[] = (int)base_convert($matches[2], 36, 10); // order by segment number - } else { - $segmentNumber = (int)base_convert($matches[2], 36, 10); - $delGeneration = (int)base_convert($matches[4], 36, 10); - if (!isset($delFiles[$segmentNumber])) { - $delFiles[$segmentNumber] = array(); - } - $delFiles[$segmentNumber][$delGeneration] = $file; - } - } else if (isset(self::$_indexExtensions[substr($file, strlen($file)-4)])) { - // one of per segment files ('.') - $segmentName = substr($file, 0, strlen($file) - 4); - // Check if it's not one of the segments in the current segments set - if (!isset($segments[$segmentName]) && - ($this->_currentSegment === null || $this->_currentSegment->getName() != $segmentName)) { - $filesToDelete[] = $file; - $filesTypes[] = 3; // second group of files for deletions - $filesNumbers[] = (int)base_convert(substr($file, 1 /* skip '_' */, strlen($file)-5), 36, 10); // order by segment number - } - } - } - - $maxGenNumber = 0; - // process .del files of currently used segments - foreach ($delFiles as $segmentNumber => $segmentDelFiles) { - ksort($delFiles[$segmentNumber], SORT_NUMERIC); - array_pop($delFiles[$segmentNumber]); // remove last delete file generation from candidates for deleting - - end($delFiles[$segmentNumber]); - $lastGenNumber = key($delFiles[$segmentNumber]); - if ($lastGenNumber > $maxGenNumber) { - $maxGenNumber = $lastGenNumber; - } - } - foreach ($delFiles as $segmentNumber => $segmentDelFiles) { - foreach ($segmentDelFiles as $delGeneration => $file) { - $filesToDelete[] = $file; - $filesTypes[] = 4; // third group of files for deletions - $filesNumbers[] = $segmentNumber*$maxGenNumber + $delGeneration; // order by , pair - } - } - - // Reorder files for deleting - array_multisort($filesTypes, SORT_ASC, SORT_NUMERIC, - $filesNumbers, SORT_ASC, SORT_NUMERIC, - $filesToDelete, SORT_ASC, SORT_STRING); - - foreach ($filesToDelete as $file) { - try { - /** Skip shared docstore segments deleting */ - /** @todo Process '.cfx' files to check if them are already unused */ - if (substr($file, strlen($file)-4) != '.cfx') { - $this->_directory->deleteFile($file); - } - } catch (Zend_Search_Lucene_Exception $e) { - if (strpos($e->getMessage(), 'Can\'t delete file') === false) { - // That's not "file is under processing or already deleted" exception - // Pass it through - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - } - } - - // Return read lock into the previous state - Zend_Search_Lucene_LockManager::deEscalateReadLock($this->_directory); - } else { - // Only release resources if another index reader is running now - foreach ($this->_segmentsToDelete as $segName) { - foreach (self::$_indexExtensions as $ext) { - $this->_directory->purgeFile($segName . $ext); - } - } - } - - // Clean-up _segmentsToDelete container - $this->_segmentsToDelete = array(); - - - // Release index write lock - Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); - - // Remove unused segments from segments list - foreach ($this->_segmentInfos as $segName => $segmentInfo) { - if (!isset($segments[$segName])) { - unset($this->_segmentInfos[$segName]); - } - } - } - - /** - * Commit current changes - */ - public function commit() - { - if ($this->_currentSegment !== null) { - $newSegment = $this->_currentSegment->close(); - if ($newSegment !== null) { - $this->_newSegments[$newSegment->getName()] = $newSegment; - } - $this->_currentSegment = null; - } - - $this->_updateSegments(); - } - - - /** - * Merges the provided indexes into this index. - * - * @param array $readers - * @return void - */ - public function addIndexes($readers) - { - /** - * @todo implementation - */ - } - - /** - * Merges all segments together into new one - * - * Returns true on success and false if another optimization or auto-optimization process - * is running now - * - * @return boolean - */ - public function optimize() - { - if (Zend_Search_Lucene_LockManager::obtainOptimizationLock($this->_directory) === false) { - return false; - } - - // Update segments list to be sure all segments are not merged yet by another process - // - // Segment merging functionality is concentrated in this class and surrounded - // by optimization lock obtaining/releasing. - // _updateSegments() refreshes segments list from the latest index generation. - // So only new segments can be added to the index while we are merging some already existing - // segments. - // Newly added segments will be also included into the index by the _updateSegments() call - // either by another process or by the current process with the commit() call at the end of _mergeSegments() method. - // That's guaranteed by the serialisation of _updateSegments() execution using exclusive locks. - $this->_updateSegments(); - - $this->_mergeSegments($this->_segmentInfos); - - Zend_Search_Lucene_LockManager::releaseOptimizationLock($this->_directory); - - return true; - } - - /** - * Get name for new segment - * - * @return string - */ - private function _newSegmentName() - { - Zend_Search_Lucene_LockManager::obtainWriteLock($this->_directory); - - $generation = Zend_Search_Lucene::getActualGeneration($this->_directory); - $segmentsFile = $this->_directory->getFileObject(Zend_Search_Lucene::getSegmentFileName($generation), false); - - $segmentsFile->seek(12); // 12 = 4 (int, file format marker) + 8 (long, index version) - $segmentNameCounter = $segmentsFile->readInt(); - - $segmentsFile->seek(12); // 12 = 4 (int, file format marker) + 8 (long, index version) - $segmentsFile->writeInt($segmentNameCounter + 1); - - // Flash output to guarantee that wrong value will not be loaded between unlock and - // return (which calls $segmentsFile destructor) - $segmentsFile->flush(); - - Zend_Search_Lucene_LockManager::releaseWriteLock($this->_directory); - - return '_' . base_convert($segmentNameCounter, 10, 36); - } - -} diff --git a/library/vendor/Zend/Search/Lucene/Interface.php b/library/vendor/Zend/Search/Lucene/Interface.php deleted file mode 100644 index baa26a9c0..000000000 --- a/library/vendor/Zend/Search/Lucene/Interface.php +++ /dev/null @@ -1,413 +0,0 @@ - 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @return integer - */ - public function getMergeFactor(); - - /** - * Set index mergeFactor option - * - * mergeFactor determines how often segment indices are merged by addDocument(). - * With smaller values, less RAM is used while indexing, - * and searches on unoptimized indices are faster, - * but indexing speed is slower. - * With larger values, more RAM is used during indexing, - * and while searches on unoptimized indices are slower, - * indexing is faster. - * Thus larger values (> 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @param integer $maxMergeDocs - */ - public function setMergeFactor($mergeFactor); - - /** - * Performs a query against the index and returns an array - * of Zend_Search_Lucene_Search_QueryHit objects. - * Input is a string or Zend_Search_Lucene_Search_Query. - * - * @param mixed $query - * @return array Zend_Search_Lucene_Search_QueryHit - * @throws Zend_Search_Lucene_Exception - */ - public function find($query); - - /** - * Returns a list of all unique field names that exist in this index. - * - * @param boolean $indexed - * @return array - */ - public function getFieldNames($indexed = false); - - /** - * Returns a Zend_Search_Lucene_Document object for the document - * number $id in this index. - * - * @param integer|Zend_Search_Lucene_Search_QueryHit $id - * @return Zend_Search_Lucene_Document - */ - public function getDocument($id); - - /** - * Returns true if index contain documents with specified term. - * - * Is used for query optimization. - * - * @param Zend_Search_Lucene_Index_Term $term - * @return boolean - */ - public function hasTerm(Zend_Search_Lucene_Index_Term $term); - - /** - * Returns IDs of all the documents containing term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - */ - public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null); - - /** - * Returns documents filter for all documents containing term. - * - * It performs the same operation as termDocs, but return result as - * Zend_Search_Lucene_Index_DocsFilter object - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return Zend_Search_Lucene_Index_DocsFilter - */ - public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null); - - /** - * Returns an array of all term freqs. - * Return array structure: array( docId => freq, ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return integer - */ - public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null); - - /** - * Returns an array of all term positions in the documents. - * Return array structure: array( docId => array( pos1, pos2, ...), ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - */ - public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null); - - /** - * Returns the number of documents in this index containing the $term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @return integer - */ - public function docFreq(Zend_Search_Lucene_Index_Term $term); - - /** - * Retrive similarity used by index reader - * - * @return Zend_Search_Lucene_Search_Similarity - */ - public function getSimilarity(); - - /** - * Returns a normalization factor for "field, document" pair. - * - * @param integer $id - * @param string $fieldName - * @return float - */ - public function norm($id, $fieldName); - - /** - * Returns true if any documents have been deleted from this index. - * - * @return boolean - */ - public function hasDeletions(); - - /** - * Deletes a document from the index. - * $id is an internal document id - * - * @param integer|Zend_Search_Lucene_Search_QueryHit $id - * @throws Zend_Search_Lucene_Exception - */ - public function delete($id); - - /** - * Adds a document to this index. - * - * @param Zend_Search_Lucene_Document $document - */ - public function addDocument(Zend_Search_Lucene_Document $document); - - /** - * Commit changes resulting from delete() or undeleteAll() operations. - */ - public function commit(); - - /** - * Optimize index. - * - * Merges all segments into one - */ - public function optimize(); - - /** - * Returns an array of all terms in this index. - * - * @return array - */ - public function terms(); - - /** - * Undeletes all documents currently marked as deleted in this index. - */ - public function undeleteAll(); - - - /** - * Add reference to the index object - * - * @internal - */ - public function addReference(); - - /** - * Remove reference from the index object - * - * When reference count becomes zero, index is closed and resources are cleaned up - * - * @internal - */ - public function removeReference(); -} diff --git a/library/vendor/Zend/Search/Lucene/Interface/MultiSearcher.php b/library/vendor/Zend/Search/Lucene/Interface/MultiSearcher.php deleted file mode 100644 index c58796de2..000000000 --- a/library/vendor/Zend/Search/Lucene/Interface/MultiSearcher.php +++ /dev/null @@ -1,24 +0,0 @@ -createFile(self::WRITE_LOCK_FILE); - if (!$lock->lock(LOCK_EX)) { - throw new Zend_Search_Lucene_Exception('Can\'t obtain exclusive index lock'); - } - return $lock; - } - - /** - * Release exclusive write lock - * - * @param Zend_Search_Lucene_Storage_Directory $lockDirectory - */ - public static function releaseWriteLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - $lock = $lockDirectory->getFileObject(self::WRITE_LOCK_FILE); - $lock->unlock(); - } - - /** - * Obtain the exclusive "read escalation/de-escalation" lock - * - * Required to protect the escalate/de-escalate read lock process - * on GFS (and potentially other) mounted filesystems. - * - * Why we need this: - * While GFS supports cluster-wide locking via flock(), it's - * implementation isn't quite what it should be. The locking - * semantics that work consistently on a local filesystem tend to - * fail on GFS mounted filesystems. This appears to be a design defect - * in the implementation of GFS. How this manifests itself is that - * conditional promotion of a shared lock to exclusive will always - * fail, lock release requests are honored but not immediately - * processed (causing erratic failures of subsequent conditional - * requests) and the releasing of the exclusive lock before the - * shared lock is set when a lock is demoted (which can open a window - * of opportunity for another process to gain an exclusive lock when - * it shoudln't be allowed to). - * - * @param Zend_Search_Lucene_Storage_Directory $lockDirectory - * @return Zend_Search_Lucene_Storage_File - * @throws Zend_Search_Lucene_Exception - */ - private static function _startReadLockProcessing(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - $lock = $lockDirectory->createFile(self::READ_LOCK_PROCESSING_LOCK_FILE); - if (!$lock->lock(LOCK_EX)) { - throw new Zend_Search_Lucene_Exception('Can\'t obtain exclusive lock for the read lock processing file'); - } - return $lock; - } - - /** - * Release the exclusive "read escalation/de-escalation" lock - * - * Required to protect the escalate/de-escalate read lock process - * on GFS (and potentially other) mounted filesystems. - * - * @param Zend_Search_Lucene_Storage_Directory $lockDirectory - */ - private static function _stopReadLockProcessing(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - $lock = $lockDirectory->getFileObject(self::READ_LOCK_PROCESSING_LOCK_FILE); - $lock->unlock(); - } - - - /** - * Obtain shared read lock on the index - * - * It doesn't block other read or update processes, but prevent index from the premature cleaning-up - * - * @param Zend_Search_Lucene_Storage_Directory $defaultLockDirectory - * @return Zend_Search_Lucene_Storage_File - * @throws Zend_Search_Lucene_Exception - */ - public static function obtainReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - $lock = $lockDirectory->createFile(self::READ_LOCK_FILE); - if (!$lock->lock(LOCK_SH)) { - throw new Zend_Search_Lucene_Exception('Can\'t obtain shared reading index lock'); - } - return $lock; - } - - /** - * Release shared read lock - * - * @param Zend_Search_Lucene_Storage_Directory $lockDirectory - */ - public static function releaseReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - $lock = $lockDirectory->getFileObject(self::READ_LOCK_FILE); - $lock->unlock(); - } - - /** - * Escalate Read lock to exclusive level - * - * @param Zend_Search_Lucene_Storage_Directory $lockDirectory - * @return boolean - */ - public static function escalateReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - self::_startReadLockProcessing($lockDirectory); - - $lock = $lockDirectory->getFileObject(self::READ_LOCK_FILE); - - // First, release the shared lock for the benefit of GFS since - // it will fail the conditional request to promote the lock to - // "exclusive" while the shared lock is held (even when we are - // the only holder). - $lock->unlock(); - - // GFS is really poor. While the above "unlock" returns, GFS - // doesn't clean up it's tables right away (which will potentially - // cause the conditional locking for the "exclusive" lock to fail. - // We will retry the conditional lock request several times on a - // failure to get past this. The performance hit is negligible - // in the grand scheme of things and only will occur with GFS - // filesystems or if another local process has the shared lock - // on local filesystems. - for ($retries = 0; $retries < 10; $retries++) { - if ($lock->lock(LOCK_EX, true)) { - // Exclusive lock is obtained! - self::_stopReadLockProcessing($lockDirectory); - return true; - } - - // wait 1 microsecond - usleep(1); - } - - // Restore lock state - $lock->lock(LOCK_SH); - - self::_stopReadLockProcessing($lockDirectory); - return false; - } - - /** - * De-escalate Read lock to shared level - * - * @param Zend_Search_Lucene_Storage_Directory $lockDirectory - */ - public static function deEscalateReadLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - $lock = $lockDirectory->getFileObject(self::READ_LOCK_FILE); - $lock->lock(LOCK_SH); - } - - /** - * Obtain exclusive optimization lock on the index - * - * Returns lock object on success and false otherwise (doesn't block execution) - * - * @param Zend_Search_Lucene_Storage_Directory $lockDirectory - * @return mixed - */ - public static function obtainOptimizationLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - $lock = $lockDirectory->createFile(self::OPTIMIZATION_LOCK_FILE); - if (!$lock->lock(LOCK_EX, true)) { - return false; - } - return $lock; - } - - /** - * Release exclusive optimization lock - * - * @param Zend_Search_Lucene_Storage_Directory $lockDirectory - */ - public static function releaseOptimizationLock(Zend_Search_Lucene_Storage_Directory $lockDirectory) - { - $lock = $lockDirectory->getFileObject(self::OPTIMIZATION_LOCK_FILE); - $lock->unlock(); - } - -} diff --git a/library/vendor/Zend/Search/Lucene/MultiSearcher.php b/library/vendor/Zend/Search/Lucene/MultiSearcher.php deleted file mode 100644 index f8116f827..000000000 --- a/library/vendor/Zend/Search/Lucene/MultiSearcher.php +++ /dev/null @@ -1,965 +0,0 @@ -_indices = $indices; - - foreach ($this->_indices as $index) { - if (!$index instanceof Zend_Search_Lucene_Interface) { - throw new Zend_Search_Lucene_Exception('sub-index objects have to implement Zend_Search_Lucene_Interface.'); - } - } - } - - /** - * Add index for searching. - * - * @param Zend_Search_Lucene_Interface $index - */ - public function addIndex(Zend_Search_Lucene_Interface $index) - { - $this->_indices[] = $index; - } - - - /** - * Get current generation number - * - * Returns generation number - * 0 means pre-2.1 index format - * -1 means there are no segments files. - * - * @param Zend_Search_Lucene_Storage_Directory $directory - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory) - { - throw new Zend_Search_Lucene_Exception("Generation number can't be retrieved for multi-searcher"); - } - - /** - * Get segments file name - * - * @param integer $generation - * @return string - */ - public static function getSegmentFileName($generation) - { - return Zend_Search_Lucene::getSegmentFileName($generation); - } - - /** - * Get index format version - * - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public function getFormatVersion() - { - throw new Zend_Search_Lucene_Exception("Format version can't be retrieved for multi-searcher"); - } - - /** - * Set index format version. - * Index is converted to this format at the nearest upfdate time - * - * @param int $formatVersion - */ - public function setFormatVersion($formatVersion) - { - foreach ($this->_indices as $index) { - $index->setFormatVersion($formatVersion); - } - } - - /** - * Returns the Zend_Search_Lucene_Storage_Directory instance for this index. - * - * @return Zend_Search_Lucene_Storage_Directory - */ - public function getDirectory() - { - throw new Zend_Search_Lucene_Exception("Index directory can't be retrieved for multi-searcher"); - } - - /** - * Returns the total number of documents in this index (including deleted documents). - * - * @return integer - */ - public function count() - { - $count = 0; - - foreach ($this->_indices as $index) { - $count += $index->count(); - } - - return $count; - } - - /** - * Returns one greater than the largest possible document number. - * This may be used to, e.g., determine how big to allocate a structure which will have - * an element for every document number in an index. - * - * @return integer - */ - public function maxDoc() - { - return $this->count(); - } - - /** - * Returns the total number of non-deleted documents in this index. - * - * @return integer - */ - public function numDocs() - { - $docs = 0; - - foreach ($this->_indices as $index) { - $docs += $index->numDocs(); - } - - return $docs; - } - - /** - * Checks, that document is deleted - * - * @param integer $id - * @return boolean - * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range - */ - public function isDeleted($id) - { - foreach ($this->_indices as $index) { - $indexCount = $index->count(); - - if ($indexCount > $id) { - return $index->isDeleted($id); - } - - $id -= $indexCount; - } - - throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); - } - - /** - * Set default search field. - * - * Null means, that search is performed through all fields by default - * - * Default value is null - * - * @param string $fieldName - */ - public static function setDefaultSearchField($fieldName) - { - foreach ($this->_indices as $index) { - $index->setDefaultSearchField($fieldName); - } - } - - - /** - * Get default search field. - * - * Null means, that search is performed through all fields by default - * - * @return string - * @throws Zend_Search_Lucene_Exception - */ - public static function getDefaultSearchField() - { - if (count($this->_indices) == 0) { - throw new Zend_Search_Lucene_Exception('Indices list is empty'); - } - - $defaultSearchField = reset($this->_indices)->getDefaultSearchField(); - - foreach ($this->_indices as $index) { - if ($index->getDefaultSearchField() !== $defaultSearchField) { - throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); - } - } - - return $defaultSearchField; - } - - /** - * Set result set limit. - * - * 0 (default) means no limit - * - * @param integer $limit - */ - public static function setResultSetLimit($limit) - { - foreach ($this->_indices as $index) { - $index->setResultSetLimit($limit); - } - } - - /** - * Set result set limit. - * - * 0 means no limit - * - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public static function getResultSetLimit() - { - if (count($this->_indices) == 0) { - throw new Zend_Search_Lucene_Exception('Indices list is empty'); - } - - $defaultResultSetLimit = reset($this->_indices)->getResultSetLimit(); - - foreach ($this->_indices as $index) { - if ($index->getResultSetLimit() !== $defaultResultSetLimit) { - throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); - } - } - - return $defaultResultSetLimit; - } - - /** - * Retrieve index maxBufferedDocs option - * - * maxBufferedDocs is a minimal number of documents required before - * the buffered in-memory documents are written into a new Segment - * - * Default value is 10 - * - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public function getMaxBufferedDocs() - { - if (count($this->_indices) == 0) { - throw new Zend_Search_Lucene_Exception('Indices list is empty'); - } - - $maxBufferedDocs = reset($this->_indices)->getMaxBufferedDocs(); - - foreach ($this->_indices as $index) { - if ($index->getMaxBufferedDocs() !== $maxBufferedDocs) { - throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); - } - } - - return $maxBufferedDocs; - } - - /** - * Set index maxBufferedDocs option - * - * maxBufferedDocs is a minimal number of documents required before - * the buffered in-memory documents are written into a new Segment - * - * Default value is 10 - * - * @param integer $maxBufferedDocs - */ - public function setMaxBufferedDocs($maxBufferedDocs) - { - foreach ($this->_indices as $index) { - $index->setMaxBufferedDocs($maxBufferedDocs); - } - } - - /** - * Retrieve index maxMergeDocs option - * - * maxMergeDocs is a largest number of documents ever merged by addDocument(). - * Small values (e.g., less than 10,000) are best for interactive indexing, - * as this limits the length of pauses while indexing to a few seconds. - * Larger values are best for batched indexing and speedier searches. - * - * Default value is PHP_INT_MAX - * - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public function getMaxMergeDocs() - { - if (count($this->_indices) == 0) { - throw new Zend_Search_Lucene_Exception('Indices list is empty'); - } - - $maxMergeDocs = reset($this->_indices)->getMaxMergeDocs(); - - foreach ($this->_indices as $index) { - if ($index->getMaxMergeDocs() !== $maxMergeDocs) { - throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); - } - } - - return $maxMergeDocs; - } - - /** - * Set index maxMergeDocs option - * - * maxMergeDocs is a largest number of documents ever merged by addDocument(). - * Small values (e.g., less than 10,000) are best for interactive indexing, - * as this limits the length of pauses while indexing to a few seconds. - * Larger values are best for batched indexing and speedier searches. - * - * Default value is PHP_INT_MAX - * - * @param integer $maxMergeDocs - */ - public function setMaxMergeDocs($maxMergeDocs) - { - foreach ($this->_indices as $index) { - $index->setMaxMergeDocs($maxMergeDocs); - } - } - - /** - * Retrieve index mergeFactor option - * - * mergeFactor determines how often segment indices are merged by addDocument(). - * With smaller values, less RAM is used while indexing, - * and searches on unoptimized indices are faster, - * but indexing speed is slower. - * With larger values, more RAM is used during indexing, - * and while searches on unoptimized indices are slower, - * indexing is faster. - * Thus larger values (> 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public function getMergeFactor() - { - if (count($this->_indices) == 0) { - throw new Zend_Search_Lucene_Exception('Indices list is empty'); - } - - $mergeFactor = reset($this->_indices)->getMergeFactor(); - - foreach ($this->_indices as $index) { - if ($index->getMergeFactor() !== $mergeFactor) { - throw new Zend_Search_Lucene_Exception('Indices have different default search field.'); - } - } - - return $mergeFactor; - } - - /** - * Set index mergeFactor option - * - * mergeFactor determines how often segment indices are merged by addDocument(). - * With smaller values, less RAM is used while indexing, - * and searches on unoptimized indices are faster, - * but indexing speed is slower. - * With larger values, more RAM is used during indexing, - * and while searches on unoptimized indices are slower, - * indexing is faster. - * Thus larger values (> 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @param integer $maxMergeDocs - */ - public function setMergeFactor($mergeFactor) - { - foreach ($this->_indices as $index) { - $index->setMaxMergeDocs($mergeFactor); - } - } - - /** - * Performs a query against the index and returns an array - * of Zend_Search_Lucene_Search_QueryHit objects. - * Input is a string or Zend_Search_Lucene_Search_Query. - * - * @param mixed $query - * @return array Zend_Search_Lucene_Search_QueryHit - * @throws Zend_Search_Lucene_Exception - */ - public function find($query) - { - if (count($this->_indices) == 0) { - return array(); - } - - $hitsList = array(); - - $indexShift = 0; - foreach ($this->_indices as $index) { - $hits = $index->find($query); - - if ($indexShift != 0) { - foreach ($hits as $hit) { - $hit->id += $indexShift; - } - } - - $indexShift += $index->count(); - $hitsList[] = $hits; - } - - /** @todo Implement advanced sorting */ - - return call_user_func_array('array_merge', $hitsList); - } - - /** - * Returns a list of all unique field names that exist in this index. - * - * @param boolean $indexed - * @return array - */ - public function getFieldNames($indexed = false) - { - $fieldNamesList = array(); - - foreach ($this->_indices as $index) { - $fieldNamesList[] = $index->getFieldNames($indexed); - } - - return array_unique(call_user_func_array('array_merge', $fieldNamesList)); - } - - /** - * Returns a Zend_Search_Lucene_Document object for the document - * number $id in this index. - * - * @param integer|Zend_Search_Lucene_Search_QueryHit $id - * @return Zend_Search_Lucene_Document - * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range - */ - public function getDocument($id) - { - if ($id instanceof Zend_Search_Lucene_Search_QueryHit) { - /* @var $id Zend_Search_Lucene_Search_QueryHit */ - $id = $id->id; - } - - foreach ($this->_indices as $index) { - $indexCount = $index->count(); - - if ($indexCount > $id) { - return $index->getDocument($id); - } - - $id -= $indexCount; - } - - throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); - } - - /** - * Returns true if index contain documents with specified term. - * - * Is used for query optimization. - * - * @param Zend_Search_Lucene_Index_Term $term - * @return boolean - */ - public function hasTerm(Zend_Search_Lucene_Index_Term $term) - { - foreach ($this->_indices as $index) { - if ($index->hasTerm($term)) { - return true; - } - } - - return false; - } - - /** - * Returns IDs of all the documents containing term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - if ($docsFilter != null) { - throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher'); - } - - $docsList = array(); - - $indexShift = 0; - foreach ($this->_indices as $index) { - $docs = $index->termDocs($term); - - if ($indexShift != 0) { - foreach ($docs as $id => $docId) { - $docs[$id] += $indexShift; - } - } - - $indexShift += $index->count(); - $docsList[] = $docs; - } - - return call_user_func_array('array_merge', $docsList); - } - - /** - * Returns documents filter for all documents containing term. - * - * It performs the same operation as termDocs, but return result as - * Zend_Search_Lucene_Index_DocsFilter object - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return Zend_Search_Lucene_Index_DocsFilter - * @throws Zend_Search_Lucene_Exception - */ - public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher'); - } - - /** - * Returns an array of all term freqs. - * Return array structure: array( docId => freq, ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - if ($docsFilter != null) { - throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher'); - } - - $freqsList = array(); - - $indexShift = 0; - foreach ($this->_indices as $index) { - $freqs = $index->termFreqs($term); - - if ($indexShift != 0) { - $freqsShifted = array(); - - foreach ($freqs as $docId => $freq) { - $freqsShifted[$docId + $indexShift] = $freq; - } - $freqs = $freqsShifted; - } - - $indexShift += $index->count(); - $freqsList[] = $freqs; - } - - return call_user_func_array('array_merge', $freqsList); - } - - /** - * Returns an array of all term positions in the documents. - * Return array structure: array( docId => array( pos1, pos2, ...), ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - if ($docsFilter != null) { - throw new Zend_Search_Lucene_Exception('Document filters could not used with multi-searcher'); - } - - $termPositionsList = array(); - - $indexShift = 0; - foreach ($this->_indices as $index) { - $termPositions = $index->termPositions($term); - - if ($indexShift != 0) { - $termPositionsShifted = array(); - - foreach ($termPositions as $docId => $positions) { - $termPositions[$docId + $indexShift] = $positions; - } - $termPositions = $termPositionsShifted; - } - - $indexShift += $index->count(); - $termPositionsList[] = $termPositions; - } - - return call_user_func_array('array_merge', $termPositions); - } - - /** - * Returns the number of documents in this index containing the $term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @return integer - */ - public function docFreq(Zend_Search_Lucene_Index_Term $term) - { - $docFreq = 0; - - foreach ($this->_indices as $index) { - $docFreq += $index->docFreq($term); - } - - return $docFreq; - } - - /** - * Retrive similarity used by index reader - * - * @return Zend_Search_Lucene_Search_Similarity - * @throws Zend_Search_Lucene_Exception - */ - public function getSimilarity() - { - if (count($this->_indices) == 0) { - throw new Zend_Search_Lucene_Exception('Indices list is empty'); - } - - $similarity = reset($this->_indices)->getSimilarity(); - - foreach ($this->_indices as $index) { - if ($index->getSimilarity() !== $similarity) { - throw new Zend_Search_Lucene_Exception('Indices have different similarity.'); - } - } - - return $similarity; - } - - /** - * Returns a normalization factor for "field, document" pair. - * - * @param integer $id - * @param string $fieldName - * @return float - */ - public function norm($id, $fieldName) - { - foreach ($this->_indices as $index) { - $indexCount = $index->count(); - - if ($indexCount > $id) { - return $index->norm($id, $fieldName); - } - - $id -= $indexCount; - } - - return null; - } - - /** - * Returns true if any documents have been deleted from this index. - * - * @return boolean - */ - public function hasDeletions() - { - foreach ($this->_indices as $index) { - if ($index->hasDeletions()) { - return true; - } - } - - return false; - } - - /** - * Deletes a document from the index. - * $id is an internal document id - * - * @param integer|Zend_Search_Lucene_Search_QueryHit $id - * @throws Zend_Search_Lucene_Exception - */ - public function delete($id) - { - foreach ($this->_indices as $index) { - $indexCount = $index->count(); - - if ($indexCount > $id) { - $index->delete($id); - return; - } - - $id -= $indexCount; - } - - throw new Zend_Search_Lucene_Exception('Document id is out of the range.'); - } - - - /** - * Callback used to choose target index for new documents - * - * Function/method signature: - * Zend_Search_Lucene_Interface callbackFunction(Zend_Search_Lucene_Document $document, array $indices); - * - * null means "default documents distributing algorithm" - * - * @var callback - */ - protected $_documentDistributorCallBack = null; - - /** - * Set callback for choosing target index. - * - * @param callback $callback - * @throws Zend_Search_Lucene_Exception - */ - public function setDocumentDistributorCallback($callback) - { - if ($callback !== null && !is_callable($callback)) { - throw new Zend_Search_Lucene_Exception('$callback parameter must be a valid callback.'); - } - - $this->_documentDistributorCallBack = $callback; - } - - /** - * Get callback for choosing target index. - * - * @return callback - */ - public function getDocumentDistributorCallback() - { - return $this->_documentDistributorCallBack; - } - - /** - * Adds a document to this index. - * - * @param Zend_Search_Lucene_Document $document - * @throws Zend_Search_Lucene_Exception - */ - public function addDocument(Zend_Search_Lucene_Document $document) - { - if ($this->_documentDistributorCallBack !== null) { - $index = call_user_func($this->_documentDistributorCallBack, $document, $this->_indices); - } else { - $index = $this->_indices[array_rand($this->_indices)]; - } - - $index->addDocument($document); - } - - /** - * Commit changes resulting from delete() or undeleteAll() operations. - */ - public function commit() - { - foreach ($this->_indices as $index) { - $index->commit(); - } - } - - /** - * Optimize index. - * - * Merges all segments into one - */ - public function optimize() - { - foreach ($this->_indices as $index) { - $index->optimise(); - } - } - - /** - * Returns an array of all terms in this index. - * - * @return array - */ - public function terms() - { - $termsList = array(); - - foreach ($this->_indices as $index) { - $termsList[] = $index->terms(); - } - - return array_unique(call_user_func_array('array_merge', $termsList)); - } - - - /** - * Terms stream priority queue object - * - * @var Zend_Search_Lucene_TermStreamsPriorityQueue - */ - private $_termsStream = null; - - /** - * Reset terms stream. - */ - public function resetTermsStream() - { - if ($this->_termsStream === null) { - /** Zend_Search_Lucene_TermStreamsPriorityQueue */ - - $this->_termsStream = new Zend_Search_Lucene_TermStreamsPriorityQueue($this->_indices); - } else { - $this->_termsStream->resetTermsStream(); - } - } - - /** - * Skip terms stream up to specified term preffix. - * - * Prefix contains fully specified field info and portion of searched term - * - * @param Zend_Search_Lucene_Index_Term $prefix - */ - public function skipTo(Zend_Search_Lucene_Index_Term $prefix) - { - $this->_termsStream->skipTo($prefix); - } - - /** - * Scans terms dictionary and returns next term - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function nextTerm() - { - return $this->_termsStream->nextTerm(); - } - - /** - * Returns term in current position - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function currentTerm() - { - return $this->_termsStream->currentTerm(); - } - - /** - * Close terms stream - * - * Should be used for resources clean up if stream is not read up to the end - */ - public function closeTermsStream() - { - $this->_termsStream->closeTermsStream(); - $this->_termsStream = null; - } - - - /** - * Undeletes all documents currently marked as deleted in this index. - */ - public function undeleteAll() - { - foreach ($this->_indices as $index) { - $index->undeleteAll(); - } - } - - - /** - * Add reference to the index object - * - * @internal - */ - public function addReference() - { - // Do nothing, since it's never referenced by indices - } - - /** - * Remove reference from the index object - * - * When reference count becomes zero, index is closed and resources are cleaned up - * - * @internal - */ - public function removeReference() - { - // Do nothing, since it's never referenced by indices - } -} - -/** - * This class is provided for backwards-compatibility (See ZF-12067) - * - * @category Zend - * @package Zend_Search_Lucene - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Search_Lucene_Interface_MultiSearcher - extends Zend_Search_Lucene_MultiSearcher -{ -} diff --git a/library/vendor/Zend/Search/Lucene/PriorityQueue.php b/library/vendor/Zend/Search/Lucene/PriorityQueue.php deleted file mode 100644 index f34c1cbda..000000000 --- a/library/vendor/Zend/Search/Lucene/PriorityQueue.php +++ /dev/null @@ -1,171 +0,0 @@ -_heap); - $parentId = ($nodeId-1) >> 1; // floor( ($nodeId-1)/2 ) - - while ($nodeId != 0 && $this->_less($element, $this->_heap[$parentId])) { - // Move parent node down - $this->_heap[$nodeId] = $this->_heap[$parentId]; - - // Move pointer to the next level of tree - $nodeId = $parentId; - $parentId = ($nodeId-1) >> 1; // floor( ($nodeId-1)/2 ) - } - - // Put new node into the tree - $this->_heap[$nodeId] = $element; - } - - - /** - * Return least element of the queue - * - * Constant time - * - * @return mixed - */ - public function top() - { - if (count($this->_heap) == 0) { - return null; - } - - return $this->_heap[0]; - } - - - /** - * Removes and return least element of the queue - * - * O(log(N)) time - * - * @return mixed - */ - public function pop() - { - if (count($this->_heap) == 0) { - return null; - } - - $top = $this->_heap[0]; - $lastId = count($this->_heap) - 1; - - /** - * Find appropriate position for last node - */ - $nodeId = 0; // Start from a top - $childId = 1; // First child - - // Choose smaller child - if ($lastId > 2 && $this->_less($this->_heap[2], $this->_heap[1])) { - $childId = 2; - } - - while ($childId < $lastId && - $this->_less($this->_heap[$childId], $this->_heap[$lastId]) - ) { - // Move child node up - $this->_heap[$nodeId] = $this->_heap[$childId]; - - $nodeId = $childId; // Go down - $childId = ($nodeId << 1) + 1; // First child - - // Choose smaller child - if (($childId+1) < $lastId && - $this->_less($this->_heap[$childId+1], $this->_heap[$childId]) - ) { - $childId++; - } - } - - // Move last element to the new position - $this->_heap[$nodeId] = $this->_heap[$lastId]; - unset($this->_heap[$lastId]); - - return $top; - } - - - /** - * Clear queue - */ - public function clear() - { - $this->_heap = array(); - } - - - /** - * Compare elements - * - * Returns true, if $el1 is less than $el2; else otherwise - * - * @param mixed $el1 - * @param mixed $el2 - * @return boolean - */ - abstract protected function _less($el1, $el2); -} - diff --git a/library/vendor/Zend/Search/Lucene/Proxy.php b/library/vendor/Zend/Search/Lucene/Proxy.php deleted file mode 100644 index d3c641982..000000000 --- a/library/vendor/Zend/Search/Lucene/Proxy.php +++ /dev/null @@ -1,611 +0,0 @@ -_index = $index; - $this->_index->addReference(); - } - - /** - * Object destructor - */ - public function __destruct() - { - if ($this->_index !== null) { - // This code is invoked if Zend_Search_Lucene_Interface object constructor throws an exception - $this->_index->removeReference(); - } - $this->_index = null; - } - - /** - * Get current generation number - * - * Returns generation number - * 0 means pre-2.1 index format - * -1 means there are no segments files. - * - * @param Zend_Search_Lucene_Storage_Directory $directory - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public static function getActualGeneration(Zend_Search_Lucene_Storage_Directory $directory) - { - Zend_Search_Lucene::getActualGeneration($directory); - } - - /** - * Get segments file name - * - * @param integer $generation - * @return string - */ - public static function getSegmentFileName($generation) - { - Zend_Search_Lucene::getSegmentFileName($generation); - } - - /** - * Get index format version - * - * @return integer - */ - public function getFormatVersion() - { - return $this->_index->getFormatVersion(); - } - - /** - * Set index format version. - * Index is converted to this format at the nearest upfdate time - * - * @param int $formatVersion - * @throws Zend_Search_Lucene_Exception - */ - public function setFormatVersion($formatVersion) - { - $this->_index->setFormatVersion($formatVersion); - } - - /** - * Returns the Zend_Search_Lucene_Storage_Directory instance for this index. - * - * @return Zend_Search_Lucene_Storage_Directory - */ - public function getDirectory() - { - return $this->_index->getDirectory(); - } - - /** - * Returns the total number of documents in this index (including deleted documents). - * - * @return integer - */ - public function count() - { - return $this->_index->count(); - } - - /** - * Returns one greater than the largest possible document number. - * This may be used to, e.g., determine how big to allocate a structure which will have - * an element for every document number in an index. - * - * @return integer - */ - public function maxDoc() - { - return $this->_index->maxDoc(); - } - - /** - * Returns the total number of non-deleted documents in this index. - * - * @return integer - */ - public function numDocs() - { - return $this->_index->numDocs(); - } - - /** - * Checks, that document is deleted - * - * @param integer $id - * @return boolean - * @throws Zend_Search_Lucene_Exception Exception is thrown if $id is out of the range - */ - public function isDeleted($id) - { - return $this->_index->isDeleted($id); - } - - /** - * Set default search field. - * - * Null means, that search is performed through all fields by default - * - * Default value is null - * - * @param string $fieldName - */ - public static function setDefaultSearchField($fieldName) - { - Zend_Search_Lucene::setDefaultSearchField($fieldName); - } - - /** - * Get default search field. - * - * Null means, that search is performed through all fields by default - * - * @return string - */ - public static function getDefaultSearchField() - { - return Zend_Search_Lucene::getDefaultSearchField(); - } - - /** - * Set result set limit. - * - * 0 (default) means no limit - * - * @param integer $limit - */ - public static function setResultSetLimit($limit) - { - Zend_Search_Lucene::setResultSetLimit($limit); - } - - /** - * Set result set limit. - * - * 0 means no limit - * - * @return integer - */ - public static function getResultSetLimit() - { - return Zend_Search_Lucene::getResultSetLimit(); - } - - /** - * Retrieve index maxBufferedDocs option - * - * maxBufferedDocs is a minimal number of documents required before - * the buffered in-memory documents are written into a new Segment - * - * Default value is 10 - * - * @return integer - */ - public function getMaxBufferedDocs() - { - return $this->_index->getMaxBufferedDocs(); - } - - /** - * Set index maxBufferedDocs option - * - * maxBufferedDocs is a minimal number of documents required before - * the buffered in-memory documents are written into a new Segment - * - * Default value is 10 - * - * @param integer $maxBufferedDocs - */ - public function setMaxBufferedDocs($maxBufferedDocs) - { - $this->_index->setMaxBufferedDocs($maxBufferedDocs); - } - - - /** - * Retrieve index maxMergeDocs option - * - * maxMergeDocs is a largest number of documents ever merged by addDocument(). - * Small values (e.g., less than 10,000) are best for interactive indexing, - * as this limits the length of pauses while indexing to a few seconds. - * Larger values are best for batched indexing and speedier searches. - * - * Default value is PHP_INT_MAX - * - * @return integer - */ - public function getMaxMergeDocs() - { - return $this->_index->getMaxMergeDocs(); - } - - /** - * Set index maxMergeDocs option - * - * maxMergeDocs is a largest number of documents ever merged by addDocument(). - * Small values (e.g., less than 10,000) are best for interactive indexing, - * as this limits the length of pauses while indexing to a few seconds. - * Larger values are best for batched indexing and speedier searches. - * - * Default value is PHP_INT_MAX - * - * @param integer $maxMergeDocs - */ - public function setMaxMergeDocs($maxMergeDocs) - { - $this->_index->setMaxMergeDocs($maxMergeDocs); - } - - - /** - * Retrieve index mergeFactor option - * - * mergeFactor determines how often segment indices are merged by addDocument(). - * With smaller values, less RAM is used while indexing, - * and searches on unoptimized indices are faster, - * but indexing speed is slower. - * With larger values, more RAM is used during indexing, - * and while searches on unoptimized indices are slower, - * indexing is faster. - * Thus larger values (> 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @return integer - */ - public function getMergeFactor() - { - return $this->_index->getMergeFactor(); - } - - /** - * Set index mergeFactor option - * - * mergeFactor determines how often segment indices are merged by addDocument(). - * With smaller values, less RAM is used while indexing, - * and searches on unoptimized indices are faster, - * but indexing speed is slower. - * With larger values, more RAM is used during indexing, - * and while searches on unoptimized indices are slower, - * indexing is faster. - * Thus larger values (> 10) are best for batch index creation, - * and smaller values (< 10) for indices that are interactively maintained. - * - * Default value is 10 - * - * @param integer $maxMergeDocs - */ - public function setMergeFactor($mergeFactor) - { - $this->_index->setMergeFactor($mergeFactor); - } - - /** - * Performs a query against the index and returns an array - * of Zend_Search_Lucene_Search_QueryHit objects. - * Input is a string or Zend_Search_Lucene_Search_Query. - * - * @param mixed $query - * @return array Zend_Search_Lucene_Search_QueryHit - * @throws Zend_Search_Lucene_Exception - */ - public function find($query) - { - // actual parameter list - $parameters = func_get_args(); - - // invoke $this->_index->find() method with specified parameters - return call_user_func_array(array(&$this->_index, 'find'), $parameters); - } - - /** - * Returns a list of all unique field names that exist in this index. - * - * @param boolean $indexed - * @return array - */ - public function getFieldNames($indexed = false) - { - return $this->_index->getFieldNames($indexed); - } - - /** - * Returns a Zend_Search_Lucene_Document object for the document - * number $id in this index. - * - * @param integer|Zend_Search_Lucene_Search_QueryHit $id - * @return Zend_Search_Lucene_Document - */ - public function getDocument($id) - { - return $this->_index->getDocument($id); - } - - /** - * Returns true if index contain documents with specified term. - * - * Is used for query optimization. - * - * @param Zend_Search_Lucene_Index_Term $term - * @return boolean - */ - public function hasTerm(Zend_Search_Lucene_Index_Term $term) - { - return $this->_index->hasTerm($term); - } - - /** - * Returns IDs of all the documents containing term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - */ - public function termDocs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - return $this->_index->termDocs($term, $docsFilter); - } - - /** - * Returns documents filter for all documents containing term. - * - * It performs the same operation as termDocs, but return result as - * Zend_Search_Lucene_Index_DocsFilter object - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return Zend_Search_Lucene_Index_DocsFilter - */ - public function termDocsFilter(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - return $this->_index->termDocsFilter($term, $docsFilter); - } - - /** - * Returns an array of all term freqs. - * Return array structure: array( docId => freq, ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return integer - */ - public function termFreqs(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - return $this->_index->termFreqs($term, $docsFilter); - } - - /** - * Returns an array of all term positions in the documents. - * Return array structure: array( docId => array( pos1, pos2, ...), ...) - * - * @param Zend_Search_Lucene_Index_Term $term - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @return array - */ - public function termPositions(Zend_Search_Lucene_Index_Term $term, $docsFilter = null) - { - return $this->_index->termPositions($term, $docsFilter); - } - - /** - * Returns the number of documents in this index containing the $term. - * - * @param Zend_Search_Lucene_Index_Term $term - * @return integer - */ - public function docFreq(Zend_Search_Lucene_Index_Term $term) - { - return $this->_index->docFreq($term); - } - - /** - * Retrive similarity used by index reader - * - * @return Zend_Search_Lucene_Search_Similarity - */ - public function getSimilarity() - { - return $this->_index->getSimilarity(); - } - - /** - * Returns a normalization factor for "field, document" pair. - * - * @param integer $id - * @param string $fieldName - * @return float - */ - public function norm($id, $fieldName) - { - return $this->_index->norm($id, $fieldName); - } - - /** - * Returns true if any documents have been deleted from this index. - * - * @return boolean - */ - public function hasDeletions() - { - return $this->_index->hasDeletions(); - } - - /** - * Deletes a document from the index. - * $id is an internal document id - * - * @param integer|Zend_Search_Lucene_Search_QueryHit $id - * @throws Zend_Search_Lucene_Exception - */ - public function delete($id) - { - return $this->_index->delete($id); - } - - /** - * Adds a document to this index. - * - * @param Zend_Search_Lucene_Document $document - */ - public function addDocument(Zend_Search_Lucene_Document $document) - { - $this->_index->addDocument($document); - } - - /** - * Commit changes resulting from delete() or undeleteAll() operations. - */ - public function commit() - { - $this->_index->commit(); - } - - /** - * Optimize index. - * - * Merges all segments into one - */ - public function optimize() - { - $this->_index->optimize(); - } - - /** - * Returns an array of all terms in this index. - * - * @return array - */ - public function terms() - { - return $this->_index->terms(); - } - - - /** - * Reset terms stream. - */ - public function resetTermsStream() - { - $this->_index->resetTermsStream(); - } - - /** - * Skip terms stream up to specified term preffix. - * - * Prefix contains fully specified field info and portion of searched term - * - * @param Zend_Search_Lucene_Index_Term $prefix - */ - public function skipTo(Zend_Search_Lucene_Index_Term $prefix) - { - return $this->_index->skipTo($prefix); - } - - /** - * Scans terms dictionary and returns next term - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function nextTerm() - { - return $this->_index->nextTerm(); - } - - /** - * Returns term in current position - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function currentTerm() - { - return $this->_index->currentTerm(); - } - - /** - * Close terms stream - * - * Should be used for resources clean up if stream is not read up to the end - */ - public function closeTermsStream() - { - $this->_index->closeTermsStream(); - } - - - /** - * Undeletes all documents currently marked as deleted in this index. - */ - public function undeleteAll() - { - return $this->_index->undeleteAll(); - } - - /** - * Add reference to the index object - * - * @internal - */ - public function addReference() - { - return $this->_index->addReference(); - } - - /** - * Remove reference from the index object - * - * When reference count becomes zero, index is closed and resources are cleaned up - * - * @internal - */ - public function removeReference() - { - return $this->_index->removeReference(); - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php b/library/vendor/Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php deleted file mode 100644 index c39336429..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php +++ /dev/null @@ -1,274 +0,0 @@ -, ) - * - * So, it has a structure: - * array( array( array(, ), // first literal of first conjuction - * array(, ), // second literal of first conjuction - * ... - * array(, ) - * ), // end of first conjuction - * array( array(, ), // first literal of second conjuction - * array(, ), // second literal of second conjuction - * ... - * array(, ) - * ), // end of second conjuction - * ... - * ) // end of structure - * - * @var array - */ - private $_conjunctions = array(); - - /** - * Current conjuction - * - * @var array - */ - private $_currentConjunction = array(); - - - /** - * Object constructor - */ - public function __construct() - { - parent::__construct( array(self::ST_START, - self::ST_LITERAL, - self::ST_NOT_OPERATOR, - self::ST_AND_OPERATOR, - self::ST_OR_OPERATOR), - array(self::IN_LITERAL, - self::IN_NOT_OPERATOR, - self::IN_AND_OPERATOR, - self::IN_OR_OPERATOR)); - - $emptyOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'emptyOperatorAction'); - $emptyNotOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'emptyNotOperatorAction'); - - $this->addRules(array( array(self::ST_START, self::IN_LITERAL, self::ST_LITERAL), - array(self::ST_START, self::IN_NOT_OPERATOR, self::ST_NOT_OPERATOR), - - array(self::ST_LITERAL, self::IN_AND_OPERATOR, self::ST_AND_OPERATOR), - array(self::ST_LITERAL, self::IN_OR_OPERATOR, self::ST_OR_OPERATOR), - array(self::ST_LITERAL, self::IN_LITERAL, self::ST_LITERAL, $emptyOperatorAction), - array(self::ST_LITERAL, self::IN_NOT_OPERATOR, self::ST_NOT_OPERATOR, $emptyNotOperatorAction), - - array(self::ST_NOT_OPERATOR, self::IN_LITERAL, self::ST_LITERAL), - - array(self::ST_AND_OPERATOR, self::IN_LITERAL, self::ST_LITERAL), - array(self::ST_AND_OPERATOR, self::IN_NOT_OPERATOR, self::ST_NOT_OPERATOR), - - array(self::ST_OR_OPERATOR, self::IN_LITERAL, self::ST_LITERAL), - array(self::ST_OR_OPERATOR, self::IN_NOT_OPERATOR, self::ST_NOT_OPERATOR), - )); - - $notOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'notOperatorAction'); - $orOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'orOperatorAction'); - $literalAction = new Zend_Search_Lucene_FSMAction($this, 'literalAction'); - - - $this->addEntryAction(self::ST_NOT_OPERATOR, $notOperatorAction); - $this->addEntryAction(self::ST_OR_OPERATOR, $orOperatorAction); - $this->addEntryAction(self::ST_LITERAL, $literalAction); - } - - - /** - * Process next operator. - * - * Operators are defined by class constants: IN_AND_OPERATOR, IN_OR_OPERATOR and IN_NOT_OPERATOR - * - * @param integer $operator - */ - public function processOperator($operator) - { - $this->process($operator); - } - - /** - * Process expression literal. - * - * @param integer $operator - */ - public function processLiteral($literal) - { - $this->_literal = $literal; - - $this->process(self::IN_LITERAL); - } - - /** - * Finish an expression and return result - * - * Result is a set of boolean query conjunctions - * - * Each conjunction is an array of conjunction elements - * Each conjunction element is presented with two-elements array: - * array(, ) - * - * So, it has a structure: - * array( array( array(, ), // first literal of first conjuction - * array(, ), // second literal of first conjuction - * ... - * array(, ) - * ), // end of first conjuction - * array( array(, ), // first literal of second conjuction - * array(, ), // second literal of second conjuction - * ... - * array(, ) - * ), // end of second conjuction - * ... - * ) // end of structure - * - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function finishExpression() - { - if ($this->getState() != self::ST_LITERAL) { - throw new Zend_Search_Lucene_Exception('Literal expected.'); - } - - $this->_conjunctions[] = $this->_currentConjunction; - - return $this->_conjunctions; - } - - - - /********************************************************************* - * Actions implementation - *********************************************************************/ - - /** - * default (omitted) operator processing - */ - public function emptyOperatorAction() - { - /** Zend_Search_Lucene_Search_QueryParser */ - - if (Zend_Search_Lucene_Search_QueryParser::getDefaultOperator() == Zend_Search_Lucene_Search_QueryParser::B_AND) { - // Do nothing - } else { - $this->orOperatorAction(); - } - - // Process literal - $this->literalAction(); - } - - /** - * default (omitted) + NOT operator processing - */ - public function emptyNotOperatorAction() - { - /** Zend_Search_Lucene_Search_QueryParser */ - - if (Zend_Search_Lucene_Search_QueryParser::getDefaultOperator() == Zend_Search_Lucene_Search_QueryParser::B_AND) { - // Do nothing - } else { - $this->orOperatorAction(); - } - - // Process NOT operator - $this->notOperatorAction(); - } - - - /** - * NOT operator processing - */ - public function notOperatorAction() - { - $this->_negativeLiteral = true; - } - - /** - * OR operator processing - * Close current conjunction - */ - public function orOperatorAction() - { - $this->_conjunctions[] = $this->_currentConjunction; - $this->_currentConjunction = array(); - } - - /** - * Literal processing - */ - public function literalAction() - { - // Add literal to the current conjunction - $this->_currentConjunction[] = array($this->_literal, !$this->_negativeLiteral); - - // Switch off negative signal - $this->_negativeLiteral = false; - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/Highlighter/Default.php b/library/vendor/Zend/Search/Lucene/Search/Highlighter/Default.php deleted file mode 100644 index 34a8386cf..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Highlighter/Default.php +++ /dev/null @@ -1,93 +0,0 @@ -_doc = $document; - } - - /** - * Get document for highlighting. - * - * @return Zend_Search_Lucene_Document_Html $document - */ - public function getDocument() - { - return $this->_doc; - } - - /** - * Highlight specified words - * - * @param string|array $words Words to highlight. They could be organized using the array or string. - */ - public function highlight($words) - { - $color = $this->_highlightColors[$this->_currentColorIndex]; - $this->_currentColorIndex = ($this->_currentColorIndex + 1) % count($this->_highlightColors); - - $this->_doc->highlight($words, $color); - } - -} diff --git a/library/vendor/Zend/Search/Lucene/Search/Highlighter/Interface.php b/library/vendor/Zend/Search/Lucene/Search/Highlighter/Interface.php deleted file mode 100644 index 99fe12ee0..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Highlighter/Interface.php +++ /dev/null @@ -1,53 +0,0 @@ -_boost; - } - - /** - * Sets the boost for this query clause to $boost. - * - * @param float $boost - */ - public function setBoost($boost) - { - $this->_boost = $boost; - } - - /** - * Score specified document - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - abstract public function score($docId, Zend_Search_Lucene_Interface $reader); - - /** - * Get document ids likely matching the query - * - * It's an array with document ids as keys (performance considerations) - * - * @return array - */ - abstract public function matchedDocs(); - - /** - * Execute query in context of index reader - * It also initializes necessary internal structures - * - * Query specific implementation - * - * @param Zend_Search_Lucene_Interface $reader - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - */ - abstract public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null); - - /** - * Constructs an appropriate Weight implementation for this query. - * - * @param Zend_Search_Lucene_Interface $reader - * @return Zend_Search_Lucene_Search_Weight - */ - abstract public function createWeight(Zend_Search_Lucene_Interface $reader); - - /** - * Constructs an initializes a Weight for a _top-level_query_. - * - * @param Zend_Search_Lucene_Interface $reader - */ - protected function _initWeight(Zend_Search_Lucene_Interface $reader) - { - // Check, that it's a top-level query and query weight is not initialized yet. - if ($this->_weight !== null) { - return $this->_weight; - } - - $this->createWeight($reader); - $sum = $this->_weight->sumOfSquaredWeights(); - $queryNorm = $reader->getSimilarity()->queryNorm($sum); - $this->_weight->normalize($queryNorm); - } - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - abstract public function rewrite(Zend_Search_Lucene_Interface $index); - - /** - * Optimize query in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - abstract public function optimize(Zend_Search_Lucene_Interface $index); - - /** - * Reset query, so it can be reused within other queries or - * with other indeces - */ - public function reset() - { - $this->_weight = null; - } - - - /** - * Print a query - * - * @return string - */ - abstract public function __toString(); - - /** - * Return query terms - * - * @return array - */ - abstract public function getQueryTerms(); - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - abstract protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter); - - /** - * Highlight matches in $inputHTML - * - * @param string $inputHTML - * @param string $defaultEncoding HTML encoding, is used if it's not specified using Content-type HTTP-EQUIV meta tag. - * @param Zend_Search_Lucene_Search_Highlighter_Interface|null $highlighter - * @return string - */ - public function highlightMatches($inputHTML, $defaultEncoding = '', $highlighter = null) - { - if ($highlighter === null) { - $highlighter = new Zend_Search_Lucene_Search_Highlighter_Default(); - } - - /** Zend_Search_Lucene_Document_Html */ - - $doc = Zend_Search_Lucene_Document_Html::loadHTML($inputHTML, false, $defaultEncoding); - $highlighter->setDocument($doc); - - $this->_highlightMatches($highlighter); - - return $doc->getHTML(); - } - - /** - * Highlight matches in $inputHtmlFragment and return it (without HTML header and body tag) - * - * @param string $inputHtmlFragment - * @param string $encoding Input HTML string encoding - * @param Zend_Search_Lucene_Search_Highlighter_Interface|null $highlighter - * @return string - */ - public function htmlFragmentHighlightMatches($inputHtmlFragment, $encoding = 'UTF-8', $highlighter = null) - { - if ($highlighter === null) { - $highlighter = new Zend_Search_Lucene_Search_Highlighter_Default(); - } - - $inputHTML = '' - . iconv($encoding, 'UTF-8//IGNORE', $inputHtmlFragment) . ''; - - /** Zend_Search_Lucene_Document_Html */ - - $doc = Zend_Search_Lucene_Document_Html::loadHTML($inputHTML); - $highlighter->setDocument($doc); - - $this->_highlightMatches($highlighter); - - return $doc->getHtmlBody(); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Boolean.php b/library/vendor/Zend/Search/Lucene/Search/Query/Boolean.php deleted file mode 100644 index db4ff3199..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Boolean.php +++ /dev/null @@ -1,802 +0,0 @@ -_subqueries = $subqueries; - - $this->_signs = null; - // Check if all subqueries are required - if (is_array($signs)) { - foreach ($signs as $sign ) { - if ($sign !== true) { - $this->_signs = $signs; - break; - } - } - } - } - } - - - /** - * Add a $subquery (Zend_Search_Lucene_Search_Query) to this query. - * - * The sign is specified as: - * TRUE - subquery is required - * FALSE - subquery is prohibited - * NULL - subquery is neither prohibited, nor required - * - * @param Zend_Search_Lucene_Search_Query $subquery - * @param boolean|null $sign - * @return void - */ - public function addSubquery(Zend_Search_Lucene_Search_Query $subquery, $sign=null) { - if ($sign !== true || $this->_signs !== null) { // Skip, if all subqueries are required - if ($this->_signs === null) { // Check, If all previous subqueries are required - $this->_signs = array(); - foreach ($this->_subqueries as $prevSubquery) { - $this->_signs[] = true; - } - } - $this->_signs[] = $sign; - } - - $this->_subqueries[] = $subquery; - } - - /** - * Re-write queries into primitive queries - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - $query = new Zend_Search_Lucene_Search_Query_Boolean(); - $query->setBoost($this->getBoost()); - - foreach ($this->_subqueries as $subqueryId => $subquery) { - $query->addSubquery($subquery->rewrite($index), - ($this->_signs === null)? true : $this->_signs[$subqueryId]); - } - - return $query; - } - - /** - * Optimize query in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function optimize(Zend_Search_Lucene_Interface $index) - { - $subqueries = array(); - $signs = array(); - - // Optimize all subqueries - foreach ($this->_subqueries as $id => $subquery) { - $subqueries[] = $subquery->optimize($index); - $signs[] = ($this->_signs === null)? true : $this->_signs[$id]; - } - - // Remove insignificant subqueries - foreach ($subqueries as $id => $subquery) { - if ($subquery instanceof Zend_Search_Lucene_Search_Query_Insignificant) { - // Insignificant subquery has to be removed anyway - unset($subqueries[$id]); - unset($signs[$id]); - } - } - if (count($subqueries) == 0) { - // Boolean query doesn't has non-insignificant subqueries - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } - // Check if all non-insignificant subqueries are prohibited - $allProhibited = true; - foreach ($signs as $sign) { - if ($sign !== false) { - $allProhibited = false; - break; - } - } - if ($allProhibited) { - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } - - - // Check for empty subqueries - foreach ($subqueries as $id => $subquery) { - if ($subquery instanceof Zend_Search_Lucene_Search_Query_Empty) { - if ($signs[$id] === true) { - // Matching is required, but is actually empty - return new Zend_Search_Lucene_Search_Query_Empty(); - } else { - // Matching is optional or prohibited, but is empty - // Remove it from subqueries and signs list - unset($subqueries[$id]); - unset($signs[$id]); - } - } - } - - // Check, if reduced subqueries list is empty - if (count($subqueries) == 0) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - - // Check if all non-empty subqueries are prohibited - $allProhibited = true; - foreach ($signs as $sign) { - if ($sign !== false) { - $allProhibited = false; - break; - } - } - if ($allProhibited) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - - - // Check, if reduced subqueries list has only one entry - if (count($subqueries) == 1) { - // It's a query with only one required or optional clause - // (it's already checked, that it's not a prohibited clause) - - if ($this->getBoost() == 1) { - return reset($subqueries); - } - - $optimizedQuery = clone reset($subqueries); - $optimizedQuery->setBoost($optimizedQuery->getBoost()*$this->getBoost()); - - return $optimizedQuery; - } - - - // Prepare first candidate for optimized query - $optimizedQuery = new Zend_Search_Lucene_Search_Query_Boolean($subqueries, $signs); - $optimizedQuery->setBoost($this->getBoost()); - - - $terms = array(); - $tsigns = array(); - $boostFactors = array(); - - // Try to decompose term and multi-term subqueries - foreach ($subqueries as $id => $subquery) { - if ($subquery instanceof Zend_Search_Lucene_Search_Query_Term) { - $terms[] = $subquery->getTerm(); - $tsigns[] = $signs[$id]; - $boostFactors[] = $subquery->getBoost(); - - // remove subquery from a subqueries list - unset($subqueries[$id]); - unset($signs[$id]); - } else if ($subquery instanceof Zend_Search_Lucene_Search_Query_MultiTerm) { - $subTerms = $subquery->getTerms(); - $subSigns = $subquery->getSigns(); - - if ($signs[$id] === true) { - // It's a required multi-term subquery. - // Something like '... +(+term1 -term2 term3 ...) ...' - - // Multi-term required subquery can be decomposed only if it contains - // required terms and doesn't contain prohibited terms: - // ... +(+term1 term2 ...) ... => ... +term1 term2 ... - // - // Check this - $hasRequired = false; - $hasProhibited = false; - if ($subSigns === null) { - // All subterms are required - $hasRequired = true; - } else { - foreach ($subSigns as $sign) { - if ($sign === true) { - $hasRequired = true; - } else if ($sign === false) { - $hasProhibited = true; - break; - } - } - } - // Continue if subquery has prohibited terms or doesn't have required terms - if ($hasProhibited || !$hasRequired) { - continue; - } - - foreach ($subTerms as $termId => $term) { - $terms[] = $term; - $tsigns[] = ($subSigns === null)? true : $subSigns[$termId]; - $boostFactors[] = $subquery->getBoost(); - } - - // remove subquery from a subqueries list - unset($subqueries[$id]); - unset($signs[$id]); - - } else { // $signs[$id] === null || $signs[$id] === false - // It's an optional or prohibited multi-term subquery. - // Something like '... (+term1 -term2 term3 ...) ...' - // or - // something like '... -(+term1 -term2 term3 ...) ...' - - // Multi-term optional and required subqueries can be decomposed - // only if all terms are optional. - // - // Check if all terms are optional. - $onlyOptional = true; - if ($subSigns === null) { - // All subterms are required - $onlyOptional = false; - } else { - foreach ($subSigns as $sign) { - if ($sign !== null) { - $onlyOptional = false; - break; - } - } - } - - // Continue if non-optional terms are presented in this multi-term subquery - if (!$onlyOptional) { - continue; - } - - foreach ($subTerms as $termId => $term) { - $terms[] = $term; - $tsigns[] = ($signs[$id] === null)? null /* optional */ : - false /* prohibited */; - $boostFactors[] = $subquery->getBoost(); - } - - // remove subquery from a subqueries list - unset($subqueries[$id]); - unset($signs[$id]); - } - } - } - - - // Check, if there are no decomposed subqueries - if (count($terms) == 0 ) { - // return prepared candidate - return $optimizedQuery; - } - - - // Check, if all subqueries have been decomposed and all terms has the same boost factor - if (count($subqueries) == 0 && count(array_unique($boostFactors)) == 1) { - $optimizedQuery = new Zend_Search_Lucene_Search_Query_MultiTerm($terms, $tsigns); - $optimizedQuery->setBoost(reset($boostFactors)*$this->getBoost()); - - return $optimizedQuery; - } - - - // This boolean query can't be transformed to Term/MultiTerm query and still contains - // several subqueries - - // Separate prohibited terms - $prohibitedTerms = array(); - foreach ($terms as $id => $term) { - if ($tsigns[$id] === false) { - $prohibitedTerms[] = $term; - - unset($terms[$id]); - unset($tsigns[$id]); - unset($boostFactors[$id]); - } - } - - if (count($terms) == 1) { - $clause = new Zend_Search_Lucene_Search_Query_Term(reset($terms)); - $clause->setBoost(reset($boostFactors)); - - $subqueries[] = $clause; - $signs[] = reset($tsigns); - - // Clear terms list - $terms = array(); - } else if (count($terms) > 1 && count(array_unique($boostFactors)) == 1) { - $clause = new Zend_Search_Lucene_Search_Query_MultiTerm($terms, $tsigns); - $clause->setBoost(reset($boostFactors)); - - $subqueries[] = $clause; - // Clause sign is 'required' if clause contains required terms. 'Optional' otherwise. - $signs[] = (in_array(true, $tsigns))? true : null; - - // Clear terms list - $terms = array(); - } - - if (count($prohibitedTerms) == 1) { - // (boost factors are not significant for prohibited clauses) - $subqueries[] = new Zend_Search_Lucene_Search_Query_Term(reset($prohibitedTerms)); - $signs[] = false; - - // Clear prohibited terms list - $prohibitedTerms = array(); - } else if (count($prohibitedTerms) > 1) { - // prepare signs array - $prohibitedSigns = array(); - foreach ($prohibitedTerms as $id => $term) { - // all prohibited term are grouped as optional into multi-term query - $prohibitedSigns[$id] = null; - } - - // (boost factors are not significant for prohibited clauses) - $subqueries[] = new Zend_Search_Lucene_Search_Query_MultiTerm($prohibitedTerms, $prohibitedSigns); - // Clause sign is 'prohibited' - $signs[] = false; - - // Clear terms list - $prohibitedTerms = array(); - } - - /** @todo Group terms with the same boost factors together */ - - // Check, that all terms are processed - // Replace candidate for optimized query - if (count($terms) == 0 && count($prohibitedTerms) == 0) { - $optimizedQuery = new Zend_Search_Lucene_Search_Query_Boolean($subqueries, $signs); - $optimizedQuery->setBoost($this->getBoost()); - } - - return $optimizedQuery; - } - - /** - * Returns subqueries - * - * @return array - */ - public function getSubqueries() - { - return $this->_subqueries; - } - - - /** - * Return subqueries signs - * - * @return array - */ - public function getSigns() - { - return $this->_signs; - } - - - /** - * Constructs an appropriate Weight implementation for this query. - * - * @param Zend_Search_Lucene_Interface $reader - * @return Zend_Search_Lucene_Search_Weight - */ - public function createWeight(Zend_Search_Lucene_Interface $reader) - { - $this->_weight = new Zend_Search_Lucene_Search_Weight_Boolean($this, $reader); - return $this->_weight; - } - - - /** - * Calculate result vector for Conjunction query - * (like ' AND AND ') - */ - private function _calculateConjunctionResult() - { - $this->_resVector = null; - - if (count($this->_subqueries) == 0) { - $this->_resVector = array(); - } - - $resVectors = array(); - $resVectorsSizes = array(); - $resVectorsIds = array(); // is used to prevent arrays comparison - foreach ($this->_subqueries as $subqueryId => $subquery) { - $resVectors[] = $subquery->matchedDocs(); - $resVectorsSizes[] = count(end($resVectors)); - $resVectorsIds[] = $subqueryId; - } - // sort resvectors in order of subquery cardinality increasing - array_multisort($resVectorsSizes, SORT_ASC, SORT_NUMERIC, - $resVectorsIds, SORT_ASC, SORT_NUMERIC, - $resVectors); - - foreach ($resVectors as $nextResVector) { - if($this->_resVector === null) { - $this->_resVector = $nextResVector; - } else { - //$this->_resVector = array_intersect_key($this->_resVector, $nextResVector); - - /** - * This code is used as workaround for array_intersect_key() slowness problem. - */ - $updatedVector = array(); - foreach ($this->_resVector as $id => $value) { - if (isset($nextResVector[$id])) { - $updatedVector[$id] = $value; - } - } - $this->_resVector = $updatedVector; - } - - if (count($this->_resVector) == 0) { - // Empty result set, we don't need to check other terms - break; - } - } - - // ksort($this->_resVector, SORT_NUMERIC); - // Used algorithm doesn't change elements order - } - - - /** - * Calculate result vector for non Conjunction query - * (like ' AND AND NOT OR ') - */ - private function _calculateNonConjunctionResult() - { - $requiredVectors = array(); - $requiredVectorsSizes = array(); - $requiredVectorsIds = array(); // is used to prevent arrays comparison - - $optional = array(); - - foreach ($this->_subqueries as $subqueryId => $subquery) { - if ($this->_signs[$subqueryId] === true) { - // required - $requiredVectors[] = $subquery->matchedDocs(); - $requiredVectorsSizes[] = count(end($requiredVectors)); - $requiredVectorsIds[] = $subqueryId; - } elseif ($this->_signs[$subqueryId] === false) { - // prohibited - // Do nothing. matchedDocs() may include non-matching id's - // Calculating prohibited vector may take significant time, but do not affect the result - // Skipped. - } else { - // neither required, nor prohibited - // array union - $optional += $subquery->matchedDocs(); - } - } - - // sort resvectors in order of subquery cardinality increasing - array_multisort($requiredVectorsSizes, SORT_ASC, SORT_NUMERIC, - $requiredVectorsIds, SORT_ASC, SORT_NUMERIC, - $requiredVectors); - - $required = null; - foreach ($requiredVectors as $nextResVector) { - if($required === null) { - $required = $nextResVector; - } else { - //$required = array_intersect_key($required, $nextResVector); - - /** - * This code is used as workaround for array_intersect_key() slowness problem. - */ - $updatedVector = array(); - foreach ($required as $id => $value) { - if (isset($nextResVector[$id])) { - $updatedVector[$id] = $value; - } - } - $required = $updatedVector; - } - - if (count($required) == 0) { - // Empty result set, we don't need to check other terms - break; - } - } - - - if ($required !== null) { - $this->_resVector = &$required; - } else { - $this->_resVector = &$optional; - } - - ksort($this->_resVector, SORT_NUMERIC); - } - - - /** - * Score calculator for conjunction queries (all subqueries are required) - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function _conjunctionScore($docId, Zend_Search_Lucene_Interface $reader) - { - if ($this->_coord === null) { - $this->_coord = $reader->getSimilarity()->coord(count($this->_subqueries), - count($this->_subqueries) ); - } - - $score = 0; - - foreach ($this->_subqueries as $subquery) { - $subscore = $subquery->score($docId, $reader); - - if ($subscore == 0) { - return 0; - } - - $score += $subquery->score($docId, $reader) * $this->_coord; - } - - return $score * $this->_coord * $this->getBoost(); - } - - - /** - * Score calculator for non conjunction queries (not all subqueries are required) - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function _nonConjunctionScore($docId, Zend_Search_Lucene_Interface $reader) - { - if ($this->_coord === null) { - $this->_coord = array(); - - $maxCoord = 0; - foreach ($this->_signs as $sign) { - if ($sign !== false /* not prohibited */) { - $maxCoord++; - } - } - - for ($count = 0; $count <= $maxCoord; $count++) { - $this->_coord[$count] = $reader->getSimilarity()->coord($count, $maxCoord); - } - } - - $score = 0; - $matchedSubqueries = 0; - foreach ($this->_subqueries as $subqueryId => $subquery) { - $subscore = $subquery->score($docId, $reader); - - // Prohibited - if ($this->_signs[$subqueryId] === false && $subscore != 0) { - return 0; - } - - // is required, but doen't match - if ($this->_signs[$subqueryId] === true && $subscore == 0) { - return 0; - } - - if ($subscore != 0) { - $matchedSubqueries++; - $score += $subscore; - } - } - - return $score * $this->_coord[$matchedSubqueries] * $this->getBoost(); - } - - /** - * Execute query in context of index reader - * It also initializes necessary internal structures - * - * @param Zend_Search_Lucene_Interface $reader - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - */ - public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) - { - // Initialize weight if it's not done yet - $this->_initWeight($reader); - - if ($docsFilter === null) { - // Create local documents filter if it's not provided by upper query - $docsFilter = new Zend_Search_Lucene_Index_DocsFilter(); - } - - foreach ($this->_subqueries as $subqueryId => $subquery) { - if ($this->_signs == null || $this->_signs[$subqueryId] === true) { - // Subquery is required - $subquery->execute($reader, $docsFilter); - } else { - $subquery->execute($reader); - } - } - - if ($this->_signs === null) { - $this->_calculateConjunctionResult(); - } else { - $this->_calculateNonConjunctionResult(); - } - } - - - - /** - * Get document ids likely matching the query - * - * It's an array with document ids as keys (performance considerations) - * - * @return array - */ - public function matchedDocs() - { - return $this->_resVector; - } - - /** - * Score specified document - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function score($docId, Zend_Search_Lucene_Interface $reader) - { - if (isset($this->_resVector[$docId])) { - if ($this->_signs === null) { - return $this->_conjunctionScore($docId, $reader); - } else { - return $this->_nonConjunctionScore($docId, $reader); - } - } else { - return 0; - } - } - - /** - * Return query terms - * - * @return array - */ - public function getQueryTerms() - { - $terms = array(); - - foreach ($this->_subqueries as $id => $subquery) { - if ($this->_signs === null || $this->_signs[$id] !== false) { - $terms = array_merge($terms, $subquery->getQueryTerms()); - } - } - - return $terms; - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - foreach ($this->_subqueries as $id => $subquery) { - if ($this->_signs === null || $this->_signs[$id] !== false) { - $subquery->_highlightMatches($highlighter); - } - } - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - - $query = ''; - - foreach ($this->_subqueries as $id => $subquery) { - if ($id != 0) { - $query .= ' '; - } - - if ($this->_signs === null || $this->_signs[$id] === true) { - $query .= '+'; - } else if ($this->_signs[$id] === false) { - $query .= '-'; - } - - $query .= '(' . $subquery->__toString() . ')'; - } - - if ($this->getBoost() != 1) { - $query = '(' . $query . ')^' . round($this->getBoost(), 4); - } - - return $query; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Empty.php b/library/vendor/Zend/Search/Lucene/Search/Query/Empty.php deleted file mode 100644 index 0deba2cba..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Empty.php +++ /dev/null @@ -1,136 +0,0 @@ -'; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Fuzzy.php b/library/vendor/Zend/Search/Lucene/Search/Query/Fuzzy.php deleted file mode 100644 index c754da422..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Fuzzy.php +++ /dev/null @@ -1,472 +0,0 @@ -= 1) { - throw new Zend_Search_Lucene_Exception('minimumSimilarity cannot be greater than or equal to 1'); - } - if ($prefixLength < 0) { - throw new Zend_Search_Lucene_Exception('prefixLength cannot be less than 0'); - } - - $this->_term = $term; - $this->_minimumSimilarity = $minimumSimilarity; - $this->_prefixLength = ($prefixLength !== null)? $prefixLength : self::$_defaultPrefixLength; - } - - /** - * Get default non-fuzzy prefix length - * - * @return integer - */ - public static function getDefaultPrefixLength() - { - return self::$_defaultPrefixLength; - } - - /** - * Set default non-fuzzy prefix length - * - * @param integer $defaultPrefixLength - */ - public static function setDefaultPrefixLength($defaultPrefixLength) - { - self::$_defaultPrefixLength = $defaultPrefixLength; - } - - /** - * Calculate maximum distance for specified word length - * - * @param integer $prefixLength - * @param integer $termLength - * @param integer $length - * @return integer - */ - private function _calculateMaxDistance($prefixLength, $termLength, $length) - { - $this->_maxDistances[$length] = (int) ((1 - $this->_minimumSimilarity)*(min($termLength, $length) + $prefixLength)); - return $this->_maxDistances[$length]; - } - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - * @throws Zend_Search_Lucene_Exception - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - $this->_matches = array(); - $this->_scores = array(); - $this->_termKeys = array(); - - if ($this->_term->field === null) { - // Search through all fields - $fields = $index->getFieldNames(true /* indexed fields list */); - } else { - $fields = array($this->_term->field); - } - - $prefix = Zend_Search_Lucene_Index_Term::getPrefix($this->_term->text, $this->_prefixLength); - $prefixByteLength = strlen($prefix); - $prefixUtf8Length = Zend_Search_Lucene_Index_Term::getLength($prefix); - - $termLength = Zend_Search_Lucene_Index_Term::getLength($this->_term->text); - - $termRest = substr($this->_term->text, $prefixByteLength); - // we calculate length of the rest in bytes since levenshtein() is not UTF-8 compatible - $termRestLength = strlen($termRest); - - $scaleFactor = 1/(1 - $this->_minimumSimilarity); - - $maxTerms = Zend_Search_Lucene::getTermsPerQueryLimit(); - foreach ($fields as $field) { - $index->resetTermsStream(); - - if ($prefix != '') { - $index->skipTo(new Zend_Search_Lucene_Index_Term($prefix, $field)); - - while ($index->currentTerm() !== null && - $index->currentTerm()->field == $field && - substr($index->currentTerm()->text, 0, $prefixByteLength) == $prefix) { - // Calculate similarity - $target = substr($index->currentTerm()->text, $prefixByteLength); - - $maxDistance = isset($this->_maxDistances[strlen($target)])? - $this->_maxDistances[strlen($target)] : - $this->_calculateMaxDistance($prefixUtf8Length, $termRestLength, strlen($target)); - - if ($termRestLength == 0) { - // we don't have anything to compare. That means if we just add - // the letters for current term we get the new word - $similarity = (($prefixUtf8Length == 0)? 0 : 1 - strlen($target)/$prefixUtf8Length); - } else if (strlen($target) == 0) { - $similarity = (($prefixUtf8Length == 0)? 0 : 1 - $termRestLength/$prefixUtf8Length); - } else if ($maxDistance < abs($termRestLength - strlen($target))){ - //just adding the characters of term to target or vice-versa results in too many edits - //for example "pre" length is 3 and "prefixes" length is 8. We can see that - //given this optimal circumstance, the edit distance cannot be less than 5. - //which is 8-3 or more precisesly abs(3-8). - //if our maximum edit distance is 4, then we can discard this word - //without looking at it. - $similarity = 0; - } else { - $similarity = 1 - levenshtein($termRest, $target)/($prefixUtf8Length + min($termRestLength, strlen($target))); - } - - if ($similarity > $this->_minimumSimilarity) { - $this->_matches[] = $index->currentTerm(); - $this->_termKeys[] = $index->currentTerm()->key(); - $this->_scores[] = ($similarity - $this->_minimumSimilarity)*$scaleFactor; - - if ($maxTerms != 0 && count($this->_matches) > $maxTerms) { - throw new Zend_Search_Lucene_Exception('Terms per query limit is reached.'); - } - } - - $index->nextTerm(); - } - } else { - $index->skipTo(new Zend_Search_Lucene_Index_Term('', $field)); - - while ($index->currentTerm() !== null && $index->currentTerm()->field == $field) { - // Calculate similarity - $target = $index->currentTerm()->text; - - $maxDistance = isset($this->_maxDistances[strlen($target)])? - $this->_maxDistances[strlen($target)] : - $this->_calculateMaxDistance(0, $termRestLength, strlen($target)); - - if ($maxDistance < abs($termRestLength - strlen($target))){ - //just adding the characters of term to target or vice-versa results in too many edits - //for example "pre" length is 3 and "prefixes" length is 8. We can see that - //given this optimal circumstance, the edit distance cannot be less than 5. - //which is 8-3 or more precisesly abs(3-8). - //if our maximum edit distance is 4, then we can discard this word - //without looking at it. - $similarity = 0; - } else { - $similarity = 1 - levenshtein($termRest, $target)/min($termRestLength, strlen($target)); - } - - if ($similarity > $this->_minimumSimilarity) { - $this->_matches[] = $index->currentTerm(); - $this->_termKeys[] = $index->currentTerm()->key(); - $this->_scores[] = ($similarity - $this->_minimumSimilarity)*$scaleFactor; - - if ($maxTerms != 0 && count($this->_matches) > $maxTerms) { - throw new Zend_Search_Lucene_Exception('Terms per query limit is reached.'); - } - } - - $index->nextTerm(); - } - } - - $index->closeTermsStream(); - } - - if (count($this->_matches) == 0) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } else if (count($this->_matches) == 1) { - return new Zend_Search_Lucene_Search_Query_Term(reset($this->_matches)); - } else { - $rewrittenQuery = new Zend_Search_Lucene_Search_Query_Boolean(); - - array_multisort($this->_scores, SORT_DESC, SORT_NUMERIC, - $this->_termKeys, SORT_ASC, SORT_STRING, - $this->_matches); - - $termCount = 0; - foreach ($this->_matches as $id => $matchedTerm) { - $subquery = new Zend_Search_Lucene_Search_Query_Term($matchedTerm); - $subquery->setBoost($this->_scores[$id]); - - $rewrittenQuery->addSubquery($subquery); - - $termCount++; - if ($termCount >= self::MAX_CLAUSE_COUNT) { - break; - } - } - - return $rewrittenQuery; - } - } - - /** - * Optimize query in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function optimize(Zend_Search_Lucene_Interface $index) - { - throw new Zend_Search_Lucene_Exception('Fuzzy query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Return query terms - * - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function getQueryTerms() - { - if ($this->_matches === null) { - throw new Zend_Search_Lucene_Exception('Search or rewrite operations have to be performed before.'); - } - - return $this->_matches; - } - - /** - * Constructs an appropriate Weight implementation for this query. - * - * @param Zend_Search_Lucene_Interface $reader - * @return Zend_Search_Lucene_Search_Weight - * @throws Zend_Search_Lucene_Exception - */ - public function createWeight(Zend_Search_Lucene_Interface $reader) - { - throw new Zend_Search_Lucene_Exception('Fuzzy query should not be directly used for search. Use $query->rewrite($index)'); - } - - - /** - * Execute query in context of index reader - * It also initializes necessary internal structures - * - * @param Zend_Search_Lucene_Interface $reader - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @throws Zend_Search_Lucene_Exception - */ - public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) - { - throw new Zend_Search_Lucene_Exception('Fuzzy query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Get document ids likely matching the query - * - * It's an array with document ids as keys (performance considerations) - * - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function matchedDocs() - { - throw new Zend_Search_Lucene_Exception('Fuzzy query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Score specified document - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - * @throws Zend_Search_Lucene_Exception - */ - public function score($docId, Zend_Search_Lucene_Interface $reader) - { - throw new Zend_Search_Lucene_Exception('Fuzzy query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - $words = array(); - - $prefix = Zend_Search_Lucene_Index_Term::getPrefix($this->_term->text, $this->_prefixLength); - $prefixByteLength = strlen($prefix); - $prefixUtf8Length = Zend_Search_Lucene_Index_Term::getLength($prefix); - - $termLength = Zend_Search_Lucene_Index_Term::getLength($this->_term->text); - - $termRest = substr($this->_term->text, $prefixByteLength); - // we calculate length of the rest in bytes since levenshtein() is not UTF-8 compatible - $termRestLength = strlen($termRest); - - $scaleFactor = 1/(1 - $this->_minimumSimilarity); - - $docBody = $highlighter->getDocument()->getFieldUtf8Value('body'); - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($docBody, 'UTF-8'); - foreach ($tokens as $token) { - $termText = $token->getTermText(); - - if (substr($termText, 0, $prefixByteLength) == $prefix) { - // Calculate similarity - $target = substr($termText, $prefixByteLength); - - $maxDistance = isset($this->_maxDistances[strlen($target)])? - $this->_maxDistances[strlen($target)] : - $this->_calculateMaxDistance($prefixUtf8Length, $termRestLength, strlen($target)); - - if ($termRestLength == 0) { - // we don't have anything to compare. That means if we just add - // the letters for current term we get the new word - $similarity = (($prefixUtf8Length == 0)? 0 : 1 - strlen($target)/$prefixUtf8Length); - } else if (strlen($target) == 0) { - $similarity = (($prefixUtf8Length == 0)? 0 : 1 - $termRestLength/$prefixUtf8Length); - } else if ($maxDistance < abs($termRestLength - strlen($target))){ - //just adding the characters of term to target or vice-versa results in too many edits - //for example "pre" length is 3 and "prefixes" length is 8. We can see that - //given this optimal circumstance, the edit distance cannot be less than 5. - //which is 8-3 or more precisesly abs(3-8). - //if our maximum edit distance is 4, then we can discard this word - //without looking at it. - $similarity = 0; - } else { - $similarity = 1 - levenshtein($termRest, $target)/($prefixUtf8Length + min($termRestLength, strlen($target))); - } - - if ($similarity > $this->_minimumSimilarity) { - $words[] = $termText; - } - } - } - - $highlighter->highlight($words); - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - return (($this->_term->field === null)? '' : $this->_term->field . ':') - . $this->_term->text . '~' - . (($this->_minimumSimilarity != self::DEFAULT_MIN_SIMILARITY)? round($this->_minimumSimilarity, 4) : '') - . (($this->getBoost() != 1)? '^' . round($this->getBoost(), 4) : ''); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Insignificant.php b/library/vendor/Zend/Search/Lucene/Search/Query/Insignificant.php deleted file mode 100644 index c25e3d439..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Insignificant.php +++ /dev/null @@ -1,137 +0,0 @@ -'; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/MultiTerm.php b/library/vendor/Zend/Search/Lucene/Search/Query/MultiTerm.php deleted file mode 100644 index 20d2ba2a0..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/MultiTerm.php +++ /dev/null @@ -1,657 +0,0 @@ - (docId => freq, ...) - * term2Id => (docId => freq, ...) - * - * @var array - */ - private $_termsFreqs = array(); - - - /** - * A score factor based on the fraction of all query terms - * that a document contains. - * float for conjunction queries - * array of float for non conjunction queries - * - * @var mixed - */ - private $_coord = null; - - - /** - * Terms weights - * array of Zend_Search_Lucene_Search_Weight - * - * @var array - */ - private $_weights = array(); - - - /** - * Class constructor. Create a new multi-term query object. - * - * if $signs array is omitted then all terms are required - * it differs from addTerm() behavior, but should never be used - * - * @param array $terms Array of Zend_Search_Lucene_Index_Term objects - * @param array $signs Array of signs. Sign is boolean|null. - * @throws Zend_Search_Lucene_Exception - */ - public function __construct($terms = null, $signs = null) - { - if (is_array($terms)) { - if (count($terms) > Zend_Search_Lucene::getTermsPerQueryLimit()) { - throw new Zend_Search_Lucene_Exception('Terms per query limit is reached.'); - } - - $this->_terms = $terms; - - $this->_signs = null; - // Check if all terms are required - if (is_array($signs)) { - foreach ($signs as $sign ) { - if ($sign !== true) { - $this->_signs = $signs; - break; - } - } - } - } - } - - - /** - * Add a $term (Zend_Search_Lucene_Index_Term) to this query. - * - * The sign is specified as: - * TRUE - term is required - * FALSE - term is prohibited - * NULL - term is neither prohibited, nor required - * - * @param Zend_Search_Lucene_Index_Term $term - * @param boolean|null $sign - * @return void - */ - public function addTerm(Zend_Search_Lucene_Index_Term $term, $sign = null) { - if ($sign !== true || $this->_signs !== null) { // Skip, if all terms are required - if ($this->_signs === null) { // Check, If all previous terms are required - $this->_signs = array(); - foreach ($this->_terms as $prevTerm) { - $this->_signs[] = true; - } - } - $this->_signs[] = $sign; - } - - $this->_terms[] = $term; - } - - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - if (count($this->_terms) == 0) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - - // Check, that all fields are qualified - $allQualified = true; - foreach ($this->_terms as $term) { - if ($term->field === null) { - $allQualified = false; - break; - } - } - - if ($allQualified) { - return $this; - } else { - /** transform multiterm query to boolean and apply rewrite() method to subqueries. */ - $query = new Zend_Search_Lucene_Search_Query_Boolean(); - $query->setBoost($this->getBoost()); - - foreach ($this->_terms as $termId => $term) { - $subquery = new Zend_Search_Lucene_Search_Query_Term($term); - - $query->addSubquery($subquery->rewrite($index), - ($this->_signs === null)? true : $this->_signs[$termId]); - } - - return $query; - } - } - - /** - * Optimize query in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function optimize(Zend_Search_Lucene_Interface $index) - { - $terms = $this->_terms; - $signs = $this->_signs; - - foreach ($terms as $id => $term) { - if (!$index->hasTerm($term)) { - if ($signs === null || $signs[$id] === true) { - // Term is required - return new Zend_Search_Lucene_Search_Query_Empty(); - } else { - // Term is optional or prohibited - // Remove it from terms and signs list - unset($terms[$id]); - unset($signs[$id]); - } - } - } - - // Check if all presented terms are prohibited - $allProhibited = true; - if ($signs === null) { - $allProhibited = false; - } else { - foreach ($signs as $sign) { - if ($sign !== false) { - $allProhibited = false; - break; - } - } - } - if ($allProhibited) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - - /** - * @todo make an optimization for repeated terms - * (they may have different signs) - */ - - if (count($terms) == 1) { - // It's already checked, that it's not a prohibited term - - // It's one term query with one required or optional element - $optimizedQuery = new Zend_Search_Lucene_Search_Query_Term(reset($terms)); - $optimizedQuery->setBoost($this->getBoost()); - - return $optimizedQuery; - } - - if (count($terms) == 0) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - - $optimizedQuery = new Zend_Search_Lucene_Search_Query_MultiTerm($terms, $signs); - $optimizedQuery->setBoost($this->getBoost()); - return $optimizedQuery; - } - - - /** - * Returns query term - * - * @return array - */ - public function getTerms() - { - return $this->_terms; - } - - - /** - * Return terms signs - * - * @return array - */ - public function getSigns() - { - return $this->_signs; - } - - - /** - * Set weight for specified term - * - * @param integer $num - * @param Zend_Search_Lucene_Search_Weight_Term $weight - */ - public function setWeight($num, $weight) - { - $this->_weights[$num] = $weight; - } - - - /** - * Constructs an appropriate Weight implementation for this query. - * - * @param Zend_Search_Lucene_Interface $reader - * @return Zend_Search_Lucene_Search_Weight - */ - public function createWeight(Zend_Search_Lucene_Interface $reader) - { - $this->_weight = new Zend_Search_Lucene_Search_Weight_MultiTerm($this, $reader); - return $this->_weight; - } - - - /** - * Calculate result vector for Conjunction query - * (like '+something +another') - * - * @param Zend_Search_Lucene_Interface $reader - */ - private function _calculateConjunctionResult(Zend_Search_Lucene_Interface $reader) - { - $this->_resVector = null; - - if (count($this->_terms) == 0) { - $this->_resVector = array(); - } - - // Order terms by selectivity - $docFreqs = array(); - $ids = array(); - foreach ($this->_terms as $id => $term) { - $docFreqs[] = $reader->docFreq($term); - $ids[] = $id; // Used to keep original order for terms with the same selectivity and omit terms comparison - } - array_multisort($docFreqs, SORT_ASC, SORT_NUMERIC, - $ids, SORT_ASC, SORT_NUMERIC, - $this->_terms); - - $docsFilter = new Zend_Search_Lucene_Index_DocsFilter(); - foreach ($this->_terms as $termId => $term) { - $termDocs = $reader->termDocs($term, $docsFilter); - } - // Treat last retrieved docs vector as a result set - // (filter collects data for other terms) - $this->_resVector = array_flip($termDocs); - - foreach ($this->_terms as $termId => $term) { - $this->_termsFreqs[$termId] = $reader->termFreqs($term, $docsFilter); - } - - // ksort($this->_resVector, SORT_NUMERIC); - // Docs are returned ordered. Used algorithms doesn't change elements order. - } - - - /** - * Calculate result vector for non Conjunction query - * (like '+something -another') - * - * @param Zend_Search_Lucene_Interface $reader - */ - private function _calculateNonConjunctionResult(Zend_Search_Lucene_Interface $reader) - { - $requiredVectors = array(); - $requiredVectorsSizes = array(); - $requiredVectorsIds = array(); // is used to prevent arrays comparison - - $optional = array(); - $prohibited = array(); - - foreach ($this->_terms as $termId => $term) { - $termDocs = array_flip($reader->termDocs($term)); - - if ($this->_signs[$termId] === true) { - // required - $requiredVectors[] = $termDocs; - $requiredVectorsSizes[] = count($termDocs); - $requiredVectorsIds[] = $termId; - } elseif ($this->_signs[$termId] === false) { - // prohibited - // array union - $prohibited += $termDocs; - } else { - // neither required, nor prohibited - // array union - $optional += $termDocs; - } - - $this->_termsFreqs[$termId] = $reader->termFreqs($term); - } - - // sort resvectors in order of subquery cardinality increasing - array_multisort($requiredVectorsSizes, SORT_ASC, SORT_NUMERIC, - $requiredVectorsIds, SORT_ASC, SORT_NUMERIC, - $requiredVectors); - - $required = null; - foreach ($requiredVectors as $nextResVector) { - if($required === null) { - $required = $nextResVector; - } else { - //$required = array_intersect_key($required, $nextResVector); - - /** - * This code is used as workaround for array_intersect_key() slowness problem. - */ - $updatedVector = array(); - foreach ($required as $id => $value) { - if (isset($nextResVector[$id])) { - $updatedVector[$id] = $value; - } - } - $required = $updatedVector; - } - - if (count($required) == 0) { - // Empty result set, we don't need to check other terms - break; - } - } - - if ($required !== null) { - $this->_resVector = $required; - } else { - $this->_resVector = $optional; - } - - if (count($prohibited) != 0) { - // $this->_resVector = array_diff_key($this->_resVector, $prohibited); - - /** - * This code is used as workaround for array_diff_key() slowness problem. - */ - if (count($this->_resVector) < count($prohibited)) { - $updatedVector = $this->_resVector; - foreach ($this->_resVector as $id => $value) { - if (isset($prohibited[$id])) { - unset($updatedVector[$id]); - } - } - $this->_resVector = $updatedVector; - } else { - $updatedVector = $this->_resVector; - foreach ($prohibited as $id => $value) { - unset($updatedVector[$id]); - } - $this->_resVector = $updatedVector; - } - } - - ksort($this->_resVector, SORT_NUMERIC); - } - - - /** - * Score calculator for conjunction queries (all terms are required) - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function _conjunctionScore($docId, Zend_Search_Lucene_Interface $reader) - { - if ($this->_coord === null) { - $this->_coord = $reader->getSimilarity()->coord(count($this->_terms), - count($this->_terms) ); - } - - $score = 0.0; - - foreach ($this->_terms as $termId => $term) { - /** - * We don't need to check that term freq is not 0 - * Score calculation is performed only for matched docs - */ - $score += $reader->getSimilarity()->tf($this->_termsFreqs[$termId][$docId]) * - $this->_weights[$termId]->getValue() * - $reader->norm($docId, $term->field); - } - - return $score * $this->_coord * $this->getBoost(); - } - - - /** - * Score calculator for non conjunction queries (not all terms are required) - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function _nonConjunctionScore($docId, $reader) - { - if ($this->_coord === null) { - $this->_coord = array(); - - $maxCoord = 0; - foreach ($this->_signs as $sign) { - if ($sign !== false /* not prohibited */) { - $maxCoord++; - } - } - - for ($count = 0; $count <= $maxCoord; $count++) { - $this->_coord[$count] = $reader->getSimilarity()->coord($count, $maxCoord); - } - } - - $score = 0.0; - $matchedTerms = 0; - foreach ($this->_terms as $termId=>$term) { - // Check if term is - if ($this->_signs[$termId] !== false && // not prohibited - isset($this->_termsFreqs[$termId][$docId]) // matched - ) { - $matchedTerms++; - - /** - * We don't need to check that term freq is not 0 - * Score calculation is performed only for matched docs - */ - $score += - $reader->getSimilarity()->tf($this->_termsFreqs[$termId][$docId]) * - $this->_weights[$termId]->getValue() * - $reader->norm($docId, $term->field); - } - } - - return $score * $this->_coord[$matchedTerms] * $this->getBoost(); - } - - /** - * Execute query in context of index reader - * It also initializes necessary internal structures - * - * @param Zend_Search_Lucene_Interface $reader - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - */ - public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) - { - if ($this->_signs === null) { - $this->_calculateConjunctionResult($reader); - } else { - $this->_calculateNonConjunctionResult($reader); - } - - // Initialize weight if it's not done yet - $this->_initWeight($reader); - } - - /** - * Get document ids likely matching the query - * - * It's an array with document ids as keys (performance considerations) - * - * @return array - */ - public function matchedDocs() - { - return $this->_resVector; - } - - /** - * Score specified document - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function score($docId, Zend_Search_Lucene_Interface $reader) - { - if (isset($this->_resVector[$docId])) { - if ($this->_signs === null) { - return $this->_conjunctionScore($docId, $reader); - } else { - return $this->_nonConjunctionScore($docId, $reader); - } - } else { - return 0; - } - } - - /** - * Return query terms - * - * @return array - */ - public function getQueryTerms() - { - if ($this->_signs === null) { - return $this->_terms; - } - - $terms = array(); - - foreach ($this->_signs as $id => $sign) { - if ($sign !== false) { - $terms[] = $this->_terms[$id]; - } - } - - return $terms; - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - $words = array(); - - if ($this->_signs === null) { - foreach ($this->_terms as $term) { - $words[] = $term->text; - } - } else { - foreach ($this->_signs as $id => $sign) { - if ($sign !== false) { - $words[] = $this->_terms[$id]->text; - } - } - } - - $highlighter->highlight($words); - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - - $query = ''; - - foreach ($this->_terms as $id => $term) { - if ($id != 0) { - $query .= ' '; - } - - if ($this->_signs === null || $this->_signs[$id] === true) { - $query .= '+'; - } else if ($this->_signs[$id] === false) { - $query .= '-'; - } - - if ($term->field !== null) { - $query .= $term->field . ':'; - } - $query .= $term->text; - } - - if ($this->getBoost() != 1) { - $query = '(' . $query . ')^' . round($this->getBoost(), 4); - } - - return $query; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Phrase.php b/library/vendor/Zend/Search/Lucene/Search/Query/Phrase.php deleted file mode 100644 index 489b3b0bb..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Phrase.php +++ /dev/null @@ -1,563 +0,0 @@ - (docId => array( pos1, pos2, ... ), ...) - * term2Id => (docId => array( pos1, pos2, ... ), ...) - * - * @var array - */ - private $_termsPositions = array(); - - /** - * Class constructor. Create a new prase query. - * - * @param string $field Field to search. - * @param array $terms Terms to search Array of strings. - * @param array $offsets Relative term positions. Array of integers. - * @throws Zend_Search_Lucene_Exception - */ - public function __construct($terms = null, $offsets = null, $field = null) - { - $this->_slop = 0; - - if (is_array($terms)) { - $this->_terms = array(); - foreach ($terms as $termId => $termText) { - $this->_terms[$termId] = ($field !== null)? new Zend_Search_Lucene_Index_Term($termText, $field): - new Zend_Search_Lucene_Index_Term($termText); - } - } else if ($terms === null) { - $this->_terms = array(); - } else { - throw new Zend_Search_Lucene_Exception('terms argument must be array of strings or null'); - } - - if (is_array($offsets)) { - if (count($this->_terms) != count($offsets)) { - throw new Zend_Search_Lucene_Exception('terms and offsets arguments must have the same size.'); - } - $this->_offsets = $offsets; - } else if ($offsets === null) { - $this->_offsets = array(); - foreach ($this->_terms as $termId => $term) { - $position = count($this->_offsets); - $this->_offsets[$termId] = $position; - } - } else { - throw new Zend_Search_Lucene_Exception('offsets argument must be array of strings or null'); - } - } - - /** - * Set slop - * - * @param integer $slop - */ - public function setSlop($slop) - { - $this->_slop = $slop; - } - - - /** - * Get slop - * - * @return integer - */ - public function getSlop() - { - return $this->_slop; - } - - - /** - * Adds a term to the end of the query phrase. - * The relative position of the term is specified explicitly or the one immediately - * after the last term added. - * - * @param Zend_Search_Lucene_Index_Term $term - * @param integer $position - */ - public function addTerm(Zend_Search_Lucene_Index_Term $term, $position = null) { - if ((count($this->_terms) != 0)&&(end($this->_terms)->field != $term->field)) { - throw new Zend_Search_Lucene_Exception('All phrase terms must be in the same field: ' . - $term->field . ':' . $term->text); - } - - $this->_terms[] = $term; - if ($position !== null) { - $this->_offsets[] = $position; - } else if (count($this->_offsets) != 0) { - $this->_offsets[] = end($this->_offsets) + 1; - } else { - $this->_offsets[] = 0; - } - } - - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - if (count($this->_terms) == 0) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } else if ($this->_terms[0]->field !== null) { - return $this; - } else { - $query = new Zend_Search_Lucene_Search_Query_Boolean(); - $query->setBoost($this->getBoost()); - - foreach ($index->getFieldNames(true) as $fieldName) { - $subquery = new Zend_Search_Lucene_Search_Query_Phrase(); - $subquery->setSlop($this->getSlop()); - - foreach ($this->_terms as $termId => $term) { - $qualifiedTerm = new Zend_Search_Lucene_Index_Term($term->text, $fieldName); - - $subquery->addTerm($qualifiedTerm, $this->_offsets[$termId]); - } - - $query->addSubquery($subquery); - } - - return $query; - } - } - - /** - * Optimize query in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function optimize(Zend_Search_Lucene_Interface $index) - { - // Check, that index contains all phrase terms - foreach ($this->_terms as $term) { - if (!$index->hasTerm($term)) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - } - - if (count($this->_terms) == 1) { - // It's one term query - $optimizedQuery = new Zend_Search_Lucene_Search_Query_Term(reset($this->_terms)); - $optimizedQuery->setBoost($this->getBoost()); - - return $optimizedQuery; - } - - if (count($this->_terms) == 0) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - - - return $this; - } - - /** - * Returns query term - * - * @return array - */ - public function getTerms() - { - return $this->_terms; - } - - - /** - * Set weight for specified term - * - * @param integer $num - * @param Zend_Search_Lucene_Search_Weight_Term $weight - */ - public function setWeight($num, $weight) - { - $this->_weights[$num] = $weight; - } - - - /** - * Constructs an appropriate Weight implementation for this query. - * - * @param Zend_Search_Lucene_Interface $reader - * @return Zend_Search_Lucene_Search_Weight - */ - public function createWeight(Zend_Search_Lucene_Interface $reader) - { - $this->_weight = new Zend_Search_Lucene_Search_Weight_Phrase($this, $reader); - return $this->_weight; - } - - - /** - * Score calculator for exact phrase queries (terms sequence is fixed) - * - * @param integer $docId - * @return float - */ - public function _exactPhraseFreq($docId) - { - $freq = 0; - - // Term Id with lowest cardinality - $lowCardTermId = null; - - // Calculate $lowCardTermId - foreach ($this->_terms as $termId => $term) { - if ($lowCardTermId === null || - count($this->_termsPositions[$termId][$docId]) < - count($this->_termsPositions[$lowCardTermId][$docId]) ) { - $lowCardTermId = $termId; - } - } - - // Walk through positions of the term with lowest cardinality - foreach ($this->_termsPositions[$lowCardTermId][$docId] as $lowCardPos) { - // We expect phrase to be found - $freq++; - - // Walk through other terms - foreach ($this->_terms as $termId => $term) { - if ($termId != $lowCardTermId) { - $expectedPosition = $lowCardPos + - ($this->_offsets[$termId] - - $this->_offsets[$lowCardTermId]); - - if (!in_array($expectedPosition, $this->_termsPositions[$termId][$docId])) { - $freq--; // Phrase wasn't found. - break; - } - } - } - } - - return $freq; - } - - /** - * Score calculator for sloppy phrase queries (terms sequence is fixed) - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function _sloppyPhraseFreq($docId, Zend_Search_Lucene_Interface $reader) - { - $freq = 0; - - $phraseQueue = array(); - $phraseQueue[0] = array(); // empty phrase - $lastTerm = null; - - // Walk through the terms to create phrases. - foreach ($this->_terms as $termId => $term) { - $queueSize = count($phraseQueue); - $firstPass = true; - - // Walk through the term positions. - // Each term position produces a set of phrases. - foreach ($this->_termsPositions[$termId][$docId] as $termPosition ) { - if ($firstPass) { - for ($count = 0; $count < $queueSize; $count++) { - $phraseQueue[$count][$termId] = $termPosition; - } - } else { - for ($count = 0; $count < $queueSize; $count++) { - if ($lastTerm !== null && - abs( $termPosition - $phraseQueue[$count][$lastTerm] - - ($this->_offsets[$termId] - $this->_offsets[$lastTerm])) > $this->_slop) { - continue; - } - - $newPhraseId = count($phraseQueue); - $phraseQueue[$newPhraseId] = $phraseQueue[$count]; - $phraseQueue[$newPhraseId][$termId] = $termPosition; - } - - } - - $firstPass = false; - } - $lastTerm = $termId; - } - - - foreach ($phraseQueue as $phrasePos) { - $minDistance = null; - - for ($shift = -$this->_slop; $shift <= $this->_slop; $shift++) { - $distance = 0; - $start = reset($phrasePos) - reset($this->_offsets) + $shift; - - foreach ($this->_terms as $termId => $term) { - $distance += abs($phrasePos[$termId] - $this->_offsets[$termId] - $start); - - if($distance > $this->_slop) { - break; - } - } - - if ($minDistance === null || $distance < $minDistance) { - $minDistance = $distance; - } - } - - if ($minDistance <= $this->_slop) { - $freq += $reader->getSimilarity()->sloppyFreq($minDistance); - } - } - - return $freq; - } - - /** - * Execute query in context of index reader - * It also initializes necessary internal structures - * - * @param Zend_Search_Lucene_Interface $reader - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - */ - public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) - { - $this->_resVector = null; - - if (count($this->_terms) == 0) { - $this->_resVector = array(); - } - - $resVectors = array(); - $resVectorsSizes = array(); - $resVectorsIds = array(); // is used to prevent arrays comparison - foreach ($this->_terms as $termId => $term) { - $resVectors[] = array_flip($reader->termDocs($term)); - $resVectorsSizes[] = count(end($resVectors)); - $resVectorsIds[] = $termId; - - $this->_termsPositions[$termId] = $reader->termPositions($term); - } - // sort resvectors in order of subquery cardinality increasing - array_multisort($resVectorsSizes, SORT_ASC, SORT_NUMERIC, - $resVectorsIds, SORT_ASC, SORT_NUMERIC, - $resVectors); - - foreach ($resVectors as $nextResVector) { - if($this->_resVector === null) { - $this->_resVector = $nextResVector; - } else { - //$this->_resVector = array_intersect_key($this->_resVector, $nextResVector); - - /** - * This code is used as workaround for array_intersect_key() slowness problem. - */ - $updatedVector = array(); - foreach ($this->_resVector as $id => $value) { - if (isset($nextResVector[$id])) { - $updatedVector[$id] = $value; - } - } - $this->_resVector = $updatedVector; - } - - if (count($this->_resVector) == 0) { - // Empty result set, we don't need to check other terms - break; - } - } - - // ksort($this->_resVector, SORT_NUMERIC); - // Docs are returned ordered. Used algorithm doesn't change elements order. - - // Initialize weight if it's not done yet - $this->_initWeight($reader); - } - - /** - * Get document ids likely matching the query - * - * It's an array with document ids as keys (performance considerations) - * - * @return array - */ - public function matchedDocs() - { - return $this->_resVector; - } - - /** - * Score specified document - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function score($docId, Zend_Search_Lucene_Interface $reader) - { - if (isset($this->_resVector[$docId])) { - if ($this->_slop == 0) { - $freq = $this->_exactPhraseFreq($docId); - } else { - $freq = $this->_sloppyPhraseFreq($docId, $reader); - } - - if ($freq != 0) { - $tf = $reader->getSimilarity()->tf($freq); - $weight = $this->_weight->getValue(); - $norm = $reader->norm($docId, reset($this->_terms)->field); - - return $tf * $weight * $norm * $this->getBoost(); - } - - // Included in result, but culculated freq is zero - return 0; - } else { - return 0; - } - } - - /** - * Return query terms - * - * @return array - */ - public function getQueryTerms() - { - return $this->_terms; - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - $words = array(); - foreach ($this->_terms as $term) { - $words[] = $term->text; - } - - $highlighter->highlight($words); - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - if (isset($this->_terms[0]) && $this->_terms[0]->field !== null) { - $query = $this->_terms[0]->field . ':'; - } else { - $query = ''; - } - - $query .= '"'; - - foreach ($this->_terms as $id => $term) { - if ($id != 0) { - $query .= ' '; - } - $query .= $term->text; - } - - $query .= '"'; - - if ($this->_slop != 0) { - $query .= '~' . $this->_slop; - } - - if ($this->getBoost() != 1) { - $query .= '^' . round($this->getBoost(), 4); - } - - return $query; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing.php b/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing.php deleted file mode 100644 index 6b2a1030b..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing.php +++ /dev/null @@ -1,120 +0,0 @@ -_word = $word; - $this->_encoding = $encoding; - $this->_field = $fieldName; - $this->_minimumSimilarity = $minimumSimilarity; - } - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - if ($this->_field === null) { - $query = new Zend_Search_Lucene_Search_Query_Boolean(); - - $hasInsignificantSubqueries = false; - - if (Zend_Search_Lucene::getDefaultSearchField() === null) { - $searchFields = $index->getFieldNames(true); - } else { - $searchFields = array(Zend_Search_Lucene::getDefaultSearchField()); - } - - foreach ($searchFields as $fieldName) { - $subquery = new Zend_Search_Lucene_Search_Query_Preprocessing_Fuzzy($this->_word, - $this->_encoding, - $fieldName, - $this->_minimumSimilarity); - - $rewrittenSubquery = $subquery->rewrite($index); - - if ( !($rewrittenSubquery instanceof Zend_Search_Lucene_Search_Query_Insignificant || - $rewrittenSubquery instanceof Zend_Search_Lucene_Search_Query_Empty) ) { - $query->addSubquery($rewrittenSubquery); - } - - if ($rewrittenSubquery instanceof Zend_Search_Lucene_Search_Query_Insignificant) { - $hasInsignificantSubqueries = true; - } - } - - $subqueries = $query->getSubqueries(); - - if (count($subqueries) == 0) { - $this->_matches = array(); - if ($hasInsignificantSubqueries) { - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } else { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - } - - if (count($subqueries) == 1) { - $query = reset($subqueries); - } - - $query->setBoost($this->getBoost()); - - $this->_matches = $query->getQueryTerms(); - return $query; - } - - // ------------------------------------- - // Recognize exact term matching (it corresponds to Keyword fields stored in the index) - // encoding is not used since we expect binary matching - $term = new Zend_Search_Lucene_Index_Term($this->_word, $this->_field); - if ($index->hasTerm($term)) { - $query = new Zend_Search_Lucene_Search_Query_Fuzzy($term, $this->_minimumSimilarity); - $query->setBoost($this->getBoost()); - - // Get rewritten query. Important! It also fills terms matching container. - $rewrittenQuery = $query->rewrite($index); - $this->_matches = $query->getQueryTerms(); - - return $rewrittenQuery; - } - - - // ------------------------------------- - // Recognize wildcard queries - - /** @todo check for PCRE unicode support may be performed through Zend_Environment in some future */ - if (@preg_match('/\pL/u', 'a') == 1) { - $subPatterns = preg_split('/[*?]/u', iconv($this->_encoding, 'UTF-8', $this->_word)); - } else { - $subPatterns = preg_split('/[*?]/', $this->_word); - } - if (count($subPatterns) > 1) { - throw new Zend_Search_Lucene_Search_QueryParserException('Fuzzy search doesn\'t support wildcards (except within Keyword fields).'); - } - - - // ------------------------------------- - // Recognize one-term multi-term and "insignificant" queries - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_word, $this->_encoding); - - if (count($tokens) == 0) { - $this->_matches = array(); - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } - - if (count($tokens) == 1) { - $term = new Zend_Search_Lucene_Index_Term($tokens[0]->getTermText(), $this->_field); - $query = new Zend_Search_Lucene_Search_Query_Fuzzy($term, $this->_minimumSimilarity); - $query->setBoost($this->getBoost()); - - // Get rewritten query. Important! It also fills terms matching container. - $rewrittenQuery = $query->rewrite($index); - $this->_matches = $query->getQueryTerms(); - - return $rewrittenQuery; - } - - // Word is tokenized into several tokens - throw new Zend_Search_Lucene_Search_QueryParserException('Fuzzy search is supported only for non-multiple word terms'); - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - /** Skip fields detection. We don't need it, since we expect all fields presented in the HTML body and don't differentiate them */ - - /** Skip exact term matching recognition, keyword fields highlighting is not supported */ - - // ------------------------------------- - // Recognize wildcard queries - - /** @todo check for PCRE unicode support may be performed through Zend_Environment in some future */ - if (@preg_match('/\pL/u', 'a') == 1) { - $subPatterns = preg_split('/[*?]/u', iconv($this->_encoding, 'UTF-8', $this->_word)); - } else { - $subPatterns = preg_split('/[*?]/', $this->_word); - } - if (count($subPatterns) > 1) { - // Do nothing - return; - } - - - // ------------------------------------- - // Recognize one-term multi-term and "insignificant" queries - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_word, $this->_encoding); - if (count($tokens) == 0) { - // Do nothing - return; - } - if (count($tokens) == 1) { - $term = new Zend_Search_Lucene_Index_Term($tokens[0]->getTermText(), $this->_field); - $query = new Zend_Search_Lucene_Search_Query_Fuzzy($term, $this->_minimumSimilarity); - - $query->_highlightMatches($highlighter); - return; - } - - // Word is tokenized into several tokens - // But fuzzy search is supported only for non-multiple word terms - // Do nothing - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - if ($this->_field !== null) { - $query = $this->_field . ':'; - } else { - $query = ''; - } - - $query .= $this->_word; - - if ($this->getBoost() != 1) { - $query .= '^' . round($this->getBoost(), 4); - } - - return $query; - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Phrase.php b/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Phrase.php deleted file mode 100644 index 905258eab..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Phrase.php +++ /dev/null @@ -1,257 +0,0 @@ -_phrase = $phrase; - $this->_phraseEncoding = $phraseEncoding; - $this->_field = $fieldName; - } - - /** - * Set slop - * - * @param integer $slop - */ - public function setSlop($slop) - { - $this->_slop = $slop; - } - - - /** - * Get slop - * - * @return integer - */ - public function getSlop() - { - return $this->_slop; - } - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { -// Allow to use wildcards within phrases -// They are either removed by text analyzer or used as a part of keyword for keyword fields -// -// if (strpos($this->_phrase, '?') !== false || strpos($this->_phrase, '*') !== false) { -// throw new Zend_Search_Lucene_Search_QueryParserException('Wildcards are only allowed in a single terms.'); -// } - - // Split query into subqueries if field name is not specified - if ($this->_field === null) { - $query = new Zend_Search_Lucene_Search_Query_Boolean(); - $query->setBoost($this->getBoost()); - - if (Zend_Search_Lucene::getDefaultSearchField() === null) { - $searchFields = $index->getFieldNames(true); - } else { - $searchFields = array(Zend_Search_Lucene::getDefaultSearchField()); - } - - foreach ($searchFields as $fieldName) { - $subquery = new Zend_Search_Lucene_Search_Query_Preprocessing_Phrase($this->_phrase, - $this->_phraseEncoding, - $fieldName); - $subquery->setSlop($this->getSlop()); - - $query->addSubquery($subquery->rewrite($index)); - } - - $this->_matches = $query->getQueryTerms(); - return $query; - } - - // Recognize exact term matching (it corresponds to Keyword fields stored in the index) - // encoding is not used since we expect binary matching - $term = new Zend_Search_Lucene_Index_Term($this->_phrase, $this->_field); - if ($index->hasTerm($term)) { - $query = new Zend_Search_Lucene_Search_Query_Term($term); - $query->setBoost($this->getBoost()); - - $this->_matches = $query->getQueryTerms(); - return $query; - } - - - // tokenize phrase using current analyzer and process it as a phrase query - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_phrase, $this->_phraseEncoding); - - if (count($tokens) == 0) { - $this->_matches = array(); - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } - - if (count($tokens) == 1) { - $term = new Zend_Search_Lucene_Index_Term($tokens[0]->getTermText(), $this->_field); - $query = new Zend_Search_Lucene_Search_Query_Term($term); - $query->setBoost($this->getBoost()); - - $this->_matches = $query->getQueryTerms(); - return $query; - } - - //It's non-trivial phrase query - $position = -1; - $query = new Zend_Search_Lucene_Search_Query_Phrase(); - foreach ($tokens as $token) { - $position += $token->getPositionIncrement(); - $term = new Zend_Search_Lucene_Index_Term($token->getTermText(), $this->_field); - $query->addTerm($term, $position); - $query->setSlop($this->getSlop()); - } - $this->_matches = $query->getQueryTerms(); - return $query; - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - /** Skip fields detection. We don't need it, since we expect all fields presented in the HTML body and don't differentiate them */ - - /** Skip exact term matching recognition, keyword fields highlighting is not supported */ - - /** Skip wildcard queries recognition. Supported wildcards are removed by text analyzer */ - - - // tokenize phrase using current analyzer and process it as a phrase query - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_phrase, $this->_phraseEncoding); - - if (count($tokens) == 0) { - // Do nothing - return; - } - - if (count($tokens) == 1) { - $highlighter->highlight($tokens[0]->getTermText()); - return; - } - - //It's non-trivial phrase query - $words = array(); - foreach ($tokens as $token) { - $words[] = $token->getTermText(); - } - $highlighter->highlight($words); - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - if ($this->_field !== null) { - $query = $this->_field . ':'; - } else { - $query = ''; - } - - $query .= '"' . $this->_phrase . '"'; - - if ($this->_slop != 0) { - $query .= '~' . $this->_slop; - } - - if ($this->getBoost() != 1) { - $query .= '^' . round($this->getBoost(), 4); - } - - return $query; - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Term.php b/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Term.php deleted file mode 100644 index 2a90fde1b..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Preprocessing/Term.php +++ /dev/null @@ -1,319 +0,0 @@ -_word = $word; - $this->_encoding = $encoding; - $this->_field = $fieldName; - } - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - if ($this->_field === null) { - $query = new Zend_Search_Lucene_Search_Query_MultiTerm(); - $query->setBoost($this->getBoost()); - - $hasInsignificantSubqueries = false; - - if (Zend_Search_Lucene::getDefaultSearchField() === null) { - $searchFields = $index->getFieldNames(true); - } else { - $searchFields = array(Zend_Search_Lucene::getDefaultSearchField()); - } - - foreach ($searchFields as $fieldName) { - $subquery = new Zend_Search_Lucene_Search_Query_Preprocessing_Term($this->_word, - $this->_encoding, - $fieldName); - $rewrittenSubquery = $subquery->rewrite($index); - foreach ($rewrittenSubquery->getQueryTerms() as $term) { - $query->addTerm($term); - } - - if ($rewrittenSubquery instanceof Zend_Search_Lucene_Search_Query_Insignificant) { - $hasInsignificantSubqueries = true; - } - } - - if (count($query->getTerms()) == 0) { - $this->_matches = array(); - if ($hasInsignificantSubqueries) { - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } else { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - } - - $this->_matches = $query->getQueryTerms(); - return $query; - } - - // ------------------------------------- - // Recognize exact term matching (it corresponds to Keyword fields stored in the index) - // encoding is not used since we expect binary matching - $term = new Zend_Search_Lucene_Index_Term($this->_word, $this->_field); - if ($index->hasTerm($term)) { - $query = new Zend_Search_Lucene_Search_Query_Term($term); - $query->setBoost($this->getBoost()); - - $this->_matches = $query->getQueryTerms(); - return $query; - } - - - // ------------------------------------- - // Recognize wildcard queries - - /** @todo check for PCRE unicode support may be performed through Zend_Environment in some future */ - if (@preg_match('/\pL/u', 'a') == 1) { - $word = iconv($this->_encoding, 'UTF-8', $this->_word); - $wildcardsPattern = '/[*?]/u'; - $subPatternsEncoding = 'UTF-8'; - } else { - $word = $this->_word; - $wildcardsPattern = '/[*?]/'; - $subPatternsEncoding = $this->_encoding; - } - - $subPatterns = preg_split($wildcardsPattern, $word, -1, PREG_SPLIT_OFFSET_CAPTURE); - - if (count($subPatterns) > 1) { - // Wildcard query is recognized - - $pattern = ''; - - foreach ($subPatterns as $id => $subPattern) { - // Append corresponding wildcard character to the pattern before each sub-pattern (except first) - if ($id != 0) { - $pattern .= $word[ $subPattern[1] - 1 ]; - } - - // Check if each subputtern is a single word in terms of current analyzer - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($subPattern[0], $subPatternsEncoding); - if (count($tokens) > 1) { - throw new Zend_Search_Lucene_Search_QueryParserException('Wildcard search is supported only for non-multiple word terms'); - } - foreach ($tokens as $token) { - $pattern .= $token->getTermText(); - } - } - - $term = new Zend_Search_Lucene_Index_Term($pattern, $this->_field); - $query = new Zend_Search_Lucene_Search_Query_Wildcard($term); - $query->setBoost($this->getBoost()); - - // Get rewritten query. Important! It also fills terms matching container. - $rewrittenQuery = $query->rewrite($index); - $this->_matches = $query->getQueryTerms(); - - return $rewrittenQuery; - } - - - // ------------------------------------- - // Recognize one-term multi-term and "insignificant" queries - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_word, $this->_encoding); - - if (count($tokens) == 0) { - $this->_matches = array(); - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } - - if (count($tokens) == 1) { - $term = new Zend_Search_Lucene_Index_Term($tokens[0]->getTermText(), $this->_field); - $query = new Zend_Search_Lucene_Search_Query_Term($term); - $query->setBoost($this->getBoost()); - - $this->_matches = $query->getQueryTerms(); - return $query; - } - - //It's not insignificant or one term query - $query = new Zend_Search_Lucene_Search_Query_MultiTerm(); - - /** - * @todo Process $token->getPositionIncrement() to support stemming, synonyms and other - * analizer design features - */ - foreach ($tokens as $token) { - $term = new Zend_Search_Lucene_Index_Term($token->getTermText(), $this->_field); - $query->addTerm($term, true); // all subterms are required - } - - $query->setBoost($this->getBoost()); - - $this->_matches = $query->getQueryTerms(); - return $query; - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - /** Skip fields detection. We don't need it, since we expect all fields presented in the HTML body and don't differentiate them */ - - /** Skip exact term matching recognition, keyword fields highlighting is not supported */ - - // ------------------------------------- - // Recognize wildcard queries - /** @todo check for PCRE unicode support may be performed through Zend_Environment in some future */ - if (@preg_match('/\pL/u', 'a') == 1) { - $word = iconv($this->_encoding, 'UTF-8', $this->_word); - $wildcardsPattern = '/[*?]/u'; - $subPatternsEncoding = 'UTF-8'; - } else { - $word = $this->_word; - $wildcardsPattern = '/[*?]/'; - $subPatternsEncoding = $this->_encoding; - } - $subPatterns = preg_split($wildcardsPattern, $word, -1, PREG_SPLIT_OFFSET_CAPTURE); - if (count($subPatterns) > 1) { - // Wildcard query is recognized - - $pattern = ''; - - foreach ($subPatterns as $id => $subPattern) { - // Append corresponding wildcard character to the pattern before each sub-pattern (except first) - if ($id != 0) { - $pattern .= $word[ $subPattern[1] - 1 ]; - } - - // Check if each subputtern is a single word in terms of current analyzer - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($subPattern[0], $subPatternsEncoding); - if (count($tokens) > 1) { - // Do nothing (nothing is highlighted) - return; - } - foreach ($tokens as $token) { - $pattern .= $token->getTermText(); - } - } - - $term = new Zend_Search_Lucene_Index_Term($pattern, $this->_field); - $query = new Zend_Search_Lucene_Search_Query_Wildcard($term); - - $query->_highlightMatches($highlighter); - return; - } - - - // ------------------------------------- - // Recognize one-term multi-term and "insignificant" queries - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_word, $this->_encoding); - - if (count($tokens) == 0) { - // Do nothing - return; - } - - if (count($tokens) == 1) { - $highlighter->highlight($tokens[0]->getTermText()); - return; - } - - //It's not insignificant or one term query - $words = array(); - foreach ($tokens as $token) { - $words[] = $token->getTermText(); - } - $highlighter->highlight($words); - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - if ($this->_field !== null) { - $query = $this->_field . ':'; - } else { - $query = ''; - } - - $query .= $this->_word; - - if ($this->getBoost() != 1) { - $query .= '^' . round($this->getBoost(), 4); - } - - return $query; - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Range.php b/library/vendor/Zend/Search/Lucene/Search/Query/Range.php deleted file mode 100644 index f04c0dd88..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Range.php +++ /dev/null @@ -1,360 +0,0 @@ -field != $upperTerm->field) { - throw new Zend_Search_Lucene_Exception('Both terms must be for the same field'); - } - - $this->_field = ($lowerTerm !== null)? $lowerTerm->field : $upperTerm->field; - $this->_lowerTerm = $lowerTerm; - $this->_upperTerm = $upperTerm; - $this->_inclusive = $inclusive; - } - - /** - * Get query field name - * - * @return string|null - */ - public function getField() - { - return $this->_field; - } - - /** - * Get lower term - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function getLowerTerm() - { - return $this->_lowerTerm; - } - - /** - * Get upper term - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function getUpperTerm() - { - return $this->_upperTerm; - } - - /** - * Get upper term - * - * @return boolean - */ - public function isInclusive() - { - return $this->_inclusive; - } - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - $this->_matches = array(); - - if ($this->_field === null) { - // Search through all fields - $fields = $index->getFieldNames(true /* indexed fields list */); - } else { - $fields = array($this->_field); - } - - $maxTerms = Zend_Search_Lucene::getTermsPerQueryLimit(); - foreach ($fields as $field) { - $index->resetTermsStream(); - - if ($this->_lowerTerm !== null) { - $lowerTerm = new Zend_Search_Lucene_Index_Term($this->_lowerTerm->text, $field); - - $index->skipTo($lowerTerm); - - if (!$this->_inclusive && - $index->currentTerm() == $lowerTerm) { - // Skip lower term - $index->nextTerm(); - } - } else { - $index->skipTo(new Zend_Search_Lucene_Index_Term('', $field)); - } - - - if ($this->_upperTerm !== null) { - // Walk up to the upper term - $upperTerm = new Zend_Search_Lucene_Index_Term($this->_upperTerm->text, $field); - - while ($index->currentTerm() !== null && - $index->currentTerm()->field == $field && - strcmp($index->currentTerm()->text, $upperTerm->text) < 0) { - $this->_matches[] = $index->currentTerm(); - - if ($maxTerms != 0 && count($this->_matches) > $maxTerms) { - throw new Zend_Search_Lucene_Exception('Terms per query limit is reached.'); - } - - $index->nextTerm(); - } - - if ($this->_inclusive && $index->currentTerm() == $upperTerm) { - // Include upper term into result - $this->_matches[] = $upperTerm; - } - } else { - // Walk up to the end of field data - while ($index->currentTerm() !== null && $index->currentTerm()->field == $field) { - $this->_matches[] = $index->currentTerm(); - - if ($maxTerms != 0 && count($this->_matches) > $maxTerms) { - throw new Zend_Search_Lucene_Exception('Terms per query limit is reached.'); - } - - $index->nextTerm(); - } - } - - $index->closeTermsStream(); - } - - if (count($this->_matches) == 0) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } else if (count($this->_matches) == 1) { - return new Zend_Search_Lucene_Search_Query_Term(reset($this->_matches)); - } else { - $rewrittenQuery = new Zend_Search_Lucene_Search_Query_MultiTerm(); - - foreach ($this->_matches as $matchedTerm) { - $rewrittenQuery->addTerm($matchedTerm); - } - - return $rewrittenQuery; - } - } - - /** - * Optimize query in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function optimize(Zend_Search_Lucene_Interface $index) - { - throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Return query terms - * - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function getQueryTerms() - { - if ($this->_matches === null) { - throw new Zend_Search_Lucene_Exception('Search or rewrite operations have to be performed before.'); - } - - return $this->_matches; - } - - /** - * Constructs an appropriate Weight implementation for this query. - * - * @param Zend_Search_Lucene_Interface $reader - * @return Zend_Search_Lucene_Search_Weight - * @throws Zend_Search_Lucene_Exception - */ - public function createWeight(Zend_Search_Lucene_Interface $reader) - { - throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); - } - - - /** - * Execute query in context of index reader - * It also initializes necessary internal structures - * - * @param Zend_Search_Lucene_Interface $reader - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @throws Zend_Search_Lucene_Exception - */ - public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) - { - throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Get document ids likely matching the query - * - * It's an array with document ids as keys (performance considerations) - * - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function matchedDocs() - { - throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Score specified document - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - * @throws Zend_Search_Lucene_Exception - */ - public function score($docId, Zend_Search_Lucene_Interface $reader) - { - throw new Zend_Search_Lucene_Exception('Range query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - $words = array(); - - $docBody = $highlighter->getDocument()->getFieldUtf8Value('body'); - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($docBody, 'UTF-8'); - - $lowerTermText = ($this->_lowerTerm !== null)? $this->_lowerTerm->text : null; - $upperTermText = ($this->_upperTerm !== null)? $this->_upperTerm->text : null; - - if ($this->_inclusive) { - foreach ($tokens as $token) { - $termText = $token->getTermText(); - if (($lowerTermText == null || $lowerTermText <= $termText) && - ($upperTermText == null || $termText <= $upperTermText)) { - $words[] = $termText; - } - } - } else { - foreach ($tokens as $token) { - $termText = $token->getTermText(); - if (($lowerTermText == null || $lowerTermText < $termText) && - ($upperTermText == null || $termText < $upperTermText)) { - $words[] = $termText; - } - } - } - - $highlighter->highlight($words); - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - return (($this->_field === null)? '' : $this->_field . ':') - . (($this->_inclusive)? '[' : '{') - . (($this->_lowerTerm !== null)? $this->_lowerTerm->text : 'null') - . ' TO ' - . (($this->_upperTerm !== null)? $this->_upperTerm->text : 'null') - . (($this->_inclusive)? ']' : '}') - . (($this->getBoost() != 1)? '^' . round($this->getBoost(), 4) : ''); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Term.php b/library/vendor/Zend/Search/Lucene/Search/Query/Term.php deleted file mode 100644 index 0b0ebe9a1..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Term.php +++ /dev/null @@ -1,223 +0,0 @@ - freq, ...) - * - * @var array - */ - private $_termFreqs; - - - /** - * Zend_Search_Lucene_Search_Query_Term constructor - * - * @param Zend_Search_Lucene_Index_Term $term - * @param boolean $sign - */ - public function __construct(Zend_Search_Lucene_Index_Term $term) - { - $this->_term = $term; - } - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - if ($this->_term->field != null) { - return $this; - } else { - $query = new Zend_Search_Lucene_Search_Query_MultiTerm(); - $query->setBoost($this->getBoost()); - - foreach ($index->getFieldNames(true) as $fieldName) { - $term = new Zend_Search_Lucene_Index_Term($this->_term->text, $fieldName); - - $query->addTerm($term); - } - - return $query->rewrite($index); - } - } - - /** - * Optimize query in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function optimize(Zend_Search_Lucene_Interface $index) - { - // Check, that index contains specified term - if (!$index->hasTerm($this->_term)) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } - - return $this; - } - - - /** - * Constructs an appropriate Weight implementation for this query. - * - * @param Zend_Search_Lucene_Interface $reader - * @return Zend_Search_Lucene_Search_Weight - */ - public function createWeight(Zend_Search_Lucene_Interface $reader) - { - $this->_weight = new Zend_Search_Lucene_Search_Weight_Term($this->_term, $this, $reader); - return $this->_weight; - } - - /** - * Execute query in context of index reader - * It also initializes necessary internal structures - * - * @param Zend_Search_Lucene_Interface $reader - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - */ - public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) - { - $this->_docVector = array_flip($reader->termDocs($this->_term, $docsFilter)); - $this->_termFreqs = $reader->termFreqs($this->_term, $docsFilter); - - // Initialize weight if it's not done yet - $this->_initWeight($reader); - } - - /** - * Get document ids likely matching the query - * - * It's an array with document ids as keys (performance considerations) - * - * @return array - */ - public function matchedDocs() - { - return $this->_docVector; - } - - /** - * Score specified document - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - */ - public function score($docId, Zend_Search_Lucene_Interface $reader) - { - if (isset($this->_docVector[$docId])) { - return $reader->getSimilarity()->tf($this->_termFreqs[$docId]) * - $this->_weight->getValue() * - $reader->norm($docId, $this->_term->field) * - $this->getBoost(); - } else { - return 0; - } - } - - /** - * Return query terms - * - * @return array - */ - public function getQueryTerms() - { - return array($this->_term); - } - - /** - * Return query term - * - * @return Zend_Search_Lucene_Index_Term - */ - public function getTerm() - { - return $this->_term; - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - $highlighter->highlight($this->_term->text); - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - if ($this->_term->field !== null) { - $query = $this->_term->field . ':'; - } else { - $query = ''; - } - - $query .= $this->_term->text; - - if ($this->getBoost() != 1) { - $query = $query . '^' . round($this->getBoost(), 4); - } - - return $query; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Query/Wildcard.php b/library/vendor/Zend/Search/Lucene/Search/Query/Wildcard.php deleted file mode 100644 index 2a4ca12a8..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Query/Wildcard.php +++ /dev/null @@ -1,347 +0,0 @@ -_pattern = $pattern; - } - - /** - * Get minimum prefix length - * - * @return integer - */ - public static function getMinPrefixLength() - { - return self::$_minPrefixLength; - } - - /** - * Set minimum prefix length - * - * @param integer $minPrefixLength - */ - public static function setMinPrefixLength($minPrefixLength) - { - self::$_minPrefixLength = $minPrefixLength; - } - - /** - * Get terms prefix - * - * @param string $word - * @return string - */ - private static function _getPrefix($word) - { - $questionMarkPosition = strpos($word, '?'); - $astrericPosition = strpos($word, '*'); - - if ($questionMarkPosition !== false) { - if ($astrericPosition !== false) { - return substr($word, 0, min($questionMarkPosition, $astrericPosition)); - } - - return substr($word, 0, $questionMarkPosition); - } else if ($astrericPosition !== false) { - return substr($word, 0, $astrericPosition); - } - - return $word; - } - - /** - * Re-write query into primitive queries in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - * @throws Zend_Search_Lucene_Exception - */ - public function rewrite(Zend_Search_Lucene_Interface $index) - { - $this->_matches = array(); - - if ($this->_pattern->field === null) { - // Search through all fields - $fields = $index->getFieldNames(true /* indexed fields list */); - } else { - $fields = array($this->_pattern->field); - } - - $prefix = self::_getPrefix($this->_pattern->text); - $prefixLength = strlen($prefix); - $matchExpression = '/^' . str_replace(array('\\?', '\\*'), array('.', '.*') , preg_quote($this->_pattern->text, '/')) . '$/'; - - if ($prefixLength < self::$_minPrefixLength) { - throw new Zend_Search_Lucene_Exception('At least ' . self::$_minPrefixLength . ' non-wildcard characters are required at the beginning of pattern.'); - } - - /** @todo check for PCRE unicode support may be performed through Zend_Environment in some future */ - if (@preg_match('/\pL/u', 'a') == 1) { - // PCRE unicode support is turned on - // add Unicode modifier to the match expression - $matchExpression .= 'u'; - } - - $maxTerms = Zend_Search_Lucene::getTermsPerQueryLimit(); - foreach ($fields as $field) { - $index->resetTermsStream(); - - if ($prefix != '') { - $index->skipTo(new Zend_Search_Lucene_Index_Term($prefix, $field)); - - while ($index->currentTerm() !== null && - $index->currentTerm()->field == $field && - substr($index->currentTerm()->text, 0, $prefixLength) == $prefix) { - if (preg_match($matchExpression, $index->currentTerm()->text) === 1) { - $this->_matches[] = $index->currentTerm(); - - if ($maxTerms != 0 && count($this->_matches) > $maxTerms) { - throw new Zend_Search_Lucene_Exception('Terms per query limit is reached.'); - } - } - - $index->nextTerm(); - } - } else { - $index->skipTo(new Zend_Search_Lucene_Index_Term('', $field)); - - while ($index->currentTerm() !== null && $index->currentTerm()->field == $field) { - if (preg_match($matchExpression, $index->currentTerm()->text) === 1) { - $this->_matches[] = $index->currentTerm(); - - if ($maxTerms != 0 && count($this->_matches) > $maxTerms) { - throw new Zend_Search_Lucene_Exception('Terms per query limit is reached.'); - } - } - - $index->nextTerm(); - } - } - - $index->closeTermsStream(); - } - - if (count($this->_matches) == 0) { - return new Zend_Search_Lucene_Search_Query_Empty(); - } else if (count($this->_matches) == 1) { - return new Zend_Search_Lucene_Search_Query_Term(reset($this->_matches)); - } else { - $rewrittenQuery = new Zend_Search_Lucene_Search_Query_MultiTerm(); - - foreach ($this->_matches as $matchedTerm) { - $rewrittenQuery->addTerm($matchedTerm); - } - - return $rewrittenQuery; - } - } - - /** - * Optimize query in the context of specified index - * - * @param Zend_Search_Lucene_Interface $index - * @return Zend_Search_Lucene_Search_Query - */ - public function optimize(Zend_Search_Lucene_Interface $index) - { - throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); - } - - - /** - * Returns query pattern - * - * @return Zend_Search_Lucene_Index_Term - */ - public function getPattern() - { - return $this->_pattern; - } - - - /** - * Return query terms - * - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function getQueryTerms() - { - if ($this->_matches === null) { - throw new Zend_Search_Lucene_Exception('Search has to be performed first to get matched terms'); - } - - return $this->_matches; - } - - /** - * Constructs an appropriate Weight implementation for this query. - * - * @param Zend_Search_Lucene_Interface $reader - * @return Zend_Search_Lucene_Search_Weight - * @throws Zend_Search_Lucene_Exception - */ - public function createWeight(Zend_Search_Lucene_Interface $reader) - { - throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); - } - - - /** - * Execute query in context of index reader - * It also initializes necessary internal structures - * - * @param Zend_Search_Lucene_Interface $reader - * @param Zend_Search_Lucene_Index_DocsFilter|null $docsFilter - * @throws Zend_Search_Lucene_Exception - */ - public function execute(Zend_Search_Lucene_Interface $reader, $docsFilter = null) - { - throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Get document ids likely matching the query - * - * It's an array with document ids as keys (performance considerations) - * - * @return array - * @throws Zend_Search_Lucene_Exception - */ - public function matchedDocs() - { - throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Score specified document - * - * @param integer $docId - * @param Zend_Search_Lucene_Interface $reader - * @return float - * @throws Zend_Search_Lucene_Exception - */ - public function score($docId, Zend_Search_Lucene_Interface $reader) - { - throw new Zend_Search_Lucene_Exception('Wildcard query should not be directly used for search. Use $query->rewrite($index)'); - } - - /** - * Query specific matches highlighting - * - * @param Zend_Search_Lucene_Search_Highlighter_Interface $highlighter Highlighter object (also contains doc for highlighting) - */ - protected function _highlightMatches(Zend_Search_Lucene_Search_Highlighter_Interface $highlighter) - { - $words = array(); - - $matchExpression = '/^' . str_replace(array('\\?', '\\*'), array('.', '.*') , preg_quote($this->_pattern->text, '/')) . '$/'; - if (@preg_match('/\pL/u', 'a') == 1) { - // PCRE unicode support is turned on - // add Unicode modifier to the match expression - $matchExpression .= 'u'; - } - - $docBody = $highlighter->getDocument()->getFieldUtf8Value('body'); - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($docBody, 'UTF-8'); - foreach ($tokens as $token) { - if (preg_match($matchExpression, $token->getTermText()) === 1) { - $words[] = $token->getTermText(); - } - } - - $highlighter->highlight($words); - } - - /** - * Print a query - * - * @return string - */ - public function __toString() - { - // It's used only for query visualisation, so we don't care about characters escaping - if ($this->_pattern->field !== null) { - $query = $this->_pattern->field . ':'; - } else { - $query = ''; - } - - $query .= $this->_pattern->text; - - if ($this->getBoost() != 1) { - $query = $query . '^' . round($this->getBoost(), 4); - } - - return $query; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryEntry.php b/library/vendor/Zend/Search/Lucene/Search/QueryEntry.php deleted file mode 100644 index 5214a40d0..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryEntry.php +++ /dev/null @@ -1,67 +0,0 @@ -_boost *= $boostFactor; - } - - -} diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Phrase.php b/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Phrase.php deleted file mode 100644 index fefe02cf0..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Phrase.php +++ /dev/null @@ -1,114 +0,0 @@ -_phrase = $phrase; - $this->_field = $field; - } - - /** - * Process modifier ('~') - * - * @param mixed $parameter - */ - public function processFuzzyProximityModifier($parameter = null) - { - $this->_proximityQuery = true; - - if ($parameter !== null) { - $this->_wordsDistance = $parameter; - } - } - - /** - * Transform entry to a subquery - * - * @param string $encoding - * @return Zend_Search_Lucene_Search_Query - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public function getQuery($encoding) - { - /** Zend_Search_Lucene_Search_Query_Preprocessing_Phrase */ - $query = new Zend_Search_Lucene_Search_Query_Preprocessing_Phrase($this->_phrase, - $encoding, - ($this->_field !== null)? - iconv($encoding, 'UTF-8', $this->_field) : - null); - - if ($this->_proximityQuery) { - $query->setSlop($this->_wordsDistance); - } - - $query->setBoost($this->_boost); - - return $query; - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Subquery.php b/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Subquery.php deleted file mode 100644 index 6dc31c9b8..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Subquery.php +++ /dev/null @@ -1,75 +0,0 @@ -_query = $query; - } - - /** - * Process modifier ('~') - * - * @param mixed $parameter - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public function processFuzzyProximityModifier($parameter = null) - { - throw new Zend_Search_Lucene_Search_QueryParserException('\'~\' sign must follow term or phrase'); - } - - - /** - * Transform entry to a subquery - * - * @param string $encoding - * @return Zend_Search_Lucene_Search_Query - */ - public function getQuery($encoding) - { - $this->_query->setBoost($this->_boost); - - return $this->_query; - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Term.php b/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Term.php deleted file mode 100644 index 0b722cbbd..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryEntry/Term.php +++ /dev/null @@ -1,126 +0,0 @@ -_term = $term; - $this->_field = $field; - } - - /** - * Process modifier ('~') - * - * @param mixed $parameter - */ - public function processFuzzyProximityModifier($parameter = null) - { - $this->_fuzzyQuery = true; - - if ($parameter !== null) { - $this->_similarity = $parameter; - } else { - /** Zend_Search_Lucene_Search_Query_Fuzzy */ - $this->_similarity = Zend_Search_Lucene_Search_Query_Fuzzy::DEFAULT_MIN_SIMILARITY; - } - } - - /** - * Transform entry to a subquery - * - * @param string $encoding - * @return Zend_Search_Lucene_Search_Query - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public function getQuery($encoding) - { - if ($this->_fuzzyQuery) { - /** Zend_Search_Lucene_Search_Query_Preprocessing_Fuzzy */ - $query = new Zend_Search_Lucene_Search_Query_Preprocessing_Fuzzy($this->_term, - $encoding, - ($this->_field !== null)? - iconv($encoding, 'UTF-8', $this->_field) : - null, - $this->_similarity - ); - $query->setBoost($this->_boost); - return $query; - } - - - /** Zend_Search_Lucene_Search_Query_Preprocessing_Term */ - $query = new Zend_Search_Lucene_Search_Query_Preprocessing_Term($this->_term, - $encoding, - ($this->_field !== null)? - iconv($encoding, 'UTF-8', $this->_field) : - null - ); - $query->setBoost($this->_boost); - return $query; - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryHit.php b/library/vendor/Zend/Search/Lucene/Search/QueryHit.php deleted file mode 100644 index df9fd92ca..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryHit.php +++ /dev/null @@ -1,109 +0,0 @@ -_index = new Zend_Search_Lucene_Proxy($index); - } - - - /** - * Convenience function for getting fields from the document - * associated with this hit. - * - * @param string $offset - * @return string - */ - public function __get($offset) - { - return $this->getDocument()->getFieldValue($offset); - } - - - /** - * Return the document object for this hit - * - * @return Zend_Search_Lucene_Document - */ - public function getDocument() - { - if (!$this->_document instanceof Zend_Search_Lucene_Document) { - $this->_document = $this->_index->getDocument($this->id); - } - - return $this->_document; - } - - - /** - * Return the index object for this hit - * - * @return Zend_Search_Lucene_Interface - */ - public function getIndex() - { - return $this->_index; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryLexer.php b/library/vendor/Zend/Search/Lucene/Search/QueryLexer.php deleted file mode 100644 index 00181ce2b..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryLexer.php +++ /dev/null @@ -1,502 +0,0 @@ -addRules(array( array(self::ST_WHITE_SPACE, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), - array(self::ST_WHITE_SPACE, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_WHITE_SPACE, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_WHITE_SPACE, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), - array(self::ST_WHITE_SPACE, self::IN_ESCAPE_CHAR, self::ST_ESCAPED_CHAR), - array(self::ST_WHITE_SPACE, self::IN_QUOTE, self::ST_QUOTED_LEXEME), - array(self::ST_WHITE_SPACE, self::IN_DECIMAL_POINT, self::ST_LEXEME), - array(self::ST_WHITE_SPACE, self::IN_ASCII_DIGIT, self::ST_LEXEME), - array(self::ST_WHITE_SPACE, self::IN_CHAR, self::ST_LEXEME) - )); - $this->addRules(array( array(self::ST_SYNT_LEXEME, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), - array(self::ST_SYNT_LEXEME, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_SYNT_LEXEME, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_SYNT_LEXEME, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), - array(self::ST_SYNT_LEXEME, self::IN_ESCAPE_CHAR, self::ST_ESCAPED_CHAR), - array(self::ST_SYNT_LEXEME, self::IN_QUOTE, self::ST_QUOTED_LEXEME), - array(self::ST_SYNT_LEXEME, self::IN_DECIMAL_POINT, self::ST_LEXEME), - array(self::ST_SYNT_LEXEME, self::IN_ASCII_DIGIT, self::ST_LEXEME), - array(self::ST_SYNT_LEXEME, self::IN_CHAR, self::ST_LEXEME) - )); - $this->addRules(array( array(self::ST_LEXEME, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), - array(self::ST_LEXEME, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_LEXEME, self::IN_MUTABLE_CHAR, self::ST_LEXEME), - array(self::ST_LEXEME, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), - array(self::ST_LEXEME, self::IN_ESCAPE_CHAR, self::ST_ESCAPED_CHAR), - - // IN_QUOTE not allowed - array(self::ST_LEXEME, self::IN_QUOTE, self::ST_ERROR, $quoteWithinLexemeErrorAction), - - array(self::ST_LEXEME, self::IN_DECIMAL_POINT, self::ST_LEXEME), - array(self::ST_LEXEME, self::IN_ASCII_DIGIT, self::ST_LEXEME), - array(self::ST_LEXEME, self::IN_CHAR, self::ST_LEXEME) - )); - $this->addRules(array( array(self::ST_QUOTED_LEXEME, self::IN_WHITE_SPACE, self::ST_QUOTED_LEXEME), - array(self::ST_QUOTED_LEXEME, self::IN_SYNT_CHAR, self::ST_QUOTED_LEXEME), - array(self::ST_QUOTED_LEXEME, self::IN_MUTABLE_CHAR, self::ST_QUOTED_LEXEME), - array(self::ST_QUOTED_LEXEME, self::IN_LEXEME_MODIFIER, self::ST_QUOTED_LEXEME), - array(self::ST_QUOTED_LEXEME, self::IN_ESCAPE_CHAR, self::ST_ESCAPED_QCHAR), - array(self::ST_QUOTED_LEXEME, self::IN_QUOTE, self::ST_WHITE_SPACE), - array(self::ST_QUOTED_LEXEME, self::IN_DECIMAL_POINT, self::ST_QUOTED_LEXEME), - array(self::ST_QUOTED_LEXEME, self::IN_ASCII_DIGIT, self::ST_QUOTED_LEXEME), - array(self::ST_QUOTED_LEXEME, self::IN_CHAR, self::ST_QUOTED_LEXEME) - )); - $this->addRules(array( array(self::ST_ESCAPED_CHAR, self::IN_WHITE_SPACE, self::ST_LEXEME), - array(self::ST_ESCAPED_CHAR, self::IN_SYNT_CHAR, self::ST_LEXEME), - array(self::ST_ESCAPED_CHAR, self::IN_MUTABLE_CHAR, self::ST_LEXEME), - array(self::ST_ESCAPED_CHAR, self::IN_LEXEME_MODIFIER, self::ST_LEXEME), - array(self::ST_ESCAPED_CHAR, self::IN_ESCAPE_CHAR, self::ST_LEXEME), - array(self::ST_ESCAPED_CHAR, self::IN_QUOTE, self::ST_LEXEME), - array(self::ST_ESCAPED_CHAR, self::IN_DECIMAL_POINT, self::ST_LEXEME), - array(self::ST_ESCAPED_CHAR, self::IN_ASCII_DIGIT, self::ST_LEXEME), - array(self::ST_ESCAPED_CHAR, self::IN_CHAR, self::ST_LEXEME) - )); - $this->addRules(array( array(self::ST_ESCAPED_QCHAR, self::IN_WHITE_SPACE, self::ST_QUOTED_LEXEME), - array(self::ST_ESCAPED_QCHAR, self::IN_SYNT_CHAR, self::ST_QUOTED_LEXEME), - array(self::ST_ESCAPED_QCHAR, self::IN_MUTABLE_CHAR, self::ST_QUOTED_LEXEME), - array(self::ST_ESCAPED_QCHAR, self::IN_LEXEME_MODIFIER, self::ST_QUOTED_LEXEME), - array(self::ST_ESCAPED_QCHAR, self::IN_ESCAPE_CHAR, self::ST_QUOTED_LEXEME), - array(self::ST_ESCAPED_QCHAR, self::IN_QUOTE, self::ST_QUOTED_LEXEME), - array(self::ST_ESCAPED_QCHAR, self::IN_DECIMAL_POINT, self::ST_QUOTED_LEXEME), - array(self::ST_ESCAPED_QCHAR, self::IN_ASCII_DIGIT, self::ST_QUOTED_LEXEME), - array(self::ST_ESCAPED_QCHAR, self::IN_CHAR, self::ST_QUOTED_LEXEME) - )); - $this->addRules(array( array(self::ST_LEXEME_MODIFIER, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), - array(self::ST_LEXEME_MODIFIER, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_LEXEME_MODIFIER, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_LEXEME_MODIFIER, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), - - // IN_ESCAPE_CHAR not allowed - array(self::ST_LEXEME_MODIFIER, self::IN_ESCAPE_CHAR, self::ST_ERROR, $lexemeModifierErrorAction), - - // IN_QUOTE not allowed - array(self::ST_LEXEME_MODIFIER, self::IN_QUOTE, self::ST_ERROR, $lexemeModifierErrorAction), - - - array(self::ST_LEXEME_MODIFIER, self::IN_DECIMAL_POINT, self::ST_MANTISSA), - array(self::ST_LEXEME_MODIFIER, self::IN_ASCII_DIGIT, self::ST_NUMBER), - - // IN_CHAR not allowed - array(self::ST_LEXEME_MODIFIER, self::IN_CHAR, self::ST_ERROR, $lexemeModifierErrorAction), - )); - $this->addRules(array( array(self::ST_NUMBER, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), - array(self::ST_NUMBER, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_NUMBER, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_NUMBER, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), - - // IN_ESCAPE_CHAR not allowed - array(self::ST_NUMBER, self::IN_ESCAPE_CHAR, self::ST_ERROR, $wrongNumberErrorAction), - - // IN_QUOTE not allowed - array(self::ST_NUMBER, self::IN_QUOTE, self::ST_ERROR, $wrongNumberErrorAction), - - array(self::ST_NUMBER, self::IN_DECIMAL_POINT, self::ST_MANTISSA), - array(self::ST_NUMBER, self::IN_ASCII_DIGIT, self::ST_NUMBER), - - // IN_CHAR not allowed - array(self::ST_NUMBER, self::IN_CHAR, self::ST_ERROR, $wrongNumberErrorAction), - )); - $this->addRules(array( array(self::ST_MANTISSA, self::IN_WHITE_SPACE, self::ST_WHITE_SPACE), - array(self::ST_MANTISSA, self::IN_SYNT_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_MANTISSA, self::IN_MUTABLE_CHAR, self::ST_SYNT_LEXEME), - array(self::ST_MANTISSA, self::IN_LEXEME_MODIFIER, self::ST_LEXEME_MODIFIER), - - // IN_ESCAPE_CHAR not allowed - array(self::ST_MANTISSA, self::IN_ESCAPE_CHAR, self::ST_ERROR, $wrongNumberErrorAction), - - // IN_QUOTE not allowed - array(self::ST_MANTISSA, self::IN_QUOTE, self::ST_ERROR, $wrongNumberErrorAction), - - // IN_DECIMAL_POINT not allowed - array(self::ST_MANTISSA, self::IN_DECIMAL_POINT, self::ST_ERROR, $wrongNumberErrorAction), - - array(self::ST_MANTISSA, self::IN_ASCII_DIGIT, self::ST_MANTISSA), - - // IN_CHAR not allowed - array(self::ST_MANTISSA, self::IN_CHAR, self::ST_ERROR, $wrongNumberErrorAction), - )); - - - /** Actions */ - $syntaxLexemeAction = new Zend_Search_Lucene_FSMAction($this, 'addQuerySyntaxLexeme'); - $lexemeModifierAction = new Zend_Search_Lucene_FSMAction($this, 'addLexemeModifier'); - $addLexemeAction = new Zend_Search_Lucene_FSMAction($this, 'addLexeme'); - $addQuotedLexemeAction = new Zend_Search_Lucene_FSMAction($this, 'addQuotedLexeme'); - $addNumberLexemeAction = new Zend_Search_Lucene_FSMAction($this, 'addNumberLexeme'); - $addLexemeCharAction = new Zend_Search_Lucene_FSMAction($this, 'addLexemeChar'); - - - /** Syntax lexeme */ - $this->addEntryAction(self::ST_SYNT_LEXEME, $syntaxLexemeAction); - // Two lexemes in succession - $this->addTransitionAction(self::ST_SYNT_LEXEME, self::ST_SYNT_LEXEME, $syntaxLexemeAction); - - - /** Lexeme */ - $this->addEntryAction(self::ST_LEXEME, $addLexemeCharAction); - $this->addTransitionAction(self::ST_LEXEME, self::ST_LEXEME, $addLexemeCharAction); - // ST_ESCAPED_CHAR => ST_LEXEME transition is covered by ST_LEXEME entry action - - $this->addTransitionAction(self::ST_LEXEME, self::ST_WHITE_SPACE, $addLexemeAction); - $this->addTransitionAction(self::ST_LEXEME, self::ST_SYNT_LEXEME, $addLexemeAction); - $this->addTransitionAction(self::ST_LEXEME, self::ST_QUOTED_LEXEME, $addLexemeAction); - $this->addTransitionAction(self::ST_LEXEME, self::ST_LEXEME_MODIFIER, $addLexemeAction); - $this->addTransitionAction(self::ST_LEXEME, self::ST_NUMBER, $addLexemeAction); - $this->addTransitionAction(self::ST_LEXEME, self::ST_MANTISSA, $addLexemeAction); - - - /** Quoted lexeme */ - // We don't need entry action (skeep quote) - $this->addTransitionAction(self::ST_QUOTED_LEXEME, self::ST_QUOTED_LEXEME, $addLexemeCharAction); - $this->addTransitionAction(self::ST_ESCAPED_QCHAR, self::ST_QUOTED_LEXEME, $addLexemeCharAction); - // Closing quote changes state to the ST_WHITE_SPACE other states are not used - $this->addTransitionAction(self::ST_QUOTED_LEXEME, self::ST_WHITE_SPACE, $addQuotedLexemeAction); - - - /** Lexeme modifier */ - $this->addEntryAction(self::ST_LEXEME_MODIFIER, $lexemeModifierAction); - - - /** Number */ - $this->addEntryAction(self::ST_NUMBER, $addLexemeCharAction); - $this->addEntryAction(self::ST_MANTISSA, $addLexemeCharAction); - $this->addTransitionAction(self::ST_NUMBER, self::ST_NUMBER, $addLexemeCharAction); - // ST_NUMBER => ST_MANTISSA transition is covered by ST_MANTISSA entry action - $this->addTransitionAction(self::ST_MANTISSA, self::ST_MANTISSA, $addLexemeCharAction); - - $this->addTransitionAction(self::ST_NUMBER, self::ST_WHITE_SPACE, $addNumberLexemeAction); - $this->addTransitionAction(self::ST_NUMBER, self::ST_SYNT_LEXEME, $addNumberLexemeAction); - $this->addTransitionAction(self::ST_NUMBER, self::ST_LEXEME_MODIFIER, $addNumberLexemeAction); - $this->addTransitionAction(self::ST_MANTISSA, self::ST_WHITE_SPACE, $addNumberLexemeAction); - $this->addTransitionAction(self::ST_MANTISSA, self::ST_SYNT_LEXEME, $addNumberLexemeAction); - $this->addTransitionAction(self::ST_MANTISSA, self::ST_LEXEME_MODIFIER, $addNumberLexemeAction); - } - - - - - /** - * Translate input char to an input symbol of state machine - * - * @param string $char - * @return integer - */ - private function _translateInput($char) - { - if (strpos(self::QUERY_WHITE_SPACE_CHARS, $char) !== false) { return self::IN_WHITE_SPACE; - } else if (strpos(self::QUERY_SYNT_CHARS, $char) !== false) { return self::IN_SYNT_CHAR; - } else if (strpos(self::QUERY_MUTABLE_CHARS, $char) !== false) { return self::IN_MUTABLE_CHAR; - } else if (strpos(self::QUERY_LEXEMEMODIFIER_CHARS, $char) !== false) { return self::IN_LEXEME_MODIFIER; - } else if (strpos(self::QUERY_ASCIIDIGITS_CHARS, $char) !== false) { return self::IN_ASCII_DIGIT; - } else if ($char === '"' ) { return self::IN_QUOTE; - } else if ($char === '.' ) { return self::IN_DECIMAL_POINT; - } else if ($char === '\\') { return self::IN_ESCAPE_CHAR; - } else { return self::IN_CHAR; - } - } - - - /** - * This method is used to tokenize query string into lexemes - * - * @param string $inputString - * @param string $encoding - * @return array - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public function tokenize($inputString, $encoding) - { - $this->reset(); - - $this->_lexemes = array(); - $this->_queryString = array(); - - if (PHP_OS == 'AIX' && $encoding == '') { - $encoding = 'ISO8859-1'; - } - $strLength = iconv_strlen($inputString, $encoding); - - // Workaround for iconv_substr bug - $inputString .= ' '; - - for ($count = 0; $count < $strLength; $count++) { - $this->_queryString[$count] = iconv_substr($inputString, $count, 1, $encoding); - } - - for ($this->_queryStringPosition = 0; - $this->_queryStringPosition < count($this->_queryString); - $this->_queryStringPosition++) { - $this->process($this->_translateInput($this->_queryString[$this->_queryStringPosition])); - } - - $this->process(self::IN_WHITE_SPACE); - - if ($this->getState() != self::ST_WHITE_SPACE) { - throw new Zend_Search_Lucene_Search_QueryParserException('Unexpected end of query'); - } - - $this->_queryString = null; - - return $this->_lexemes; - } - - - - /********************************************************************* - * Actions implementation - * - * Actions affect on recognized lexemes list - *********************************************************************/ - - /** - * Add query syntax lexeme - * - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public function addQuerySyntaxLexeme() - { - $lexeme = $this->_queryString[$this->_queryStringPosition]; - - // Process two char lexemes - if (strpos(self::QUERY_DOUBLECHARLEXEME_CHARS, $lexeme) !== false) { - // increase current position in a query string - $this->_queryStringPosition++; - - // check, - if ($this->_queryStringPosition == count($this->_queryString) || - $this->_queryString[$this->_queryStringPosition] != $lexeme) { - throw new Zend_Search_Lucene_Search_QueryParserException('Two chars lexeme expected. ' . $this->_positionMsg()); - } - - // duplicate character - $lexeme .= $lexeme; - } - - $token = new Zend_Search_Lucene_Search_QueryToken( - Zend_Search_Lucene_Search_QueryToken::TC_SYNTAX_ELEMENT, - $lexeme, - $this->_queryStringPosition); - - // Skip this lexeme if it's a field indicator ':' and treat previous as 'field' instead of 'word' - if ($token->type == Zend_Search_Lucene_Search_QueryToken::TT_FIELD_INDICATOR) { - $token = array_pop($this->_lexemes); - if ($token === null || $token->type != Zend_Search_Lucene_Search_QueryToken::TT_WORD) { - throw new Zend_Search_Lucene_Search_QueryParserException('Field mark \':\' must follow field name. ' . $this->_positionMsg()); - } - - $token->type = Zend_Search_Lucene_Search_QueryToken::TT_FIELD; - } - - $this->_lexemes[] = $token; - } - - /** - * Add lexeme modifier - */ - public function addLexemeModifier() - { - $this->_lexemes[] = new Zend_Search_Lucene_Search_QueryToken( - Zend_Search_Lucene_Search_QueryToken::TC_SYNTAX_ELEMENT, - $this->_queryString[$this->_queryStringPosition], - $this->_queryStringPosition); - } - - - /** - * Add lexeme - */ - public function addLexeme() - { - $this->_lexemes[] = new Zend_Search_Lucene_Search_QueryToken( - Zend_Search_Lucene_Search_QueryToken::TC_WORD, - $this->_currentLexeme, - $this->_queryStringPosition - 1); - - $this->_currentLexeme = ''; - } - - /** - * Add quoted lexeme - */ - public function addQuotedLexeme() - { - $this->_lexemes[] = new Zend_Search_Lucene_Search_QueryToken( - Zend_Search_Lucene_Search_QueryToken::TC_PHRASE, - $this->_currentLexeme, - $this->_queryStringPosition); - - $this->_currentLexeme = ''; - } - - /** - * Add number lexeme - */ - public function addNumberLexeme() - { - $this->_lexemes[] = new Zend_Search_Lucene_Search_QueryToken( - Zend_Search_Lucene_Search_QueryToken::TC_NUMBER, - $this->_currentLexeme, - $this->_queryStringPosition - 1); - $this->_currentLexeme = ''; - } - - /** - * Extend lexeme by one char - */ - public function addLexemeChar() - { - $this->_currentLexeme .= $this->_queryString[$this->_queryStringPosition]; - } - - - /** - * Position message - * - * @return string - */ - private function _positionMsg() - { - return 'Position is ' . $this->_queryStringPosition . '.'; - } - - - /********************************************************************* - * Syntax errors actions - *********************************************************************/ - public function lexModifierErrException() - { - throw new Zend_Search_Lucene_Search_QueryParserException('Lexeme modifier character can be followed only by number, white space or query syntax element. ' . $this->_positionMsg()); - } - public function quoteWithinLexemeErrException() - { - throw new Zend_Search_Lucene_Search_QueryParserException('Quote within lexeme must be escaped by \'\\\' char. ' . $this->_positionMsg()); - } - public function wrongNumberErrException() - { - throw new Zend_Search_Lucene_Search_QueryParserException('Wrong number syntax.' . $this->_positionMsg()); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryParser.php b/library/vendor/Zend/Search/Lucene/Search/QueryParser.php deleted file mode 100644 index a645ae9ce..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryParser.php +++ /dev/null @@ -1,603 +0,0 @@ -addRules( - array(array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_PHRASE, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_FIELD, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_REQUIRED, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_PROHIBITED, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_FUZZY_PROX_MARK, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_BOOSTING_MARK, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_RANGE_INCL_START, self::ST_CLOSEDINT_RQ_START), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_RANGE_EXCL_START, self::ST_OPENEDINT_RQ_START), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_SUBQUERY_START, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_SUBQUERY_END, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_AND_LEXEME, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_OR_LEXEME, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_NOT_LEXEME, self::ST_COMMON_QUERY_ELEMENT), - array(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_NUMBER, self::ST_COMMON_QUERY_ELEMENT) - )); - $this->addRules( - array(array(self::ST_CLOSEDINT_RQ_START, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_CLOSEDINT_RQ_FIRST_TERM), - array(self::ST_CLOSEDINT_RQ_FIRST_TERM, Zend_Search_Lucene_Search_QueryToken::TT_TO_LEXEME, self::ST_CLOSEDINT_RQ_TO_TERM), - array(self::ST_CLOSEDINT_RQ_TO_TERM, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_CLOSEDINT_RQ_LAST_TERM), - array(self::ST_CLOSEDINT_RQ_LAST_TERM, Zend_Search_Lucene_Search_QueryToken::TT_RANGE_INCL_END, self::ST_COMMON_QUERY_ELEMENT) - )); - $this->addRules( - array(array(self::ST_OPENEDINT_RQ_START, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_OPENEDINT_RQ_FIRST_TERM), - array(self::ST_OPENEDINT_RQ_FIRST_TERM, Zend_Search_Lucene_Search_QueryToken::TT_TO_LEXEME, self::ST_OPENEDINT_RQ_TO_TERM), - array(self::ST_OPENEDINT_RQ_TO_TERM, Zend_Search_Lucene_Search_QueryToken::TT_WORD, self::ST_OPENEDINT_RQ_LAST_TERM), - array(self::ST_OPENEDINT_RQ_LAST_TERM, Zend_Search_Lucene_Search_QueryToken::TT_RANGE_EXCL_END, self::ST_COMMON_QUERY_ELEMENT) - )); - - - - $addTermEntryAction = new Zend_Search_Lucene_FSMAction($this, 'addTermEntry'); - $addPhraseEntryAction = new Zend_Search_Lucene_FSMAction($this, 'addPhraseEntry'); - $setFieldAction = new Zend_Search_Lucene_FSMAction($this, 'setField'); - $setSignAction = new Zend_Search_Lucene_FSMAction($this, 'setSign'); - $setFuzzyProxAction = new Zend_Search_Lucene_FSMAction($this, 'processFuzzyProximityModifier'); - $processModifierParameterAction = new Zend_Search_Lucene_FSMAction($this, 'processModifierParameter'); - $subqueryStartAction = new Zend_Search_Lucene_FSMAction($this, 'subqueryStart'); - $subqueryEndAction = new Zend_Search_Lucene_FSMAction($this, 'subqueryEnd'); - $logicalOperatorAction = new Zend_Search_Lucene_FSMAction($this, 'logicalOperator'); - $openedRQFirstTermAction = new Zend_Search_Lucene_FSMAction($this, 'openedRQFirstTerm'); - $openedRQLastTermAction = new Zend_Search_Lucene_FSMAction($this, 'openedRQLastTerm'); - $closedRQFirstTermAction = new Zend_Search_Lucene_FSMAction($this, 'closedRQFirstTerm'); - $closedRQLastTermAction = new Zend_Search_Lucene_FSMAction($this, 'closedRQLastTerm'); - - - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_WORD, $addTermEntryAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_PHRASE, $addPhraseEntryAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_FIELD, $setFieldAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_REQUIRED, $setSignAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_PROHIBITED, $setSignAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_FUZZY_PROX_MARK, $setFuzzyProxAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_NUMBER, $processModifierParameterAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_SUBQUERY_START, $subqueryStartAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_SUBQUERY_END, $subqueryEndAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_AND_LEXEME, $logicalOperatorAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_OR_LEXEME, $logicalOperatorAction); - $this->addInputAction(self::ST_COMMON_QUERY_ELEMENT, Zend_Search_Lucene_Search_QueryToken::TT_NOT_LEXEME, $logicalOperatorAction); - - $this->addEntryAction(self::ST_OPENEDINT_RQ_FIRST_TERM, $openedRQFirstTermAction); - $this->addEntryAction(self::ST_OPENEDINT_RQ_LAST_TERM, $openedRQLastTermAction); - $this->addEntryAction(self::ST_CLOSEDINT_RQ_FIRST_TERM, $closedRQFirstTermAction); - $this->addEntryAction(self::ST_CLOSEDINT_RQ_LAST_TERM, $closedRQLastTermAction); - - - $this->_lexer = new Zend_Search_Lucene_Search_QueryLexer(); - } - - /** - * Get query parser instance - * - * @return Zend_Search_Lucene_Search_QueryParser - */ - private static function _getInstance() - { - if (self::$_instance === null) { - self::$_instance = new self(); - } - return self::$_instance; - } - - /** - * Set query string default encoding - * - * @param string $encoding - */ - public static function setDefaultEncoding($encoding) - { - self::_getInstance()->_defaultEncoding = $encoding; - } - - /** - * Get query string default encoding - * - * @return string - */ - public static function getDefaultEncoding() - { - return self::_getInstance()->_defaultEncoding; - } - - /** - * Set default boolean operator - * - * @param integer $operator - */ - public static function setDefaultOperator($operator) - { - self::_getInstance()->_defaultOperator = $operator; - } - - /** - * Get default boolean operator - * - * @return integer - */ - public static function getDefaultOperator() - { - return self::_getInstance()->_defaultOperator; - } - - /** - * Turn on 'suppress query parser exceptions' mode. - */ - public static function suppressQueryParsingExceptions() - { - self::_getInstance()->_suppressQueryParsingExceptions = true; - } - /** - * Turn off 'suppress query parser exceptions' mode. - */ - public static function dontSuppressQueryParsingExceptions() - { - self::_getInstance()->_suppressQueryParsingExceptions = false; - } - /** - * Check 'suppress query parser exceptions' mode. - * @return boolean - */ - public static function queryParsingExceptionsSuppressed() - { - return self::_getInstance()->_suppressQueryParsingExceptions; - } - - - /** - * Escape keyword to force it to be parsed as one term - * - * @param string $keyword - * @return string - */ - public static function escape($keyword) - { - return '\\' . implode('\\', str_split($keyword)); - } - - /** - * Parses a query string - * - * @param string $strQuery - * @param string $encoding - * @return Zend_Search_Lucene_Search_Query - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public static function parse($strQuery, $encoding = null) - { - self::_getInstance(); - - // Reset FSM if previous parse operation didn't return it into a correct state - self::$_instance->reset(); - - try { - - self::$_instance->_encoding = ($encoding !== null) ? $encoding : self::$_instance->_defaultEncoding; - self::$_instance->_lastToken = null; - self::$_instance->_context = new Zend_Search_Lucene_Search_QueryParserContext(self::$_instance->_encoding); - self::$_instance->_contextStack = array(); - self::$_instance->_tokens = self::$_instance->_lexer->tokenize($strQuery, self::$_instance->_encoding); - - // Empty query - if (count(self::$_instance->_tokens) == 0) { - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } - - - foreach (self::$_instance->_tokens as $token) { - try { - self::$_instance->_currentToken = $token; - self::$_instance->process($token->type); - - self::$_instance->_lastToken = $token; - } catch (Exception $e) { - if (strpos($e->getMessage(), 'There is no any rule for') !== false) { - throw new Zend_Search_Lucene_Search_QueryParserException( 'Syntax error at char position ' . $token->position . '.', 0, $e); - } - - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - } - - if (count(self::$_instance->_contextStack) != 0) { - throw new Zend_Search_Lucene_Search_QueryParserException('Syntax Error: mismatched parentheses, every opening must have closing.' ); - } - - return self::$_instance->_context->getQuery(); - } catch (Zend_Search_Lucene_Search_QueryParserException $e) { - if (self::$_instance->_suppressQueryParsingExceptions) { - $queryTokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($strQuery, self::$_instance->_encoding); - - $query = new Zend_Search_Lucene_Search_Query_MultiTerm(); - $termsSign = (self::$_instance->_defaultOperator == self::B_AND) ? true /* required term */ : - null /* optional term */; - - foreach ($queryTokens as $token) { - $query->addTerm(new Zend_Search_Lucene_Index_Term($token->getTermText()), $termsSign); - } - - - return $query; - } else { - throw new Zend_Search_Lucene_Exception($e->getMessage(), $e->getCode(), $e); - } - } - } - - /********************************************************************* - * Actions implementation - * - * Actions affect on recognized lexemes list - *********************************************************************/ - - /** - * Add term to a query - */ - public function addTermEntry() - { - $entry = new Zend_Search_Lucene_Search_QueryEntry_Term($this->_currentToken->text, $this->_context->getField()); - $this->_context->addEntry($entry); - } - - /** - * Add phrase to a query - */ - public function addPhraseEntry() - { - $entry = new Zend_Search_Lucene_Search_QueryEntry_Phrase($this->_currentToken->text, $this->_context->getField()); - $this->_context->addEntry($entry); - } - - /** - * Set entry field - */ - public function setField() - { - $this->_context->setNextEntryField($this->_currentToken->text); - } - - /** - * Set entry sign - */ - public function setSign() - { - $this->_context->setNextEntrySign($this->_currentToken->type); - } - - - /** - * Process fuzzy search/proximity modifier - '~' - */ - public function processFuzzyProximityModifier() - { - $this->_context->processFuzzyProximityModifier(); - } - - /** - * Process modifier parameter - * - * @throws Zend_Search_Lucene_Exception - */ - public function processModifierParameter() - { - if ($this->_lastToken === null) { - throw new Zend_Search_Lucene_Search_QueryParserException('Lexeme modifier parameter must follow lexeme modifier. Char position 0.' ); - } - - switch ($this->_lastToken->type) { - case Zend_Search_Lucene_Search_QueryToken::TT_FUZZY_PROX_MARK: - $this->_context->processFuzzyProximityModifier($this->_currentToken->text); - break; - - case Zend_Search_Lucene_Search_QueryToken::TT_BOOSTING_MARK: - $this->_context->boost($this->_currentToken->text); - break; - - default: - // It's not a user input exception - throw new Zend_Search_Lucene_Exception('Lexeme modifier parameter must follow lexeme modifier. Char position 0.' ); - } - } - - - /** - * Start subquery - */ - public function subqueryStart() - { - - $this->_contextStack[] = $this->_context; - $this->_context = new Zend_Search_Lucene_Search_QueryParserContext($this->_encoding, $this->_context->getField()); - } - - /** - * End subquery - */ - public function subqueryEnd() - { - if (count($this->_contextStack) == 0) { - throw new Zend_Search_Lucene_Search_QueryParserException('Syntax Error: mismatched parentheses, every opening must have closing. Char position ' . $this->_currentToken->position . '.' ); - } - - $query = $this->_context->getQuery(); - $this->_context = array_pop($this->_contextStack); - - $this->_context->addEntry(new Zend_Search_Lucene_Search_QueryEntry_Subquery($query)); - } - - /** - * Process logical operator - */ - public function logicalOperator() - { - $this->_context->addLogicalOperator($this->_currentToken->type); - } - - /** - * Process first range query term (opened interval) - */ - public function openedRQFirstTerm() - { - $this->_rqFirstTerm = $this->_currentToken->text; - } - - /** - * Process last range query term (opened interval) - * - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public function openedRQLastTerm() - { - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_rqFirstTerm, $this->_encoding); - if (count($tokens) > 1) { - throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); - } else if (count($tokens) == 1) { - $from = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); - } else { - $from = null; - } - - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_currentToken->text, $this->_encoding); - if (count($tokens) > 1) { - throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); - } else if (count($tokens) == 1) { - $to = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); - } else { - $to = null; - } - - if ($from === null && $to === null) { - throw new Zend_Search_Lucene_Search_QueryParserException('At least one range query boundary term must be non-empty term'); - } - - $rangeQuery = new Zend_Search_Lucene_Search_Query_Range($from, $to, false); - $entry = new Zend_Search_Lucene_Search_QueryEntry_Subquery($rangeQuery); - $this->_context->addEntry($entry); - } - - /** - * Process first range query term (closed interval) - */ - public function closedRQFirstTerm() - { - $this->_rqFirstTerm = $this->_currentToken->text; - } - - /** - * Process last range query term (closed interval) - * - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public function closedRQLastTerm() - { - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_rqFirstTerm, $this->_encoding); - if (count($tokens) > 1) { - throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); - } else if (count($tokens) == 1) { - $from = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); - } else { - $from = null; - } - - $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_currentToken->text, $this->_encoding); - if (count($tokens) > 1) { - throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); - } else if (count($tokens) == 1) { - $to = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); - } else { - $to = null; - } - - if ($from === null && $to === null) { - throw new Zend_Search_Lucene_Search_QueryParserException('At least one range query boundary term must be non-empty term'); - } - - $rangeQuery = new Zend_Search_Lucene_Search_Query_Range($from, $to, true); - $entry = new Zend_Search_Lucene_Search_QueryEntry_Subquery($rangeQuery); - $this->_context->addEntry($entry); - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryParserContext.php b/library/vendor/Zend/Search/Lucene/Search/QueryParserContext.php deleted file mode 100644 index e9c80df1a..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryParserContext.php +++ /dev/null @@ -1,385 +0,0 @@ -_encoding = $encoding; - $this->_defaultField = $defaultField; - } - - - /** - * Get context default field - * - * @return string|null - */ - public function getField() - { - return ($this->_nextEntryField !== null) ? $this->_nextEntryField : $this->_defaultField; - } - - /** - * Set field for next entry - * - * @param string $field - */ - public function setNextEntryField($field) - { - $this->_nextEntryField = $field; - } - - - /** - * Set sign for next entry - * - * @param integer $sign - * @throws Zend_Search_Lucene_Exception - */ - public function setNextEntrySign($sign) - { - if ($this->_mode === self::GM_BOOLEAN) { - throw new Zend_Search_Lucene_Search_QueryParserException('It\'s not allowed to mix boolean and signs styles in the same subquery.'); - } - - $this->_mode = self::GM_SIGNS; - - if ($sign == Zend_Search_Lucene_Search_QueryToken::TT_REQUIRED) { - $this->_nextEntrySign = true; - } else if ($sign == Zend_Search_Lucene_Search_QueryToken::TT_PROHIBITED) { - $this->_nextEntrySign = false; - } else { - throw new Zend_Search_Lucene_Exception('Unrecognized sign type.'); - } - } - - - /** - * Add entry to a query - * - * @param Zend_Search_Lucene_Search_QueryEntry $entry - */ - public function addEntry(Zend_Search_Lucene_Search_QueryEntry $entry) - { - if ($this->_mode !== self::GM_BOOLEAN) { - $this->_signs[] = $this->_nextEntrySign; - } - - $this->_entries[] = $entry; - - $this->_nextEntryField = null; - $this->_nextEntrySign = null; - } - - - /** - * Process fuzzy search or proximity search modifier - * - * @throws Zend_Search_Lucene_Search_QueryParserException - */ - public function processFuzzyProximityModifier($parameter = null) - { - // Check, that modifier has came just after word or phrase - if ($this->_nextEntryField !== null || $this->_nextEntrySign !== null) { - throw new Zend_Search_Lucene_Search_QueryParserException('\'~\' modifier must follow word or phrase.'); - } - - $lastEntry = array_pop($this->_entries); - - if (!$lastEntry instanceof Zend_Search_Lucene_Search_QueryEntry) { - // there are no entries or last entry is boolean operator - throw new Zend_Search_Lucene_Search_QueryParserException('\'~\' modifier must follow word or phrase.'); - } - - $lastEntry->processFuzzyProximityModifier($parameter); - - $this->_entries[] = $lastEntry; - } - - /** - * Set boost factor to the entry - * - * @param float $boostFactor - */ - public function boost($boostFactor) - { - // Check, that modifier has came just after word or phrase - if ($this->_nextEntryField !== null || $this->_nextEntrySign !== null) { - throw new Zend_Search_Lucene_Search_QueryParserException('\'^\' modifier must follow word, phrase or subquery.'); - } - - $lastEntry = array_pop($this->_entries); - - if (!$lastEntry instanceof Zend_Search_Lucene_Search_QueryEntry) { - // there are no entries or last entry is boolean operator - throw new Zend_Search_Lucene_Search_QueryParserException('\'^\' modifier must follow word, phrase or subquery.'); - } - - $lastEntry->boost($boostFactor); - - $this->_entries[] = $lastEntry; - } - - /** - * Process logical operator - * - * @param integer $operator - */ - public function addLogicalOperator($operator) - { - if ($this->_mode === self::GM_SIGNS) { - throw new Zend_Search_Lucene_Search_QueryParserException('It\'s not allowed to mix boolean and signs styles in the same subquery.'); - } - - $this->_mode = self::GM_BOOLEAN; - - $this->_entries[] = $operator; - } - - - /** - * Generate 'signs style' query from the context - * '+term1 term2 -term3 +() ...' - * - * @return Zend_Search_Lucene_Search_Query - */ - public function _signStyleExpressionQuery() - { - $query = new Zend_Search_Lucene_Search_Query_Boolean(); - - if (Zend_Search_Lucene_Search_QueryParser::getDefaultOperator() == Zend_Search_Lucene_Search_QueryParser::B_AND) { - $defaultSign = true; // required - } else { - // Zend_Search_Lucene_Search_QueryParser::B_OR - $defaultSign = null; // optional - } - - foreach ($this->_entries as $entryId => $entry) { - $sign = ($this->_signs[$entryId] !== null) ? $this->_signs[$entryId] : $defaultSign; - $query->addSubquery($entry->getQuery($this->_encoding), $sign); - } - - return $query; - } - - - /** - * Generate 'boolean style' query from the context - * 'term1 and term2 or term3 and () and not ()' - * - * @return Zend_Search_Lucene_Search_Query - * @throws Zend_Search_Lucene - */ - private function _booleanExpressionQuery() - { - /** - * We treat each level of an expression as a boolean expression in - * a Disjunctive Normal Form - * - * AND operator has higher precedence than OR - * - * Thus logical query is a disjunction of one or more conjunctions of - * one or more query entries - */ - - $expressionRecognizer = new Zend_Search_Lucene_Search_BooleanExpressionRecognizer(); - - try { - foreach ($this->_entries as $entry) { - if ($entry instanceof Zend_Search_Lucene_Search_QueryEntry) { - $expressionRecognizer->processLiteral($entry); - } else { - switch ($entry) { - case Zend_Search_Lucene_Search_QueryToken::TT_AND_LEXEME: - $expressionRecognizer->processOperator(Zend_Search_Lucene_Search_BooleanExpressionRecognizer::IN_AND_OPERATOR); - break; - - case Zend_Search_Lucene_Search_QueryToken::TT_OR_LEXEME: - $expressionRecognizer->processOperator(Zend_Search_Lucene_Search_BooleanExpressionRecognizer::IN_OR_OPERATOR); - break; - - case Zend_Search_Lucene_Search_QueryToken::TT_NOT_LEXEME: - $expressionRecognizer->processOperator(Zend_Search_Lucene_Search_BooleanExpressionRecognizer::IN_NOT_OPERATOR); - break; - - default: - throw new Zend_Search_Lucene('Boolean expression error. Unknown operator type.'); - } - } - } - - $conjuctions = $expressionRecognizer->finishExpression(); - } catch (Zend_Search_Exception $e) { - // throw new Zend_Search_Lucene_Search_QueryParserException('Boolean expression error. Error message: \'' . - // $e->getMessage() . '\'.' ); - // It's query syntax error message and it should be user friendly. So FSM message is omitted - throw new Zend_Search_Lucene_Search_QueryParserException('Boolean expression error.', 0, $e); - } - - // Remove 'only negative' conjunctions - foreach ($conjuctions as $conjuctionId => $conjuction) { - $nonNegativeEntryFound = false; - - foreach ($conjuction as $conjuctionEntry) { - if ($conjuctionEntry[1]) { - $nonNegativeEntryFound = true; - break; - } - } - - if (!$nonNegativeEntryFound) { - unset($conjuctions[$conjuctionId]); - } - } - - - $subqueries = array(); - foreach ($conjuctions as $conjuction) { - // Check, if it's a one term conjuction - if (count($conjuction) == 1) { - $subqueries[] = $conjuction[0][0]->getQuery($this->_encoding); - } else { - $subquery = new Zend_Search_Lucene_Search_Query_Boolean(); - - foreach ($conjuction as $conjuctionEntry) { - $subquery->addSubquery($conjuctionEntry[0]->getQuery($this->_encoding), $conjuctionEntry[1]); - } - - $subqueries[] = $subquery; - } - } - - if (count($subqueries) == 0) { - return new Zend_Search_Lucene_Search_Query_Insignificant(); - } - - if (count($subqueries) == 1) { - return $subqueries[0]; - } - - - $query = new Zend_Search_Lucene_Search_Query_Boolean(); - - foreach ($subqueries as $subquery) { - // Non-requirered entry/subquery - $query->addSubquery($subquery); - } - - return $query; - } - - /** - * Generate query from current context - * - * @return Zend_Search_Lucene_Search_Query - */ - public function getQuery() - { - if ($this->_mode === self::GM_BOOLEAN) { - return $this->_booleanExpressionQuery(); - } else { - return $this->_signStyleExpressionQuery(); - } - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/QueryParserException.php b/library/vendor/Zend/Search/Lucene/Search/QueryParserException.php deleted file mode 100644 index 0bd043604..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/QueryParserException.php +++ /dev/null @@ -1,40 +0,0 @@ - or field:() pairs - const TT_FIELD_INDICATOR = 3; // ':' - const TT_REQUIRED = 4; // '+' - const TT_PROHIBITED = 5; // '-' - const TT_FUZZY_PROX_MARK = 6; // '~' - const TT_BOOSTING_MARK = 7; // '^' - const TT_RANGE_INCL_START = 8; // '[' - const TT_RANGE_INCL_END = 9; // ']' - const TT_RANGE_EXCL_START = 10; // '{' - const TT_RANGE_EXCL_END = 11; // '}' - const TT_SUBQUERY_START = 12; // '(' - const TT_SUBQUERY_END = 13; // ')' - const TT_AND_LEXEME = 14; // 'AND' or 'and' - const TT_OR_LEXEME = 15; // 'OR' or 'or' - const TT_NOT_LEXEME = 16; // 'NOT' or 'not' - const TT_TO_LEXEME = 17; // 'TO' or 'to' - const TT_NUMBER = 18; // Number, like: 10, 0.8, .64, .... - - - /** - * Returns all possible lexeme types. - * It's used for syntax analyzer state machine initialization - * - * @return array - */ - public static function getTypes() - { - return array( self::TT_WORD, - self::TT_PHRASE, - self::TT_FIELD, - self::TT_FIELD_INDICATOR, - self::TT_REQUIRED, - self::TT_PROHIBITED, - self::TT_FUZZY_PROX_MARK, - self::TT_BOOSTING_MARK, - self::TT_RANGE_INCL_START, - self::TT_RANGE_INCL_END, - self::TT_RANGE_EXCL_START, - self::TT_RANGE_EXCL_END, - self::TT_SUBQUERY_START, - self::TT_SUBQUERY_END, - self::TT_AND_LEXEME, - self::TT_OR_LEXEME, - self::TT_NOT_LEXEME, - self::TT_TO_LEXEME, - self::TT_NUMBER - ); - } - - - /** - * TokenCategories - */ - const TC_WORD = 0; // Word - const TC_PHRASE = 1; // Phrase (one or several quoted words) - const TC_NUMBER = 2; // Nubers, which are used with syntax elements. Ex. roam~0.8 - const TC_SYNTAX_ELEMENT = 3; // + - ( ) [ ] { } ! || && ~ ^ - - - /** - * Token type. - * - * @var integer - */ - public $type; - - /** - * Token text. - * - * @var integer - */ - public $text; - - /** - * Token position within query. - * - * @var integer - */ - public $position; - - - /** - * IndexReader constructor needs token type and token text as a parameters. - * - * @param integer $tokenCategory - * @param string $tokText - * @param integer $position - */ - public function __construct($tokenCategory, $tokenText, $position) - { - $this->text = $tokenText; - $this->position = $position + 1; // Start from 1 - - switch ($tokenCategory) { - case self::TC_WORD: - if ( strtolower($tokenText) == 'and') { - $this->type = self::TT_AND_LEXEME; - } else if (strtolower($tokenText) == 'or') { - $this->type = self::TT_OR_LEXEME; - } else if (strtolower($tokenText) == 'not') { - $this->type = self::TT_NOT_LEXEME; - } else if (strtolower($tokenText) == 'to') { - $this->type = self::TT_TO_LEXEME; - } else { - $this->type = self::TT_WORD; - } - break; - - case self::TC_PHRASE: - $this->type = self::TT_PHRASE; - break; - - case self::TC_NUMBER: - $this->type = self::TT_NUMBER; - break; - - case self::TC_SYNTAX_ELEMENT: - switch ($tokenText) { - case ':': - $this->type = self::TT_FIELD_INDICATOR; - break; - - case '+': - $this->type = self::TT_REQUIRED; - break; - - case '-': - $this->type = self::TT_PROHIBITED; - break; - - case '~': - $this->type = self::TT_FUZZY_PROX_MARK; - break; - - case '^': - $this->type = self::TT_BOOSTING_MARK; - break; - - case '[': - $this->type = self::TT_RANGE_INCL_START; - break; - - case ']': - $this->type = self::TT_RANGE_INCL_END; - break; - - case '{': - $this->type = self::TT_RANGE_EXCL_START; - break; - - case '}': - $this->type = self::TT_RANGE_EXCL_END; - break; - - case '(': - $this->type = self::TT_SUBQUERY_START; - break; - - case ')': - $this->type = self::TT_SUBQUERY_END; - break; - - case '!': - $this->type = self::TT_NOT_LEXEME; - break; - - case '&&': - $this->type = self::TT_AND_LEXEME; - break; - - case '||': - $this->type = self::TT_OR_LEXEME; - break; - - default: - throw new Zend_Search_Lucene_Exception('Unrecognized query syntax lexeme: \'' . $tokenText . '\''); - } - break; - - case self::TC_NUMBER: - $this->type = self::TT_NUMBER; - - default: - throw new Zend_Search_Lucene_Exception('Unrecognized lexeme type: \'' . $tokenCategory . '\''); - } - } -} diff --git a/library/vendor/Zend/Search/Lucene/Search/Similarity.php b/library/vendor/Zend/Search/Lucene/Search/Similarity.php deleted file mode 100644 index bc6cb7d67..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Similarity.php +++ /dev/null @@ -1,550 +0,0 @@ - 0.0, - 1 => 5.820766E-10, - 2 => 6.9849193E-10, - 3 => 8.1490725E-10, - 4 => 9.313226E-10, - 5 => 1.1641532E-9, - 6 => 1.3969839E-9, - 7 => 1.6298145E-9, - 8 => 1.8626451E-9, - 9 => 2.3283064E-9, - 10 => 2.7939677E-9, - 11 => 3.259629E-9, - 12 => 3.7252903E-9, - 13 => 4.656613E-9, - 14 => 5.5879354E-9, - 15 => 6.519258E-9, - 16 => 7.4505806E-9, - 17 => 9.313226E-9, - 18 => 1.1175871E-8, - 19 => 1.3038516E-8, - 20 => 1.4901161E-8, - 21 => 1.8626451E-8, - 22 => 2.2351742E-8, - 23 => 2.6077032E-8, - 24 => 2.9802322E-8, - 25 => 3.7252903E-8, - 26 => 4.4703484E-8, - 27 => 5.2154064E-8, - 28 => 5.9604645E-8, - 29 => 7.4505806E-8, - 30 => 8.940697E-8, - 31 => 1.0430813E-7, - 32 => 1.1920929E-7, - 33 => 1.4901161E-7, - 34 => 1.7881393E-7, - 35 => 2.0861626E-7, - 36 => 2.3841858E-7, - 37 => 2.9802322E-7, - 38 => 3.5762787E-7, - 39 => 4.172325E-7, - 40 => 4.7683716E-7, - 41 => 5.9604645E-7, - 42 => 7.1525574E-7, - 43 => 8.34465E-7, - 44 => 9.536743E-7, - 45 => 1.1920929E-6, - 46 => 1.4305115E-6, - 47 => 1.66893E-6, - 48 => 1.9073486E-6, - 49 => 2.3841858E-6, - 50 => 2.861023E-6, - 51 => 3.33786E-6, - 52 => 3.8146973E-6, - 53 => 4.7683716E-6, - 54 => 5.722046E-6, - 55 => 6.67572E-6, - 56 => 7.6293945E-6, - 57 => 9.536743E-6, - 58 => 1.1444092E-5, - 59 => 1.335144E-5, - 60 => 1.5258789E-5, - 61 => 1.9073486E-5, - 62 => 2.2888184E-5, - 63 => 2.670288E-5, - 64 => 3.0517578E-5, - 65 => 3.8146973E-5, - 66 => 4.5776367E-5, - 67 => 5.340576E-5, - 68 => 6.1035156E-5, - 69 => 7.6293945E-5, - 70 => 9.1552734E-5, - 71 => 1.0681152E-4, - 72 => 1.2207031E-4, - 73 => 1.5258789E-4, - 74 => 1.8310547E-4, - 75 => 2.1362305E-4, - 76 => 2.4414062E-4, - 77 => 3.0517578E-4, - 78 => 3.6621094E-4, - 79 => 4.272461E-4, - 80 => 4.8828125E-4, - 81 => 6.1035156E-4, - 82 => 7.324219E-4, - 83 => 8.544922E-4, - 84 => 9.765625E-4, - 85 => 0.0012207031, - 86 => 0.0014648438, - 87 => 0.0017089844, - 88 => 0.001953125, - 89 => 0.0024414062, - 90 => 0.0029296875, - 91 => 0.0034179688, - 92 => 0.00390625, - 93 => 0.0048828125, - 94 => 0.005859375, - 95 => 0.0068359375, - 96 => 0.0078125, - 97 => 0.009765625, - 98 => 0.01171875, - 99 => 0.013671875, - 100 => 0.015625, - 101 => 0.01953125, - 102 => 0.0234375, - 103 => 0.02734375, - 104 => 0.03125, - 105 => 0.0390625, - 106 => 0.046875, - 107 => 0.0546875, - 108 => 0.0625, - 109 => 0.078125, - 110 => 0.09375, - 111 => 0.109375, - 112 => 0.125, - 113 => 0.15625, - 114 => 0.1875, - 115 => 0.21875, - 116 => 0.25, - 117 => 0.3125, - 118 => 0.375, - 119 => 0.4375, - 120 => 0.5, - 121 => 0.625, - 122 => 0.75, - 123 => 0.875, - 124 => 1.0, - 125 => 1.25, - 126 => 1.5, - 127 => 1.75, - 128 => 2.0, - 129 => 2.5, - 130 => 3.0, - 131 => 3.5, - 132 => 4.0, - 133 => 5.0, - 134 => 6.0, - 135 => 7.0, - 136 => 8.0, - 137 => 10.0, - 138 => 12.0, - 139 => 14.0, - 140 => 16.0, - 141 => 20.0, - 142 => 24.0, - 143 => 28.0, - 144 => 32.0, - 145 => 40.0, - 146 => 48.0, - 147 => 56.0, - 148 => 64.0, - 149 => 80.0, - 150 => 96.0, - 151 => 112.0, - 152 => 128.0, - 153 => 160.0, - 154 => 192.0, - 155 => 224.0, - 156 => 256.0, - 157 => 320.0, - 158 => 384.0, - 159 => 448.0, - 160 => 512.0, - 161 => 640.0, - 162 => 768.0, - 163 => 896.0, - 164 => 1024.0, - 165 => 1280.0, - 166 => 1536.0, - 167 => 1792.0, - 168 => 2048.0, - 169 => 2560.0, - 170 => 3072.0, - 171 => 3584.0, - 172 => 4096.0, - 173 => 5120.0, - 174 => 6144.0, - 175 => 7168.0, - 176 => 8192.0, - 177 => 10240.0, - 178 => 12288.0, - 179 => 14336.0, - 180 => 16384.0, - 181 => 20480.0, - 182 => 24576.0, - 183 => 28672.0, - 184 => 32768.0, - 185 => 40960.0, - 186 => 49152.0, - 187 => 57344.0, - 188 => 65536.0, - 189 => 81920.0, - 190 => 98304.0, - 191 => 114688.0, - 192 => 131072.0, - 193 => 163840.0, - 194 => 196608.0, - 195 => 229376.0, - 196 => 262144.0, - 197 => 327680.0, - 198 => 393216.0, - 199 => 458752.0, - 200 => 524288.0, - 201 => 655360.0, - 202 => 786432.0, - 203 => 917504.0, - 204 => 1048576.0, - 205 => 1310720.0, - 206 => 1572864.0, - 207 => 1835008.0, - 208 => 2097152.0, - 209 => 2621440.0, - 210 => 3145728.0, - 211 => 3670016.0, - 212 => 4194304.0, - 213 => 5242880.0, - 214 => 6291456.0, - 215 => 7340032.0, - 216 => 8388608.0, - 217 => 1.048576E7, - 218 => 1.2582912E7, - 219 => 1.4680064E7, - 220 => 1.6777216E7, - 221 => 2.097152E7, - 222 => 2.5165824E7, - 223 => 2.9360128E7, - 224 => 3.3554432E7, - 225 => 4.194304E7, - 226 => 5.0331648E7, - 227 => 5.8720256E7, - 228 => 6.7108864E7, - 229 => 8.388608E7, - 230 => 1.00663296E8, - 231 => 1.17440512E8, - 232 => 1.34217728E8, - 233 => 1.6777216E8, - 234 => 2.01326592E8, - 235 => 2.34881024E8, - 236 => 2.68435456E8, - 237 => 3.3554432E8, - 238 => 4.02653184E8, - 239 => 4.69762048E8, - 240 => 5.3687091E8, - 241 => 6.7108864E8, - 242 => 8.0530637E8, - 243 => 9.395241E8, - 244 => 1.07374182E9, - 245 => 1.34217728E9, - 246 => 1.61061274E9, - 247 => 1.87904819E9, - 248 => 2.14748365E9, - 249 => 2.68435456E9, - 250 => 3.22122547E9, - 251 => 3.75809638E9, - 252 => 4.2949673E9, - 253 => 5.3687091E9, - 254 => 6.4424509E9, - 255 => 7.5161928E9 ); - - - /** - * Set the default Similarity implementation used by indexing and search - * code. - * - * @param Zend_Search_Lucene_Search_Similarity $similarity - */ - public static function setDefault(Zend_Search_Lucene_Search_Similarity $similarity) - { - self::$_defaultImpl = $similarity; - } - - - /** - * Return the default Similarity implementation used by indexing and search - * code. - * - * @return Zend_Search_Lucene_Search_Similarity - */ - public static function getDefault() - { - if (!self::$_defaultImpl instanceof Zend_Search_Lucene_Search_Similarity) { - self::$_defaultImpl = new Zend_Search_Lucene_Search_Similarity_Default(); - } - - return self::$_defaultImpl; - } - - - /** - * Computes the normalization value for a field given the total number of - * terms contained in a field. These values, together with field boosts, are - * stored in an index and multipled into scores for hits on each field by the - * search code. - * - * Matches in longer fields are less precise, so implemenations of this - * method usually return smaller values when 'numTokens' is large, - * and larger values when 'numTokens' is small. - * - * That these values are computed under - * IndexWriter::addDocument(Document) and stored then using - * encodeNorm(float). Thus they have limited precision, and documents - * must be re-indexed if this method is altered. - * - * fieldName - name of field - * numTokens - the total number of tokens contained in fields named - * 'fieldName' of 'doc'. - * Returns a normalization factor for hits on this field of this document - * - * @param string $fieldName - * @param integer $numTokens - * @return float - */ - abstract public function lengthNorm($fieldName, $numTokens); - - /** - * Computes the normalization value for a query given the sum of the squared - * weights of each of the query terms. This value is then multipled into the - * weight of each query term. - * - * This does not affect ranking, but rather just attempts to make scores - * from different queries comparable. - * - * sumOfSquaredWeights - the sum of the squares of query term weights - * Returns a normalization factor for query weights - * - * @param float $sumOfSquaredWeights - * @return float - */ - abstract public function queryNorm($sumOfSquaredWeights); - - - /** - * Decodes a normalization factor stored in an index. - * - * @param integer $byte - * @return float - */ - public static function decodeNorm($byte) - { - return self::$_normTable[$byte & 0xFF]; - } - - - /** - * Encodes a normalization factor for storage in an index. - * - * The encoding uses a five-bit exponent and three-bit mantissa, thus - * representing values from around 7x10^9 to 2x10^-9 with about one - * significant decimal digit of accuracy. Zero is also represented. - * Negative numbers are rounded up to zero. Values too large to represent - * are rounded down to the largest representable value. Positive values too - * small to represent are rounded up to the smallest positive representable - * value. - * - * @param float $f - * @return integer - */ - static function encodeNorm($f) - { - return self::_floatToByte($f); - } - - /** - * Float to byte conversion - * - * @param integer $b - * @return float - */ - private static function _floatToByte($f) - { - // round negatives up to zero - if ($f <= 0.0) { - return 0; - } - - // search for appropriate value - $lowIndex = 0; - $highIndex = 255; - while ($highIndex >= $lowIndex) { - // $mid = ($highIndex - $lowIndex)/2; - $mid = ($highIndex + $lowIndex) >> 1; - $delta = $f - self::$_normTable[$mid]; - - if ($delta < 0) { - $highIndex = $mid-1; - } elseif ($delta > 0) { - $lowIndex = $mid+1; - } else { - return $mid; // We got it! - } - } - - // round to closest value - if ($highIndex != 255 && - $f - self::$_normTable[$highIndex] > self::$_normTable[$highIndex+1] - $f ) { - return $highIndex + 1; - } else { - return $highIndex; - } - } - - - /** - * Computes a score factor based on a term or phrase's frequency in a - * document. This value is multiplied by the idf(Term, Searcher) - * factor for each term in the query and these products are then summed to - * form the initial score for a document. - * - * Terms and phrases repeated in a document indicate the topic of the - * document, so implementations of this method usually return larger values - * when 'freq' is large, and smaller values when 'freq' - * is small. - * - * freq - the frequency of a term within a document - * Returns a score factor based on a term's within-document frequency - * - * @param float $freq - * @return float - */ - abstract public function tf($freq); - - /** - * Computes the amount of a sloppy phrase match, based on an edit distance. - * This value is summed for each sloppy phrase match in a document to form - * the frequency that is passed to tf(float). - * - * A phrase match with a small edit distance to a document passage more - * closely matches the document, so implementations of this method usually - * return larger values when the edit distance is small and smaller values - * when it is large. - * - * distance - the edit distance of this sloppy phrase match - * Returns the frequency increment for this match - * - * @param integer $distance - * @return float - */ - abstract public function sloppyFreq($distance); - - - /** - * Computes a score factor for a simple term or a phrase. - * - * The default implementation is: - * return idfFreq(searcher.docFreq(term), searcher.maxDoc()); - * - * input - the term in question or array of terms - * reader - reader the document collection being searched - * Returns a score factor for the term - * - * @param mixed $input - * @param Zend_Search_Lucene_Interface $reader - * @return a score factor for the term - */ - public function idf($input, Zend_Search_Lucene_Interface $reader) - { - if (!is_array($input)) { - return $this->idfFreq($reader->docFreq($input), $reader->count()); - } else { - $idf = 0.0; - foreach ($input as $term) { - $idf += $this->idfFreq($reader->docFreq($term), $reader->count()); - } - return $idf; - } - } - - /** - * Computes a score factor based on a term's document frequency (the number - * of documents which contain the term). This value is multiplied by the - * tf(int) factor for each term in the query and these products are - * then summed to form the initial score for a document. - * - * Terms that occur in fewer documents are better indicators of topic, so - * implemenations of this method usually return larger values for rare terms, - * and smaller values for common terms. - * - * docFreq - the number of documents which contain the term - * numDocs - the total number of documents in the collection - * Returns a score factor based on the term's document frequency - * - * @param integer $docFreq - * @param integer $numDocs - * @return float - */ - abstract public function idfFreq($docFreq, $numDocs); - - /** - * Computes a score factor based on the fraction of all query terms that a - * document contains. This value is multiplied into scores. - * - * The presence of a large portion of the query terms indicates a better - * match with the query, so implemenations of this method usually return - * larger values when the ratio between these parameters is large and smaller - * values when the ratio between them is small. - * - * overlap - the number of query terms matched in the document - * maxOverlap - the total number of terms in the query - * Returns a score factor based on term overlap with the query - * - * @param integer $overlap - * @param integer $maxOverlap - * @return float - */ - abstract public function coord($overlap, $maxOverlap); -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Similarity/Default.php b/library/vendor/Zend/Search/Lucene/Search/Similarity/Default.php deleted file mode 100644 index d717c2219..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Similarity/Default.php +++ /dev/null @@ -1,109 +0,0 @@ -createWeight(). - * The sumOfSquaredWeights() method is then called on the top-level - * query to compute the query normalization factor Similarity->queryNorm(float). - * This factor is then passed to normalize(float). At this point the weighting - * is complete. - * - * @category Zend - * @package Zend_Search_Lucene - * @subpackage Search - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -abstract class Zend_Search_Lucene_Search_Weight -{ - /** - * Normalization factor. - * This value is stored only for query expanation purpose and not used in any other place - * - * @var float - */ - protected $_queryNorm; - - /** - * Weight value - * - * Weight value may be initialized in sumOfSquaredWeights() or normalize() - * because they both are invoked either in Query::_initWeight (for top-level query) or - * in corresponding methods of parent query's weights - * - * @var float - */ - protected $_value; - - - /** - * The weight for this query. - * - * @return float - */ - public function getValue() - { - return $this->_value; - } - - /** - * The sum of squared weights of contained query clauses. - * - * @return float - */ - abstract public function sumOfSquaredWeights(); - - /** - * Assigns the query normalization factor to this. - * - * @param float $norm - */ - abstract public function normalize($norm); -} - diff --git a/library/vendor/Zend/Search/Lucene/Search/Weight/Boolean.php b/library/vendor/Zend/Search/Lucene/Search/Weight/Boolean.php deleted file mode 100644 index 99e4678d1..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Weight/Boolean.php +++ /dev/null @@ -1,136 +0,0 @@ -_query = $query; - $this->_reader = $reader; - $this->_weights = array(); - - $signs = $query->getSigns(); - - foreach ($query->getSubqueries() as $num => $subquery) { - if ($signs === null || $signs[$num] === null || $signs[$num]) { - $this->_weights[$num] = $subquery->createWeight($reader); - } - } - } - - - /** - * The weight for this query - * Standard Weight::$_value is not used for boolean queries - * - * @return float - */ - public function getValue() - { - return $this->_query->getBoost(); - } - - - /** - * The sum of squared weights of contained query clauses. - * - * @return float - */ - public function sumOfSquaredWeights() - { - $sum = 0; - foreach ($this->_weights as $weight) { - // sum sub weights - $sum += $weight->sumOfSquaredWeights(); - } - - // boost each sub-weight - $sum *= $this->_query->getBoost() * $this->_query->getBoost(); - - // check for empty query (like '-something -another') - if ($sum == 0) { - $sum = 1.0; - } - return $sum; - } - - - /** - * Assigns the query normalization factor to this. - * - * @param float $queryNorm - */ - public function normalize($queryNorm) - { - // incorporate boost - $queryNorm *= $this->_query->getBoost(); - - foreach ($this->_weights as $weight) { - $weight->normalize($queryNorm); - } - } -} - - diff --git a/library/vendor/Zend/Search/Lucene/Search/Weight/Empty.php b/library/vendor/Zend/Search/Lucene/Search/Weight/Empty.php deleted file mode 100644 index 616ebd194..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Weight/Empty.php +++ /dev/null @@ -1,56 +0,0 @@ -_query = $query; - $this->_reader = $reader; - $this->_weights = array(); - - $signs = $query->getSigns(); - - foreach ($query->getTerms() as $id => $term) { - if ($signs === null || $signs[$id] === null || $signs[$id]) { - $this->_weights[$id] = new Zend_Search_Lucene_Search_Weight_Term($term, $query, $reader); - $query->setWeight($id, $this->_weights[$id]); - } - } - } - - - /** - * The weight for this query - * Standard Weight::$_value is not used for boolean queries - * - * @return float - */ - public function getValue() - { - return $this->_query->getBoost(); - } - - - /** - * The sum of squared weights of contained query clauses. - * - * @return float - */ - public function sumOfSquaredWeights() - { - $sum = 0; - foreach ($this->_weights as $weight) { - // sum sub weights - $sum += $weight->sumOfSquaredWeights(); - } - - // boost each sub-weight - $sum *= $this->_query->getBoost() * $this->_query->getBoost(); - - // check for empty query (like '-something -another') - if ($sum == 0) { - $sum = 1.0; - } - return $sum; - } - - - /** - * Assigns the query normalization factor to this. - * - * @param float $queryNorm - */ - public function normalize($queryNorm) - { - // incorporate boost - $queryNorm *= $this->_query->getBoost(); - - foreach ($this->_weights as $weight) { - $weight->normalize($queryNorm); - } - } -} - - diff --git a/library/vendor/Zend/Search/Lucene/Search/Weight/Phrase.php b/library/vendor/Zend/Search/Lucene/Search/Weight/Phrase.php deleted file mode 100644 index 16b3fe929..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Weight/Phrase.php +++ /dev/null @@ -1,107 +0,0 @@ -_query = $query; - $this->_reader = $reader; - } - - /** - * The sum of squared weights of contained query clauses. - * - * @return float - */ - public function sumOfSquaredWeights() - { - // compute idf - $this->_idf = $this->_reader->getSimilarity()->idf($this->_query->getTerms(), $this->_reader); - - // compute query weight - $this->_queryWeight = $this->_idf * $this->_query->getBoost(); - - // square it - return $this->_queryWeight * $this->_queryWeight; - } - - - /** - * Assigns the query normalization factor to this. - * - * @param float $queryNorm - */ - public function normalize($queryNorm) - { - $this->_queryNorm = $queryNorm; - - // normalize query weight - $this->_queryWeight *= $queryNorm; - - // idf for documents - $this->_value = $this->_queryWeight * $this->_idf; - } -} - - diff --git a/library/vendor/Zend/Search/Lucene/Search/Weight/Term.php b/library/vendor/Zend/Search/Lucene/Search/Weight/Term.php deleted file mode 100644 index 595b372b6..000000000 --- a/library/vendor/Zend/Search/Lucene/Search/Weight/Term.php +++ /dev/null @@ -1,124 +0,0 @@ -_term = $term; - $this->_query = $query; - $this->_reader = $reader; - } - - - /** - * The sum of squared weights of contained query clauses. - * - * @return float - */ - public function sumOfSquaredWeights() - { - // compute idf - $this->_idf = $this->_reader->getSimilarity()->idf($this->_term, $this->_reader); - - // compute query weight - $this->_queryWeight = $this->_idf * $this->_query->getBoost(); - - // square it - return $this->_queryWeight * $this->_queryWeight; - } - - - /** - * Assigns the query normalization factor to this. - * - * @param float $queryNorm - */ - public function normalize($queryNorm) - { - $this->_queryNorm = $queryNorm; - - // normalize query weight - $this->_queryWeight *= $queryNorm; - - // idf for documents - $this->_value = $this->_queryWeight * $this->_idf; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Storage/Directory.php b/library/vendor/Zend/Search/Lucene/Storage/Directory.php deleted file mode 100644 index 1dd550520..000000000 --- a/library/vendor/Zend/Search/Lucene/Storage/Directory.php +++ /dev/null @@ -1,136 +0,0 @@ - Zend_Search_Lucene_Storage_File object - * - * @var array - * @throws Zend_Search_Lucene_Exception - */ - protected $_fileHandlers; - - /** - * Default file permissions - * - * @var integer - */ - protected static $_defaultFilePermissions = 0666; - - - /** - * Get default file permissions - * - * @return integer - */ - public static function getDefaultFilePermissions() - { - return self::$_defaultFilePermissions; - } - - /** - * Set default file permissions - * - * @param integer $mode - */ - public static function setDefaultFilePermissions($mode) - { - self::$_defaultFilePermissions = $mode; - } - - - /** - * Utility function to recursive directory creation - * - * @param string $dir - * @param integer $mode - * @param boolean $recursive - * @return boolean - */ - - public static function mkdirs($dir, $mode = 0777, $recursive = true) - { - if (($dir === null) || $dir === '') { - return false; - } - if (is_dir($dir) || $dir === '/') { - return true; - } - if (self::mkdirs(dirname($dir), $mode, $recursive)) { - return mkdir($dir, $mode); - } - return false; - } - - - /** - * Object constructor - * Checks if $path is a directory or tries to create it. - * - * @param string $path - * @throws Zend_Search_Lucene_Exception - */ - public function __construct($path) - { - if (!is_dir($path)) { - if (file_exists($path)) { - throw new Zend_Search_Lucene_Exception('Path exists, but it\'s not a directory'); - } else { - if (!self::mkdirs($path)) { - throw new Zend_Search_Lucene_Exception("Can't create directory '$path'."); - } - } - } - $this->_dirPath = $path; - $this->_fileHandlers = array(); - } - - - /** - * Closes the store. - * - * @return void - */ - public function close() - { - foreach ($this->_fileHandlers as $fileObject) { - $fileObject->close(); - } - - $this->_fileHandlers = array(); - } - - - /** - * Returns an array of strings, one for each file in the directory. - * - * @return array - */ - public function fileList() - { - $result = array(); - - $dirContent = opendir( $this->_dirPath ); - while (($file = readdir($dirContent)) !== false) { - if (($file == '..')||($file == '.')) continue; - - if( !is_dir($this->_dirPath . '/' . $file) ) { - $result[] = $file; - } - } - closedir($dirContent); - - return $result; - } - - /** - * Creates a new, empty file in the directory with the given $filename. - * - * @param string $filename - * @return Zend_Search_Lucene_Storage_File - * @throws Zend_Search_Lucene_Exception - */ - public function createFile($filename) - { - if (isset($this->_fileHandlers[$filename])) { - $this->_fileHandlers[$filename]->close(); - } - unset($this->_fileHandlers[$filename]); - $this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($this->_dirPath . '/' . $filename, 'w+b'); - - // Set file permissions, but don't care about any possible failures, since file may be already - // created by anther user which has to care about right permissions - @chmod($this->_dirPath . '/' . $filename, self::$_defaultFilePermissions); - - return $this->_fileHandlers[$filename]; - } - - - /** - * Removes an existing $filename in the directory. - * - * @param string $filename - * @return void - * @throws Zend_Search_Lucene_Exception - */ - public function deleteFile($filename) - { - if (isset($this->_fileHandlers[$filename])) { - $this->_fileHandlers[$filename]->close(); - } - unset($this->_fileHandlers[$filename]); - - global $php_errormsg; - $trackErrors = ini_get('track_errors'); - ini_set('track_errors', '1'); - if (!@unlink($this->_dirPath . '/' . $filename)) { - ini_set('track_errors', $trackErrors); - throw new Zend_Search_Lucene_Exception('Can\'t delete file: ' . $php_errormsg); - } - ini_set('track_errors', $trackErrors); - } - - /** - * Purge file if it's cached by directory object - * - * Method is used to prevent 'too many open files' error - * - * @param string $filename - * @return void - */ - public function purgeFile($filename) - { - if (isset($this->_fileHandlers[$filename])) { - $this->_fileHandlers[$filename]->close(); - } - unset($this->_fileHandlers[$filename]); - } - - - /** - * Returns true if a file with the given $filename exists. - * - * @param string $filename - * @return boolean - */ - public function fileExists($filename) - { - return isset($this->_fileHandlers[$filename]) || - file_exists($this->_dirPath . '/' . $filename); - } - - - /** - * Returns the length of a $filename in the directory. - * - * @param string $filename - * @return integer - */ - public function fileLength($filename) - { - if (isset( $this->_fileHandlers[$filename] )) { - return $this->_fileHandlers[$filename]->size(); - } - return filesize($this->_dirPath .'/'. $filename); - } - - - /** - * Returns the UNIX timestamp $filename was last modified. - * - * @param string $filename - * @return integer - */ - public function fileModified($filename) - { - return filemtime($this->_dirPath .'/'. $filename); - } - - - /** - * Renames an existing file in the directory. - * - * @param string $from - * @param string $to - * @return void - * @throws Zend_Search_Lucene_Exception - */ - public function renameFile($from, $to) - { - global $php_errormsg; - - if (isset($this->_fileHandlers[$from])) { - $this->_fileHandlers[$from]->close(); - } - unset($this->_fileHandlers[$from]); - - if (isset($this->_fileHandlers[$to])) { - $this->_fileHandlers[$to]->close(); - } - unset($this->_fileHandlers[$to]); - - if (file_exists($this->_dirPath . '/' . $to)) { - if (!unlink($this->_dirPath . '/' . $to)) { - throw new Zend_Search_Lucene_Exception('Delete operation failed'); - } - } - - $trackErrors = ini_get('track_errors'); - ini_set('track_errors', '1'); - - $success = @rename($this->_dirPath . '/' . $from, $this->_dirPath . '/' . $to); - if (!$success) { - ini_set('track_errors', $trackErrors); - throw new Zend_Search_Lucene_Exception($php_errormsg); - } - - ini_set('track_errors', $trackErrors); - - return $success; - } - - - /** - * Sets the modified time of $filename to now. - * - * @param string $filename - * @return void - */ - public function touchFile($filename) - { - return touch($this->_dirPath .'/'. $filename); - } - - - /** - * Returns a Zend_Search_Lucene_Storage_File object for a given $filename in the directory. - * - * If $shareHandler option is true, then file handler can be shared between File Object - * requests. It speed-ups performance, but makes problems with file position. - * Shared handler are good for short atomic requests. - * Non-shared handlers are useful for stream file reading (especial for compound files). - * - * @param string $filename - * @param boolean $shareHandler - * @return Zend_Search_Lucene_Storage_File - */ - public function getFileObject($filename, $shareHandler = true) - { - $fullFilename = $this->_dirPath . '/' . $filename; - - if (!$shareHandler) { - return new Zend_Search_Lucene_Storage_File_Filesystem($fullFilename); - } - - if (isset( $this->_fileHandlers[$filename] )) { - $this->_fileHandlers[$filename]->seek(0); - return $this->_fileHandlers[$filename]; - } - - $this->_fileHandlers[$filename] = new Zend_Search_Lucene_Storage_File_Filesystem($fullFilename); - return $this->_fileHandlers[$filename]; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Storage/File.php b/library/vendor/Zend/Search/Lucene/Storage/File.php deleted file mode 100644 index 745ed7ed7..000000000 --- a/library/vendor/Zend/Search/Lucene/Storage/File.php +++ /dev/null @@ -1,470 +0,0 @@ -_fread(1)); - } - - /** - * Writes a byte to the end of the file. - * - * @param integer $byte - */ - public function writeByte($byte) - { - return $this->_fwrite(chr($byte), 1); - } - - /** - * Read num bytes from the current position in the file - * and advances the file pointer. - * - * @param integer $num - * @return string - */ - public function readBytes($num) - { - return $this->_fread($num); - } - - /** - * Writes num bytes of data (all, if $num===null) to the end - * of the string. - * - * @param string $data - * @param integer $num - */ - public function writeBytes($data, $num=null) - { - $this->_fwrite($data, $num); - } - - - /** - * Reads an integer from the current position in the file - * and advances the file pointer. - * - * @return integer - */ - public function readInt() - { - $str = $this->_fread(4); - - return ord($str[0]) << 24 | - ord($str[1]) << 16 | - ord($str[2]) << 8 | - ord($str[3]); - } - - - /** - * Writes an integer to the end of file. - * - * @param integer $value - */ - public function writeInt($value) - { - settype($value, 'integer'); - $this->_fwrite( chr($value>>24 & 0xFF) . - chr($value>>16 & 0xFF) . - chr($value>>8 & 0xFF) . - chr($value & 0xFF), 4 ); - } - - - /** - * Returns a long integer from the current position in the file - * and advances the file pointer. - * - * @return integer|float - * @throws Zend_Search_Lucene_Exception - */ - public function readLong() - { - /** - * Check, that we work in 64-bit mode. - * fseek() uses long for offset. Thus, largest index segment file size in 32bit mode is 2Gb - */ - if (PHP_INT_SIZE > 4) { - $str = $this->_fread(8); - - return ord($str[0]) << 56 | - ord($str[1]) << 48 | - ord($str[2]) << 40 | - ord($str[3]) << 32 | - ord($str[4]) << 24 | - ord($str[5]) << 16 | - ord($str[6]) << 8 | - ord($str[7]); - } else { - return $this->readLong32Bit(); - } - } - - /** - * Writes long integer to the end of file - * - * @param integer $value - * @throws Zend_Search_Lucene_Exception - */ - public function writeLong($value) - { - /** - * Check, that we work in 64-bit mode. - * fseek() and ftell() use long for offset. Thus, largest index segment file size in 32bit mode is 2Gb - */ - if (PHP_INT_SIZE > 4) { - settype($value, 'integer'); - $this->_fwrite( chr($value>>56 & 0xFF) . - chr($value>>48 & 0xFF) . - chr($value>>40 & 0xFF) . - chr($value>>32 & 0xFF) . - chr($value>>24 & 0xFF) . - chr($value>>16 & 0xFF) . - chr($value>>8 & 0xFF) . - chr($value & 0xFF), 8 ); - } else { - $this->writeLong32Bit($value); - } - } - - - /** - * Returns a long integer from the current position in the file, - * advances the file pointer and return it as float (for 32-bit platforms). - * - * @return integer|float - * @throws Zend_Search_Lucene_Exception - */ - public function readLong32Bit() - { - $wordHigh = $this->readInt(); - $wordLow = $this->readInt(); - - if ($wordHigh & (int)0x80000000) { - // It's a negative value since the highest bit is set - if ($wordHigh == (int)0xFFFFFFFF && ($wordLow & (int)0x80000000)) { - return $wordLow; - } else { - throw new Zend_Search_Lucene_Exception('Long integers lower than -2147483648 (0x80000000) are not supported on 32-bit platforms.'); - } - - } - - if ($wordLow < 0) { - // Value is large than 0x7FFF FFFF. Represent low word as float. - $wordLow &= 0x7FFFFFFF; - $wordLow += (float)0x80000000; - } - - if ($wordHigh == 0) { - // Return value as integer if possible - return $wordLow; - } - - return $wordHigh*(float)0x100000000/* 0x00000001 00000000 */ + $wordLow; - } - - - /** - * Writes long integer to the end of file (32-bit platforms implementation) - * - * @param integer|float $value - * @throws Zend_Search_Lucene_Exception - */ - public function writeLong32Bit($value) - { - if ($value < (int)0x80000000) { - throw new Zend_Search_Lucene_Exception('Long integers lower than -2147483648 (0x80000000) are not supported on 32-bit platforms.'); - } - - if ($value < 0) { - $wordHigh = (int)0xFFFFFFFF; - $wordLow = (int)$value; - } else { - $wordHigh = (int)($value/(float)0x100000000/* 0x00000001 00000000 */); - $wordLow = $value - $wordHigh*(float)0x100000000/* 0x00000001 00000000 */; - - if ($wordLow > 0x7FFFFFFF) { - // Highest bit of low word is set. Translate it to the corresponding negative integer value - $wordLow -= 0x80000000; - $wordLow |= 0x80000000; - } - } - - $this->writeInt($wordHigh); - $this->writeInt($wordLow); - } - - - /** - * Returns a variable-length integer from the current - * position in the file and advances the file pointer. - * - * @return integer - */ - public function readVInt() - { - $nextByte = ord($this->_fread(1)); - $val = $nextByte & 0x7F; - - for ($shift=7; ($nextByte & 0x80) != 0; $shift += 7) { - $nextByte = ord($this->_fread(1)); - $val |= ($nextByte & 0x7F) << $shift; - } - return $val; - } - - /** - * Writes a variable-length integer to the end of file. - * - * @param integer $value - */ - public function writeVInt($value) - { - settype($value, 'integer'); - while ($value > 0x7F) { - $this->_fwrite(chr( ($value & 0x7F)|0x80 )); - $value >>= 7; - } - $this->_fwrite(chr($value)); - } - - - /** - * Reads a string from the current position in the file - * and advances the file pointer. - * - * @return string - */ - public function readString() - { - $strlen = $this->readVInt(); - if ($strlen == 0) { - return ''; - } else { - /** - * This implementation supports only Basic Multilingual Plane - * (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support - * "supplementary characters" (characters whose code points are - * greater than 0xFFFF) - * Java 2 represents these characters as a pair of char (16-bit) - * values, the first from the high-surrogates range (0xD800-0xDBFF), - * the second from the low-surrogates range (0xDC00-0xDFFF). Then - * they are encoded as usual UTF-8 characters in six bytes. - * Standard UTF-8 representation uses four bytes for supplementary - * characters. - */ - - $str_val = $this->_fread($strlen); - - for ($count = 0; $count < $strlen; $count++ ) { - if (( ord($str_val[$count]) & 0xC0 ) == 0xC0) { - $addBytes = 1; - if (ord($str_val[$count]) & 0x20 ) { - $addBytes++; - - // Never used. Java2 doesn't encode strings in four bytes - if (ord($str_val[$count]) & 0x10 ) { - $addBytes++; - } - } - $str_val .= $this->_fread($addBytes); - $strlen += $addBytes; - - // Check for null character. Java2 encodes null character - // in two bytes. - if (ord($str_val[$count]) == 0xC0 && - ord($str_val[$count+1]) == 0x80 ) { - $str_val[$count] = 0; - $str_val = substr($str_val,0,$count+1) - . substr($str_val,$count+2); - } - $count += $addBytes; - } - } - - return $str_val; - } - } - - /** - * Writes a string to the end of file. - * - * @param string $str - * @throws Zend_Search_Lucene_Exception - */ - public function writeString($str) - { - /** - * This implementation supports only Basic Multilingual Plane - * (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support - * "supplementary characters" (characters whose code points are - * greater than 0xFFFF) - * Java 2 represents these characters as a pair of char (16-bit) - * values, the first from the high-surrogates range (0xD800-0xDBFF), - * the second from the low-surrogates range (0xDC00-0xDFFF). Then - * they are encoded as usual UTF-8 characters in six bytes. - * Standard UTF-8 representation uses four bytes for supplementary - * characters. - */ - - // convert input to a string before iterating string characters - settype($str, 'string'); - - $chars = $strlen = strlen($str); - $containNullChars = false; - - for ($count = 0; $count < $strlen; $count++ ) { - /** - * String is already in Java 2 representation. - * We should only calculate actual string length and replace - * \x00 by \xC0\x80 - */ - if ((ord($str[$count]) & 0xC0) == 0xC0) { - $addBytes = 1; - if (ord($str[$count]) & 0x20 ) { - $addBytes++; - - // Never used. Java2 doesn't encode strings in four bytes - // and we dont't support non-BMP characters - if (ord($str[$count]) & 0x10 ) { - $addBytes++; - } - } - $chars -= $addBytes; - - if (ord($str[$count]) == 0 ) { - $containNullChars = true; - } - $count += $addBytes; - } - } - - if ($chars < 0) { - throw new Zend_Search_Lucene_Exception('Invalid UTF-8 string'); - } - - $this->writeVInt($chars); - if ($containNullChars) { - $this->_fwrite(str_replace($str, "\x00", "\xC0\x80")); - } else { - $this->_fwrite($str); - } - } - - - /** - * Reads binary data from the current position in the file - * and advances the file pointer. - * - * @return string - */ - public function readBinary() - { - return $this->_fread($this->readVInt()); - } -} diff --git a/library/vendor/Zend/Search/Lucene/Storage/File/Filesystem.php b/library/vendor/Zend/Search/Lucene/Storage/File/Filesystem.php deleted file mode 100644 index 7a1ef55cc..000000000 --- a/library/vendor/Zend/Search/Lucene/Storage/File/Filesystem.php +++ /dev/null @@ -1,226 +0,0 @@ -_fileHandle = @fopen($filename, $mode); - - if ($this->_fileHandle === false) { - ini_set('track_errors', $trackErrors); - throw new Zend_Search_Lucene_Exception($php_errormsg); - } - - ini_set('track_errors', $trackErrors); - } - - /** - * Sets the file position indicator and advances the file pointer. - * The new position, measured in bytes from the beginning of the file, - * is obtained by adding offset to the position specified by whence, - * whose values are defined as follows: - * SEEK_SET - Set position equal to offset bytes. - * SEEK_CUR - Set position to current location plus offset. - * SEEK_END - Set position to end-of-file plus offset. (To move to - * a position before the end-of-file, you need to pass a negative value - * in offset.) - * SEEK_CUR is the only supported offset type for compound files - * - * Upon success, returns 0; otherwise, returns -1 - * - * @param integer $offset - * @param integer $whence - * @return integer - */ - public function seek($offset, $whence=SEEK_SET) - { - return fseek($this->_fileHandle, $offset, $whence); - } - - - /** - * Get file position. - * - * @return integer - */ - public function tell() - { - return ftell($this->_fileHandle); - } - - /** - * Flush output. - * - * Returns true on success or false on failure. - * - * @return boolean - */ - public function flush() - { - return fflush($this->_fileHandle); - } - - /** - * Close File object - */ - public function close() - { - if ($this->_fileHandle !== null ) { - @fclose($this->_fileHandle); - $this->_fileHandle = null; - } - } - - /** - * Get the size of the already opened file - * - * @return integer - */ - public function size() - { - $position = ftell($this->_fileHandle); - fseek($this->_fileHandle, 0, SEEK_END); - $size = ftell($this->_fileHandle); - fseek($this->_fileHandle,$position); - - return $size; - } - - /** - * Read a $length bytes from the file and advance the file pointer. - * - * @param integer $length - * @return string - */ - protected function _fread($length=1) - { - if ($length == 0) { - return ''; - } - - if ($length < 1024) { - return fread($this->_fileHandle, $length); - } - - $data = ''; - while ($length > 0 && !feof($this->_fileHandle)) { - $nextBlock = fread($this->_fileHandle, $length); - if ($nextBlock === false) { - throw new Zend_Search_Lucene_Exception( "Error occured while file reading." ); - } - - $data .= $nextBlock; - $length -= strlen($nextBlock); - } - if ($length != 0) { - throw new Zend_Search_Lucene_Exception( "Error occured while file reading." ); - } - - return $data; - } - - - /** - * Writes $length number of bytes (all, if $length===null) to the end - * of the file. - * - * @param string $data - * @param integer $length - */ - protected function _fwrite($data, $length=null) - { - if ($length === null ) { - fwrite($this->_fileHandle, $data); - } else { - fwrite($this->_fileHandle, $data, $length); - } - } - - /** - * Lock file - * - * Lock type may be a LOCK_SH (shared lock) or a LOCK_EX (exclusive lock) - * - * @param integer $lockType - * @param boolean $nonBlockingLock - * @return boolean - */ - public function lock($lockType, $nonBlockingLock = false) - { - if ($nonBlockingLock) { - return flock($this->_fileHandle, $lockType | LOCK_NB); - } else { - return flock($this->_fileHandle, $lockType); - } - } - - /** - * Unlock file - * - * Returns true on success - * - * @return boolean - */ - public function unlock() - { - if ($this->_fileHandle !== null ) { - return flock($this->_fileHandle, LOCK_UN); - } else { - return true; - } - } -} - diff --git a/library/vendor/Zend/Search/Lucene/Storage/File/Memory.php b/library/vendor/Zend/Search/Lucene/Storage/File/Memory.php deleted file mode 100644 index 25bc416a1..000000000 --- a/library/vendor/Zend/Search/Lucene/Storage/File/Memory.php +++ /dev/null @@ -1,597 +0,0 @@ -_data = $data; - } - - /** - * Reads $length number of bytes at the current position in the - * file and advances the file pointer. - * - * @param integer $length - * @return string - */ - protected function _fread($length = 1) - { - $returnValue = substr($this->_data, $this->_position, $length); - $this->_position += $length; - return $returnValue; - } - - - /** - * Sets the file position indicator and advances the file pointer. - * The new position, measured in bytes from the beginning of the file, - * is obtained by adding offset to the position specified by whence, - * whose values are defined as follows: - * SEEK_SET - Set position equal to offset bytes. - * SEEK_CUR - Set position to current location plus offset. - * SEEK_END - Set position to end-of-file plus offset. (To move to - * a position before the end-of-file, you need to pass a negative value - * in offset.) - * Upon success, returns 0; otherwise, returns -1 - * - * @param integer $offset - * @param integer $whence - * @return integer - */ - public function seek($offset, $whence=SEEK_SET) - { - switch ($whence) { - case SEEK_SET: - $this->_position = $offset; - break; - - case SEEK_CUR: - $this->_position += $offset; - break; - - case SEEK_END: - $this->_position = strlen($this->_data); - $this->_position += $offset; - break; - - default: - break; - } - } - - /** - * Get file position. - * - * @return integer - */ - public function tell() - { - return $this->_position; - } - - /** - * Flush output. - * - * Returns true on success or false on failure. - * - * @return boolean - */ - public function flush() - { - // Do nothing - - return true; - } - - /** - * Writes $length number of bytes (all, if $length===null) to the end - * of the file. - * - * @param string $data - * @param integer $length - */ - protected function _fwrite($data, $length=null) - { - // We do not need to check if file position points to the end of "file". - // Only append operation is supported now - - if ($length !== null) { - $this->_data .= substr($data, 0, $length); - } else { - $this->_data .= $data; - } - - $this->_position = strlen($this->_data); - } - - /** - * Lock file - * - * Lock type may be a LOCK_SH (shared lock) or a LOCK_EX (exclusive lock) - * - * @param integer $lockType - * @return boolean - */ - public function lock($lockType, $nonBlockinLock = false) - { - // Memory files can't be shared - // do nothing - - return true; - } - - /** - * Unlock file - */ - public function unlock() - { - // Memory files can't be shared - // do nothing - } - - /** - * Reads a byte from the current position in the file - * and advances the file pointer. - * - * @return integer - */ - public function readByte() - { - return ord($this->_data[$this->_position++]); - } - - /** - * Writes a byte to the end of the file. - * - * @param integer $byte - */ - public function writeByte($byte) - { - // We do not need to check if file position points to the end of "file". - // Only append operation is supported now - - $this->_data .= chr($byte); - $this->_position = strlen($this->_data); - - return 1; - } - - /** - * Read num bytes from the current position in the file - * and advances the file pointer. - * - * @param integer $num - * @return string - */ - public function readBytes($num) - { - $returnValue = substr($this->_data, $this->_position, $num); - $this->_position += $num; - - return $returnValue; - } - - /** - * Writes num bytes of data (all, if $num===null) to the end - * of the string. - * - * @param string $data - * @param integer $num - */ - public function writeBytes($data, $num=null) - { - // We do not need to check if file position points to the end of "file". - // Only append operation is supported now - - if ($num !== null) { - $this->_data .= substr($data, 0, $num); - } else { - $this->_data .= $data; - } - - $this->_position = strlen($this->_data); - } - - - /** - * Reads an integer from the current position in the file - * and advances the file pointer. - * - * @return integer - */ - public function readInt() - { - $str = substr($this->_data, $this->_position, 4); - $this->_position += 4; - - return ord($str[0]) << 24 | - ord($str[1]) << 16 | - ord($str[2]) << 8 | - ord($str[3]); - } - - - /** - * Writes an integer to the end of file. - * - * @param integer $value - */ - public function writeInt($value) - { - // We do not need to check if file position points to the end of "file". - // Only append operation is supported now - - settype($value, 'integer'); - $this->_data .= chr($value>>24 & 0xFF) . - chr($value>>16 & 0xFF) . - chr($value>>8 & 0xFF) . - chr($value & 0xFF); - - $this->_position = strlen($this->_data); - } - - - /** - * Returns a long integer from the current position in the file - * and advances the file pointer. - * - * @return integer - * @throws Zend_Search_Lucene_Exception - */ - public function readLong() - { - /** - * Check, that we work in 64-bit mode. - * fseek() uses long for offset. Thus, largest index segment file size in 32bit mode is 2Gb - */ - if (PHP_INT_SIZE > 4) { - $str = substr($this->_data, $this->_position, 8); - $this->_position += 8; - - return ord($str[0]) << 56 | - ord($str[1]) << 48 | - ord($str[2]) << 40 | - ord($str[3]) << 32 | - ord($str[4]) << 24 | - ord($str[5]) << 16 | - ord($str[6]) << 8 | - ord($str[7]); - } else { - return $this->readLong32Bit(); - } - } - - /** - * Writes long integer to the end of file - * - * @param integer $value - * @throws Zend_Search_Lucene_Exception - */ - public function writeLong($value) - { - // We do not need to check if file position points to the end of "file". - // Only append operation is supported now - - /** - * Check, that we work in 64-bit mode. - * fseek() and ftell() use long for offset. Thus, largest index segment file size in 32bit mode is 2Gb - */ - if (PHP_INT_SIZE > 4) { - settype($value, 'integer'); - $this->_data .= chr($value>>56 & 0xFF) . - chr($value>>48 & 0xFF) . - chr($value>>40 & 0xFF) . - chr($value>>32 & 0xFF) . - chr($value>>24 & 0xFF) . - chr($value>>16 & 0xFF) . - chr($value>>8 & 0xFF) . - chr($value & 0xFF); - } else { - $this->writeLong32Bit($value); - } - - $this->_position = strlen($this->_data); - } - - - /** - * Returns a long integer from the current position in the file, - * advances the file pointer and return it as float (for 32-bit platforms). - * - * @return integer|float - * @throws Zend_Search_Lucene_Exception - */ - public function readLong32Bit() - { - $wordHigh = $this->readInt(); - $wordLow = $this->readInt(); - - if ($wordHigh & (int)0x80000000) { - // It's a negative value since the highest bit is set - if ($wordHigh == (int)0xFFFFFFFF && ($wordLow & (int)0x80000000)) { - return $wordLow; - } else { - throw new Zend_Search_Lucene_Exception('Long integers lower than -2147483648 (0x80000000) are not supported on 32-bit platforms.'); - } - - } - - if ($wordLow < 0) { - // Value is large than 0x7FFF FFFF. Represent low word as float. - $wordLow &= 0x7FFFFFFF; - $wordLow += (float)0x80000000; - } - - if ($wordHigh == 0) { - // Return value as integer if possible - return $wordLow; - } - - return $wordHigh*(float)0x100000000/* 0x00000001 00000000 */ + $wordLow; - } - - - /** - * Writes long integer to the end of file (32-bit platforms implementation) - * - * @param integer|float $value - * @throws Zend_Search_Lucene_Exception - */ - public function writeLong32Bit($value) - { - if ($value < (int)0x80000000) { - throw new Zend_Search_Lucene_Exception('Long integers lower than -2147483648 (0x80000000) are not supported on 32-bit platforms.'); - } - - if ($value < 0) { - $wordHigh = (int)0xFFFFFFFF; - $wordLow = (int)$value; - } else { - $wordHigh = (int)($value/(float)0x100000000/* 0x00000001 00000000 */); - $wordLow = $value - $wordHigh*(float)0x100000000/* 0x00000001 00000000 */; - - if ($wordLow > 0x7FFFFFFF) { - // Highest bit of low word is set. Translate it to the corresponding negative integer value - $wordLow -= 0x80000000; - $wordLow |= 0x80000000; - } - } - - $this->writeInt($wordHigh); - $this->writeInt($wordLow); - } - - /** - * Returns a variable-length integer from the current - * position in the file and advances the file pointer. - * - * @return integer - */ - public function readVInt() - { - $nextByte = ord($this->_data[$this->_position++]); - $val = $nextByte & 0x7F; - - for ($shift=7; ($nextByte & 0x80) != 0; $shift += 7) { - $nextByte = ord($this->_data[$this->_position++]); - $val |= ($nextByte & 0x7F) << $shift; - } - return $val; - } - - /** - * Writes a variable-length integer to the end of file. - * - * @param integer $value - */ - public function writeVInt($value) - { - // We do not need to check if file position points to the end of "file". - // Only append operation is supported now - - settype($value, 'integer'); - while ($value > 0x7F) { - $this->_data .= chr( ($value & 0x7F)|0x80 ); - $value >>= 7; - } - $this->_data .= chr($value); - - $this->_position = strlen($this->_data); - } - - - /** - * Reads a string from the current position in the file - * and advances the file pointer. - * - * @return string - */ - public function readString() - { - $strlen = $this->readVInt(); - if ($strlen == 0) { - return ''; - } else { - /** - * This implementation supports only Basic Multilingual Plane - * (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support - * "supplementary characters" (characters whose code points are - * greater than 0xFFFF) - * Java 2 represents these characters as a pair of char (16-bit) - * values, the first from the high-surrogates range (0xD800-0xDBFF), - * the second from the low-surrogates range (0xDC00-0xDFFF). Then - * they are encoded as usual UTF-8 characters in six bytes. - * Standard UTF-8 representation uses four bytes for supplementary - * characters. - */ - - $str_val = substr($this->_data, $this->_position, $strlen); - $this->_position += $strlen; - - for ($count = 0; $count < $strlen; $count++ ) { - if (( ord($str_val[$count]) & 0xC0 ) == 0xC0) { - $addBytes = 1; - if (ord($str_val[$count]) & 0x20 ) { - $addBytes++; - - // Never used. Java2 doesn't encode strings in four bytes - if (ord($str_val[$count]) & 0x10 ) { - $addBytes++; - } - } - $str_val .= substr($this->_data, $this->_position, $addBytes); - $this->_position += $addBytes; - $strlen += $addBytes; - - // Check for null character. Java2 encodes null character - // in two bytes. - if (ord($str_val[$count]) == 0xC0 && - ord($str_val[$count+1]) == 0x80 ) { - $str_val[$count] = 0; - $str_val = substr($str_val,0,$count+1) - . substr($str_val,$count+2); - } - $count += $addBytes; - } - } - - return $str_val; - } - } - - /** - * Writes a string to the end of file. - * - * @param string $str - * @throws Zend_Search_Lucene_Exception - */ - public function writeString($str) - { - /** - * This implementation supports only Basic Multilingual Plane - * (BMP) characters (from 0x0000 to 0xFFFF) and doesn't support - * "supplementary characters" (characters whose code points are - * greater than 0xFFFF) - * Java 2 represents these characters as a pair of char (16-bit) - * values, the first from the high-surrogates range (0xD800-0xDBFF), - * the second from the low-surrogates range (0xDC00-0xDFFF). Then - * they are encoded as usual UTF-8 characters in six bytes. - * Standard UTF-8 representation uses four bytes for supplementary - * characters. - */ - - // We do not need to check if file position points to the end of "file". - // Only append operation is supported now - - // convert input to a string before iterating string characters - settype($str, 'string'); - - $chars = $strlen = strlen($str); - $containNullChars = false; - - for ($count = 0; $count < $strlen; $count++ ) { - /** - * String is already in Java 2 representation. - * We should only calculate actual string length and replace - * \x00 by \xC0\x80 - */ - if ((ord($str[$count]) & 0xC0) == 0xC0) { - $addBytes = 1; - if (ord($str[$count]) & 0x20 ) { - $addBytes++; - - // Never used. Java2 doesn't encode strings in four bytes - // and we dont't support non-BMP characters - if (ord($str[$count]) & 0x10 ) { - $addBytes++; - } - } - $chars -= $addBytes; - - if (ord($str[$count]) == 0 ) { - $containNullChars = true; - } - $count += $addBytes; - } - } - - if ($chars < 0) { - throw new Zend_Search_Lucene_Exception('Invalid UTF-8 string'); - } - - $this->writeVInt($chars); - if ($containNullChars) { - $this->_data .= str_replace($str, "\x00", "\xC0\x80"); - - } else { - $this->_data .= $str; - } - - $this->_position = strlen($this->_data); - } - - - /** - * Reads binary data from the current position in the file - * and advances the file pointer. - * - * @return string - */ - public function readBinary() - { - $length = $this->readVInt(); - $returnValue = substr($this->_data, $this->_position, $length); - $this->_position += $length; - return $returnValue; - } -} - diff --git a/library/vendor/Zend/Search/Lucene/TermStreamsPriorityQueue.php b/library/vendor/Zend/Search/Lucene/TermStreamsPriorityQueue.php deleted file mode 100644 index 557865786..000000000 --- a/library/vendor/Zend/Search/Lucene/TermStreamsPriorityQueue.php +++ /dev/null @@ -1,170 +0,0 @@ -_termStreams = $termStreams; - - $this->resetTermsStream(); - } - - /** - * Reset terms stream. - */ - public function resetTermsStream() - { - /** Zend_Search_Lucene_Index_TermsPriorityQueue */ - - $this->_termsStreamQueue = new Zend_Search_Lucene_Index_TermsPriorityQueue(); - - foreach ($this->_termStreams as $termStream) { - $termStream->resetTermsStream(); - - // Skip "empty" containers - if ($termStream->currentTerm() !== null) { - $this->_termsStreamQueue->put($termStream); - } - } - - $this->nextTerm(); - } - - /** - * Skip terms stream up to the specified term preffix. - * - * Prefix contains fully specified field info and portion of searched term - * - * @param Zend_Search_Lucene_Index_Term $prefix - */ - public function skipTo(Zend_Search_Lucene_Index_Term $prefix) - { - $this->_termsStreamQueue = new Zend_Search_Lucene_Index_TermsPriorityQueue(); - - foreach ($this->_termStreams as $termStream) { - $termStream->skipTo($prefix); - - if ($termStream->currentTerm() !== null) { - $this->_termsStreamQueue->put($termStream); - } - } - - return $this->nextTerm(); - } - - /** - * Scans term streams and returns next term - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function nextTerm() - { - while (($termStream = $this->_termsStreamQueue->pop()) !== null) { - if ($this->_termsStreamQueue->top() === null || - $this->_termsStreamQueue->top()->currentTerm()->key() != - $termStream->currentTerm()->key()) { - // We got new term - $this->_lastTerm = $termStream->currentTerm(); - - if ($termStream->nextTerm() !== null) { - // Put segment back into the priority queue - $this->_termsStreamQueue->put($termStream); - } - - return $this->_lastTerm; - } - - if ($termStream->nextTerm() !== null) { - // Put segment back into the priority queue - $this->_termsStreamQueue->put($termStream); - } - } - - // End of stream - $this->_lastTerm = null; - - return null; - } - - /** - * Returns term in current position - * - * @return Zend_Search_Lucene_Index_Term|null - */ - public function currentTerm() - { - return $this->_lastTerm; - } - - /** - * Close terms stream - * - * Should be used for resources clean up if stream is not read up to the end - */ - public function closeTermsStream() - { - while (($termStream = $this->_termsStreamQueue->pop()) !== null) { - $termStream->closeTermsStream(); - } - - $this->_termsStreamQueue = null; - $this->_lastTerm = null; - } -} diff --git a/library/vendor/Zend/Serializer.php b/library/vendor/Zend/Serializer.php deleted file mode 100644 index 3eb84d524..000000000 --- a/library/vendor/Zend/Serializer.php +++ /dev/null @@ -1,185 +0,0 @@ -load($adapterName); - } catch (Exception $e) { - throw new Zend_Serializer_Exception('Can\'t load serializer adapter "'.$adapterName.'"', 0, $e); - } - - // ZF-8842: - // check that the loaded class implements Zend_Serializer_Adapter_AdapterInterface without execute code - if (!in_array('Zend_Serializer_Adapter_AdapterInterface', class_implements($adapterClass))) { - throw new Zend_Serializer_Exception('The serializer adapter class "'.$adapterClass.'" must implement Zend_Serializer_Adapter_AdapterInterface'); - } - - return new $adapterClass($opts); - } - - /** - * Get the adapter plugin loader. - * - * @return Zend_Loader_PluginLoader - */ - public static function getAdapterLoader() - { - if (self::$_adapterLoader === null) { - self::$_adapterLoader = self::_getDefaultAdapterLoader(); - } - return self::$_adapterLoader; - } - - /** - * Change the adapter plugin load. - * - * @param Zend_Loader_PluginLoader $pluginLoader - * @return void - */ - public static function setAdapterLoader(Zend_Loader_PluginLoader $pluginLoader) - { - self::$_adapterLoader = $pluginLoader; - } - - /** - * Resets the internal adapter plugin loader - * - * @return Zend_Loader_PluginLoader - */ - public static function resetAdapterLoader() - { - self::$_adapterLoader = self::_getDefaultAdapterLoader(); - return self::$_adapterLoader; - } - - /** - * Returns a default adapter plugin loader - * - * @return Zend_Loader_PluginLoader - */ - protected static function _getDefaultAdapterLoader() - { - $loader = new Zend_Loader_PluginLoader(); - $loader->addPrefixPath('Zend_Serializer_Adapter', dirname(__FILE__).'/Serializer/Adapter'); - return $loader; - } - - /** - * Change the default adapter. - * - * @param string|Zend_Serializer_Adapter_AdapterInterface $adapter - * @param array|Zend_Config $options - */ - public static function setDefaultAdapter($adapter, $options = array()) - { - self::$_defaultAdapter = self::factory($adapter, $options); - } - - /** - * Get the default adapter. - * - * @return Zend_Serializer_Adapter_AdapterInterface - */ - public static function getDefaultAdapter() - { - if (!self::$_defaultAdapter instanceof Zend_Serializer_Adapter_AdapterInterface) { - self::setDefaultAdapter(self::$_defaultAdapter); - } - return self::$_defaultAdapter; - } - - /** - * Generates a storable representation of a value using the default adapter. - * - * @param mixed $value - * @param array $options - * @return string - * @throws Zend_Serializer_Exception - */ - public static function serialize($value, array $options = array()) - { - if (isset($options['adapter'])) { - $adapter = self::factory($options['adapter']); - unset($options['adapter']); - } else { - $adapter = self::getDefaultAdapter(); - } - - return $adapter->serialize($value, $options); - } - - /** - * Creates a PHP value from a stored representation using the default adapter. - * - * @param string $serialized - * @param array $options - * @return mixed - * @throws Zend_Serializer_Exception - */ - public static function unserialize($serialized, array $options = array()) - { - if (isset($options['adapter'])) { - $adapter = self::factory($options['adapter']); - unset($options['adapter']); - } else { - $adapter = self::getDefaultAdapter(); - } - - return $adapter->unserialize($serialized, $options); - } -} diff --git a/library/vendor/Zend/Serializer/Adapter/AdapterAbstract.php b/library/vendor/Zend/Serializer/Adapter/AdapterAbstract.php deleted file mode 100644 index a8657baaa..000000000 --- a/library/vendor/Zend/Serializer/Adapter/AdapterAbstract.php +++ /dev/null @@ -1,110 +0,0 @@ -setOptions($opts); - } - - /** - * Set serializer options - * - * @param array|Zend_Config $opts Serializer options - * @return Zend_Serializer_Adapter_AdapterAbstract - */ - public function setOptions($opts) - { - if ($opts instanceof Zend_Config) { - $opts = $opts->toArray(); - } else { - $opts = (array) $opts; - } - - foreach ($opts as $k => $v) { - $this->setOption($k, $v); - } - return $this; - } - - /** - * Set a serializer option - * - * @param string $name Option name - * @param mixed $value Option value - * @return Zend_Serializer_Adapter_AdapterAbstract - */ - public function setOption($name, $value) - { - $this->_options[(string) $name] = $value; - return $this; - } - - /** - * Get serializer options - * - * @return array - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Get a serializer option - * - * @param string $name - * @return mixed - * @throws Zend_Serializer_Exception - */ - public function getOption($name) - { - $name = (string) $name; - if (!array_key_exists($name, $this->_options)) { - throw new Zend_Serializer_Exception('Unknown option name "'.$name.'"'); - } - - return $this->_options[$name]; - } -} diff --git a/library/vendor/Zend/Serializer/Adapter/AdapterInterface.php b/library/vendor/Zend/Serializer/Adapter/AdapterInterface.php deleted file mode 100644 index 970b02519..000000000 --- a/library/vendor/Zend/Serializer/Adapter/AdapterInterface.php +++ /dev/null @@ -1,92 +0,0 @@ -writeTypeMarker($value); - return $stream->getStream(); - } catch (Exception $e) { - throw new Zend_Serializer_Exception('Serialization failed by previous error', 0, $e); - } - } - - /** - * Unserialize an AMF0 value to PHP - * - * @param mixed $value - * @param array $opts - * @return void - * @throws Zend_Serializer_Exception - */ - public function unserialize($value, array $opts = array()) - { - try { - $stream = new Zend_Amf_Parse_InputStream($value); - $deserializer = new Zend_Amf_Parse_Amf0_Deserializer($stream); - return $deserializer->readTypeMarker(); - } catch (Exception $e) { - throw new Zend_Serializer_Exception('Unserialization failed by previous error', 0, $e); - } - } - -} diff --git a/library/vendor/Zend/Serializer/Adapter/Amf3.php b/library/vendor/Zend/Serializer/Adapter/Amf3.php deleted file mode 100644 index b1f96a2d7..000000000 --- a/library/vendor/Zend/Serializer/Adapter/Amf3.php +++ /dev/null @@ -1,80 +0,0 @@ -writeTypeMarker($value); - return $stream->getStream(); - } catch (Exception $e) { - throw new Zend_Serializer_Exception('Serialization failed by previous error', 0, $e); - } - } - - /** - * Deserialize an AMF3 value to PHP - * - * @param mixed $value - * @param array $opts - * @return string - * @throws Zend_Serializer_Exception - */ - public function unserialize($value, array $opts = array()) - { - try { - $stream = new Zend_Amf_Parse_InputStream($value); - $deserializer = new Zend_Amf_Parse_Amf3_Deserializer($stream); - return $deserializer->readTypeMarker(); - } catch (Exception $e) { - throw new Zend_Serializer_Exception('Unserialization failed by previous error', 0, $e); - } - } -} diff --git a/library/vendor/Zend/Serializer/Adapter/Igbinary.php b/library/vendor/Zend/Serializer/Adapter/Igbinary.php deleted file mode 100644 index 3ce8045e4..000000000 --- a/library/vendor/Zend/Serializer/Adapter/Igbinary.php +++ /dev/null @@ -1,94 +0,0 @@ - false, - 'enableJsonExprFinder' => false, - 'objectDecodeType' => Zend_Json::TYPE_ARRAY, - ); - - /** - * Serialize PHP value to JSON - * - * @param mixed $value - * @param array $opts - * @return string - * @throws Zend_Serializer_Exception on JSON encoding exception - */ - public function serialize($value, array $opts = array()) - { - $opts = $opts + $this->_options; - - try { - return Zend_Json::encode($value, $opts['cycleCheck'], $opts); - } catch (Exception $e) { - throw new Zend_Serializer_Exception('Serialization failed', 0, $e); - } - } - - /** - * Deserialize JSON to PHP value - * - * @param string $json - * @param array $opts - * @return mixed - */ - public function unserialize($json, array $opts = array()) - { - $opts = $opts + $this->_options; - - try { - $ret = Zend_Json::decode($json, $opts['objectDecodeType']); - } catch (Zend_Json_Exception $e) { - throw new Zend_Serializer_Exception('Invalid json data'); - } catch (Exception $e) { - throw new Zend_Serializer_Exception('Unserialization failed by previous error', 0, $e); - } - - return $ret; - } -} diff --git a/library/vendor/Zend/Serializer/Adapter/PhpCode.php b/library/vendor/Zend/Serializer/Adapter/PhpCode.php deleted file mode 100644 index 29be8c738..000000000 --- a/library/vendor/Zend/Serializer/Adapter/PhpCode.php +++ /dev/null @@ -1,65 +0,0 @@ - '\\\\', - "\x00" => '\\x00', "\x01" => '\\x01', "\x02" => '\\x02', "\x03" => '\\x03', - "\x04" => '\\x04', "\x05" => '\\x05', "\x06" => '\\x06', "\x07" => '\\x07', - "\x08" => '\\x08', "\x09" => '\\t', "\x0a" => '\\n', "\x0b" => '\\x0b', - "\x0c" => '\\x0c', "\x0d" => '\\r', "\x0e" => '\\x0e', "\x0f" => '\\x0f', - "\x10" => '\\x10', "\x11" => '\\x11', "\x12" => '\\x12', "\x13" => '\\x13', - "\x14" => '\\x14', "\x15" => '\\x15', "\x16" => '\\x16', "\x17" => '\\x17', - "\x18" => '\\x18', "\x19" => '\\x19', "\x1a" => '\\x1a', "\x1b" => '\\x1b', - "\x1c" => '\\x1c', "\x1d" => '\\x1d', "\x1e" => '\\x1e', "\x1f" => '\\x1f', - "\xff" => '\\xff' - ); - - /** - * @var array Default options - */ - protected $_options = array( - 'protocol' => 0, - ); - - // process vars - protected $_protocol = 0; - protected $_binary = false; - protected $_memo = array(); - protected $_pickle = ''; - protected $_pickleLen = 0; - protected $_pos = 0; - protected $_stack = array(); - protected $_marker = null; - - /** - * Constructor - * - * @link Zend_Serializer_Adapter_AdapterAbstract::__construct() - */ - public function __construct($opts=array()) - { - parent::__construct($opts); - - // init - if (self::$_isLittleEndian === null) { - self::$_isLittleEndian = (pack('l', 1) === "\x01\x00\x00\x00"); - } - - $this->_marker = new stdClass(); - } - - /** - * Set an option - * - * @link Zend_Serializer_Adapter_AdapterAbstract::setOption() - * @param string $name - * @param mixed $value - * @return Zend_Serializer_Adapter_PythonPickle - */ - public function setOption($name, $value) - { - switch ($name) { - case 'protocol': - $value = $this->_checkProtocolNumber($value); - break; - } - - return parent::setOption($name, $value); - } - - /** - * Check and normalize pickle protocol number - * - * @param int $number - * @return int - * @throws Zend_Serializer_Exception - */ - protected function _checkProtocolNumber($number) - { - $int = (int) $number; - if ($int < 0 || $int > 3) { - throw new Zend_Serializer_Exception('Invalid or unknown protocol version "'.$number.'"'); - } - return $int; - } - - /* serialize */ - - /** - * Serialize PHP to PythonPickle format - * - * @param mixed $value - * @param array $opts - * @return string - */ - public function serialize($value, array $opts = array()) - { - $opts = $opts + $this->_options; - - $this->_protocol = $this->_checkProtocolNumber($opts['protocol']); - $this->_binary = $this->_protocol != 0; - - // clear process vars before serializing - $this->_memo = array(); - $this->_pickle = ''; - - // write - if ($this->_protocol >= 2) { - $this->_writeProto($this->_protocol); - } - $this->_write($value); - $this->_writeStop(); - - // clear process vars after serializing - $this->_memo = array(); - $pickle = $this->_pickle; - $this->_pickle = ''; - - return $pickle; - } - - /** - * Write a value - * - * @param mixed $value - * @return void - * @throws Zend_Serializer_Exception on invalid or unrecognized value type - */ - protected function _write($value) - { - if ($value === null) { - $this->_writeNull(); - } elseif ($value === true) { - $this->_writeTrue(); - } elseif ($value === false) { - $this->_writeFalse(); - } elseif (is_int($value)) { - $this->_writeInt($value); - } elseif (is_float($value)) { - $this->_writeFloat($value); - } elseif (is_string($value)) { - // TODO: write unicode / binary - $this->_writeString($value); - } elseif (is_array($value)) { - if ($this->_isArrayAssoc($value)) { - $this->_writeArrayDict($value); - } else { - $this->_writeArrayList($value); - } - } elseif (is_object($value)) { - $this->_writeObject($value); - } else { - throw new Zend_Serializer_Exception( - 'PHP-Type "'.gettype($value).'" isn\'t serializable with '.get_class($this) - ); - } - } - - /** - * Write pickle protocol - * - * @param int $protocol - * @return void - */ - protected function _writeProto($protocol) - { - $this->_pickle .= self::OP_PROTO . $protocol; - } - - /** - * Write a get - * - * @param int $id Id of memo - * @return void - */ - protected function _writeGet($id) - { - if ($this->_binary) { - if ($id <= 0xff) { - // BINGET + chr(i) - $this->_pickle .= self::OP_BINGET . chr($id); - } else { - // LONG_BINGET + pack("_pickle .= self::OP_LONG_BINGET . $bin; - } - } else { - $this->_pickle .= self::OP_GET . $id . "\r\n"; - } - } - - /** - * Write a put - * - * @param int $id Id of memo - * @return void - */ - protected function _writePut($id) - { - if ($this->_binary) { - if ($id <= 0xff) { - // BINPUT + chr(i) - $this->_pickle .= self::OP_BINPUT . chr($id); - } else { - // LONG_BINPUT + pack("_pickle .= self::OP_LONG_BINPUT . $bin; - } - } else { - $this->_pickle .= self::OP_PUT . $id . "\r\n"; - } - } - - /** - * Write a null as None - * - * @return void - */ - protected function _writeNull() - { - $this->_pickle .= self::OP_NONE; - } - - /** - * Write a boolean true - * - * @return void - */ - protected function _writeTrue() - { - if ($this->_protocol >= 2) { - $this->_pickle .= self::OP_NEWTRUE; - } else { - $this->_pickle .= self::OP_INT . "01\r\n"; - } - } - - /** - * Write a boolean false - * - * @return void - */ - protected function _writeFalse() - { - if ($this->_protocol >= 2) { - $this->_pickle .= self::OP_NEWFALSE; - } else { - $this->_pickle .= self::OP_INT . "00\r\n"; - } - } - - /** - * Write an integer value - * - * @param int $value - * @return void - */ - protected function _writeInt($value) - { - if ($this->_binary) { - if ($value >= 0) { - if ($value <= 0xff) { - // self.write(BININT1 + chr(obj)) - $this->_pickle .= self::OP_BININT1 . chr($value); - } elseif ($value <= 0xffff) { - // self.write("%c%c%c" % (BININT2, obj&0xff, obj>>8)) - $this->_pickle .= self::OP_BININT2 . pack('v', $value); - } - return; - } - - // Next check for 4-byte signed ints: - $highBits = $value >> 31; // note that Python shift sign-extends - if ($highBits == 0 || $highBits == -1) { - // All high bits are copies of bit 2**31, so the value - // fits in a 4-byte signed int. - // self.write(BININT + pack("_pickle .= self::OP_BININT . $bin; - return; - } - } - - $this->_pickle .= self::OP_INT . $value . "\r\n"; - } - - /** - * Write a float value - * - * @param float $value - * @return void - */ - protected function _writeFloat($value) - { - if ($this->_binary) { - // self.write(BINFLOAT + pack('>d', obj)) - $bin = pack('d', $value); - if (self::$_isLittleEndian === true) { - $bin = strrev($bin); - } - $this->_pickle .= self::OP_BINFLOAT . $bin; - } else { - $this->_pickle .= self::OP_FLOAT . $value . "\r\n"; - } - } - - /** - * Write a string value - * - * @param string $value - * @return void - */ - protected function _writeString($value) - { - if ( ($id=$this->_searchMomo($value)) !== false ) { - $this->_writeGet($id); - return; - } - - if ($this->_binary) { - $n = strlen($value); - if ($n <= 0xff) { - // self.write(SHORT_BINSTRING + chr(n) + obj) - $this->_pickle .= self::OP_SHORT_BINSTRING . chr($n) . $value; - } else { - // self.write(BINSTRING + pack("_pickle .= self::OP_BINSTRING . $binLen . $value; - } - } else { - $this->_pickle .= self::OP_STRING . $this->_quoteString($value) . "\r\n"; - } - - $this->_momorize($value); - } - - /** - * Write an associative array value as dictionary - * - * @param array $value - * @return void - */ - protected function _writeArrayDict(array $value) - { - if (($id=$this->_searchMomo($value)) !== false) { - $this->_writeGet($id);; - return; - } - - $this->_pickle .= self::OP_MARK . self::OP_DICT; - $this->_momorize($value); - - foreach ($value as $k => $v) { - $this->_pickle .= $this->_write($k) - . $this->_write($v) - . self::OP_SETITEM; - } - } - - /** - * Write a simple array value as list - * - * @param array $value - * @return void - */ - protected function _writeArrayList(array $value) - { - if (($id = $this->_searchMomo($value)) !== false) { - $this->_writeGet($id); - return; - } - - $this->_pickle .= self::OP_MARK . self::OP_LIST; - $this->_momorize($value); - - foreach ($value as $k => $v) { - $this->_pickle .= $this->_write($v) . self::OP_APPEND; - } - } - - /** - * Write an object as an dictionary - * - * @param object $value - * @return void - */ - protected function _writeObject($value) - { - // can't serialize php objects to python objects yet - $this->_writeArrayDict(get_object_vars($value)); - } - - /** - * Write stop - * - * @return void - */ - protected function _writeStop() - { - $this->_pickle .= self::OP_STOP; - } - - /* serialize helper */ - - /** - * Add a value to the memo and write the id - * - * @param mixed $value - * @return void - */ - protected function _momorize($value) - { - $id = count($this->_memo); - $this->_memo[$id] = $value; - $this->_writePut($id); - } - - /** - * Search a value in the meno and return the id - * - * @param mixed $value - * @return int|false The id or false - */ - protected function _searchMomo($value) - { - return array_search($value, $this->_memo, true); - } - - /** - * Is an array associative? - * - * @param array $value - * @return boolean - */ - protected function _isArrayAssoc(array $value) - { - return array_diff_key($value, array_keys(array_keys($value))); - } - - /** - * Quote/Escape a string - * - * @param string $str - * @return string quoted string - */ - protected function _quoteString($str) - { - $quoteArr = self::$_quoteString; - - if (($cntSingleQuote = substr_count($str, "'")) - && ($cntDoubleQuote = substr_count($str, '"')) - && ($cntSingleQuote < $cntDoubleQuote) - ) { - $quoteArr['"'] = '\\"'; - $enclosure = '"'; - } else { - $quoteArr["'"] = "\\'"; - $enclosure = "'"; - } - - return $enclosure . strtr($str, $quoteArr) . $enclosure; - } - - /* unserialize */ - - /** - * Unserialize from Python Pickle format to PHP - * - * @param string $pickle - * @param array $opts - * @return mixed - * @throws Zend_Serializer_Exception on invalid Pickle string - */ - public function unserialize($pickle, array $opts = array()) - { - // init process vars - $this->_pos = 0; - $this->_pickle = $pickle; - $this->_pickleLen = strlen($this->_pickle); - $this->_memo = array(); - $this->_stack = array(); - - // read pickle string - while (($op=$this->_read(1)) !== self::OP_STOP) { - $this->_load($op); - } - - if (!count($this->_stack)) { - throw new Zend_Serializer_Exception('No data found'); - } - - $ret = array_pop($this->_stack); - - // clear process vars - $this->_pos = 0; - $this->_pickle = ''; - $this->_pickleLen = 0; - $this->_memo = array(); - $this->_stack = array(); - - return $ret; - } - - /** - * Load a pickle opcode - * - * @param string $op - * @return void - * @throws Zend_Serializer_Exception on invalid opcode - */ - protected function _load($op) - { - switch ($op) { - case self::OP_PUT: - $this->_loadPut(); - break; - case self::OP_BINPUT: - $this->_loadBinPut(); - break; - case self::OP_LONG_BINPUT: - $this->_loadLongBinPut(); - break; - case self::OP_GET: - $this->_loadGet(); - break; - case self::OP_BINGET: - $this->_loadBinGet(); - break; - case self::OP_LONG_BINGET: - $this->_loadLongBinGet(); - break; - case self::OP_NONE: - $this->_loadNone(); - break; - case self::OP_NEWTRUE: - $this->_loadNewTrue(); - break; - case self::OP_NEWFALSE: - $this->_loadNewFalse(); - break; - case self::OP_INT: - $this->_loadInt(); - break; - case self::OP_BININT: - $this->_loadBinInt(); - break; - case self::OP_BININT1: - $this->_loadBinInt1(); - break; - case self::OP_BININT2: - $this->_loadBinInt2(); - break; - case self::OP_LONG: - $this->_loadLong(); - break; - case self::OP_LONG1: - $this->_loadLong1(); - break; - case self::OP_LONG4: - $this->_loadLong4(); - break; - case self::OP_FLOAT: - $this->_loadFloat(); - break; - case self::OP_BINFLOAT: - $this->_loadBinFloat(); - break; - case self::OP_STRING: - $this->_loadString(); - break; - case self::OP_BINSTRING: - $this->_loadBinString(); - break; - case self::OP_SHORT_BINSTRING: - $this->_loadShortBinString(); - break; - case self::OP_BINBYTES: - $this->_loadBinBytes(); - break; - case self::OP_SHORT_BINBYTES: - $this->_loadShortBinBytes(); - break; - case self::OP_UNICODE: - $this->_loadUnicode(); - break; - case self::OP_BINUNICODE: - $this->_loadBinUnicode(); - break; - case self::OP_MARK: - $this->_loadMark(); - break; - case self::OP_LIST: - $this->_loadList(); - break; - case self::OP_EMPTY_LIST: - $this->_loadEmptyList(); - break; - case self::OP_APPEND: - $this->_loadAppend(); - break; - case self::OP_APPENDS: - $this->_loadAppends(); - break; - case self::OP_DICT: - $this->_loadDict(); - break; - case self::OP_EMPTY_DICT: - $this->_loadEmptyDict(); - break; - case self::OP_SETITEM: - $this->_loadSetItem(); - break; - case self::OP_SETITEMS: - $this->_loadSetItems(); - break; - case self::OP_TUPLE: - $this->_loadTuple(); - break; - case self::OP_TUPLE1: - $this->_loadTuple1(); - break; - case self::OP_TUPLE2: - $this->_loadTuple2(); - break; - case self::OP_TUPLE3: - $this->_loadTuple3(); - break; - case self::OP_PROTO: - $this->_loadProto(); - break; - default: - throw new Zend_Serializer_Exception('Invalid or unknown opcode "'.$op.'"'); - } - } - - /** - * Load a PUT opcode - * - * @return void - * @throws Zend_Serializer_Exception on missing stack - */ - protected function _loadPut() - { - $id = (int)$this->_readline(); - - $lastStack = count($this->_stack)-1; - if (!isset($this->_stack[$lastStack])) { - throw new Zend_Serializer_Exception('No stack exist'); - } - $this->_memo[$id] = & $this->_stack[$lastStack]; - } - - /** - * Load a binary PUT - * - * @return void - * @throws Zend_Serializer_Exception on missing stack - */ - protected function _loadBinPut() - { - $id = ord($this->_read(1)); - - $lastStack = count($this->_stack)-1; - if (!isset($this->_stack[$lastStack])) { - throw new Zend_Serializer_Exception('No stack exist'); - } - $this->_memo[$id] = & $this->_stack[$lastStack]; - } - - /** - * Load a long binary PUT - * - * @return void - * @throws Zend_Serializer_Exception on missing stack - */ - protected function _loadLongBinPut() - { - $bin = $this->_read(4); - if (self::$_isLittleEndian === false) { - $bin = strrev($bin); - } - list(, $id) = unpack('l', $bin); - - $lastStack = count($this->_stack)-1; - if (!isset($this->_stack[$lastStack])) { - throw new Zend_Serializer_Exception('No stack exist'); - } - $this->_memo[$id] = & $this->_stack[$lastStack]; - } - - /** - * Load a GET operation - * - * @return void - * @throws Zend_Serializer_Exception on missing GET identifier - */ - protected function _loadGet() - { - $id = (int)$this->_readline(); - - if (!array_key_exists($id, $this->_memo)) { - throw new Zend_Serializer_Exception('Get id "' . $id . '" not found in momo'); - } - $this->_stack[] = & $this->_memo[$id]; - } - - /** - * Load a binary GET operation - * - * @return void - * @throws Zend_Serializer_Exception on missing GET identifier - */ - protected function _loadBinGet() - { - $id = ord($this->_read(1)); - - if (!array_key_exists($id, $this->_memo)) { - throw new Zend_Serializer_Exception('Get id "' . $id . '" not found in momo'); - } - $this->_stack[] = & $this->_memo[$id]; - } - - /** - * Load a long binary GET operation - * - * @return void - * @throws Zend_Serializer_Exception on missing GET identifier - */ - protected function _loadLongBinGet() - { - $bin = $this->_read(4); - if (self::$_isLittleEndian === false) { - $bin = strrev($bin); - } - list(, $id) = unpack('l', $bin); - - if (!array_key_exists($id, $this->_memo)) { - throw new Zend_Serializer_Exception('Get id "' . $id . '" not found in momo'); - } - $this->_stack[] = & $this->_memo[$id]; - } - - /** - * Load a NONE operator - * - * @return void - */ - protected function _loadNone() - { - $this->_stack[] = null; - } - - /** - * Load a boolean TRUE operator - * - * @return void - */ - protected function _loadNewTrue() - { - $this->_stack[] = true; - } - - /** - * Load a boolean FALSE operator - * - * @return void - */ - protected function _loadNewFalse() - { - $this->_stack[] = false; - } - - /** - * Load an integer operator - * - * @return void - */ - protected function _loadInt() - { - $line = $this->_readline(); - if ($line === '01') { - $this->_stack[] = true; - } elseif ($line === '00') { - $this->_stack[] = false; - } else { - $this->_stack[] = (int)$line; - } - } - - /** - * Load a binary integer operator - * - * @return void - */ - protected function _loadBinInt() - { - $bin = $this->_read(4); - if (self::$_isLittleEndian === false) { - $bin = strrev($bin); - } - list(, $int) = unpack('l', $bin); - $this->_stack[] = $int; - } - - /** - * Load the first byte of a binary integer - * - * @return void - */ - protected function _loadBinInt1() - { - $this->_stack[] = ord($this->_read(1)); - } - - /** - * Load the second byte of a binary integer - * - * @return void - */ - protected function _loadBinInt2() - { - $bin = $this->_read(2); - list(, $int) = unpack('v', $bin); - $this->_stack[] = $int; - } - - /** - * Load a long (float) operator - * - * @return void - */ - protected function _loadLong() - { - $data = rtrim($this->_readline(), 'L'); - if ($data === '') { - $this->_stack[] = 0; - } else { - $this->_stack[] = $data; - } - } - - /** - * Load a one byte long integer - * - * @return void - */ - protected function _loadLong1() - { - $n = ord($this->_read(1)); - $data = $this->_read($n); - $this->_stack[] = $this->_decodeBinLong($data); - } - - /** - * Load a 4 byte long integer - * - * @return void - */ - protected function _loadLong4() - { - $nBin = $this->_read(4); - if (self::$_isLittleEndian === false) { - $nBin = strrev($$nBin); - } - list(, $n) = unpack('l', $nBin); - $data = $this->_read($n); - - $this->_stack[] = $this->_decodeBinLong($data); - } - - /** - * Load a float value - * - * @return void - */ - protected function _loadFloat() - { - $float = (float)$this->_readline(); - $this->_stack[] = $float; - } - - /** - * Load a binary float value - * - * @return void - */ - protected function _loadBinFloat() - { - $bin = $this->_read(8); - if (self::$_isLittleEndian === true) { - $bin = strrev($bin); - } - list(, $float) = unpack('d', $bin); - $this->_stack[] = $float; - } - - /** - * Load a string - * - * @return void - */ - protected function _loadString() - { - $this->_stack[] = $this->_unquoteString((string)$this->_readline()); - } - - /** - * Load a binary string - * - * @return void - */ - protected function _loadBinString() - { - $bin = $this->_read(4); - if (!self::$_isLittleEndian) { - $bin = strrev($bin); - } - list(, $len) = unpack('l', $bin); - $this->_stack[] = (string)$this->_read($len); - } - - /** - * Load a short binary string - * - * @return void - */ - protected function _loadShortBinString() - { - $len = ord($this->_read(1)); - $this->_stack[] = (string)$this->_read($len); - } - - /** - * Load arbitrary binary bytes - * - * @return void - */ - protected function _loadBinBytes() - { - // read byte length - $nBin = $this->_read(4); - if (self::$_isLittleEndian === false) { - $nBin = strrev($$nBin); - } - list(, $n) = unpack('l', $nBin); - $this->_stack[] = $this->_read($n); - } - - /** - * Load a single binary byte - * - * @return void - */ - protected function _loadShortBinBytes() - { - $n = ord($this->_read(1)); - $this->_stack[] = $this->_read($n); - } - - /** - * Load a unicode string - * - * @return void - */ - protected function _loadUnicode() - { - $data = $this->_readline(); - $pattern = '/\\\\u([a-fA-F0-9]{4})/u'; // \uXXXX - $data = preg_replace_callback($pattern, array($this, '_convertMatchingUnicodeSequence2Utf8'), $data); - - $this->_stack[] = $data; - } - - /** - * Convert a unicode sequence to UTF-8 - * - * @param array $match - * @return string - */ - protected function _convertMatchingUnicodeSequence2Utf8(array $match) - { - return $this->_hex2Utf8($match[1]); - } - - /** - * Convert a hex string to a UTF-8 string - * - * @param string $sequence - * @return string - * @throws Zend_Serializer_Exception on unmatched unicode sequence - */ - protected function _hex2Utf8($hex) - { - $uniCode = hexdec($hex); - - if ($uniCode < 0x80) { // 1Byte - $utf8Char = chr($uniCode); - - } elseif ($uniCode < 0x800) { // 2Byte - $utf8Char = chr(0xC0 | $uniCode >> 6) - . chr(0x80 | $uniCode & 0x3F); - - } elseif ($uniCode < 0x10000) { // 3Byte - $utf8Char = chr(0xE0 | $uniCode >> 12) - . chr(0x80 | $uniCode >> 6 & 0x3F) - . chr(0x80 | $uniCode & 0x3F); - - } elseif ($uniCode < 0x110000) { // 4Byte - $utf8Char = chr(0xF0 | $uniCode >> 18) - . chr(0x80 | $uniCode >> 12 & 0x3F) - . chr(0x80 | $uniCode >> 6 & 0x3F) - . chr(0x80 | $uniCode & 0x3F); - } else { - throw new Zend_Serializer_Exception('Unsupported unicode character found "' . dechex($uniCode) . '"'); - } - - return $utf8Char; - } - - /** - * Load binary unicode sequence - * - * @return void - */ - protected function _loadBinUnicode() - { - // read byte length - $n = $this->_read(4); - if (self::$_isLittleEndian === false) { - $n = strrev($n); - } - list(, $n) = unpack('l', $n); - $data = $this->_read($n); - - $this->_stack[] = $data; - } - - /** - * Load a marker sequence - * - * @return void - */ - protected function _loadMark() - { - $this->_stack[] = $this->_marker; - } - - /** - * Load an array (list) - * - * @return void - */ - protected function _loadList() - { - $k = $this->_lastMarker(); - $this->_stack[$k] = array(); - - // remove all elements after marker - $max = count($this->_stack); - for ($i = $k+1, $max; $i < $max; $i++) { - unset($this->_stack[$i]); - } - } - - /** - * Load an append (to list) sequence - * - * @return void - */ - protected function _loadAppend() - { - $value = array_pop($this->_stack); - $list =& $this->_stack[count($this->_stack)-1]; - $list[] = $value; - } - - /** - * Load an empty list sequence - * - * @return void - */ - protected function _loadEmptyList() - { - $this->_stack[] = array(); - } - - /** - * Load multiple append (to list) sequences at once - * - * @return void - */ - protected function _loadAppends() - { - $k = $this->_lastMarker(); - $list =& $this->_stack[$k - 1]; - $max = count($this->_stack); - for ($i = $k + 1; $i < $max; $i++) { - $list[] = $this->_stack[$i]; - unset($this->_stack[$i]); - } - unset($this->_stack[$k]); - } - - /** - * Load an associative array (Python dictionary) - * - * @return void - */ - protected function _loadDict() - { - $k = $this->_lastMarker(); - $this->_stack[$k] = array(); - - // remove all elements after marker - $max = count($this->_stack); - for($i = $k + 1; $i < $max; $i++) { - unset($this->_stack[$i]); - } - } - - /** - * Load an item from a set - * - * @return void - */ - protected function _loadSetItem() - { - $value = array_pop($this->_stack); - $key = array_pop($this->_stack); - $dict =& $this->_stack[count($this->_stack) - 1]; - $dict[$key] = $value; - } - - /** - * Load an empty dictionary - * - * @return void - */ - protected function _loadEmptyDict() - { - $this->_stack[] = array(); - } - - /** - * Load set items - * - * @return void - */ - protected function _loadSetItems() - { - $k = $this->_lastMarker(); - $dict =& $this->_stack[$k - 1]; - $max = count($this->_stack); - for ($i = $k + 1; $i < $max; $i += 2) { - $key = $this->_stack[$i]; - $value = $this->_stack[$i + 1]; - $dict[$key] = $value; - unset($this->_stack[$i], $this->_stack[$i+1]); - } - unset($this->_stack[$k]); - } - - /** - * Load a tuple - * - * @return void - */ - protected function _loadTuple() - { - $k = $this->_lastMarker(); - $this->_stack[$k] = array(); - $tuple =& $this->_stack[$k]; - $max = count($this->_stack); - for($i = $k + 1; $i < $max; $i++) { - $tuple[] = $this->_stack[$i]; - unset($this->_stack[$i]); - } - } - - /** - * Load single item tuple - * - * @return void - */ - protected function _loadTuple1() - { - $value1 = array_pop($this->_stack); - $this->_stack[] = array($value1); - } - - /** - * Load two item tuple - * - * @return void - */ - protected function _loadTuple2() - { - $value2 = array_pop($this->_stack); - $value1 = array_pop($this->_stack); - $this->_stack[] = array($value1, $value2); - } - - /** - * Load three item tuple - * - * @return void - */ - protected function _loadTuple3() { - $value3 = array_pop($this->_stack); - $value2 = array_pop($this->_stack); - $value1 = array_pop($this->_stack); - $this->_stack[] = array($value1, $value2, $value3); - } - - /** - * Load a proto value - * - * @return void - * @throws Zend_Serializer_Exception if Pickle version does not support this feature - */ - protected function _loadProto() - { - $proto = ord($this->_read(1)); - if ($proto < 2 || $proto > 3) { - throw new Zend_Serializer_Exception('Invalid protocol version detected'); - } - $this->_protocol = $proto; - } - - /* unserialize helper */ - - /** - * Read a segment of the pickle - * - * @param mixed $len - * @return string - * @throws Zend_Serializer_Exception if position matches end of data - */ - protected function _read($len) - { - if (($this->_pos + $len) > $this->_pickleLen) { - throw new Zend_Serializer_Exception('End of data'); - } - - $this->_pos+= $len; - return substr($this->_pickle, ($this->_pos - $len), $len); - } - - /** - * Read a line of the pickle at once - * - * @return string - * @throws Zend_Serializer_Exception if no EOL character found - */ - protected function _readline() - { - $eolLen = 2; - $eolPos = strpos($this->_pickle, "\r\n", $this->_pos); - if ($eolPos === false) { - $eolPos = strpos($this->_pickle, "\n", $this->_pos); - $eolLen = 1; - } - - if ($eolPos === false) { - throw new Zend_Serializer_Exception('No new line found'); - } - $ret = substr($this->_pickle, $this->_pos, $eolPos-$this->_pos); - $this->_pos = $eolPos + $eolLen; - - return $ret; - } - - /** - * Unquote/Unescape a quoted string - * - * @param string $str quoted string - * @return string unquoted string - */ - protected function _unquoteString($str) - { - $quoteArr = array_flip(self::$_quoteString); - - if ($str[0] == '"') { - $quoteArr['\\"'] = '"'; - } else { - $quoteArr["\\'"] = "'"; - } - - return strtr(substr(trim($str), 1, -1), $quoteArr); - } - - /** - * Return last marker position in stack - * - * @return int - */ - protected function _lastMarker() - { - for ($k = count($this->_stack)-1; $k >= 0; $k -= 1) { - if ($this->_stack[$k] === $this->_marker) { - break; - } - } - return $k; - } - - /** - * Decode a binary long sequence - * - * @param string $data - * @return int|float|string - */ - protected function _decodeBinLong($data) - { - $nbytes = strlen($data); - - if ($nbytes == 0) { - return 0; - } - - $long = 0; - - if ($nbytes > 7) { - if (!extension_loaded('bcmath')) { - return INF; - } - - for ($i=0; $i<$nbytes; $i++) { - $long = bcadd($long, bcmul(ord($data[$i]), bcpow(256, $i, 0))); - } - if (0x80 <= ord($data[$nbytes-1])) { - $long = bcsub($long, bcpow(2, $nbytes * 8)); - } - - } else { - for ($i=0; $i<$nbytes; $i++) { - $long+= ord($data[$i]) * pow(256, $i); - } - if (0x80 <= ord($data[$nbytes-1])) { - $long-= pow(2, $nbytes * 8); - // $long-= 1 << ($nbytes * 8); - } - } - - return $long; - } -} diff --git a/library/vendor/Zend/Serializer/Adapter/Wddx.php b/library/vendor/Zend/Serializer/Adapter/Wddx.php deleted file mode 100644 index c0a5c89dd..000000000 --- a/library/vendor/Zend/Serializer/Adapter/Wddx.php +++ /dev/null @@ -1,118 +0,0 @@ - null, - ); - - /** - * Constructor - * - * @param array $opts - * @return void - * @throws Zend_Serializer_Exception if wddx extension not found - */ - public function __construct($opts = array()) - { - if (!extension_loaded('wddx')) { - throw new Zend_Serializer_Exception('PHP extension "wddx" is required for this adapter'); - } - - parent::__construct($opts); - } - - /** - * Serialize PHP to WDDX - * - * @param mixed $value - * @param array $opts - * @return string - * @throws Zend_Serializer_Exception on wddx error - */ - public function serialize($value, array $opts = array()) - { - $opts = $opts + $this->_options; - - if (isset($opts['comment']) && $opts['comment']) { - $wddx = wddx_serialize_value($value, (string)$opts['comment']); - } else { - $wddx = wddx_serialize_value($value); - } - - if ($wddx === false) { - $lastErr = error_get_last(); - throw new Zend_Serializer_Exception($lastErr['message']); - } - return $wddx; - } - - /** - * Unserialize from WDDX to PHP - * - * @param string $wddx - * @param array $opts - * @return mixed - * @throws Zend_Serializer_Exception on wddx error - */ - public function unserialize($wddx, array $opts = array()) - { - $ret = wddx_deserialize($wddx); - - if ($ret === null) { - // check if the returned NULL is valid - // or based on an invalid wddx string - try { - $simpleXml = Zend_Xml_Security::scan($wddx); - if (isset($simpleXml->data[0]->null[0])) { - return null; // valid null - } - $errMsg = 'Can\'t unserialize wddx string'; - } catch (Zend_Xml_Exception $e) { - $errMsg = $e->getMessage(); - } - - throw new Zend_Serializer_Exception($errMsg); - } - - return $ret; - } -} diff --git a/library/vendor/Zend/Serializer/Exception.php b/library/vendor/Zend/Serializer/Exception.php deleted file mode 100644 index 6bde2cccf..000000000 --- a/library/vendor/Zend/Serializer/Exception.php +++ /dev/null @@ -1,32 +0,0 @@ - * if (!Zend_Server_Cache::get($filename, $server)) { + * require_once 'Some/Service/Class.php'; + * require_once 'Another/Service/Class.php'; * * // Attach Some_Service_Class with namespace 'some' * $server->attach('Some_Service_Class', 'some'); diff --git a/library/vendor/Zend/Stdlib/CallbackHandler.php b/library/vendor/Zend/Stdlib/CallbackHandler.php deleted file mode 100644 index 01ef04c0c..000000000 --- a/library/vendor/Zend/Stdlib/CallbackHandler.php +++ /dev/null @@ -1,300 +0,0 @@ -metadata = $metadata; - $this->registerCallback($callback); - } - - /** - * Error handler - * - * Used by registerCallback() when calling is_callable() to capture engine warnings. - * - * @param int $errno - * @param string $errstr - * @return void - */ - public function errorHandler($errno, $errstr) - { - $this->error = true; - } - - /** - * Registers the callback provided in the constructor - * - * If you have pecl/weakref {@see http://pecl.php.net/weakref} installed, - * this method provides additional behavior. - * - * If a callback is a functor, or an array callback composing an object - * instance, this method will pass the object to a WeakRef instance prior - * to registering the callback. - * - * @param Callable $callback - * @return void - */ - protected function registerCallback($callback) - { - set_error_handler(array($this, 'errorHandler'), E_STRICT); - $callable = is_callable($callback); - restore_error_handler(); - if (!$callable || $this->error) { - throw new Zend_Stdlib_Exception_InvalidCallbackException('Invalid callback provided; not callable'); - } - - // If pecl/weakref is not installed, simply store the callback and return - set_error_handler(array($this, 'errorHandler'), E_WARNING); - $callable = class_exists('WeakRef'); - restore_error_handler(); - if (!$callable || $this->error) { - $this->callback = $callback; - return; - } - - // If WeakRef exists, we want to use it. - - // If we have a non-closure object, pass it to WeakRef, and then - // register it. - if (is_object($callback) && !$callback instanceof Closure) { - $this->callback = new WeakRef($callback); - return; - } - - // If we have a string or closure, register as-is - if (!is_array($callback)) { - $this->callback = $callback; - return; - } - - list($target, $method) = $callback; - - // If we have an array callback, and the first argument is not an - // object, register as-is - if (!is_object($target)) { - $this->callback = $callback; - return; - } - - // We have an array callback with an object as the first argument; - // pass it to WeakRef, and then register the new callback - $target = new WeakRef($target); - $this->callback = array($target, $method); - } - - /** - * Retrieve registered callback - * - * @return Callable - */ - public function getCallback() - { - $callback = $this->callback; - - // String callbacks -- simply return - if (is_string($callback)) { - return $callback; - } - - // WeakRef callbacks -- pull it out of the object and return it - if ($callback instanceof WeakRef) { - return $callback->get(); - } - - // Non-WeakRef object callback -- return it - if (is_object($callback)) { - return $callback; - } - - // Array callback with WeakRef object -- retrieve the object first, and - // then return - list($target, $method) = $callback; - if ($target instanceof WeakRef) { - return array($target->get(), $method); - } - - // Otherwise, return it - return $callback; - } - - /** - * Invoke handler - * - * @param array $args Arguments to pass to callback - * @return mixed - */ - public function call(array $args = array()) - { - $callback = $this->getCallback(); - - $isPhp54 = version_compare(PHP_VERSION, '5.4.0rc1', '>='); - - if ($isPhp54 && is_string($callback)) { - $this->validateStringCallbackFor54($callback); - } - - // Minor performance tweak; use call_user_func() until > 3 arguments - // reached - switch (count($args)) { - case 0: - if ($isPhp54) { - return $callback(); - } - return call_user_func($callback); - case 1: - if ($isPhp54) { - return $callback(array_shift($args)); - } - return call_user_func($callback, array_shift($args)); - case 2: - $arg1 = array_shift($args); - $arg2 = array_shift($args); - if ($isPhp54) { - return $callback($arg1, $arg2); - } - return call_user_func($callback, $arg1, $arg2); - case 3: - $arg1 = array_shift($args); - $arg2 = array_shift($args); - $arg3 = array_shift($args); - if ($isPhp54) { - return $callback($arg1, $arg2, $arg3); - } - return call_user_func($callback, $arg1, $arg2, $arg3); - default: - return call_user_func_array($callback, $args); - } - } - - /** - * Invoke as functor - * - * @return mixed - */ - public function __invoke() - { - return $this->call(func_get_args()); - } - - /** - * Get all callback metadata - * - * @return array - */ - public function getMetadata() - { - return $this->metadata; - } - - /** - * Retrieve a single metadatum - * - * @param string $name - * @return mixed - */ - public function getMetadatum($name) - { - if (array_key_exists($name, $this->metadata)) { - return $this->metadata[$name]; - } - return null; - } - - /** - * Validate a static method call - * - * Validates that a static method call in PHP 5.4 will actually work - * - * @param string $callback - * @return true - * @throws Zend_Stdlib_Exception_InvalidCallbackException if invalid - */ - protected function validateStringCallbackFor54($callback) - { - if (!strstr($callback, '::')) { - return true; - } - - list($class, $method) = explode('::', $callback, 2); - - if (!class_exists($class)) { - throw new Zend_Stdlib_Exception_InvalidCallbackException(sprintf( - 'Static method call "%s" refers to a class that does not exist', - $callback - )); - } - - $r = new ReflectionClass($class); - if (!$r->hasMethod($method)) { - throw new Zend_Stdlib_Exception_InvalidCallbackException(sprintf( - 'Static method call "%s" refers to a method that does not exist', - $callback - )); - } - $m = $r->getMethod($method); - if (!$m->isStatic()) { - throw new Zend_Stdlib_Exception_InvalidCallbackException(sprintf( - 'Static method call "%s" refers to a method that is not static', - $callback - )); - } - - return true; - } -} diff --git a/library/vendor/Zend/Stdlib/Exception.php b/library/vendor/Zend/Stdlib/Exception.php deleted file mode 100644 index 05cb27533..000000000 --- a/library/vendor/Zend/Stdlib/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ -items[] = array( - 'data' => $data, - 'priority' => $priority, - ); - $this->getQueue()->insert($data, $priority); - return $this; - } - - /** - * Remove an item from the queue - * - * This is different than {@link extract()}; its purpose is to dequeue an - * item. - * - * This operation is potentially expensive, as it requires - * re-initialization and re-population of the inner queue. - * - * Note: this removes the first item matching the provided item found. If - * the same item has been added multiple times, it will not remove other - * instances. - * - * @param mixed $datum - * @return boolean False if the item was not found, true otherwise. - */ - public function remove($datum) - { - $found = false; - foreach ($this->items as $key => $item) { - if ($item['data'] === $datum) { - $found = true; - break; - } - } - if ($found) { - unset($this->items[$key]); - $this->queue = null; - $queue = $this->getQueue(); - foreach ($this->items as $item) { - $queue->insert($item['data'], $item['priority']); - } - return true; - } - return false; - } - - /** - * Is the queue empty? - * - * @return bool - */ - public function isEmpty() - { - return (0 === $this->count()); - } - - /** - * How many items are in the queue? - * - * @return int - */ - public function count() - { - return count($this->items); - } - - /** - * Peek at the top node in the queue, based on priority. - * - * @return mixed - */ - public function top() - { - return $this->getIterator()->top(); - } - - /** - * Extract a node from the inner queue and sift up - * - * @return mixed - */ - public function extract() - { - return $this->getQueue()->extract(); - } - - /** - * Retrieve the inner iterator - * - * SplPriorityQueue acts as a heap, which typically implies that as items - * are iterated, they are also removed. This does not work for situations - * where the queue may be iterated multiple times. As such, this class - * aggregates the values, and also injects an SplPriorityQueue. This method - * retrieves the inner queue object, and clones it for purposes of - * iteration. - * - * @return SplPriorityQueue - */ - public function getIterator() - { - $queue = $this->getQueue(); - return clone $queue; - } - - /** - * Serialize the data structure - * - * @return string - */ - public function serialize() - { - return serialize($this->items); - } - - /** - * Unserialize a string into a Zend_Stdlib_PriorityQueue object - * - * Serialization format is compatible with {@link Zend_Stdlib_SplPriorityQueue} - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - foreach (unserialize($data) as $item) { - $this->insert($item['data'], $item['priority']); - } - } - - /** - * Serialize to an array - * - * By default, returns only the item data, and in the order registered (not - * sorted). You may provide one of the EXTR_* flags as an argument, allowing - * the ability to return priorities or both data and priority. - * - * @param int $flag - * @return array - */ - public function toArray($flag = self::EXTR_DATA) - { - switch ($flag) { - case self::EXTR_BOTH: - return $this->items; - case self::EXTR_PRIORITY: - return array_map(array($this, 'returnPriority'), $this->items); - case self::EXTR_DATA: - default: - return array_map(array($this, 'returnData'), $this->items); - } - } - - /** - * Specify the internal queue class - * - * Please see {@link getIterator()} for details on the necessity of an - * internal queue class. The class provided should extend SplPriorityQueue. - * - * @param string $class - * @return Zend_Stdlib_PriorityQueue - */ - public function setInternalQueueClass($class) - { - $this->queueClass = (string) $class; - return $this; - } - - /** - * Does the queue contain the given datum? - * - * @param mixed $datum - * @return bool - */ - public function contains($datum) - { - foreach ($this->items as $item) { - if ($item['data'] === $datum) { - return true; - } - } - return false; - } - - /** - * Does the queue have an item with the given priority? - * - * @param int $priority - * @return bool - */ - public function hasPriority($priority) - { - foreach ($this->items as $item) { - if ($item['priority'] === $priority) { - return true; - } - } - return false; - } - - /** - * Get the inner priority queue instance - * - * @return Zend_Stdlib_SplPriorityQueue - */ - protected function getQueue() - { - if (null === $this->queue) { - $this->queue = new $this->queueClass(); - if (!$this->queue instanceof SplPriorityQueue) { - throw new DomainException(sprintf( - 'Zend_Stdlib_PriorityQueue expects an internal queue of type SplPriorityQueue; received "%s"', - get_class($this->queue) - )); - } - } - return $this->queue; - } - - /** - * Return priority from an internal item - * - * Used as a lambda in toArray(). - * - * @param array $item - * @return mixed - */ - public function returnPriority($item) - { - return $item['priority']; - } - - /** - * Return data from an internal item - * - * Used as a lambda in toArray(). - * - * @param array $item - * @return mixed - */ - public function returnData($item) - { - return $item['data']; - } -} diff --git a/library/vendor/Zend/Stdlib/SplPriorityQueue.php b/library/vendor/Zend/Stdlib/SplPriorityQueue.php deleted file mode 100644 index bf19cc7aa..000000000 --- a/library/vendor/Zend/Stdlib/SplPriorityQueue.php +++ /dev/null @@ -1,499 +0,0 @@ - $value, 'priority' => $priority) - */ - const EXTR_BOTH = 0x00000003; - - /** - * Count of items in the queue - * @var int - */ - protected $count = 0; - - /** - * Flag indicating what should be returned when iterating or extracting - * @var int - */ - protected $extractFlags = self::EXTR_DATA; - - /** - * @var bool|array - */ - protected $preparedQueue = false; - - /** - * All items in the queue - * @var array - */ - protected $queue = array(); - - /** - * Constructor - * - * Creates a new, empty queue - * - * @return void - */ - public function __construct() - { - } - - /** - * Compare two priorities - * - * Returns positive integer if $priority1 is greater than $priority2, 0 - * if equal, negative otherwise. - * - * Unused internally, and only included in order to retain the same - * interface as PHP's SplPriorityQueue. - * - * @param mixed $priority1 - * @param mixed $priority2 - * @return int - */ - public function compare($priority1, $priority2) - { - if ($priority1 > $priority2) { - return 1; - } - if ($priority1 == $priority2) { - return 0; - } - - return -1; - } - - /** - * Countable: return number of items composed in the queue - * - * @return int - */ - public function count() - { - return $this->count; - } - - /** - * Iterator: return current item - * - * @return mixed - */ - public function current() - { - if (!$this->preparedQueue) { - $this->rewind(); - } - if (!$this->count) { - throw new OutOfBoundsException('Cannot iterate SplPriorityQueue; no elements present'); - } - -if (!is_array($this->preparedQueue)) { - throw new DomainException(sprintf( - "Queue was prepared, but is empty?\n PreparedQueue: %s\n Internal Queue: %s\n", - var_export($this->preparedQueue, 1), - var_export($this->queue, 1) - )); -} - - $return = array_shift($this->preparedQueue); - $priority = $return['priority']; - $priorityKey = $return['priorityKey']; - $key = $return['key']; - unset($return['key']); - unset($return['priorityKey']); - unset($this->queue[$priorityKey][$key]); - - switch ($this->extractFlags) { - case self::EXTR_DATA: - return $return['data']; - case self::EXTR_PRIORITY: - return $return['priority']; - case self::EXTR_BOTH: - default: - return $return; - }; - } - - /** - * Extract a node from top of the heap and sift up - * - * Returns either the value, the priority, or both, depending on the extract flag. - * - * @return mixed; - */ - public function extract() - { - if (!$this->count) { - return null; - } - - if (!$this->preparedQueue) { - $this->prepareQueue(); - } - - if (empty($this->preparedQueue)) { - return null; - } - - $return = array_shift($this->preparedQueue); - $priority = $return['priority']; - $priorityKey = $return['priorityKey']; - $key = $return['key']; - unset($return['key']); - unset($return['priorityKey']); - unset($this->queue[$priorityKey][$key]); - $this->count--; - - switch ($this->extractFlags) { - case self::EXTR_DATA: - return $return['data']; - case self::EXTR_PRIORITY: - return $return['priority']; - case self::EXTR_BOTH: - default: - return $return; - }; - } - - /** - * Insert a value into the heap, at the specified priority - * - * @param mixed $value - * @param mixed $priority - * @return void - */ - public function insert($value, $priority) - { - if (!is_scalar($priority)) { - $priority = serialize($priority); - } - if (!isset($this->queue[$priority])) { - $this->queue[$priority] = array(); - } - $this->queue[$priority][] = $value; - $this->count++; - $this->preparedQueue = false; - } - - /** - * Is the queue currently empty? - * - * @return bool - */ - public function isEmpty() - { - return (0 == $this->count); - } - - /** - * Iterator: return current key - * - * @return mixed Usually an int or string - */ - public function key() - { - return $this->count; - } - - /** - * Iterator: Move pointer forward - * - * @return void - */ - public function next() - { - $this->count--; - } - - /** - * Recover from corrupted state and allow further actions on the queue - * - * Unimplemented, and only included in order to retain the same interface as PHP's - * SplPriorityQueue. - * - * @return void - */ - public function recoverFromCorruption() - { - } - - /** - * Iterator: Move pointer to first item - * - * @return void - */ - public function rewind() - { - if (!$this->preparedQueue) { - $this->prepareQueue(); - } - } - - /** - * Set the extract flags - * - * Defines what is extracted by SplPriorityQueue::current(), - * SplPriorityQueue::top() and SplPriorityQueue::extract(). - * - * - SplPriorityQueue::EXTR_DATA (0x00000001): Extract the data - * - SplPriorityQueue::EXTR_PRIORITY (0x00000002): Extract the priority - * - SplPriorityQueue::EXTR_BOTH (0x00000003): Extract an array containing both - * - * The default mode is SplPriorityQueue::EXTR_DATA. - * - * @param int $flags - * @return void - */ - public function setExtractFlags($flags) - { - $expected = array( - self::EXTR_DATA => true, - self::EXTR_PRIORITY => true, - self::EXTR_BOTH => true, - ); - if (!isset($expected[$flags])) { - throw new InvalidArgumentException(sprintf('Expected an EXTR_* flag; received %s', $flags)); - } - $this->extractFlags = $flags; - } - - /** - * Return the value or priority (or both) of the top node, depending on - * the extract flag - * - * @return mixed - */ - public function top() - { - $this->sort(); - $keys = array_keys($this->queue); - $key = array_shift($keys); - if (preg_match('/^(a|O):/', $key)) { - $key = unserialize($key); - } - - if ($this->extractFlags == self::EXTR_PRIORITY) { - return $key; - } - - if ($this->extractFlags == self::EXTR_DATA) { - return $this->queue[$key][0]; - } - - return array( - 'data' => $this->queue[$key][0], - 'priority' => $key, - ); - } - - /** - * Iterator: is the current position valid for the queue - * - * @return bool - */ - public function valid() - { - return (bool) $this->count; - } - - /** - * Sort the queue - * - * @return void - */ - protected function sort() - { - krsort($this->queue); - } - - /** - * Prepare the queue for iteration and/or extraction - * - * @return void - */ - protected function prepareQueue() - { - $this->sort(); - $count = $this->count; - $queue = array(); - foreach ($this->queue as $priority => $values) { - $priorityKey = $priority; - if (preg_match('/^(a|O):/', $priority)) { - $priority = unserialize($priority); - } - foreach ($values as $key => $value) { - $queue[$count] = array( - 'data' => $value, - 'priority' => $priority, - 'priorityKey' => $priorityKey, - 'key' => $key, - ); - $count--; - } - } - $this->preparedQueue = $queue; - } - } -} - -/** - * Serializable version of SplPriorityQueue - * - * Also, provides predictable heap order for datums added with the same priority - * (i.e., they will be emitted in the same order they are enqueued). - * - * @category Zend - * @package Zend_Stdlib - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_Stdlib_SplPriorityQueue extends SplPriorityQueue implements Serializable -{ - /** - * @var int Seed used to ensure queue order for items of the same priority - */ - protected $serial = PHP_INT_MAX; - - /** - * @var bool - */ - protected $isPhp53; - - /** - * Constructor - * - * @return void - */ - public function __construct() - { - $this->isPhp53 = version_compare(PHP_VERSION, '5.3', '>='); - } - - /** - * Insert a value with a given priority - * - * Utilizes {@var $serial} to ensure that values of equal priority are - * emitted in the same order in which they are inserted. - * - * @param mixed $datum - * @param mixed $priority - * @return void - */ - public function insert($datum, $priority) - { - // If using the native PHP SplPriorityQueue implementation, we need to - // hack around it to ensure that items registered at the same priority - // return in the order registered. In the userland version, this is not - // necessary. - if ($this->isPhp53) { - if (!is_array($priority)) { - $priority = array($priority, $this->serial--); - } - } - parent::insert($datum, $priority); - } - - /** - * Serialize to an array - * - * Array will be priority => data pairs - * - * @return array - */ - public function toArray() - { - $this->setExtractFlags(self::EXTR_BOTH); - $array = array(); - while ($this->valid()) { - $array[] = $this->current(); - $this->next(); - } - $this->setExtractFlags(self::EXTR_DATA); - - // Iterating through a priority queue removes items - foreach ($array as $item) { - $this->insert($item['data'], $item['priority']); - } - - // Return only the data - $return = array(); - foreach ($array as $item) { - $return[] = $item['data']; - } - - return $return; - } - - /** - * Serialize - * - * @return string - */ - public function serialize() - { - $data = array(); - $this->setExtractFlags(self::EXTR_BOTH); - while ($this->valid()) { - $data[] = $this->current(); - $this->next(); - } - $this->setExtractFlags(self::EXTR_DATA); - - // Iterating through a priority queue removes items - foreach ($data as $item) { - $this->insert($item['data'], $item['priority']); - } - - return serialize($data); - } - - /** - * Deserialize - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - foreach (unserialize($data) as $item) { - $this->insert($item['data'], $item['priority']); - } - } -} diff --git a/library/vendor/Zend/Tag/Cloud.php b/library/vendor/Zend/Tag/Cloud.php deleted file mode 100644 index 890328673..000000000 --- a/library/vendor/Zend/Tag/Cloud.php +++ /dev/null @@ -1,403 +0,0 @@ -setConfig($options); - } - - if (is_array($options)) { - $this->setOptions($options); - } - } - - /** - * Set options from Zend_Config - * - * @param Zend_Config $config - * @return Zend_Tag_Cloud - */ - public function setConfig(Zend_Config $config) - { - $this->setOptions($config->toArray()); - - return $this; - } - - /** - * Set options from array - * - * @param array $options Configuration for Zend_Tag_Cloud - * @return Zend_Tag_Cloud - */ - public function setOptions(array $options) - { - if (isset($options['prefixPath'])) { - $this->addPrefixPaths($options['prefixPath']); - unset($options['prefixPath']); - } - - foreach ($options as $key => $value) { - if (in_array(strtolower($key), $this->_skipOptions)) { - continue; - } - - $method = 'set' . ucfirst($key); - if (method_exists($this, $method)) { - $this->$method($value); - } - } - - return $this; - } - - /** - * Set the tags for the tag cloud. - * - * $tags should be an array containing single tags as array. Each tag - * array should at least contain the keys 'title' and 'weight'. Optionally - * you may supply the key 'url', to which the tag links to. Any additional - * parameter in the array is silently ignored and can be used by custom - * decorators. - * - * @param array $tags - * @return Zend_Tag_Cloud - */ - public function setTags(array $tags) - { - // Validate and cleanup the tags - $itemList = $this->getItemList(); - - foreach ($tags as $tag) { - if ($tag instanceof Zend_Tag_Taggable) { - $itemList[] = $tag; - } else if (is_array($tag)) { - $itemList[] = new Zend_Tag_Item($tag); - } else { - throw new Zend_Tag_Cloud_Exception('Tag must be an instance of Zend_Tag_Taggable or an array'); - } - } - - return $this; - } - - /** - * Append a single tag to the cloud - * - * @param Zend_Tag_Taggable|array $tag - * @return Zend_Tag_Cloud - */ - public function appendTag($tag) - { - $tags = $this->getItemList(); - if ($tag instanceof Zend_Tag_Taggable) { - $tags[] = $tag; - } else if (is_array($tag)) { - $tags[] = new Zend_Tag_Item($tag); - } else { - throw new Zend_Tag_Cloud_Exception('Tag must be an instance of Zend_Tag_Taggable or an array'); - } - - return $this; - } - - /** - * Set the item list - * - * @param Zend_Tag_ItemList $itemList - * @return Zend_Tag_Cloud - */ - public function setItemList(Zend_Tag_ItemList $itemList) - { - $this->_tags = $itemList; - return $this; - } - - /** - * Retrieve the item list - * - * If item list is undefined, creates one. - * - * @return Zend_Tag_ItemList - */ - public function getItemList() - { - if (null === $this->_tags) { - $this->setItemList(new Zend_Tag_ItemList()); - } - return $this->_tags; - } - - /** - * Set the decorator for the cloud - * - * @param mixed $decorator - * @return Zend_Tag_Cloud - */ - public function setCloudDecorator($decorator) - { - $options = null; - - if (is_array($decorator)) { - if (isset($decorator['options'])) { - $options = $decorator['options']; - } - - if (isset($decorator['decorator'])) { - $decorator = $decorator['decorator']; - } - } - - if (is_string($decorator)) { - $classname = $this->getPluginLoader()->load($decorator); - $decorator = new $classname($options); - } - - if (!($decorator instanceof Zend_Tag_Cloud_Decorator_Cloud)) { - throw new Zend_Tag_Cloud_Exception('Decorator is no instance of Zend_Tag_Cloud_Decorator_Cloud'); - } - - $this->_cloudDecorator = $decorator; - - return $this; - } - - /** - * Get the decorator for the cloud - * - * @return Zend_Tag_Cloud_Decorator_Cloud - */ - public function getCloudDecorator() - { - if (null === $this->_cloudDecorator) { - $this->setCloudDecorator('htmlCloud'); - } - return $this->_cloudDecorator; - } - - /** - * Set the decorator for the tags - * - * @param mixed $decorator - * @return Zend_Tag_Cloud - */ - public function setTagDecorator($decorator) - { - $options = null; - - if (is_array($decorator)) { - if (isset($decorator['options'])) { - $options = $decorator['options']; - } - - if (isset($decorator['decorator'])) { - $decorator = $decorator['decorator']; - } - } - - if (is_string($decorator)) { - $classname = $this->getPluginLoader()->load($decorator); - $decorator = new $classname($options); - } - - if (!($decorator instanceof Zend_Tag_Cloud_Decorator_Tag)) { - throw new Zend_Tag_Cloud_Exception('Decorator is no instance of Zend_Tag_Cloud_Decorator_Tag'); - } - - $this->_tagDecorator = $decorator; - - return $this; - } - - /** - * Get the decorator for the tags - * - * @return Zend_Tag_Cloud_Decorator_Tag - */ - public function getTagDecorator() - { - if (null === $this->_tagDecorator) { - $this->setTagDecorator('htmlTag'); - } - return $this->_tagDecorator; - } - - /** - * Set plugin loaders for use with decorators - * - * @param Zend_Loader_PluginLoader_Interface $loader - * @return Zend_Tag_Cloud - */ - public function setPluginLoader(Zend_Loader_PluginLoader_Interface $loader) - { - $this->_pluginLoader = $loader; - return $this; - } - - /** - * Get the plugin loader for decorators - * - * @return Zend_Loader_PluginLoader - */ - public function getPluginLoader() - { - if ($this->_pluginLoader === null) { - $prefix = 'Zend_Tag_Cloud_Decorator_'; - $pathPrefix = 'Zend/Tag/Cloud/Decorator/'; - - $this->_pluginLoader = new Zend_Loader_PluginLoader(array($prefix => $pathPrefix)); - } - - return $this->_pluginLoader; - } - - /** - * Add many prefix paths at once - * - * @param array $paths - * @return Zend_Tag_Cloud - */ - public function addPrefixPaths(array $paths) - { - if (isset($paths['prefix']) && isset($paths['path'])) { - return $this->addPrefixPath($paths['prefix'], $paths['path']); - } - - foreach ($paths as $path) { - if (!isset($path['prefix']) || !isset($path['path'])) { - continue; - } - - $this->addPrefixPath($path['prefix'], $path['path']); - } - - return $this; - } - - /** - * Add prefix path for plugin loader - * - * @param string $prefix - * @param string $path - * @return Zend_Tag_Cloud - */ - public function addPrefixPath($prefix, $path) - { - $loader = $this->getPluginLoader(); - $loader->addPrefixPath($prefix, $path); - - return $this; - } - - /** - * Render the tag cloud - * - * @return string - */ - public function render() - { - $tags = $this->getItemList(); - - if (count($tags) === 0) { - return ''; - } - - $tagsResult = $this->getTagDecorator()->render($tags); - $cloudResult = $this->getCloudDecorator()->render($tagsResult); - - return $cloudResult; - } - - /** - * Render the tag cloud - * - * @return string - */ - public function __toString() - { - try { - $result = $this->render(); - return $result; - } catch (Exception $e) { - $message = "Exception caught by tag cloud: " . $e->getMessage() - . "\nStack Trace:\n" . $e->getTraceAsString(); - trigger_error($message, E_USER_WARNING); - return ''; - } - } -} diff --git a/library/vendor/Zend/Tag/Cloud/Decorator/Cloud.php b/library/vendor/Zend/Tag/Cloud/Decorator/Cloud.php deleted file mode 100644 index e649d54f2..000000000 --- a/library/vendor/Zend/Tag/Cloud/Decorator/Cloud.php +++ /dev/null @@ -1,88 +0,0 @@ -toArray(); - } - - if (is_array($options)) { - $this->setOptions($options); - } - } - - /** - * Set options from array - * - * @param array $options Configuration for the decorator - * @return Zend_Tag_Cloud - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - if (in_array(strtolower($key), $this->_skipOptions)) { - continue; - } - - $method = 'set' . $key; - if (method_exists($this, $method)) { - $this->$method($value); - } - } - - return $this; - } - - /** - * Render a list of formatted tags - * - * @param array $tags - * @return string - */ - abstract public function render(array $tags); -} diff --git a/library/vendor/Zend/Tag/Cloud/Decorator/Exception.php b/library/vendor/Zend/Tag/Cloud/Decorator/Exception.php deleted file mode 100644 index 73a4e3ead..000000000 --- a/library/vendor/Zend/Tag/Cloud/Decorator/Exception.php +++ /dev/null @@ -1,38 +0,0 @@ - array('class' => 'Zend_Tag_Cloud') - ); - - /** - * Separator for the single tags - * - * @var string - */ - protected $_separator = ' '; - - /** - * Get encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set encoding - * - * @param string - * @return Zend_Tag_Cloud_Decorator_HtmlCloud - */ - public function setEncoding($value) - { - $this->_encoding = (string) $value; - return $this; - } - - /** - * Set the HTML tags surrounding all tags - * - * @param array $htmlTags - * @return Zend_Tag_Cloud_Decorator_HtmlCloud - */ - public function setHtmlTags(array $htmlTags) - { - $this->_htmlTags = $htmlTags; - return $this; - } - - /** - * Retrieve HTML tag map - * - * @return array - */ - public function getHtmlTags() - { - return $this->_htmlTags; - } - - /** - * Set the separator between the single tags - * - * @param string - * @return Zend_Tag_Cloud_Decorator_HtmlCloud - */ - public function setSeparator($separator) - { - $this->_separator = $separator; - return $this; - } - - /** - * Get tag separator - * - * @return string - */ - public function getSeparator() - { - return $this->_separator; - } - - /** - * Defined by Zend_Tag_Cloud_Decorator_Cloud - * - * @param array $tags - * @return string - */ - public function render(array $tags) - { - $cloudHtml = implode($this->getSeparator(), $tags); - - $enc = $this->getEncoding(); - foreach ($this->getHtmlTags() as $key => $data) { - if (is_array($data)) { - $htmlTag = $key; - $attributes = ''; - - foreach ($data as $param => $value) { - $attributes .= ' ' . $param . '="' . htmlspecialchars($value, ENT_COMPAT, $enc) . '"'; - } - } else { - $htmlTag = $data; - $attributes = ''; - } - - $cloudHtml = sprintf('<%1$s%3$s>%2$s', $htmlTag, $cloudHtml, $attributes); - } - - return $cloudHtml; - } -} diff --git a/library/vendor/Zend/Tag/Cloud/Decorator/HtmlTag.php b/library/vendor/Zend/Tag/Cloud/Decorator/HtmlTag.php deleted file mode 100644 index c257cce14..000000000 --- a/library/vendor/Zend/Tag/Cloud/Decorator/HtmlTag.php +++ /dev/null @@ -1,300 +0,0 @@ -_classList = $classList; - return $this; - } - - /** - * Get class list - * - * @return array - */ - public function getClassList() - { - return $this->_classList; - } - - /** - * Get encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set encoding - * - * @param string $value - * @return Zend_Tag_Cloud_Decorator_HtmlTag - */ - public function setEncoding($value) - { - $this->_encoding = (string) $value; - return $this; - } - - /** - * Set the font size unit - * - * Possible values are: em, ex, px, in, cm, mm, pt, pc and % - * - * @param string $fontSizeUnit - * @throws Zend_Tag_Cloud_Decorator_Exception When an invalid fontsize unit is specified - * @return Zend_Tag_Cloud_Decorator_HtmlTag - */ - public function setFontSizeUnit($fontSizeUnit) - { - if (!in_array($fontSizeUnit, $this->_alloweFontSizeUnits)) { - throw new Zend_Tag_Cloud_Decorator_Exception('Invalid fontsize unit specified'); - } - - $this->_fontSizeUnit = (string) $fontSizeUnit; - $this->setClassList(null); - return $this; - } - - /** - * Retrieve font size unit - * - * @return string - */ - public function getFontSizeUnit() - { - return $this->_fontSizeUnit; - } - /** - * Set the HTML tags surrounding the element - * - * @param array $htmlTags - * @return Zend_Tag_Cloud_Decorator_HtmlTag - */ - public function setHtmlTags(array $htmlTags) - { - $this->_htmlTags = $htmlTags; - return $this; - } - - /** - * Get HTML tags map - * - * @return array - */ - public function getHtmlTags() - { - return $this->_htmlTags; - } - - /** - * Set maximum font size - * - * @param integer $maxFontSize - * @throws Zend_Tag_Cloud_Decorator_Exception When fontsize is not numeric - * @return Zend_Tag_Cloud_Decorator_HtmlTag - */ - public function setMaxFontSize($maxFontSize) - { - if (!is_numeric($maxFontSize)) { - throw new Zend_Tag_Cloud_Decorator_Exception('Fontsize must be numeric'); - } - - $this->_maxFontSize = (int) $maxFontSize; - $this->setClassList(null); - return $this; - } - - /** - * Retrieve maximum font size - * - * @return int - */ - public function getMaxFontSize() - { - return $this->_maxFontSize; - } - - /** - * Set minimum font size - * - * @param int $minFontSize - * @throws Zend_Tag_Cloud_Decorator_Exception When fontsize is not numeric - * @return Zend_Tag_Cloud_Decorator_HtmlTag - */ - public function setMinFontSize($minFontSize) - { - if (!is_numeric($minFontSize)) { - throw new Zend_Tag_Cloud_Decorator_Exception('Fontsize must be numeric'); - } - - $this->_minFontSize = (int) $minFontSize; - $this->setClassList(null); - return $this; - } - - /** - * Retrieve minimum font size - * - * @return int - */ - public function getMinFontSize() - { - return $this->_minFontSize; - } - - /** - * Defined by Zend_Tag_Cloud_Decorator_Tag - * - * @param Zend_Tag_ItemList $tags - * @return array - */ - public function render(Zend_Tag_ItemList $tags) - { - if (null === ($weightValues = $this->getClassList())) { - $weightValues = range($this->getMinFontSize(), $this->getMaxFontSize()); - } - - $tags->spreadWeightValues($weightValues); - - $result = array(); - - $enc = $this->getEncoding(); - foreach ($tags as $tag) { - if (null === ($classList = $this->getClassList())) { - $attribute = sprintf('style="font-size: %d%s;"', $tag->getParam('weightValue'), $this->getFontSizeUnit()); - } else { - $attribute = sprintf('class="%s"', htmlspecialchars($tag->getParam('weightValue'), ENT_COMPAT, $enc)); - } - - $tagHtml = sprintf('%s', htmlSpecialChars($tag->getParam('url'), ENT_COMPAT, $enc), $attribute, $tag->getTitle()); - - foreach ($this->getHtmlTags() as $key => $data) { - if (is_array($data)) { - $htmlTag = $key; - $attributes = ''; - - foreach ($data as $param => $value) { - $attributes .= ' ' . $param . '="' . htmlspecialchars($value, ENT_COMPAT, $enc) . '"'; - } - } else { - $htmlTag = $data; - $attributes = ''; - } - - $tagHtml = sprintf('<%1$s%3$s>%2$s', $htmlTag, $tagHtml, $attributes); - } - - $result[] = $tagHtml; - } - - return $result; - } -} diff --git a/library/vendor/Zend/Tag/Cloud/Decorator/Tag.php b/library/vendor/Zend/Tag/Cloud/Decorator/Tag.php deleted file mode 100644 index b23695691..000000000 --- a/library/vendor/Zend/Tag/Cloud/Decorator/Tag.php +++ /dev/null @@ -1,88 +0,0 @@ -toArray(); - } - - if (is_array($options)) { - $this->setOptions($options); - } - } - - /** - * Set options from array - * - * @param array $options Configuration for the decorator - * @return Zend_Tag_Cloud - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - if (in_array(strtolower($key), $this->_skipOptions)) { - continue; - } - - $method = 'set' . $key; - if (method_exists($this, $method)) { - $this->$method($value); - } - } - - return $this; - } - - /** - * Render a list of tags - * - * @param Zend_Tag_ItemList $tags - * @return array - */ - abstract public function render(Zend_Tag_ItemList $tags); -} diff --git a/library/vendor/Zend/Tag/Cloud/Exception.php b/library/vendor/Zend/Tag/Cloud/Exception.php deleted file mode 100644 index 023f6cc9c..000000000 --- a/library/vendor/Zend/Tag/Cloud/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ -toArray(); - } - - if (!is_array($options)) { - throw new Zend_Tag_Exception('Invalid options provided to constructor'); - } - - $this->setOptions($options); - - if ($this->_title === null) { - throw new Zend_Tag_Exception('Title was not set'); - } - - if ($this->_weight === null) { - throw new Zend_Tag_Exception('Weight was not set'); - } - } - - /** - * Set options of the tag - * - * @param array $options - * @return Zend_Tag_Item - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - if (in_array(strtolower($key), $this->_skipOptions)) { - continue; - } - - $method = 'set' . $key; - if (method_exists($this, $method)) { - $this->$method($value); - } - } - - return $this; - } - - /** - * Defined by Zend_Tag_Taggable - * - * @return string - */ - public function getTitle() - { - return $this->_title; - } - - /** - * Set the title - * - * @param string $title - * @throws Zend_Tag_Exception When title is no string - * @return Zend_Tag_Item - */ - public function setTitle($title) - { - if (!is_string($title)) { - throw new Zend_Tag_Exception('Title must be a string'); - } - - $this->_title = (string) $title; - return $this; - } - - /** - * Defined by Zend_Tag_Taggable - * - * @return float - */ - public function getWeight() - { - return $this->_weight; - } - - /** - * Set the weight - * - * @param float $weight - * @throws Zend_Tag_Exception When weight is not numeric - * @return Zend_Tag_Item - */ - public function setWeight($weight) - { - if (!is_numeric($weight)) { - throw new Zend_Tag_Exception('Weight must be numeric'); - } - - $this->_weight = (float) $weight; - return $this; - } - - /** - * Set multiple params at once - * - * @param array $params - * @return Zend_Tag_Item - */ - public function setParams(array $params) - { - foreach ($params as $name => $value) { - $this->setParam($name, $value); - } - - return $this; - } - - /** - * Defined by Zend_Tag_Taggable - * - * @param string $name - * @param mixed $value - * @return Zend_Tag_Item - */ - public function setParam($name, $value) - { - $this->_params[$name] = $value; - return $this; - } - - /** - * Defined by Zend_Tag_Taggable - * - * @param string $name - * @return mixed - */ - public function getParam($name) - { - if (isset($this->_params[$name])) { - return $this->_params[$name]; - } - return null; - } -} diff --git a/library/vendor/Zend/Tag/ItemList.php b/library/vendor/Zend/Tag/ItemList.php deleted file mode 100644 index 225e1f45a..000000000 --- a/library/vendor/Zend/Tag/ItemList.php +++ /dev/null @@ -1,235 +0,0 @@ -_items); - } - - /** - * Spread values in the items relative to their weight - * - * @param array $values - * @throws Zend_Tag_Exception When value list is empty - * @return void - */ - public function spreadWeightValues(array $values) - { - // Don't allow an empty value list - if (count($values) === 0) { - throw new Zend_Tag_Exception('Value list may not be empty'); - } - - // Re-index the array - $values = array_values($values); - - // If just a single value is supplied simply assign it to to all tags - if (count($values) === 1) { - foreach ($this->_items as $item) { - $item->setParam('weightValue', $values[0]); - } - } else { - // Calculate min- and max-weight - $minWeight = null; - $maxWeight = null; - - foreach ($this->_items as $item) { - if ($minWeight === null && $maxWeight === null) { - $minWeight = $item->getWeight(); - $maxWeight = $item->getWeight(); - } else { - $minWeight = min($minWeight, $item->getWeight()); - $maxWeight = max($maxWeight, $item->getWeight()); - } - } - - // Calculate the thresholds - $steps = count($values); - $delta = ($maxWeight - $minWeight) / ($steps - 1); - $thresholds = array(); - - for ($i = 0; $i < $steps; $i++) { - $thresholds[$i] = floor(100 * log(($minWeight + $i * $delta) + 2)); - } - - // Then assign the weight values - foreach ($this->_items as $item) { - $threshold = floor(100 * log($item->getWeight() + 2)); - - for ($i = 0; $i < $steps; $i++) { - if ($threshold <= $thresholds[$i]) { - $item->setParam('weightValue', $values[$i]); - break; - } - } - } - } - } - - /** - * Seek to an absolute positio - * - * @param integer $index - * @throws OutOfBoundsException When the seek position is invalid - * @return void - */ - public function seek($index) - { - $this->rewind(); - $position = 0; - - while ($position < $index && $this->valid()) { - $this->next(); - $position++; - } - - if (!$this->valid()) { - throw new OutOfBoundsException('Invalid seek position'); - } - } - - /** - * Return the current element - * - * @return mixed - */ - public function current() - { - return current($this->_items); - } - - /** - * Move forward to next element - * - * @return mixed - */ - public function next() - { - return next($this->_items); - } - - /** - * Return the key of the current element - * - * @return mixed - */ - public function key() - { - return key($this->_items); - } - - /** - * Check if there is a current element after calls to rewind() or next() - * - * @return boolean - */ - public function valid() - { - return ($this->current() !== false); - } - - /** - * Rewind the Iterator to the first element - * - * @return void - */ - public function rewind() - { - reset($this->_items); - } - - /** - * Check if an offset exists - * - * @param mixed $offset - * @return boolean - */ - public function offsetExists($offset) { - return array_key_exists($offset, $this->_items); - } - - /** - * Get the value of an offset - * - * @param mixed $offset - * @return Zend_Tag_Taggable - */ - public function offsetGet($offset) { - return $this->_items[$offset]; - } - - /** - * Append a new item - * - * @param mixed $offset - * @param Zend_Tag_Taggable $item - * @throws OutOfBoundsException When item does not implement Zend_Tag_Taggable - * @return void - */ - public function offsetSet($offset, $item) { - // We need to make that check here, as the method signature must be - // compatible with ArrayAccess::offsetSet() - if (!($item instanceof Zend_Tag_Taggable)) { - throw new Zend_Tag_Exception('Item must implement Zend_Tag_Taggable'); - } - - if ($offset === null) { - $this->_items[] = $item; - } else { - $this->_items[$offset] = $item; - } - } - - /** - * Unset an item - * - * @param mixed $offset - * @return void - */ - public function offsetUnset($offset) { - unset($this->_items[$offset]); - } -} diff --git a/library/vendor/Zend/Tag/Taggable.php b/library/vendor/Zend/Tag/Taggable.php deleted file mode 100644 index 767b8e5b0..000000000 --- a/library/vendor/Zend/Tag/Taggable.php +++ /dev/null @@ -1,60 +0,0 @@ -setEnabled(true); - $this->setProfiler($profiler); - } - - /** - * Append a new Statement to the SQL Result Stack. - * - * @param Zend_Test_DbStatement $stmt - * @return Zend_Test_DbAdapter - */ - public function appendStatementToStack(Zend_Test_DbStatement $stmt) - { - array_push($this->_statementStack, $stmt); - return $this; - } - - /** - * Append a new Insert Id to the {@see lastInsertId}. - * - * @param int|string $id - * @return Zend_Test_DbAdapter - */ - public function appendLastInsertIdToStack($id) - { - array_push($this->_lastInsertIdStack, $id); - return $this; - } - - /** - * @var string - */ - public function setQuoteIdentifierSymbol($symbol) - { - $this->_quoteIdentifierSymbol = $symbol; - } - - /** - * Returns the symbol the adapter uses for delimited identifiers. - * - * @return string - */ - public function getQuoteIdentifierSymbol() - { - return $this->_quoteIdentifierSymbol; - } - - /** - * Set the result from {@see listTables()}. - * - * @param array $listTables - */ - public function setListTables(array $listTables) - { - $this->_listTables = $listTables; - } - - /** - * Returns a list of the tables in the database. - * - * @return array - */ - public function listTables() - { - return $this->_listTables; - } - - /** - * - * @param string $table - * @param array $tableInfo - * @return Zend_Test_DbAdapter - */ - public function setDescribeTable($table, $tableInfo) - { - $this->_describeTables[$table] = $tableInfo; - return $this; - } - - /** - * Returns the column descriptions for a table. - * - * The return value is an associative array keyed by the column name, - * as returned by the RDBMS. - * - * The value of each array element is an associative array - * with the following keys: - * - * SCHEMA_NAME => string; name of database or schema - * TABLE_NAME => string; - * COLUMN_NAME => string; column name - * COLUMN_POSITION => number; ordinal position of column in table - * DATA_TYPE => string; SQL datatype name of column - * DEFAULT => string; default expression of column, null if none - * NULLABLE => boolean; true if column can have nulls - * LENGTH => number; length of CHAR/VARCHAR - * SCALE => number; scale of NUMERIC/DECIMAL - * PRECISION => number; precision of NUMERIC/DECIMAL - * UNSIGNED => boolean; unsigned property of an integer type - * PRIMARY => boolean; true if column is part of the primary key - * PRIMARY_POSITION => integer; position of column in primary key - * - * @param string $tableName - * @param string $schemaName OPTIONAL - * @return array - */ - public function describeTable($tableName, $schemaName = null) - { - if(isset($this->_describeTables[$tableName])) { - return $this->_describeTables[$tableName]; - } else { - return array(); - } - } - - /** - * Creates a connection to the database. - * - * @return void - */ - protected function _connect() - { - $this->_connected = true; - } - - /** - * Test if a connection is active - * - * @return boolean - */ - public function isConnected() - { - return $this->_connected; - } - - /** - * Force the connection to close. - * - * @return void - */ - public function closeConnection() - { - $this->_connected = false; - } - - /** - * Prepare a statement and return a PDOStatement-like object. - * - * @param string|Zend_Db_Select $sql SQL query - * @return Zend_Db_Statment|PDOStatement - */ - public function prepare($sql) - { - $queryId = $this->getProfiler()->queryStart($sql); - - if(count($this->_statementStack)) { - $stmt = array_pop($this->_statementStack); - } else { - $stmt = new Zend_Test_DbStatement(); - } - - if($this->getProfiler()->getEnabled() == true) { - $qp = $this->getProfiler()->getQueryProfile($queryId); - $stmt->setQueryProfile($qp); - } - - return $stmt; - } - - /** - * Gets the last ID generated automatically by an IDENTITY/AUTOINCREMENT column. - * - * As a convention, on RDBMS brands that support sequences - * (e.g. Oracle, PostgreSQL, DB2), this method forms the name of a sequence - * from the arguments and returns the last id generated by that sequence. - * On RDBMS brands that support IDENTITY/AUTOINCREMENT columns, this method - * returns the last value generated for such a column, and the table name - * argument is disregarded. - * - * @param string $tableName OPTIONAL Name of table. - * @param string $primaryKey OPTIONAL Name of primary key column. - * @return string - */ - public function lastInsertId($tableName = null, $primaryKey = null) - { - if(count($this->_lastInsertIdStack)) { - return array_pop($this->_lastInsertIdStack); - } else { - return false; - } - } - - /** - * Begin a transaction. - */ - protected function _beginTransaction() - { - return; - } - - /** - * Commit a transaction. - */ - protected function _commit() - { - return; - } - - /** - * Roll-back a transaction. - */ - protected function _rollBack() - { - - } - - /** - * Set the fetch mode. - * - * @param integer $mode - * @return void - * @throws Zend_Db_Adapter_Exception - */ - public function setFetchMode($mode) - { - return; - } - - /** - * Adds an adapter-specific LIMIT clause to the SELECT statement. - * - * @param mixed $sql - * @param integer $count - * @param integer $offset - * @return string - */ - public function limit($sql, $count, $offset = 0) - { - return sprintf('%s LIMIT %d,%d', $sql, $offset, $count); - } - - /** - * Check if the adapter supports real SQL parameters. - * - * @param string $type 'positional' or 'named' - * @return bool - */ - public function supportsParameters($type) - { - return true; - } - - /** - * Retrieve server version in PHP style - * - * @return string - */ - function getServerVersion() - { - return "1.0.0"; - } -} diff --git a/library/vendor/Zend/Test/DbStatement.php b/library/vendor/Zend/Test/DbStatement.php deleted file mode 100644 index 2499aed44..000000000 --- a/library/vendor/Zend/Test/DbStatement.php +++ /dev/null @@ -1,402 +0,0 @@ -append($row); - } - return $stmt; - } - - /** - * Create an Insert Statement - * - * @param int $affectedRows - * @return Zend_Test_DbStatement - */ - static public function createInsertStatement($affectedRows=0) - { - return self::_createRowCountStatement($affectedRows); - } - - /** - * Create an Delete Statement - * - * @param int $affectedRows - * @return Zend_Test_DbStatement - */ - static public function createDeleteStatement($affectedRows=0) - { - return self::_createRowCountStatement($affectedRows); - } - - /** - * Create an Update Statement - * - * @param int $affectedRows - * @return Zend_Test_DbStatement - */ - static public function createUpdateStatement($affectedRows=0) - { - return self::_createRowCountStatement($affectedRows); - } - - /** - * Create a Row Count Statement - * - * @param int $affectedRows - * @return Zend_Test_DbStatement - */ - static protected function _createRowCountStatement($affectedRows) - { - $stmt = new Zend_Test_DbStatement(); - $stmt->setRowCount($affectedRows); - return $stmt; - } - - /** - * @param Zend_Db_Profiler_Query $qp - */ - public function setQueryProfile(Zend_Db_Profiler_Query $qp) - { - $this->_queryProfile = $qp; - } - - /** - * @param int $rowCount - */ - public function setRowCount($rowCount) - { - $this->_rowCount = $rowCount; - } - - /** - * Append a new row to the fetch stack. - * - * @param array $row - */ - public function append($row) - { - $this->_columnCount = count($row); - $this->_fetchStack[] = $row; - } - - /** - * Bind a column of the statement result set to a PHP variable. - * - * @param string $column Name the column in the result set, either by - * position or by name. - * @param mixed $param Reference to the PHP variable containing the value. - * @param mixed $type OPTIONAL - * @return bool - * @throws Zend_Db_Statement_Exception - */ - public function bindColumn($column, &$param, $type = null) - { - return true; - } - - /** - * Binds a parameter to the specified variable name. - * - * @param mixed $parameter Name the parameter, either integer or string. - * @param mixed $variable Reference to PHP variable containing the value. - * @param mixed $type OPTIONAL Datatype of SQL parameter. - * @param mixed $length OPTIONAL Length of SQL parameter. - * @param mixed $options OPTIONAL Other options. - * @return bool - * @throws Zend_Db_Statement_Exception - */ - public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null) - { - if($this->_queryProfile !== null) { - $this->_queryProfile->bindParam($parameter, $variable); - } - return true; - } - - /** - * Binds a value to a parameter. - * - * @param mixed $parameter Name the parameter, either integer or string. - * @param mixed $value Scalar value to bind to the parameter. - * @param mixed $type OPTIONAL Datatype of the parameter. - * @return bool - * @throws Zend_Db_Statement_Exception - */ - public function bindValue($parameter, $value, $type = null) - { - return true; - } - - /** - * Closes the cursor, allowing the statement to be executed again. - * - * @return bool - * @throws Zend_Db_Statement_Exception - */ - public function closeCursor() - { - return true; - } - - /** - * Returns the number of columns in the result set. - * Returns null if the statement has no result set metadata. - * - * @return int The number of columns. - * @throws Zend_Db_Statement_Exception - */ - public function columnCount() - { - return $this->_columnCount; - } - - /** - * Retrieves the error code, if any, associated with the last operation on - * the statement handle. - * - * @return string error code. - * @throws Zend_Db_Statement_Exception - */ - public function errorCode() - { - return false; - } - - /** - * Retrieves an array of error information, if any, associated with the - * last operation on the statement handle. - * - * @return array - * @throws Zend_Db_Statement_Exception - */ - public function errorInfo() - { - return false; - } - - /** - * Executes a prepared statement. - * - * @param array $params OPTIONAL Values to bind to parameter placeholders. - * @return bool - * @throws Zend_Db_Statement_Exception - */ - public function execute(array $params = array()) - { - if($this->_queryProfile !== null) { - $this->_queryProfile->bindParams($params); - $this->_queryProfile->end(); - } - return true; - } - - /** - * Fetches a row from the result set. - * - * @param int $style OPTIONAL Fetch mode for this fetch operation. - * @param int $cursor OPTIONAL Absolute, relative, or other. - * @param int $offset OPTIONAL Number for absolute or relative cursors. - * @return mixed Array, object, or scalar depending on fetch mode. - * @throws Zend_Db_Statement_Exception - */ - public function fetch($style = null, $cursor = null, $offset = null) - { - if(count($this->_fetchStack)) { - $row = array_shift($this->_fetchStack); - return $row; - } else { - return false; - } - } - - /** - * Returns an array containing all of the result set rows. - * - * @param int $style OPTIONAL Fetch mode. - * @param int $col OPTIONAL Column number, if fetch mode is by column. - * @return array Collection of rows, each in a format by the fetch mode. - * @throws Zend_Db_Statement_Exception - */ - public function fetchAll($style = null, $col = null) - { - $rows = $this->_fetchStack; - $this->_fetchStack = array(); - - return $rows; - } - - /** - * Returns a single column from the next row of a result set. - * - * @param int $col OPTIONAL Position of the column to fetch. - * @return string - * @throws Zend_Db_Statement_Exception - */ - public function fetchColumn($col = 0) - { - $row = $this->fetch(); - - if($row == false) { - return false; - } else { - if(count($row) < $col) { - throw new Zend_Db_Statement_Exception( - "Column Position '".$col."' is out of bounds." - ); - } - - $keys = array_keys($row); - return $row[$keys[$col]]; - } - } - - /** - * Fetches the next row and returns it as an object. - * - * @param string $class OPTIONAL Name of the class to create. - * @param array $config OPTIONAL Constructor arguments for the class. - * @return mixed One object instance of the specified class. - * @throws Zend_Db_Statement_Exception - */ - public function fetchObject($class = 'stdClass', array $config = array()) - { - if(!class_exists($class)) { - throw new Zend_Db_Statement_Exception("Class '".$class."' does not exist!"); - } - - $object = new $class(); - $row = $this->fetch(); - foreach($row AS $k => $v) { - $object->$k = $v; - } - - return $object; - } - - /** - * Retrieve a statement attribute. - * - * @param string $key Attribute name. - * @return mixed Attribute value. - * @throws Zend_Db_Statement_Exception - */ - public function getAttribute($key) - { - return false; - } - - /** - * Retrieves the next rowset (result set) for a SQL statement that has - * multiple result sets. An example is a stored procedure that returns - * the results of multiple queries. - * - * @return bool - * @throws Zend_Db_Statement_Exception - */ - public function nextRowset() - { - return false; - } - - /** - * Returns the number of rows affected by the execution of the - * last INSERT, DELETE, or UPDATE statement executed by this - * statement object. - * - * @return int The number of rows affected. - * @throws Zend_Db_Statement_Exception - */ - public function rowCount() - { - return $this->_rowCount; - } - - /** - * Set a statement attribute. - * - * @param string $key Attribute name. - * @param mixed $val Attribute value. - * @return bool - * @throws Zend_Db_Statement_Exception - */ - public function setAttribute($key, $val) - { - return true; - } - - /** - * Set the default fetch mode for this statement. - * - * @param int $mode The fetch mode. - * @return bool - * @throws Zend_Db_Statement_Exception - */ - public function setFetchMode($mode) - { - return true; - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery.php b/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery.php deleted file mode 100644 index 2aa52794b..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery.php +++ /dev/null @@ -1,38 +0,0 @@ -=')) { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'DomQuery41.php'); - - class Zend_Test_PHPUnit_Constraint_DomQuery extends Zend_Test_PHPUnit_Constraint_DomQuery41 - {} -} elseif (version_compare(PHPUnit_Runner_Version::id(), '3.5', '>=')) { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'DomQuery37.php'); - - class Zend_Test_PHPUnit_Constraint_DomQuery extends Zend_Test_PHPUnit_Constraint_DomQuery37 - {} -} else { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'DomQuery34.php'); - - class Zend_Test_PHPUnit_Constraint_DomQuery extends Zend_Test_PHPUnit_Constraint_DomQuery34 - {} -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery34.php b/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery34.php deleted file mode 100644 index 740f51cbb..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery34.php +++ /dev/null @@ -1,422 +0,0 @@ -_path = $path; - } - - /** - * Indicate negative match - * - * @param bool $flag - * @return void - */ - public function setNegate($flag = true) - { - $this->_negate = $flag; - } - - /** - * Whether or not path is a straight XPath expression - * - * @param bool $flag - * @return Zend_Test_PHPUnit_Constraint_DomQuery - */ - public function setUseXpath($flag = true) - { - $this->_useXpath = (bool) $flag; - return $this; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param string $other String to examine - * @param null|string Assertion type - * @return bool - */ - public function evaluate($other, $assertType = null) - { - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (strstr($assertType, 'Xpath')) { - $this->setUseXpath(true); - $assertType = str_replace('Xpath', 'Query', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $method = $this->_useXpath ? 'queryXpath' : 'query'; - $domQuery = new Zend_Dom_Query($other); - $domQuery->registerXpathNamespaces($this->_xpathNamespaces); - $result = $domQuery->$method($this->_path); - $argv = func_get_args(); - $argc = func_num_args(); - - switch ($assertType) { - case self::ASSERT_CONTENT_CONTAINS: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No content provided against which to match'); - } - $this->_content = $content = $argv[2]; - return ($this->_negate) - ? $this->_notMatchContent($result, $content) - : $this->_matchContent($result, $content); - case self::ASSERT_CONTENT_REGEX: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No pattern provided against which to match'); - } - $this->_content = $content = $argv[2]; - return ($this->_negate) - ? $this->_notRegexContent($result, $content) - : $this->_regexContent($result, $content); - case self::ASSERT_CONTENT_COUNT: - case self::ASSERT_CONTENT_COUNT_MIN: - case self::ASSERT_CONTENT_COUNT_MAX: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No count provided against which to compare'); - } - $this->_content = $content = $argv[2]; - return $this->_countContent($result, $content, $assertType); - case self::ASSERT_QUERY: - default: - if ($this->_negate) { - return (0 == count($result)); - } else { - return (0 != count($result)); - } - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed $other CSS selector path - * @param string $description - * @param bool $not - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function fail($other, $description, $not = false) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_CONTENT_CONTAINS: - $failure = 'Failed asserting node denoted by %s CONTAINS content "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT CONTAIN content "%s"'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_REGEX: - $failure = 'Failed asserting node denoted by %s CONTAINS content MATCHING "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT CONTAIN content MATCHING "%s"'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT: - $failure = 'Failed asserting node DENOTED BY %s OCCURS EXACTLY %d times'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT OCCUR EXACTLY %d times'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT_MIN: - $failure = 'Failed asserting node DENOTED BY %s OCCURS AT LEAST %d times'; - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT_MAX: - $failure = 'Failed asserting node DENOTED BY %s OCCURS AT MOST %d times'; - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_QUERY: - default: - $failure = 'Failed asserting node DENOTED BY %s EXISTS'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT EXIST'; - } - $failure = sprintf($failure, $other); - break; - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Register XPath namespaces - * - * @param array $xpathNamespaces - * @return void - */ - public function registerXpathNamespaces($xpathNamespaces) - { - $this->_xpathNamespaces = $xpathNamespaces; - } - - /** - * Check to see if content is matched in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $match Content to match - * @return bool - */ - protected function _matchContent($result, $match) - { - $match = (string) $match; - - if (0 == count($result)) { - return false; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (strstr($content, $match)) { - return true; - } - } - - return false; - } - - /** - * Check to see if content is NOT matched in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $match - * @return bool - */ - protected function _notMatchContent($result, $match) - { - if (0 == count($result)) { - return true; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (strstr($content, $match)) { - return false; - } - } - - return true; - } - - /** - * Check to see if content is matched by regex in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $pattern - * @return bool - */ - protected function _regexContent($result, $pattern) - { - if (0 == count($result)) { - return false; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (preg_match($pattern, $content)) { - return true; - } - } - - return false; - } - - /** - * Check to see if content is NOT matched by regex in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $pattern - * @return bool - */ - protected function _notRegexContent($result, $pattern) - { - if (0 == count($result)) { - return true; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (preg_match($pattern, $content)) { - return false; - } - } - - return true; - } - - /** - * Determine if content count matches criteria - * - * @param Zend_Dom_Query_Result $result - * @param int $test Value against which to test - * @param string $type assertion type - * @return boolean - */ - protected function _countContent($result, $test, $type) - { - $count = count($result); - - switch ($type) { - case self::ASSERT_CONTENT_COUNT: - return ($this->_negate) - ? ($test != $count) - : ($test == $count); - case self::ASSERT_CONTENT_COUNT_MIN: - return ($count >= $test); - case self::ASSERT_CONTENT_COUNT_MAX: - return ($count <= $test); - default: - return false; - } - } - - /** - * Get node content, minus node markup tags - * - * @param DOMNode $node - * @return string - */ - protected function _getNodeContent(DOMNode $node) - { - if ($node instanceof DOMAttr) { - return $node->value; - } else { - $doc = $node->ownerDocument; - $content = $doc->saveXML($node); - $tag = $node->nodeName; - $regex = '|]*>|'; - return preg_replace($regex, '', $content); - } - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery37.php b/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery37.php deleted file mode 100644 index b5c230ab7..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery37.php +++ /dev/null @@ -1,434 +0,0 @@ -_path = $path; - } - - /** - * Indicate negative match - * - * @param bool $flag - * @return void - */ - public function setNegate($flag = true) - { - $this->_negate = $flag; - } - - /** - * Whether or not path is a straight XPath expression - * - * @param bool $flag - * @return Zend_Test_PHPUnit_Constraint_DomQuery - */ - public function setUseXpath($flag = true) - { - $this->_useXpath = (bool) $flag; - return $this; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param string Response content to be matched against (haystack) - * @param null|string Assertion type - * @param string (optional) String to match (needle), may be required depending on assertion type - * @return bool - * - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function evaluate($other, $assertType = null) - * In PHPUnit 3.6.0 they changed the interface into this: - * public function evaluate($other, $description = '', $returnResult = FALSE) - * We use the new interface for PHP-strict checking, but emulate the old one - */ - public function evaluate($content, $assertType = '', $match = FALSE) - { - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (strstr($assertType, 'Xpath')) { - $this->setUseXpath(true); - $assertType = str_replace('Xpath', 'Query', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $method = $this->_useXpath ? 'queryXpath' : 'query'; - $domQuery = new Zend_Dom_Query($content); - $domQuery->registerXpathNamespaces($this->_xpathNamespaces); - $result = $domQuery->$method($this->_path); - - switch ($assertType) { - case self::ASSERT_CONTENT_CONTAINS: - if (!$match) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No content provided against which to match'); - } - $this->_content = $match; - return ($this->_negate) - ? $this->_notMatchContent($result, $match) - : $this->_matchContent($result, $match); - case self::ASSERT_CONTENT_REGEX: - if (!$match) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No pattern provided against which to match'); - } - $this->_content = $match; - return ($this->_negate) - ? $this->_notRegexContent($result, $match) - : $this->_regexContent($result, $match); - case self::ASSERT_CONTENT_COUNT: - case self::ASSERT_CONTENT_COUNT_MIN: - case self::ASSERT_CONTENT_COUNT_MAX: - if ($match === false) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No count provided against which to compare'); - } - $this->_content = $match; - return $this->_countContent($result, $match, $assertType); - case self::ASSERT_QUERY: - default: - if ($this->_negate) { - return (0 == count($result)); - } else { - return (0 != count($result)); - } - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed CSS selector path - * @param string Failure description - * @param object Cannot be used, null - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function fail($other, $description, $not = false) - * In PHPUnit 3.6.0 they changed the interface into this: - * protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) - * We use the new interface for PHP-strict checking - */ - public function fail($other, $description, PHPUnit_Framework_ComparisonFailure $cannot_be_used = NULL) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_CONTENT_CONTAINS: - $failure = 'Failed asserting node denoted by %s CONTAINS content "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT CONTAIN content "%s"'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_REGEX: - $failure = 'Failed asserting node denoted by %s CONTAINS content MATCHING "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT CONTAIN content MATCHING "%s"'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT: - $failure = 'Failed asserting node DENOTED BY %s OCCURS EXACTLY %d times'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT OCCUR EXACTLY %d times'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT_MIN: - $failure = 'Failed asserting node DENOTED BY %s OCCURS AT LEAST %d times'; - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT_MAX: - $failure = 'Failed asserting node DENOTED BY %s OCCURS AT MOST %d times'; - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_QUERY: - default: - $failure = 'Failed asserting node DENOTED BY %s EXISTS'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT EXIST'; - } - $failure = sprintf($failure, $other); - break; - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Register XPath namespaces - * - * @param array $xpathNamespaces - * @return void - */ - public function registerXpathNamespaces($xpathNamespaces) - { - $this->_xpathNamespaces = $xpathNamespaces; - } - - /** - * Check to see if content is matched in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $match Content to match - * @return bool - */ - protected function _matchContent($result, $match) - { - $match = (string) $match; - - if (0 == count($result)) { - return false; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (strstr($content, $match)) { - return true; - } - } - - return false; - } - - /** - * Check to see if content is NOT matched in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $match - * @return bool - */ - protected function _notMatchContent($result, $match) - { - if (0 == count($result)) { - return true; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (strstr($content, $match)) { - return false; - } - } - - return true; - } - - /** - * Check to see if content is matched by regex in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $pattern - * @return bool - */ - protected function _regexContent($result, $pattern) - { - if (0 == count($result)) { - return false; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (preg_match($pattern, $content)) { - return true; - } - } - - return false; - } - - /** - * Check to see if content is NOT matched by regex in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $pattern - * @return bool - */ - protected function _notRegexContent($result, $pattern) - { - if (0 == count($result)) { - return true; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (preg_match($pattern, $content)) { - return false; - } - } - - return true; - } - - /** - * Determine if content count matches criteria - * - * @param Zend_Dom_Query_Result $result - * @param int $test Value against which to test - * @param string $type assertion type - * @return boolean - */ - protected function _countContent($result, $test, $type) - { - $count = count($result); - - switch ($type) { - case self::ASSERT_CONTENT_COUNT: - return ($this->_negate) - ? ($test != $count) - : ($test == $count); - case self::ASSERT_CONTENT_COUNT_MIN: - return ($count >= $test); - case self::ASSERT_CONTENT_COUNT_MAX: - return ($count <= $test); - default: - return false; - } - } - - /** - * Get node content, minus node markup tags - * - * @param DOMNode $node - * @return string - */ - protected function _getNodeContent(DOMNode $node) - { - if ($node instanceof DOMAttr) { - return $node->value; - } else { - $doc = $node->ownerDocument; - $content = $doc->saveXML($node); - $tag = $node->nodeName; - $regex = '|]*>|'; - return preg_replace($regex, '', $content); - } - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery41.php b/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery41.php deleted file mode 100644 index 28cc484b3..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/DomQuery41.php +++ /dev/null @@ -1,436 +0,0 @@ -_path = $path; - } - - /** - * Indicate negative match - * - * @param bool $flag - * @return void - */ - public function setNegate($flag = true) - { - $this->_negate = $flag; - } - - /** - * Whether or not path is a straight XPath expression - * - * @param bool $flag - * @return Zend_Test_PHPUnit_Constraint_DomQuery - */ - public function setUseXpath($flag = true) - { - $this->_useXpath = (bool) $flag; - return $this; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param string Response content to be matched against (haystack) - * @param null|string Assertion type - * @param string (optional) String to match (needle), may be required depending on assertion type - * @return bool - * - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function evaluate($other, $assertType = null) - * In PHPUnit 3.6.0 they changed the interface into this: - * public function evaluate($other, $description = '', $returnResult = FALSE) - * We use the new interface for PHP-strict checking, but emulate the old one - */ - public function evaluate($content, $assertType = '', $match = FALSE) - { - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (strstr($assertType, 'Xpath')) { - $this->setUseXpath(true); - $assertType = str_replace('Xpath', 'Query', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $method = $this->_useXpath ? 'queryXpath' : 'query'; - $domQuery = new Zend_Dom_Query($content); - $domQuery->registerXpathNamespaces($this->_xpathNamespaces); - $result = $domQuery->$method($this->_path); - - switch ($assertType) { - case self::ASSERT_CONTENT_CONTAINS: - if (!$match) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No content provided against which to match'); - } - $this->_content = $match; - return ($this->_negate) - ? $this->_notMatchContent($result, $match) - : $this->_matchContent($result, $match); - case self::ASSERT_CONTENT_REGEX: - if (!$match) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No pattern provided against which to match'); - } - $this->_content = $match; - return ($this->_negate) - ? $this->_notRegexContent($result, $match) - : $this->_regexContent($result, $match); - case self::ASSERT_CONTENT_COUNT: - case self::ASSERT_CONTENT_COUNT_MIN: - case self::ASSERT_CONTENT_COUNT_MAX: - if ($match === false) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No count provided against which to compare'); - } - $this->_content = $match; - return $this->_countContent($result, $match, $assertType); - case self::ASSERT_QUERY: - default: - if ($this->_negate) { - return (0 == count($result)); - } else { - return (0 != count($result)); - } - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed CSS selector path - * @param string Failure description - * @param object Cannot be used, null - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function fail($other, $description, $not = false) - * In PHPUnit 3.6.0 they changed the interface into this: - * protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) - * We use the new interface for PHP-strict checking - * NOTE 2: - * Interface changed again in PHPUnit 4.1.0 because of refactoring to SebastianBergmann\Comparator - */ - public function fail($other, $description, \SebastianBergmann\Comparator\ComparisonFailure $cannot_be_used = NULL) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_CONTENT_CONTAINS: - $failure = 'Failed asserting node denoted by %s CONTAINS content "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT CONTAIN content "%s"'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_REGEX: - $failure = 'Failed asserting node denoted by %s CONTAINS content MATCHING "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT CONTAIN content MATCHING "%s"'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT: - $failure = 'Failed asserting node DENOTED BY %s OCCURS EXACTLY %d times'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT OCCUR EXACTLY %d times'; - } - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT_MIN: - $failure = 'Failed asserting node DENOTED BY %s OCCURS AT LEAST %d times'; - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_CONTENT_COUNT_MAX: - $failure = 'Failed asserting node DENOTED BY %s OCCURS AT MOST %d times'; - $failure = sprintf($failure, $other, $this->_content); - break; - case self::ASSERT_QUERY: - default: - $failure = 'Failed asserting node DENOTED BY %s EXISTS'; - if ($this->_negate) { - $failure = 'Failed asserting node DENOTED BY %s DOES NOT EXIST'; - } - $failure = sprintf($failure, $other); - break; - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Register XPath namespaces - * - * @param array $xpathNamespaces - * @return void - */ - public function registerXpathNamespaces($xpathNamespaces) - { - $this->_xpathNamespaces = $xpathNamespaces; - } - - /** - * Check to see if content is matched in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $match Content to match - * @return bool - */ - protected function _matchContent($result, $match) - { - $match = (string) $match; - - if (0 == count($result)) { - return false; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (strstr($content, $match)) { - return true; - } - } - - return false; - } - - /** - * Check to see if content is NOT matched in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $match - * @return bool - */ - protected function _notMatchContent($result, $match) - { - if (0 == count($result)) { - return true; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (strstr($content, $match)) { - return false; - } - } - - return true; - } - - /** - * Check to see if content is matched by regex in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $pattern - * @return bool - */ - protected function _regexContent($result, $pattern) - { - if (0 == count($result)) { - return false; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (preg_match($pattern, $content)) { - return true; - } - } - - return false; - } - - /** - * Check to see if content is NOT matched by regex in selected nodes - * - * @param Zend_Dom_Query_Result $result - * @param string $pattern - * @return bool - */ - protected function _notRegexContent($result, $pattern) - { - if (0 == count($result)) { - return true; - } - - foreach ($result as $node) { - $content = $this->_getNodeContent($node); - if (preg_match($pattern, $content)) { - return false; - } - } - - return true; - } - - /** - * Determine if content count matches criteria - * - * @param Zend_Dom_Query_Result $result - * @param int $test Value against which to test - * @param string $type assertion type - * @return boolean - */ - protected function _countContent($result, $test, $type) - { - $count = count($result); - - switch ($type) { - case self::ASSERT_CONTENT_COUNT: - return ($this->_negate) - ? ($test != $count) - : ($test == $count); - case self::ASSERT_CONTENT_COUNT_MIN: - return ($count >= $test); - case self::ASSERT_CONTENT_COUNT_MAX: - return ($count <= $test); - default: - return false; - } - } - - /** - * Get node content, minus node markup tags - * - * @param DOMNode $node - * @return string - */ - protected function _getNodeContent(DOMNode $node) - { - if ($node instanceof DOMAttr) { - return $node->value; - } else { - $doc = $node->ownerDocument; - $content = $doc->saveXML($node); - $tag = $node->nodeName; - $regex = '|]*>|'; - return preg_replace($regex, '', $content); - } - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/Exception.php b/library/vendor/Zend/Test/PHPUnit/Constraint/Exception.php deleted file mode 100644 index 2286fef07..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/Exception.php +++ /dev/null @@ -1,35 +0,0 @@ -=')) { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Redirect41.php'); - - class Zend_Test_PHPUnit_Constraint_Redirect extends Zend_Test_PHPUnit_Constraint_Redirect41 - {} -} elseif (version_compare(PHPUnit_Runner_Version::id(), '3.5', '>=')) { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Redirect37.php'); - - class Zend_Test_PHPUnit_Constraint_Redirect extends Zend_Test_PHPUnit_Constraint_Redirect37 - {} -} else { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Redirect34.php'); - - class Zend_Test_PHPUnit_Constraint_Redirect extends Zend_Test_PHPUnit_Constraint_Redirect34 - {} -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect34.php b/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect34.php deleted file mode 100644 index e8d9f8ed9..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect34.php +++ /dev/null @@ -1,303 +0,0 @@ -_negate = $flag; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param string $other String to examine - * @param null|string Assertion type - * @return bool - */ - public function evaluate($other, $assertType = null) - { - if (!$other instanceof Zend_Controller_Response_Abstract) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Redirect constraint assertions require a response object'); - } - - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $response = $other; - $argv = func_get_args(); - $argc = func_num_args(); - - switch ($assertType) { - case self::ASSERT_REDIRECT_TO: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No redirect URL provided against which to match'); - } - $this->_match = $match = $argv[2]; - return ($this->_negate) - ? $this->_notMatch($response, $match) - : $this->_match($response, $match); - case self::ASSERT_REDIRECT_REGEX: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No pattern provided against which to match redirect'); - } - $this->_match = $match = $argv[2]; - return ($this->_negate) - ? $this->_notRegex($response, $match) - : $this->_regex($response, $match); - case self::ASSERT_REDIRECT: - default: - $headers = $response->sendHeaders(); - if (isset($headers['location'])) { - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - } - return ($this->_negate) ? !$response->isRedirect() : $response->isRedirect(); - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed $other - * @param string $description Additional message to display - * @param bool $not - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function fail($other, $description, $not = false) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_REDIRECT_TO: - $failure = 'Failed asserting response redirects to "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response DOES NOT redirect to "%s"'; - } - $failure = sprintf($failure, $this->_match); - if (!$this->_negate && $this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s".', $this->_actual); - } - break; - case self::ASSERT_REDIRECT_REGEX: - $failure = 'Failed asserting response redirects to URL MATCHING "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response DOES NOT redirect to URL MATCHING "%s"'; - } - $failure = sprintf($failure, $this->_match); - if ($this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s".', $this->_actual); - } - break; - case self::ASSERT_REDIRECT: - default: - $failure = 'Failed asserting response is a redirect'; - if ($this->_negate) { - $failure = 'Failed asserting response is NOT a redirect'; - if ($this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s"', $this->_actual); - } - } - break; - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Check to see if content is matched in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $match Content to match - * @return bool - */ - protected function _match($response, $match) - { - if (!$response->isRedirect()) { - return false; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return ($redirect == $match); - } - - /** - * Check to see if content is NOT matched in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $match - * @return bool - */ - protected function _notMatch($response, $match) - { - if (!$response->isRedirect()) { - return true; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return ($redirect != $match); - } - - /** - * Check to see if content is matched by regex in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $pattern - * @return bool - */ - protected function _regex($response, $pattern) - { - if (!$response->isRedirect()) { - return false; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return preg_match($pattern, $redirect); - } - - /** - * Check to see if content is NOT matched by regex in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $pattern - * @return bool - */ - protected function _notRegex($response, $pattern) - { - if (!$response->isRedirect()) { - return true; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return !preg_match($pattern, $redirect); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect37.php b/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect37.php deleted file mode 100644 index 0494c976f..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect37.php +++ /dev/null @@ -1,315 +0,0 @@ -_negate = $flag; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param string $other String to examine - * @param null|string Assertion type - * @return bool - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function evaluate($other, $assertType = null) - * In PHPUnit 3.6.0 they changed the interface into this: - * public function evaluate($other, $description = '', $returnResult = FALSE) - * We use the new interface for PHP-strict checking, but emulate the old one - */ - public function evaluate($other, $assertType = null, $variable = FALSE) - { - if (!$other instanceof Zend_Controller_Response_Abstract) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Redirect constraint assertions require a response object'); - } - - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $response = $other; - $argv = func_get_args(); - $argc = func_num_args(); - - switch ($assertType) { - case self::ASSERT_REDIRECT_TO: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No redirect URL provided against which to match'); - } - $this->_match = $match = $argv[2]; - return ($this->_negate) - ? $this->_notMatch($response, $match) - : $this->_match($response, $match); - case self::ASSERT_REDIRECT_REGEX: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No pattern provided against which to match redirect'); - } - $this->_match = $match = $argv[2]; - return ($this->_negate) - ? $this->_notRegex($response, $match) - : $this->_regex($response, $match); - case self::ASSERT_REDIRECT: - default: - $headers = $response->sendHeaders(); - if (isset($headers['location'])) { - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - } - return ($this->_negate) ? !$response->isRedirect() : $response->isRedirect(); - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed $other - * @param string $description Additional message to display - * @param bool $not - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function fail($other, $description, $not = false) - * In PHPUnit 3.6.0 they changed the interface into this: - * protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) - * We use the new interface for PHP-strict checking - */ - public function fail($other, $description, PHPUnit_Framework_ComparisonFailure $cannot_be_used = NULL) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_REDIRECT_TO: - $failure = 'Failed asserting response redirects to "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response DOES NOT redirect to "%s"'; - } - $failure = sprintf($failure, $this->_match); - if (!$this->_negate && $this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s".', $this->_actual); - } - break; - case self::ASSERT_REDIRECT_REGEX: - $failure = 'Failed asserting response redirects to URL MATCHING "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response DOES NOT redirect to URL MATCHING "%s"'; - } - $failure = sprintf($failure, $this->_match); - if ($this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s".', $this->_actual); - } - break; - case self::ASSERT_REDIRECT: - default: - $failure = 'Failed asserting response is a redirect'; - if ($this->_negate) { - $failure = 'Failed asserting response is NOT a redirect'; - if ($this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s"', $this->_actual); - } - } - break; - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Check to see if content is matched in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $match Content to match - * @return bool - */ - protected function _match($response, $match) - { - if (!$response->isRedirect()) { - return false; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return ($redirect == $match); - } - - /** - * Check to see if content is NOT matched in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $match - * @return bool - */ - protected function _notMatch($response, $match) - { - if (!$response->isRedirect()) { - return true; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return ($redirect != $match); - } - - /** - * Check to see if content is matched by regex in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $pattern - * @return bool - */ - protected function _regex($response, $pattern) - { - if (!$response->isRedirect()) { - return false; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return preg_match($pattern, $redirect); - } - - /** - * Check to see if content is NOT matched by regex in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $pattern - * @return bool - */ - protected function _notRegex($response, $pattern) - { - if (!$response->isRedirect()) { - return true; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return !preg_match($pattern, $redirect); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect41.php b/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect41.php deleted file mode 100644 index 6f6e91564..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/Redirect41.php +++ /dev/null @@ -1,317 +0,0 @@ -_negate = $flag; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param string $other String to examine - * @param null|string Assertion type - * @return bool - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function evaluate($other, $assertType = null) - * In PHPUnit 3.6.0 they changed the interface into this: - * public function evaluate($other, $description = '', $returnResult = FALSE) - * We use the new interface for PHP-strict checking, but emulate the old one - */ - public function evaluate($other, $assertType = null, $variable = FALSE) - { - if (!$other instanceof Zend_Controller_Response_Abstract) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Redirect constraint assertions require a response object'); - } - - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $response = $other; - $argv = func_get_args(); - $argc = func_num_args(); - - switch ($assertType) { - case self::ASSERT_REDIRECT_TO: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No redirect URL provided against which to match'); - } - $this->_match = $match = $argv[2]; - return ($this->_negate) - ? $this->_notMatch($response, $match) - : $this->_match($response, $match); - case self::ASSERT_REDIRECT_REGEX: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No pattern provided against which to match redirect'); - } - $this->_match = $match = $argv[2]; - return ($this->_negate) - ? $this->_notRegex($response, $match) - : $this->_regex($response, $match); - case self::ASSERT_REDIRECT: - default: - $headers = $response->sendHeaders(); - if (isset($headers['location'])) { - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - } - return ($this->_negate) ? !$response->isRedirect() : $response->isRedirect(); - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed $other - * @param string $description Additional message to display - * @param bool $not - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function fail($other, $description, $not = false) - * In PHPUnit 3.6.0 they changed the interface into this: - * protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) - * We use the new interface for PHP-strict checking - * NOTE 2: - * Interface changed again in PHPUnit 4.1.0 because of refactoring to SebastianBergmann\Comparator - */ - public function fail($other, $description, \SebastianBergmann\Comparator\ComparisonFailure $cannot_be_used = NULL) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_REDIRECT_TO: - $failure = 'Failed asserting response redirects to "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response DOES NOT redirect to "%s"'; - } - $failure = sprintf($failure, $this->_match); - if (!$this->_negate && $this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s".', $this->_actual); - } - break; - case self::ASSERT_REDIRECT_REGEX: - $failure = 'Failed asserting response redirects to URL MATCHING "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response DOES NOT redirect to URL MATCHING "%s"'; - } - $failure = sprintf($failure, $this->_match); - if ($this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s".', $this->_actual); - } - break; - case self::ASSERT_REDIRECT: - default: - $failure = 'Failed asserting response is a redirect'; - if ($this->_negate) { - $failure = 'Failed asserting response is NOT a redirect'; - if ($this->_actual) { - $failure .= sprintf(PHP_EOL . 'It redirects to "%s"', $this->_actual); - } - } - break; - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Check to see if content is matched in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $match Content to match - * @return bool - */ - protected function _match($response, $match) - { - if (!$response->isRedirect()) { - return false; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return ($redirect == $match); - } - - /** - * Check to see if content is NOT matched in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $match - * @return bool - */ - protected function _notMatch($response, $match) - { - if (!$response->isRedirect()) { - return true; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return ($redirect != $match); - } - - /** - * Check to see if content is matched by regex in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $pattern - * @return bool - */ - protected function _regex($response, $pattern) - { - if (!$response->isRedirect()) { - return false; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return preg_match($pattern, $redirect); - } - - /** - * Check to see if content is NOT matched by regex in selected nodes - * - * @param Zend_Controller_Response_HttpTestCase $response - * @param string $pattern - * @return bool - */ - protected function _notRegex($response, $pattern) - { - if (!$response->isRedirect()) { - return true; - } - - $headers = $response->sendHeaders(); - $redirect = $headers['location']; - $redirect = str_replace('Location: ', '', $redirect); - $this->_actual = $redirect; - - return !preg_match($pattern, $redirect); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader.php b/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader.php deleted file mode 100644 index 178de0505..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader.php +++ /dev/null @@ -1,38 +0,0 @@ -=')) { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ResponseHeader41.php'); - - class Zend_Test_PHPUnit_Constraint_ResponseHeader extends Zend_Test_PHPUnit_Constraint_ResponseHeader41 - {} -} elseif (version_compare(PHPUnit_Runner_Version::id(), '3.5', '>=')) { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ResponseHeader37.php'); - - class Zend_Test_PHPUnit_Constraint_ResponseHeader extends Zend_Test_PHPUnit_Constraint_ResponseHeader37 - {} -} else { - include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ResponseHeader34.php'); - - class Zend_Test_PHPUnit_Constraint_ResponseHeader extends Zend_Test_PHPUnit_Constraint_ResponseHeader34 - {} -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader34.php b/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader34.php deleted file mode 100644 index 3d37756d2..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader34.php +++ /dev/null @@ -1,406 +0,0 @@ -_negate = $flag; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param Zend_Controller_Response_Abstract $other String to examine - * @param null|string Assertion type - * @return bool - */ - public function evaluate($other, $assertType = null) - { - if (!$other instanceof Zend_Controller_Response_Abstract) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Header constraint assertions require a response object'); - } - - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $response = $other; - $argv = func_get_args(); - $argc = func_num_args(); - - switch ($assertType) { - case self::ASSERT_RESPONSE_CODE: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No response code provided against which to match'); - } - $this->_code = $code = $argv[2]; - return ($this->_negate) - ? $this->_notCode($response, $code) - : $this->_code($response, $code); - case self::ASSERT_HEADER: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No header provided against which to match'); - } - $this->_header = $header = $argv[2]; - return ($this->_negate) - ? $this->_notHeader($response, $header) - : $this->_header($response, $header); - case self::ASSERT_HEADER_CONTAINS: - if (4 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Both a header name and content to match are required for ' . __FUNCTION__); - } - $this->_header = $header = $argv[2]; - $this->_match = $match = $argv[3]; - return ($this->_negate) - ? $this->_notHeaderContains($response, $header, $match) - : $this->_headerContains($response, $header, $match); - case self::ASSERT_HEADER_REGEX: - if (4 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Both a header name and content to match are required for ' . __FUNCTION__); - } - $this->_header = $header = $argv[2]; - $this->_match = $match = $argv[3]; - return ($this->_negate) - ? $this->_notHeaderRegex($response, $header, $match) - : $this->_headerRegex($response, $header, $match); - default: - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Invalid assertion type ' . __FUNCTION__); - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed $other - * @param string $description Additional message to display - * @param bool $not - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - */ - public function fail($other, $description, $not = false) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_RESPONSE_CODE: - $failure = 'Failed asserting response code "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response code IS NOT "%s"'; - } - $failure = sprintf($failure, $this->_code); - if (!$this->_negate && $this->_actualCode) { - $failure .= sprintf(PHP_EOL . 'Was "%s"', $this->_actualCode); - } - break; - case self::ASSERT_HEADER: - $failure = 'Failed asserting response header "%s" found'; - if ($this->_negate) { - $failure = 'Failed asserting response response header "%s" WAS NOT found'; - } - $failure = sprintf($failure, $this->_header); - break; - case self::ASSERT_HEADER_CONTAINS: - $failure = 'Failed asserting response header "%s" exists and contains "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response header "%s" DOES NOT CONTAIN "%s"'; - } - $failure = sprintf($failure, $this->_header, $this->_match); - break; - case self::ASSERT_HEADER_REGEX: - $failure = 'Failed asserting response header "%s" exists and matches regex "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response header "%s" DOES NOT MATCH regex "%s"'; - } - $failure = sprintf($failure, $this->_header, $this->_match); - break; - default: - throw new Zend_Test_PHPUnit_Constraint_Exception('Invalid assertion type ' . __FUNCTION__); - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Compare response code for positive match - * - * @param Zend_Controller_Response_Abstract $response - * @param int $code - * @return bool - */ - protected function _code(Zend_Controller_Response_Abstract $response, $code) - { - $test = $this->_getCode($response); - $this->_actualCode = $test; - return ($test == $code); - } - - /** - * Compare response code for negative match - * - * @param Zend_Controller_Response_Abstract $response - * @param int $code - * @return bool - */ - protected function _notCode(Zend_Controller_Response_Abstract $response, $code) - { - $test = $this->_getCode($response); - return ($test != $code); - } - - /** - * Retrieve response code - * - * @param Zend_Controller_Response_Abstract $response - * @return int - */ - protected function _getCode(Zend_Controller_Response_Abstract $response) - { - $test = $response->getHttpResponseCode(); - if (null === $test) { - $test = 200; - } - return $test; - } - - /** - * Positive check for response header presence - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return bool - */ - protected function _header(Zend_Controller_Response_Abstract $response, $header) - { - return (null !== $this->_getHeader($response, $header)); - } - - /** - * Negative check for response header presence - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return bool - */ - protected function _notHeader(Zend_Controller_Response_Abstract $response, $header) - { - return (null === $this->_getHeader($response, $header)); - } - - /** - * Retrieve response header - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return string|null - */ - protected function _getHeader(Zend_Controller_Response_Abstract $response, $header) - { - $headers = $response->sendHeaders(); - $header = strtolower($header); - if (array_key_exists($header, $headers)) { - return $headers[$header]; - } - return null; - } - - /** - * Positive check for header contents matching pattern - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $match - * @return bool - */ - protected function _headerContains(Zend_Controller_Response_Abstract $response, $header, $match) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return false; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return (strstr($contents, $match) !== false); - } - - /** - * Negative check for header contents matching pattern - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $match - * @return bool - */ - protected function _notHeaderContains(Zend_Controller_Response_Abstract $response, $header, $match) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return true; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return (strstr($contents, $match) === false); - } - - /** - * Positive check for header contents matching regex - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $pattern - * @return bool - */ - protected function _headerRegex(Zend_Controller_Response_Abstract $response, $header, $pattern) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return false; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return preg_match($pattern, $contents); - } - - /** - * Negative check for header contents matching regex - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $pattern - * @return bool - */ - protected function _notHeaderRegex(Zend_Controller_Response_Abstract $response, $header, $pattern) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return true; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return !preg_match($pattern, $contents); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader37.php b/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader37.php deleted file mode 100644 index ad26f0eb6..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader37.php +++ /dev/null @@ -1,419 +0,0 @@ -_negate = $flag; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param object of Zend_Controller_Response_Abstract to be evaluated - * @param null|string Assertion type - * @param int|string HTTP response code to evaluate against | header string (haystack) - * @param string (optional) match (needle), may be required depending on assertion type - * @return bool - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function evaluate($other, $assertType = null) - * In PHPUnit 3.6.0 they changed the interface into this: - * public function evaluate($other, $description = '', $returnResult = FALSE) - * We use the new interface for PHP-strict checking, but emulate the old one - */ - public function evaluate($response, $assertType = '', $variable = FALSE) - { - if (!$response instanceof Zend_Controller_Response_Abstract) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Header constraint assertions require a response object'); - } - - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $argv = func_get_args(); - $argc = func_num_args(); - - switch ($assertType) { - case self::ASSERT_RESPONSE_CODE: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No response code provided against which to match'); - } - $this->_code = $code = $argv[2]; - return ($this->_negate) - ? $this->_notCode($response, $code) - : $this->_code($response, $code); - case self::ASSERT_HEADER: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No header provided against which to match'); - } - $this->_header = $header = $argv[2]; - return ($this->_negate) - ? $this->_notHeader($response, $header) - : $this->_header($response, $header); - case self::ASSERT_HEADER_CONTAINS: - if (4 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Both a header name and content to match are required for ' . $assertType); - } - $this->_header = $header = $argv[2]; - $this->_match = $match = $argv[3]; - return ($this->_negate) - ? $this->_notHeaderContains($response, $header, $match) - : $this->_headerContains($response, $header, $match); - case self::ASSERT_HEADER_REGEX: - if (4 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Both a header name and content to match are required for ' . $assertType); - } - $this->_header = $header = $argv[2]; - $this->_match = $match = $argv[3]; - return ($this->_negate) - ? $this->_notHeaderRegex($response, $header, $match) - : $this->_headerRegex($response, $header, $match); - default: - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Invalid assertion type ' . $assertType); - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed CSS selector path - * @param string Failure description - * @param object Cannot be used, null - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function fail($other, $description, $not = false) - * In PHPUnit 3.6.0 they changed the interface into this: - * protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) - * We use the new interface for PHP-strict checking - */ - public function fail($other, $description, PHPUnit_Framework_ComparisonFailure $cannot_be_used = NULL) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_RESPONSE_CODE: - $failure = 'Failed asserting response code "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response code IS NOT "%s"'; - } - $failure = sprintf($failure, $this->_code); - if (!$this->_negate && $this->_actualCode) { - $failure .= sprintf(PHP_EOL . 'Was "%s"', $this->_actualCode); - } - break; - case self::ASSERT_HEADER: - $failure = 'Failed asserting response header "%s" found'; - if ($this->_negate) { - $failure = 'Failed asserting response response header "%s" WAS NOT found'; - } - $failure = sprintf($failure, $this->_header); - break; - case self::ASSERT_HEADER_CONTAINS: - $failure = 'Failed asserting response header "%s" exists and contains "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response header "%s" DOES NOT CONTAIN "%s"'; - } - $failure = sprintf($failure, $this->_header, $this->_match); - break; - case self::ASSERT_HEADER_REGEX: - $failure = 'Failed asserting response header "%s" exists and matches regex "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response header "%s" DOES NOT MATCH regex "%s"'; - } - $failure = sprintf($failure, $this->_header, $this->_match); - break; - default: - throw new Zend_Test_PHPUnit_Constraint_Exception('Invalid assertion type ' . __FUNCTION__); - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Compare response code for positive match - * - * @param Zend_Controller_Response_Abstract $response - * @param int $code - * @return bool - */ - protected function _code(Zend_Controller_Response_Abstract $response, $code) - { - $test = $this->_getCode($response); - $this->_actualCode = $test; - return ($test == $code); - } - - /** - * Compare response code for negative match - * - * @param Zend_Controller_Response_Abstract $response - * @param int $code - * @return bool - */ - protected function _notCode(Zend_Controller_Response_Abstract $response, $code) - { - $test = $this->_getCode($response); - return ($test != $code); - } - - /** - * Retrieve response code - * - * @param Zend_Controller_Response_Abstract $response - * @return int - */ - protected function _getCode(Zend_Controller_Response_Abstract $response) - { - $test = $response->getHttpResponseCode(); - if (null === $test) { - $test = 200; - } - return $test; - } - - /** - * Positive check for response header presence - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return bool - */ - protected function _header(Zend_Controller_Response_Abstract $response, $header) - { - return (null !== $this->_getHeader($response, $header)); - } - - /** - * Negative check for response header presence - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return bool - */ - protected function _notHeader(Zend_Controller_Response_Abstract $response, $header) - { - return (null === $this->_getHeader($response, $header)); - } - - /** - * Retrieve response header - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return string|null - */ - protected function _getHeader(Zend_Controller_Response_Abstract $response, $header) - { - $headers = $response->sendHeaders(); - $header = strtolower($header); - if (array_key_exists($header, $headers)) { - return $headers[$header]; - } - return null; - } - - /** - * Positive check for header contents matching pattern - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $match - * @return bool - */ - protected function _headerContains(Zend_Controller_Response_Abstract $response, $header, $match) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return false; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return (strstr($contents, $match) !== false); - } - - /** - * Negative check for header contents matching pattern - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $match - * @return bool - */ - protected function _notHeaderContains(Zend_Controller_Response_Abstract $response, $header, $match) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return true; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return (strstr($contents, $match) === false); - } - - /** - * Positive check for header contents matching regex - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $pattern - * @return bool - */ - protected function _headerRegex(Zend_Controller_Response_Abstract $response, $header, $pattern) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return false; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return preg_match($pattern, $contents); - } - - /** - * Negative check for header contents matching regex - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $pattern - * @return bool - */ - protected function _notHeaderRegex(Zend_Controller_Response_Abstract $response, $header, $pattern) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return true; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return !preg_match($pattern, $contents); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php b/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php deleted file mode 100644 index 7f244d43b..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Constraint/ResponseHeader41.php +++ /dev/null @@ -1,421 +0,0 @@ -_negate = $flag; - } - - /** - * Evaluate an object to see if it fits the constraints - * - * @param object of Zend_Controller_Response_Abstract to be evaluated - * @param null|string Assertion type - * @param int|string HTTP response code to evaluate against | header string (haystack) - * @param string (optional) match (needle), may be required depending on assertion type - * @return bool - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function evaluate($other, $assertType = null) - * In PHPUnit 3.6.0 they changed the interface into this: - * public function evaluate($other, $description = '', $returnResult = FALSE) - * We use the new interface for PHP-strict checking, but emulate the old one - */ - public function evaluate($response, $assertType = '', $variable = FALSE) - { - if (!$response instanceof Zend_Controller_Response_Abstract) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Header constraint assertions require a response object'); - } - - if (strstr($assertType, 'Not')) { - $this->setNegate(true); - $assertType = str_replace('Not', '', $assertType); - } - - if (!in_array($assertType, $this->_assertTypes)) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception(sprintf('Invalid assertion type "%s" provided to %s constraint', $assertType, __CLASS__)); - } - - $this->_assertType = $assertType; - - $argv = func_get_args(); - $argc = func_num_args(); - - switch ($assertType) { - case self::ASSERT_RESPONSE_CODE: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No response code provided against which to match'); - } - $this->_code = $code = $argv[2]; - return ($this->_negate) - ? $this->_notCode($response, $code) - : $this->_code($response, $code); - case self::ASSERT_HEADER: - if (3 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('No header provided against which to match'); - } - $this->_header = $header = $argv[2]; - return ($this->_negate) - ? $this->_notHeader($response, $header) - : $this->_header($response, $header); - case self::ASSERT_HEADER_CONTAINS: - if (4 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Both a header name and content to match are required for ' . $assertType); - } - $this->_header = $header = $argv[2]; - $this->_match = $match = $argv[3]; - return ($this->_negate) - ? $this->_notHeaderContains($response, $header, $match) - : $this->_headerContains($response, $header, $match); - case self::ASSERT_HEADER_REGEX: - if (4 > $argc) { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Both a header name and content to match are required for ' . $assertType); - } - $this->_header = $header = $argv[2]; - $this->_match = $match = $argv[3]; - return ($this->_negate) - ? $this->_notHeaderRegex($response, $header, $match) - : $this->_headerRegex($response, $header, $match); - default: - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - throw new Zend_Test_PHPUnit_Constraint_Exception('Invalid assertion type ' . $assertType); - } - } - - /** - * Report Failure - * - * @see PHPUnit_Framework_Constraint for implementation details - * @param mixed CSS selector path - * @param string Failure description - * @param object Cannot be used, null - * @return void - * @throws PHPUnit_Framework_ExpectationFailedException - * NOTE: - * Drastic changes up to PHPUnit 3.5.15 this was: - * public function fail($other, $description, $not = false) - * In PHPUnit 3.6.0 they changed the interface into this: - * protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) - * We use the new interface for PHP-strict checking - * NOTE 2: - * Interface changed again in PHPUnit 4.1.0 because of refactoring to SebastianBergmann\Comparator - */ - public function fail($other, $description, \SebastianBergmann\Comparator\ComparisonFailure $cannot_be_used = NULL) - { - require_once 'Zend/Test/PHPUnit/Constraint/Exception.php'; - switch ($this->_assertType) { - case self::ASSERT_RESPONSE_CODE: - $failure = 'Failed asserting response code "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response code IS NOT "%s"'; - } - $failure = sprintf($failure, $this->_code); - if (!$this->_negate && $this->_actualCode) { - $failure .= sprintf(PHP_EOL . 'Was "%s"', $this->_actualCode); - } - break; - case self::ASSERT_HEADER: - $failure = 'Failed asserting response header "%s" found'; - if ($this->_negate) { - $failure = 'Failed asserting response response header "%s" WAS NOT found'; - } - $failure = sprintf($failure, $this->_header); - break; - case self::ASSERT_HEADER_CONTAINS: - $failure = 'Failed asserting response header "%s" exists and contains "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response header "%s" DOES NOT CONTAIN "%s"'; - } - $failure = sprintf($failure, $this->_header, $this->_match); - break; - case self::ASSERT_HEADER_REGEX: - $failure = 'Failed asserting response header "%s" exists and matches regex "%s"'; - if ($this->_negate) { - $failure = 'Failed asserting response header "%s" DOES NOT MATCH regex "%s"'; - } - $failure = sprintf($failure, $this->_header, $this->_match); - break; - default: - throw new Zend_Test_PHPUnit_Constraint_Exception('Invalid assertion type ' . __FUNCTION__); - } - - if (!empty($description)) { - $failure = $description . "\n" . $failure; - } - - throw new Zend_Test_PHPUnit_Constraint_Exception($failure); - } - - /** - * Complete implementation - * - * @return string - */ - public function toString() - { - return ''; - } - - /** - * Compare response code for positive match - * - * @param Zend_Controller_Response_Abstract $response - * @param int $code - * @return bool - */ - protected function _code(Zend_Controller_Response_Abstract $response, $code) - { - $test = $this->_getCode($response); - $this->_actualCode = $test; - return ($test == $code); - } - - /** - * Compare response code for negative match - * - * @param Zend_Controller_Response_Abstract $response - * @param int $code - * @return bool - */ - protected function _notCode(Zend_Controller_Response_Abstract $response, $code) - { - $test = $this->_getCode($response); - return ($test != $code); - } - - /** - * Retrieve response code - * - * @param Zend_Controller_Response_Abstract $response - * @return int - */ - protected function _getCode(Zend_Controller_Response_Abstract $response) - { - $test = $response->getHttpResponseCode(); - if (null === $test) { - $test = 200; - } - return $test; - } - - /** - * Positive check for response header presence - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return bool - */ - protected function _header(Zend_Controller_Response_Abstract $response, $header) - { - return (null !== $this->_getHeader($response, $header)); - } - - /** - * Negative check for response header presence - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return bool - */ - protected function _notHeader(Zend_Controller_Response_Abstract $response, $header) - { - return (null === $this->_getHeader($response, $header)); - } - - /** - * Retrieve response header - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @return string|null - */ - protected function _getHeader(Zend_Controller_Response_Abstract $response, $header) - { - $headers = $response->sendHeaders(); - $header = strtolower($header); - if (array_key_exists($header, $headers)) { - return $headers[$header]; - } - return null; - } - - /** - * Positive check for header contents matching pattern - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $match - * @return bool - */ - protected function _headerContains(Zend_Controller_Response_Abstract $response, $header, $match) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return false; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return (strstr($contents, $match) !== false); - } - - /** - * Negative check for header contents matching pattern - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $match - * @return bool - */ - protected function _notHeaderContains(Zend_Controller_Response_Abstract $response, $header, $match) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return true; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return (strstr($contents, $match) === false); - } - - /** - * Positive check for header contents matching regex - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $pattern - * @return bool - */ - protected function _headerRegex(Zend_Controller_Response_Abstract $response, $header, $pattern) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return false; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return preg_match($pattern, $contents); - } - - /** - * Negative check for header contents matching regex - * - * @param Zend_Controller_Response_Abstract $response - * @param string $header - * @param string $pattern - * @return bool - */ - protected function _notHeaderRegex(Zend_Controller_Response_Abstract $response, $header, $pattern) - { - if (null === ($fullHeader = $this->_getHeader($response, $header))) { - return true; - } - - $contents = str_replace($header . ': ', '', $fullHeader); - - return !preg_match($pattern, $contents); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/ControllerTestCase.php b/library/vendor/Zend/Test/PHPUnit/ControllerTestCase.php deleted file mode 100644 index 69976f0d9..000000000 --- a/library/vendor/Zend/Test/PHPUnit/ControllerTestCase.php +++ /dev/null @@ -1,1165 +0,0 @@ -$name = $value; - } - - /** - * Overloading for common properties - * - * Provides overloading for request, response, and frontController objects. - * - * @param mixed $name - * @return null|Zend_Controller_Front|Zend_Controller_Request_HttpTestCase|Zend_Controller_Response_HttpTestCase - */ - public function __get($name) - { - switch ($name) { - case 'request': - return $this->getRequest(); - case 'response': - return $this->getResponse(); - case 'frontController': - return $this->getFrontController(); - } - - return null; - } - - /** - * Set up MVC app - * - * Calls {@link bootstrap()} by default - */ - protected function setUp() - { - $this->bootstrap(); - } - - /** - * Bootstrap the front controller - * - * Resets the front controller, and then bootstraps it. - * - * If {@link $bootstrap} is a callback, executes it; if it is a file, it include's - * it. When done, sets the test case request and response objects into the - * front controller. - */ - final public function bootstrap() - { - $this->reset(); - if (null !== $this->bootstrap) { - if ($this->bootstrap instanceof Zend_Application) { - $this->bootstrap->bootstrap(); - $this->_frontController = $this->bootstrap->getBootstrap()->getResource('frontcontroller'); - } 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; - } - } - } - $this->frontController - ->setRequest($this->getRequest()) - ->setResponse($this->getResponse()); - } - - /** - * Dispatch the MVC - * - * If a URL is provided, sets it as the request URI in the request object. - * Then sets test case request and response objects in front controller, - * disables throwing exceptions, and disables returning the response. - * Finally, dispatches the front controller. - * - * @param string|null $url - */ - public function dispatch($url = null) - { - // redirector should not exit - $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); - $redirector->setExit(false); - - // json helper should not exit - $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); - $json->suppressExit = true; - - $request = $this->getRequest(); - if (null !== $url) { - $request->setRequestUri($url); - } - $request->setPathInfo(null); - - $controller = $this->getFrontController(); - $this->frontController - ->setRequest($request) - ->setResponse($this->getResponse()) - ->throwExceptions(false) - ->returnResponse(false); - - if ($this->bootstrap instanceof Zend_Application) { - $this->bootstrap->run(); - } else { - $this->frontController->dispatch(); - } - } - - /** - * Reset MVC state - * - * Creates new request/response objects, resets the front controller - * instance, and resets the action helper broker. - * - * @todo Need to update Zend_Layout to add a resetInstance() method - */ - public function reset() - { - $_SESSION = array(); - $_GET = array(); - $_POST = array(); - $_COOKIE = array(); - $this->resetRequest(); - $this->resetResponse(); - Zend_Layout::resetMvcInstance(); - Zend_Controller_Action_HelperBroker::resetHelpers(); - $this->frontController->resetInstance(); - Zend_Session::$_unitTestEnabled = true; - } - - /** - * Rest all view placeholders - */ - protected function _resetPlaceholders() - { - $registry = Zend_Registry::getInstance(); - $remove = array(); - foreach ($registry as $key => $value) { - if (strstr($key, '_View_')) { - $remove[] = $key; - } - } - - foreach ($remove as $key) { - unset($registry[$key]); - } - } - - /** - * Reset the request object - * - * Useful for test cases that need to test multiple trips to the server. - * - * @return Zend_Test_PHPUnit_ControllerTestCase - */ - public function resetRequest() - { - if ($this->_request instanceof Zend_Controller_Request_HttpTestCase) { - $this->_request->clearQuery() - ->clearPost(); - } - $this->_request = null; - return $this; - } - - /** - * Reset the response object - * - * Useful for test cases that need to test multiple trips to the server. - * - * @return Zend_Test_PHPUnit_ControllerTestCase - */ - public function resetResponse() - { - $this->_response = null; - $this->_resetPlaceholders(); - return $this; - } - - /** - * Assert against DOM selection - * - * @param string $path CSS selector path - * @param string $message - */ - public function assertQuery($path, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection - * - * @param string $path CSS selector path - * @param string $message - */ - public function assertNotQuery($path, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection; node should contain content - * - * @param string $path CSS selector path - * @param string $match content that should be contained in matched nodes - * @param string $message - */ - public function assertQueryContentContains($path, $match, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $match)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection; node should NOT contain content - * - * @param string $path CSS selector path - * @param string $match content that should NOT be contained in matched nodes - * @param string $message - */ - public function assertNotQueryContentContains($path, $match, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $match)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection; node should match content - * - * @param string $path CSS selector path - * @param string $pattern Pattern that should be contained in matched nodes - * @param string $message - */ - public function assertQueryContentRegex($path, $pattern, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $pattern)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection; node should NOT match content - * - * @param string $path CSS selector path - * @param string $pattern pattern that should NOT be contained in matched nodes - * @param string $message - */ - public function assertNotQueryContentRegex($path, $pattern, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $pattern)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection; should contain exact number of nodes - * - * @param string $path CSS selector path - * @param string $count Number of nodes that should match - * @param string $message - */ - public function assertQueryCount($path, $count, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $count)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection; should NOT contain exact number of nodes - * - * @param string $path CSS selector path - * @param string $count Number of nodes that should NOT match - * @param string $message - */ - public function assertNotQueryCount($path, $count, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $count)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection; should contain at least this number of nodes - * - * @param string $path CSS selector path - * @param string $count Minimum number of nodes that should match - * @param string $message - */ - public function assertQueryCountMin($path, $count, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $count)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against DOM selection; should contain no more than this number of nodes - * - * @param string $path CSS selector path - * @param string $count Maximum number of nodes that should match - * @param string $message - */ - public function assertQueryCountMax($path, $count, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $count)) { - $constraint->fail($path, $message); - } - } - - /** - * Register XPath namespaces - * - * @param array $xpathNamespaces - */ - public function registerXpathNamespaces($xpathNamespaces) - { - $this->_xpathNamespaces = $xpathNamespaces; - } - - /** - * Assert against XPath selection - * - * @param string $path XPath path - * @param string $message - */ - public function assertXpath($path, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection - * - * @param string $path XPath path - * @param string $message - */ - public function assertNotXpath($path, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection; node should contain content - * - * @param string $path XPath path - * @param string $match content that should be contained in matched nodes - * @param string $message - */ - public function assertXpathContentContains($path, $match, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $match)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection; node should NOT contain content - * - * @param string $path XPath path - * @param string $match content that should NOT be contained in matched nodes - * @param string $message - */ - public function assertNotXpathContentContains($path, $match, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $match)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection; node should match content - * - * @param string $path XPath path - * @param string $pattern Pattern that should be contained in matched nodes - * @param string $message - */ - public function assertXpathContentRegex($path, $pattern, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $pattern)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection; node should NOT match content - * - * @param string $path XPath path - * @param string $pattern pattern that should NOT be contained in matched nodes - * @param string $message - */ - public function assertNotXpathContentRegex($path, $pattern, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $pattern)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection; should contain exact number of nodes - * - * @param string $path XPath path - * @param string $count Number of nodes that should match - * @param string $message - */ - public function assertXpathCount($path, $count, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $count)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection; should NOT contain exact number of nodes - * - * @param string $path XPath path - * @param string $count Number of nodes that should NOT match - * @param string $message - */ - public function assertNotXpathCount($path, $count, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $count)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection; should contain at least this number of nodes - * - * @param string $path XPath path - * @param string $count Minimum number of nodes that should match - * @param string $message - */ - public function assertXpathCountMin($path, $count, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $count)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert against XPath selection; should contain no more than this number of nodes - * - * @param string $path XPath path - * @param string $count Maximum number of nodes that should match - * @param string $message - */ - public function assertXpathCountMax($path, $count, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/DomQuery.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_DomQuery($path); - $constraint->registerXpathNamespaces($this->_xpathNamespaces); - $content = $this->response->outputBody(); - if (!$constraint->evaluate($content, __FUNCTION__, $count)) { - $constraint->fail($path, $message); - } - } - - /** - * Assert that response is a redirect - * - * @param string $message - */ - public function assertRedirect($message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/Redirect.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_Redirect(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert that response is NOT a redirect - * - * @param string $message - */ - public function assertNotRedirect($message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/Redirect.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_Redirect(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert that response redirects to given URL - * - * @param string $url - * @param string $message - */ - public function assertRedirectTo($url, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/Redirect.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_Redirect(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $url)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert that response does not redirect to given URL - * - * @param string $url - * @param string $message - */ - public function assertNotRedirectTo($url, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/Redirect.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_Redirect(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $url)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert that redirect location matches pattern - * - * @param string $pattern - * @param string $message - */ - public function assertRedirectRegex($pattern, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/Redirect.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_Redirect(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $pattern)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert that redirect location does not match pattern - * - * @param string $pattern - * @param string $message - */ - public function assertNotRedirectRegex($pattern, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/Redirect.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_Redirect(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $pattern)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert response code - * - * @param int $code - * @param string $message - */ - public function assertResponseCode($code, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/ResponseHeader.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_ResponseHeader(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $code)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert response code - * - * @param int $code - * @param string $message - */ - public function assertNotResponseCode($code, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/ResponseHeader.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_ResponseHeader(); - $constraint->setNegate(true); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $code)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert response header exists - * - * @param string $header - * @param string $message - */ - public function assertHeader($header, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/ResponseHeader.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_ResponseHeader(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $header)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert response header does not exist - * - * @param string $header - * @param string $message - */ - public function assertNotHeader($header, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/ResponseHeader.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_ResponseHeader(); - $constraint->setNegate(true); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $header)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert response header exists and contains the given string - * - * @param string $header - * @param string $match - * @param string $message - */ - public function assertHeaderContains($header, $match, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/ResponseHeader.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_ResponseHeader(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $header, $match)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert response header does not exist and/or does not contain the given string - * - * @param string $header - * @param string $match - * @param string $message - */ - public function assertNotHeaderContains($header, $match, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/ResponseHeader.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_ResponseHeader(); - $constraint->setNegate(true); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $header, $match)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert response header exists and matches the given pattern - * - * @param string $header - * @param string $pattern - * @param string $message - */ - public function assertHeaderRegex($header, $pattern, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/ResponseHeader.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_ResponseHeader(); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $header, $pattern)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert response header does not exist and/or does not match the given regex - * - * @param string $header - * @param string $pattern - * @param string $message - */ - public function assertNotHeaderRegex($header, $pattern, $message = '') - { - $this->_incrementAssertionCount(); - require_once 'Zend/Test/PHPUnit/Constraint/ResponseHeader.php'; - $constraint = new Zend_Test_PHPUnit_Constraint_ResponseHeader(); - $constraint->setNegate(true); - $response = $this->response; - if (!$constraint->evaluate($response, __FUNCTION__, $header, $pattern)) { - $constraint->fail($response, $message); - } - } - - /** - * Assert that the last handled request used the given module - * - * @param string $module - * @param string $message - */ - public function assertModule($module, $message = '') - { - $this->_incrementAssertionCount(); - if ($module != $this->request->getModuleName()) { - $msg = sprintf('Failed asserting last module used <"%s"> was "%s"', - $this->request->getModuleName(), - $module - ); - if (!empty($message)) { - $msg = $message . "\n" . $msg; - } - $this->fail($msg); - } - } - - /** - * Assert that the last handled request did NOT use the given module - * - * @param string $module - * @param string $message - */ - public function assertNotModule($module, $message = '') - { - $this->_incrementAssertionCount(); - if ($module == $this->request->getModuleName()) { - $msg = sprintf('Failed asserting last module used was NOT "%s"', $module); - if (!empty($message)) { - $msg = $message . "\n" . $msg; - } - $this->fail($msg); - } - } - - /** - * Assert that the last handled request used the given controller - * - * @param string $controller - * @param string $message - */ - public function assertController($controller, $message = '') - { - $this->_incrementAssertionCount(); - if ($controller != $this->request->getControllerName()) { - $msg = sprintf('Failed asserting last controller used <"%s"> was "%s"', - $this->request->getControllerName(), - $controller - ); - if (!empty($message)) { - $msg = $message . "\n" . $msg; - } - $this->fail($msg); - } - } - - /** - * Assert that the last handled request did NOT use the given controller - * - * @param string $controller - * @param string $message - */ - public function assertNotController($controller, $message = '') - { - $this->_incrementAssertionCount(); - if ($controller == $this->request->getControllerName()) { - $msg = sprintf('Failed asserting last controller used <"%s"> was NOT "%s"', - $this->request->getControllerName(), - $controller - ); - if (!empty($message)) { - $msg = $message . "\n" . $msg; - } - $this->fail($msg); - } - } - - /** - * Assert that the last handled request used the given action - * - * @param string $action - * @param string $message - */ - public function assertAction($action, $message = '') - { - $this->_incrementAssertionCount(); - if ($action != $this->request->getActionName()) { - $msg = sprintf('Failed asserting last action used <"%s"> was "%s"', $this->request->getActionName(), $action); - if (!empty($message)) { - $msg = $message . "\n" . $msg; - } - $this->fail($msg); - } - } - - /** - * Assert that the last handled request did NOT use the given action - * - * @param string $action - * @param string $message - */ - public function assertNotAction($action, $message = '') - { - $this->_incrementAssertionCount(); - if ($action == $this->request->getActionName()) { - $msg = sprintf('Failed asserting last action used <"%s"> was NOT "%s"', $this->request->getActionName(), $action); - if (!empty($message)) { - $msg = $message . "\n" . $msg; - } - $this->fail($msg); - } - } - - /** - * Assert that the specified route was used - * - * @param string $route - * @param string $message - */ - public function assertRoute($route, $message = '') - { - $this->_incrementAssertionCount(); - $router = $this->frontController->getRouter(); - if ($route != $router->getCurrentRouteName()) { - $msg = sprintf('Failed asserting matched route was "%s", actual route is %s', - $route, - $router->getCurrentRouteName() - ); - if (!empty($message)) { - $msg = $message . "\n" . $msg; - } - $this->fail($msg); - } - } - - /** - * Assert that the route matched is NOT as specified - * - * @param string $route - * @param string $message - */ - public function assertNotRoute($route, $message = '') - { - $this->_incrementAssertionCount(); - $router = $this->frontController->getRouter(); - if ($route == $router->getCurrentRouteName()) { - $msg = sprintf('Failed asserting route matched was NOT "%s"', $route); - if (!empty($message)) { - $msg = $message . "\n" . $msg; - } - $this->fail($msg); - } - } - - /** - * Retrieve front controller instance - * - * @return Zend_Controller_Front - */ - public function getFrontController() - { - if (null === $this->_frontController) { - $this->_frontController = Zend_Controller_Front::getInstance(); - } - return $this->_frontController; - } - - /** - * Retrieve test case request object - * - * @return Zend_Controller_Request_HttpTestCase - */ - public function getRequest() - { - if (null === $this->_request) { - require_once 'Zend/Controller/Request/HttpTestCase.php'; - $this->_request = new Zend_Controller_Request_HttpTestCase; - } - return $this->_request; - } - - /** - * Retrieve test case response object - * - * @return Zend_Controller_Response_HttpTestCase - */ - public function getResponse() - { - if (null === $this->_response) { - require_once 'Zend/Controller/Response/HttpTestCase.php'; - $this->_response = new Zend_Controller_Response_HttpTestCase; - } - return $this->_response; - } - - /** - * Retrieve DOM query object - * - * @return Zend_Dom_Query - */ - public function getQuery() - { - if (null === $this->_query) { - require_once 'Zend/Dom/Query.php'; - $this->_query = new Zend_Dom_Query; - } - return $this->_query; - } - - /** - * URL Helper - * - * @param array $urlOptions - * @param string $name - * @param bool $reset - * @param bool $encode - * @throws Exception - * @throws Zend_Controller_Router_Exception - * @return string - */ - public function url($urlOptions = array(), $name = null, $reset = false, $encode = true) - { - $frontController = $this->getFrontController(); - $router = $frontController->getRouter(); - if (!$router instanceof Zend_Controller_Router_Rewrite) { - throw new Exception('This url helper utility function only works when the router is of type Zend_Controller_Router_Rewrite'); - } - if (count($router->getRoutes()) == 0) { - $router->addDefaultRoutes(); - } - return $router->assemble($urlOptions, $name, $reset, $encode); - } - - /** - * Urlize options - * - * @param array $urlOptions - * @param bool $actionControllerModuleOnly - * @return mixed - */ - public function urlizeOptions($urlOptions, $actionControllerModuleOnly = true) - { - $ccToDash = new Zend_Filter_Word_CamelCaseToDash(); - foreach ($urlOptions as $n => $v) { - if (in_array($n, array('action', 'controller', 'module'))) { - $urlOptions[$n] = $ccToDash->filter($v); - } - } - return $urlOptions; - } - - /** - * Increment assertion count - */ - protected function _incrementAssertionCount() - { - $stack = debug_backtrace(); - foreach ($stack as $step) { - if (isset($step['object']) - && $step['object'] instanceof PHPUnit_Framework_TestCase - ) { - if (version_compare(PHPUnit_Runner_Version::id(), '3.3.0', 'lt')) { - break; - } elseif (version_compare(PHPUnit_Runner_Version::id(), '3.3.3', 'lt')) { - $step['object']->incrementAssertionCounter(); - } else { - $step['object']->addToAssertionCount(1); - } - break; - } - } - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/DatabaseTestCase.php b/library/vendor/Zend/Test/PHPUnit/DatabaseTestCase.php deleted file mode 100644 index 128030974..000000000 --- a/library/vendor/Zend/Test/PHPUnit/DatabaseTestCase.php +++ /dev/null @@ -1,146 +0,0 @@ -getConnection()->getConnection(); - } - - /** - * Returns the database operation executed in test setup. - * - * @return PHPUnit_Extensions_Database_Operation_DatabaseOperation - */ - protected function getSetUpOperation() - { - return new PHPUnit_Extensions_Database_Operation_Composite(array( - new Zend_Test_PHPUnit_Db_Operation_Truncate(), - new Zend_Test_PHPUnit_Db_Operation_Insert(), - )); - } - - /** - * Returns the database operation executed in test cleanup. - * - * @return PHPUnit_Extensions_Database_Operation_DatabaseOperation - */ - protected function getTearDownOperation() - { - return PHPUnit_Extensions_Database_Operation_Factory::NONE(); - } - - /** - * Create a dataset based on multiple Zend_Db_Table instances - * - * @param array $tables - * @return Zend_Test_PHPUnit_Db_DataSet_DbTableDataSet - */ - protected function createDbTableDataSet(array $tables=array()) - { - $dataSet = new Zend_Test_PHPUnit_Db_DataSet_DbTableDataSet(); - foreach($tables AS $table) { - $dataSet->addTable($table); - } - return $dataSet; - } - - /** - * Create a table based on one Zend_Db_Table instance - * - * @param Zend_Db_Table_Abstract $table - * @param string $where - * @param string $order - * @param string $count - * @param string $offset - * @return Zend_Test_PHPUnit_Db_DataSet_DbTable - */ - protected function createDbTable(Zend_Db_Table_Abstract $table, $where=null, $order=null, $count=null, $offset=null) - { - return new Zend_Test_PHPUnit_Db_DataSet_DbTable($table, $where, $order, $count, $offset); - } - - /** - * Create a data table based on a Zend_Db_Table_Rowset instance - * - * @param Zend_Db_Table_Rowset_Abstract $rowset - * @param string - * @return Zend_Test_PHPUnit_Db_DataSet_DbRowset - */ - protected function createDbRowset(Zend_Db_Table_Rowset_Abstract $rowset, $tableName = null) - { - return new Zend_Test_PHPUnit_Db_DataSet_DbRowset($rowset, $tableName); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/Connection.php b/library/vendor/Zend/Test/PHPUnit/Db/Connection.php deleted file mode 100644 index 2b0e5c3c1..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/Connection.php +++ /dev/null @@ -1,144 +0,0 @@ -_connection = $db; - $this->_schema = $schema; - } - - /** - * Close this connection. - * - * @return void - */ - public function close() - { - $this->_connection->closeConnection(); - } - - /** - * Creates a table with the result of the specified SQL statement. - * - * @param string $resultName - * @param string $sql - * @return PHPUnit_Extensions_Database_DataSet_ITable - */ - public function createQueryTable($resultName, $sql) - { - return new Zend_Test_PHPUnit_Db_DataSet_QueryTable($resultName, $sql, $this); - } - - /** - * Returns a Zend_Db Connection - * - * @return Zend_Db_Adapter_Abstract - */ - public function getConnection() - { - return $this->_connection; - } - - /** - * Returns a database metadata object that can be used to retrieve table - * meta data from the database. - * - * @return PHPUnit_Extensions_Database_DB_IMetaData - */ - public function getMetaData() - { - if($this->_metaData === null) { - $this->_metaData = new Zend_Test_PHPUnit_Db_Metadata_Generic($this->getConnection(), $this->getSchema()); - } - return $this->_metaData; - } - - /** - * Returns the schema for the connection. - * - * @return string - */ - public function getSchema() - { - return $this->_schema; - } - - /** - * Returns the command used to truncate a table. - * - * @return string - */ - public function getTruncateCommand() - { - return "DELETE"; - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbRowset.php b/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbRowset.php deleted file mode 100644 index d8437528d..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbRowset.php +++ /dev/null @@ -1,73 +0,0 @@ -getTable(); - if($table !== null) { - $tableName = $table->info('name'); - } else { - require_once "Zend/Test/PHPUnit/Db/Exception.php"; - throw new Zend_Test_PHPUnit_Db_Exception( - 'No table name was given to Rowset Table and table name cannot be infered from the table, '. - 'because the rowset is disconnected from database.' - ); - } - } - - $this->data = $rowset->toArray(); - - $columns = array(); - if(isset($this->data[0]) > 0) { - $columns = array_keys($this->data[0]); - } else if($rowset->getTable() != null) { - $columns = $rowset->getTable()->info('cols'); - } - - $this->tableName = $tableName; - $this->tableMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($this->tableName, $columns); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbTable.php b/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbTable.php deleted file mode 100644 index 37eaf430c..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbTable.php +++ /dev/null @@ -1,120 +0,0 @@ -tableName = $table->info('name'); - $this->_columns = $table->info('cols'); - - $this->_table = $table; - $this->_where = $where; - $this->_order = $order; - $this->_count = $count; - $this->_offset = $offset; - } - - /** - * Lazy load data via table fetchAll() method. - * - * @return void - */ - protected function loadData() - { - if ($this->data === null) { - $this->data = $this->_table->fetchAll( - $this->_where, $this->_order, $this->_count, $this->_offset - ); - if($this->data instanceof Zend_Db_Table_Rowset_Abstract) { - $this->data = $this->data->toArray(); - } - } - } - - /** - * Create Table Metadata object - */ - protected function createTableMetaData() - { - if ($this->tableMetaData === NULL) { - $this->loadData(); - $this->tableMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($this->tableName, $this->_columns); - } - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbTableDataSet.php b/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbTableDataSet.php deleted file mode 100644 index ed7530564..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/DbTableDataSet.php +++ /dev/null @@ -1,98 +0,0 @@ -info('name'); - $this->tables[$tableName] = new Zend_Test_PHPUnit_Db_DataSet_DbTable($table, $where, $order, $count, $offset); - } - - /** - * Creates an iterator over the tables in the data set. If $reverse is - * true a reverse iterator will be returned. - * - * @param bool $reverse - * @return PHPUnit_Extensions_Database_DB_TableIterator - */ - protected function createIterator($reverse = FALSE) - { - return new PHPUnit_Extensions_Database_DataSet_DefaultTableIterator($this->tables, $reverse); - } - - /** - * Returns a table object for the given table. - * - * @param string $tableName - * @return PHPUnit_Extensions_Database_DB_Table - */ - public function getTable($tableName) - { - if (!isset($this->tables[$tableName])) { - throw new InvalidArgumentException("$tableName is not a table in the current database."); - } - - return $this->tables[$tableName]; - } - - /** - * Returns a list of table names for the database - * - * @return Array - */ - public function getTableNames() - { - return array_keys($this->tables); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/QueryDataSet.php b/library/vendor/Zend/Test/PHPUnit/Db/DataSet/QueryDataSet.php deleted file mode 100644 index bd3f67daf..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/QueryDataSet.php +++ /dev/null @@ -1,80 +0,0 @@ -databaseConnection = $databaseConnection; - } - - /** - * Add a Table dataset representation by specifiying an arbitrary select query. - * - * By default a select * will be done on the given tablename. - * - * @param string $tableName - * @param string|Zend_Db_Select $query - */ - public function addTable($tableName, $query = NULL) - { - if ($query === NULL) { - $query = $this->databaseConnection->getConnection()->select(); - $query->from($tableName, Zend_Db_Select::SQL_WILDCARD); - } - - if($query instanceof Zend_Db_Select) { - $query = $query->__toString(); - } - - $this->tables[$tableName] = new Zend_Test_PHPUnit_Db_DataSet_QueryTable($tableName, $query, $this->databaseConnection); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/QueryTable.php b/library/vendor/Zend/Test/PHPUnit/Db/DataSet/QueryTable.php deleted file mode 100644 index 6100e8057..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/DataSet/QueryTable.php +++ /dev/null @@ -1,82 +0,0 @@ -data === null) { - $stmt = $this->databaseConnection->getConnection()->query($this->query); - $this->data = $stmt->fetchAll(Zend_Db::FETCH_ASSOC); - } - } - - /** - * Create Table Metadata - */ - protected function createTableMetaData() - { - if ($this->tableMetaData === NULL) - { - $this->loadData(); - $keys = array(); - if(count($this->data) > 0) { - $keys = array_keys($this->data[0]); - } - $this->tableMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData( - $this->tableName, $keys - ); - } - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/Exception.php b/library/vendor/Zend/Test/PHPUnit/Db/Exception.php deleted file mode 100644 index 6cf4c5715..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/Exception.php +++ /dev/null @@ -1,40 +0,0 @@ -_connection = $db; - $this->_schema = $schema; - } - - /** - * List Tables - * - * @return array - */ - public function getTableNames() - { - return $this->_connection->listTables(); - } - - /** - * Get Table information - * - * @param string $tableName - * @return array - */ - protected function getTableDescription($tableName) - { - if(!isset($this->_tableMetadata[$tableName])) { - $this->_tableMetadata[$tableName] = $this->_connection->describeTable($tableName); - } - return $this->_tableMetadata[$tableName]; - } - - /** - * Returns an array containing the names of all the columns in the - * $tableName table, - * - * @param string $tableName - * @return array - */ - public function getTableColumns($tableName) - { - $tableMeta = $this->getTableDescription($tableName); - $columns = array_keys($tableMeta); - return $columns; - } - - /** - * Returns an array containing the names of all the primary key columns in - * the $tableName table. - * - * @param string $tableName - * @return array - */ - public function getTablePrimaryKeys($tableName) - { - $tableMeta = $this->getTableDescription($tableName); - - $primaryColumnNames = array(); - foreach($tableMeta AS $column) { - if($column['PRIMARY'] == true) { - $primaryColumnNames[] = $column['COLUMN_NAME']; - } - } - return $primaryColumnNames; - } - - /** - * Returns the name of the default schema. - * - * @return string - */ - public function getSchema() - { - return $this->_schema; - } - - /** - * Returns a quoted schema object. (table name, column name, etc) - * - * @param string $object - * @return string - */ - public function quoteSchemaObject($object) - { - return $this->_connection->quoteIdentifier($object); - } - - /** - * Returns true if the rdbms allows cascading - * - * @return bool - */ - public function allowsCascading() - { - return false; - } - - /** - * Disables primary keys if rdbms does not allow setting them otherwise - * - * @param string $tableName - */ - public function disablePrimaryKeys($tableName) - { - // Implemented only to match new DBUnit interface - } - - /** - * Reenables primary keys after they have been disabled - * - * @param string $tableName - */ - public function enablePrimaryKeys($tableName) - { - // Implemented only to match new DBUnit interface - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/Operation/DeleteAll.php b/library/vendor/Zend/Test/PHPUnit/Db/Operation/DeleteAll.php deleted file mode 100644 index 7e4fa5e2e..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/Operation/DeleteAll.php +++ /dev/null @@ -1,60 +0,0 @@ -getTableMetaData()->getTableName(); - $connection->getConnection()->delete($tableName); - } catch (Exception $e) { - throw new PHPUnit_Extensions_Database_Operation_Exception('DELETEALL', 'DELETE FROM '.$tableName.'', array(), $table, $e->getMessage()); - } - } - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/Operation/Insert.php b/library/vendor/Zend/Test/PHPUnit/Db/Operation/Insert.php deleted file mode 100644 index 7668d6c50..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/Operation/Insert.php +++ /dev/null @@ -1,84 +0,0 @@ -createDataSet(); - - $dsIterator = $dataSet->getIterator(); - - foreach($dsIterator as $table) { - $tableName = $table->getTableMetaData()->getTableName(); - - $db = $connection->getConnection(); - for($i = 0; $i < $table->getRowCount(); $i++) { - $values = $this->buildInsertValues($table, $i); - try { - $db->insert($tableName, $values); - } catch (Exception $e) { - throw new PHPUnit_Extensions_Database_Operation_Exception("INSERT", "INSERT INTO ".$tableName." [..]", $values, $table, $e->getMessage()); - } - } - } - } - - /** - * - * @param PHPUnit_Extensions_Database_DataSet_ITable $table - * @param int $rowNum - * @return array - */ - protected function buildInsertValues(PHPUnit_Extensions_Database_DataSet_ITable $table, $rowNum) - { - $values = array(); - foreach($table->getTableMetaData()->getColumns() as $columnName) { - $values[$columnName] = $table->getValue($rowNum, $columnName); - } - return $values; - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/Operation/Truncate.php b/library/vendor/Zend/Test/PHPUnit/Db/Operation/Truncate.php deleted file mode 100644 index da7c643b7..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/Operation/Truncate.php +++ /dev/null @@ -1,110 +0,0 @@ -getReverseIterator() AS $table) { - try { - $tableName = $table->getTableMetaData()->getTableName(); - $this->_truncate($connection->getConnection(), $tableName); - } catch (Exception $e) { - throw new PHPUnit_Extensions_Database_Operation_Exception('TRUNCATE', 'TRUNCATE '.$tableName.'', array(), $table, $e->getMessage()); - } - } - } - - /** - * Truncate a given table. - * - * @param Zend_Db_Adapter_Abstract $db - * @param string $tableName - * @return void - */ - protected function _truncate(Zend_Db_Adapter_Abstract $db, $tableName) - { - $tableName = $db->quoteIdentifier($tableName, true); - if($db instanceof Zend_Db_Adapter_Pdo_Sqlite) { - $db->query('DELETE FROM '.$tableName); - } else if($db instanceof Zend_Db_Adapter_Db2) { - /*if(strstr(PHP_OS, "WIN")) { - $file = tempnam(sys_get_temp_dir(), "zendtestdbibm_"); - file_put_contents($file, ""); - $db->query('IMPORT FROM '.$file.' OF DEL REPLACE INTO '.$tableName); - unlink($file); - } else { - $db->query('IMPORT FROM /dev/null OF DEL REPLACE INTO '.$tableName); - }*/ - require_once "Zend/Exception.php"; - throw Zend_Exception("IBM Db2 TRUNCATE not supported."); - } else if($this->_isMssqlOrOracle($db)) { - $db->query('TRUNCATE TABLE '.$tableName); - } else if($db instanceof Zend_Db_Adapter_Pdo_Pgsql) { - $db->query('TRUNCATE '.$tableName.' CASCADE'); - } else { - $db->query('TRUNCATE '.$tableName); - } - } - - /** - * Detect if an adapter is for Mssql or Oracle Databases. - * - * @param Zend_Db_Adapter_Abstract $db - * @return bool - */ - private function _isMssqlOrOracle($db) - { - return ( - $db instanceof Zend_Db_Adapter_Pdo_Mssql || - $db instanceof Zend_Db_Adapter_Sqlsrv || - $db instanceof Zend_Db_Adapter_Pdo_Oci || - $db instanceof Zend_Db_Adapter_Oracle - ); - } -} diff --git a/library/vendor/Zend/Test/PHPUnit/Db/SimpleTester.php b/library/vendor/Zend/Test/PHPUnit/Db/SimpleTester.php deleted file mode 100644 index 901b4e713..000000000 --- a/library/vendor/Zend/Test/PHPUnit/Db/SimpleTester.php +++ /dev/null @@ -1,75 +0,0 @@ -connection = $connection; - $this->setUpOperation = new PHPUnit_Extensions_Database_Operation_Composite(array( - new Zend_Test_PHPUnit_Db_Operation_Truncate(), - new Zend_Test_PHPUnit_Db_Operation_Insert(), - )); - $this->tearDownOperation = PHPUnit_Extensions_Database_Operation_Factory::NONE(); - } - - /** - * Set Up the database using the given Dataset and the SetUp strategy "Truncate, then Insert" - * - * @param PHPUnit_Extensions_Database_DataSet_IDataSet $dataSet - */ - public function setUpDatabase(PHPUnit_Extensions_Database_DataSet_IDataSet $dataSet) - { - $this->setDataSet($dataSet); - $this->onSetUp(); - } -} diff --git a/library/vendor/Zend/Text/Exception.php b/library/vendor/Zend/Text/Exception.php deleted file mode 100644 index 026e36cc4..000000000 --- a/library/vendor/Zend/Text/Exception.php +++ /dev/null @@ -1,38 +0,0 @@ -setOptions($options); - } else if ($options instanceof Zend_Config) { - $this->setConfig($options); - } - - // If no font was defined, load default font - if (!$this->_fontLoaded) { - $this->_loadFont(dirname(__FILE__) . '/Figlet/zend-framework.flf'); - } - } - - /** - * Set options from array - * - * @param array $options Configuration for Zend_Text_Figlet - * @return Zend_Text_Figlet - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - if (in_array(strtolower($key), $this->_skipOptions)) { - continue; - } - - $method = 'set' . ucfirst($key); - if (method_exists($this, $method)) { - $this->$method($value); - } - } - return $this; - } - - /** - * Set options from config object - * - * @param Zend_Config $config Configuration for Zend_Text_Figlet - * @return Zend_Text_Figlet - */ - public function setConfig(Zend_Config $config) - { - return $this->setOptions($config->toArray()); - } - - /** - * Set a font to use - * - * @param string $font Path to the font - * @return Zend_Text_Figlet - */ - public function setFont($font) - { - $this->_loadFont($font); - return $this; - } - - /** - * Set handling of paragraphs - * - * @param boolean $handleParagraphs Wether to handle paragraphs or not - * @return Zend_Text_Figlet - */ - public function setHandleParagraphs($handleParagraphs) - { - $this->_handleParagraphs = (bool) $handleParagraphs; - return $this; - } - - /** - * Set the justification. 0 stands for left aligned, 1 for centered and 2 - * for right aligned. - * - * @param integer $justification Justification of the output text - * @return Zend_Text_Figlet - */ - public function setJustification($justification) - { - $this->_justification = min(3, max(0, (int) $justification)); - return $this; - } - - /** - * Set the output width - * - * @param integer $outputWidth Output with which should be used for word - * wrapping and justification - * @return Zend_Text_Figlet - */ - public function setOutputWidth($outputWidth) - { - $this->_outputWidth = max(1, (int) $outputWidth); - return $this; - } - - /** - * Set right to left mode. For writing from left to right, use - * Zend_Text_Figlet::DIRECTION_LEFT_TO_RIGHT. For writing from right to left, - * use Zend_Text_Figlet::DIRECTION_RIGHT_TO_LEFT. - * - * @param integer $rightToLeft Right-to-left mode - * @return Zend_Text_Figlet - */ - public function setRightToLeft($rightToLeft) - { - $this->_rightToLeft = min(1, max(0, (int) $rightToLeft)); - return $this; - } - - /** - * Set the smush mode. - * - * Use one of the constants of Zend_Text_Figlet::SM_*, you may combine them. - * - * @param integer $smushMode Smush mode to use for generating text - * @return Zend_Text_Figlet - */ - public function setSmushMode($smushMode) - { - $smushMode = (int) $smushMode; - - if ($smushMode < -1) { - $this->_smushOverride = self::SMO_NO; - } else { - if ($smushMode === 0) { - $this->_userSmush = self::SM_KERN; - } else if ($smushMode === -1) { - $this->_userSmush = 0; - } else { - $this->_userSmush = (($smushMode & 63) | self::SM_SMUSH); - } - - $this->_smushOverride = self::SMO_YES; - } - - $this->_setUsedSmush(); - - return $this; - } - - /** - * Render a FIGlet text - * - * @param string $text Text to convert to a figlet text - * @param string $encoding Encoding of the input string - * @throws InvalidArgumentException When $text is not a string - * @throws Zend_Text_Figlet_Exception When $text it not properly encoded - * @return string - */ - public function render($text, $encoding = 'UTF-8') - { - if (!is_string($text)) { - throw new InvalidArgumentException('$text must be a string'); - } - - if ($encoding !== 'UTF-8') { - $text = iconv($encoding, 'UTF-8', $text); - } - - $this->_output = ''; - $this->_outputLine = array(); - - $this->_clearLine(); - - $this->_outlineLengthLimit = ($this->_outputWidth - 1); - $this->_inCharLineLengthLimit = ($this->_outputWidth * 4 + 100); - - $wordBreakMode = 0; - $lastCharWasEol = false; - $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); - } - - for ($charNum = 0; $charNum < $textLength; $charNum++) { - // Handle paragraphs - $char = iconv_substr($text, $charNum, 1, 'UTF-8'); - - if ($char === "\n" && $this->_handleParagraphs && !$lastCharWasEol) { - $nextChar = iconv_substr($text, ($charNum + 1), 1, 'UTF-8'); - if (!$nextChar) { - $nextChar = null; - } - - $char = (ctype_space($nextChar)) ? "\n" : ' '; - } - - $lastCharWasEol = (ctype_space($char) && $char !== "\t" && $char !== ' '); - - if (ctype_space($char)) { - $char = ($char === "\t" || $char === ' ') ? ' ': "\n"; - } - - // Skip unprintable characters - $ordChar = $this->_uniOrd($char); - if (($ordChar > 0 && $ordChar < 32 && $char !== "\n") || $ordChar === 127) { - continue; - } - - // Build the character - // Note: The following code is complex and thoroughly tested. - // Be careful when modifying! - do { - $charNotAdded = false; - - if ($wordBreakMode === -1) { - if ($char === ' ') { - break; - } else if ($char === "\n") { - $wordBreakMode = 0; - break; - } - - $wordBreakMode = 0; - } - - if ($char === "\n") { - $this->_appendLine(); - $wordBreakMode = false; - } else if ($this->_addChar($char)) { - if ($char !== ' ') { - $wordBreakMode = ($wordBreakMode >= 2) ? 3: 1; - } else { - $wordBreakMode = ($wordBreakMode > 0) ? 2: 0; - } - } else if ($this->_outlineLength === 0) { - for ($i = 0; $i < $this->_charHeight; $i++) { - if ($this->_rightToLeft === 1 && $this->_outputWidth > 1) { - $offset = (strlen($this->_currentChar[$i]) - $this->_outlineLengthLimit); - $this->_putString(substr($this->_currentChar[$i], $offset)); - } else { - $this->_putString($this->_currentChar[$i]); - } - } - - $wordBreakMode = -1; - } else if ($char === ' ') { - if ($wordBreakMode === 2) { - $this->_splitLine(); - } else { - $this->_appendLine(); - } - - $wordBreakMode = -1; - } else { - if ($wordBreakMode >= 2) { - $this->_splitLine(); - } else { - $this->_appendLine(); - } - - $wordBreakMode = ($wordBreakMode === 3) ? 1 : 0; - $charNotAdded = true; - } - } while ($charNotAdded); - } - - if ($this->_outlineLength !== 0) { - $this->_appendLine(); - } - - return $this->_output; - } - - /** - * Puts the given string, substituting blanks for hardblanks. If outputWidth - * is 1, puts the entire string; otherwise puts at most outputWidth - 1 - * characters. Puts a newline at the end of the string. The string is left- - * justified, centered or right-justified (taking outputWidth as the screen - * width) if justification is 0, 1 or 2 respectively. - * - * @param string $string The string to add to the output - * @return void - */ - protected function _putString($string) - { - $length = strlen($string); - - if ($this->_outputWidth > 1) { - if ($length > ($this->_outputWidth - 1)) { - $length = ($this->_outputWidth - 1); - } - - if ($this->_justification > 0) { - for ($i = 1; - ((3 - $this->_justification) * $i + $length + $this->_justification - 2) < $this->_outputWidth; - $i++) { - $this->_output .= ' '; - } - } - } - - $this->_output .= str_replace($this->_hardBlank, ' ', $string) . "\n"; - } - - /** - * Appends the current line to the output - * - * @return void - */ - protected function _appendLine() - { - for ($i = 0; $i < $this->_charHeight; $i++) { - $this->_putString($this->_outputLine[$i]); - } - - $this->_clearLine(); - } - - /** - * Splits inCharLine at the last word break (bunch of consecutive blanks). - * Makes a new line out of the first part and appends it using appendLine(). - * Makes a new line out of the second part and returns. - * - * @return void - */ - protected function _splitLine() - { - $gotSpace = false; - for ($i = ($this->_inCharLineLength - 1); $i >= 0; $i--) { - if (!$gotSpace && $this->_inCharLine[$i] === ' ') { - $gotSpace = true; - $lastSpace = $i; - } - - if ($gotSpace && $this->_inCharLine[$i] !== ' ') { - break; - } - } - - $firstLength = ($i + 1); - $lastLength = ($this->_inCharLineLength - $lastSpace - 1); - - $firstPart = ''; - for ($i = 0; $i < $firstLength; $i++) { - $firstPart[$i] = $this->_inCharLine[$i]; - } - - $lastPart = ''; - for ($i = 0; $i < $lastLength; $i++) { - $lastPart[$i] = $this->_inCharLine[($lastSpace + 1 + $i)]; - } - - $this->_clearLine(); - - for ($i = 0; $i < $firstLength; $i++) { - $this->_addChar($firstPart[$i]); - } - - $this->_appendLine(); - - for ($i = 0; $i < $lastLength; $i++) { - $this->_addChar($lastPart[$i]); - } - } - - /** - * Clears the current line - * - * @return void - */ - protected function _clearLine() - { - for ($i = 0; $i < $this->_charHeight; $i++) { - $this->_outputLine[$i] = ''; - } - - $this->_outlineLength = 0; - $this->_inCharLineLength = 0; - } - - /** - * Attempts to add the given character onto the end of the current line. - * Returns true if this can be done, false otherwise. - * - * @param string $char Character which to add to the output - * @return boolean - */ - protected function _addChar($char) - { - $this->_getLetter($char); - - if ($this->_currentChar === null) { - return true; - } - - $smushAmount = $this->_smushAmount(); - - if (($this->_outlineLength + $this->_currentCharWidth - $smushAmount) > $this->_outlineLengthLimit - || ($this->_inCharLineLength + 1) > $this->_inCharLineLengthLimit) { - return false; - } - - $tempLine = ''; - for ($row = 0; $row < $this->_charHeight; $row++) { - if ($this->_rightToLeft === 1) { - $tempLine = $this->_currentChar[$row]; - - for ($k = 0; $k < $smushAmount; $k++) { - $position = ($this->_currentCharWidth - $smushAmount + $k); - $tempLine[$position] = $this->_smushem($tempLine[$position], $this->_outputLine[$row][$k]); - } - - $this->_outputLine[$row] = $tempLine . substr($this->_outputLine[$row], $smushAmount); - } else { - for ($k = 0; $k < $smushAmount; $k++) { - if (($this->_outlineLength - $smushAmount + $k) < 0) { - continue; - } - - $position = ($this->_outlineLength - $smushAmount + $k); - if (isset($this->_outputLine[$row][$position])) { - $leftChar = $this->_outputLine[$row][$position]; - } else { - $leftChar = null; - } - - $this->_outputLine[$row][$position] = $this->_smushem($leftChar, $this->_currentChar[$row][$k]); - } - - $this->_outputLine[$row] .= substr($this->_currentChar[$row], $smushAmount); - } - } - - $this->_outlineLength = strlen($this->_outputLine[0]); - $this->_inCharLine[$this->_inCharLineLength++] = $char; - - return true; - } - - /** - * Gets the requested character and sets current and previous char width. - * - * @param string $char The character from which to get the letter of - * @return void - */ - protected function _getLetter($char) - { - if (array_key_exists($this->_uniOrd($char), $this->_charList)) { - $this->_currentChar = $this->_charList[$this->_uniOrd($char)]; - $this->_previousCharWidth = $this->_currentCharWidth; - $this->_currentCharWidth = strlen($this->_currentChar[0]); - } else { - $this->_currentChar = null; - } - } - - /** - * Returns the maximum amount that the current character can be smushed into - * the current line. - * - * @return integer - */ - protected function _smushAmount() - { - if (($this->_smushMode & (self::SM_SMUSH | self::SM_KERN)) === 0) { - return 0; - } - - $maxSmush = $this->_currentCharWidth; - $amount = $maxSmush; - - for ($row = 0; $row < $this->_charHeight; $row++) { - if ($this->_rightToLeft === 1) { - $charbd = strlen($this->_currentChar[$row]); - while (true) { - if (!isset($this->_currentChar[$row][$charbd])) { - $leftChar = null; - } else { - $leftChar = $this->_currentChar[$row][$charbd]; - } - - if ($charbd > 0 && ($leftChar === null || $leftChar == ' ')) { - $charbd--; - } else { - break; - } - } - - $linebd = 0; - while (true) { - if (!isset($this->_outputLine[$row][$linebd])) { - $rightChar = null; - } else { - $rightChar = $this->_outputLine[$row][$linebd]; - } - - if ($rightChar === ' ') { - $linebd++; - } else { - break; - } - } - - $amount = ($linebd + $this->_currentCharWidth - 1 - $charbd); - } else { - $linebd = strlen($this->_outputLine[$row]); - while (true) { - if (!isset($this->_outputLine[$row][$linebd])) { - $leftChar = null; - } else { - $leftChar = $this->_outputLine[$row][$linebd]; - } - - if ($linebd > 0 && ($leftChar === null || $leftChar == ' ')) { - $linebd--; - } else { - break; - } - } - - $charbd = 0; - while (true) { - if (!isset($this->_currentChar[$row][$charbd])) { - $rightChar = null; - } else { - $rightChar = $this->_currentChar[$row][$charbd]; - } - - if ($rightChar === ' ') { - $charbd++; - } else { - break; - } - } - - $amount = ($charbd + $this->_outlineLength - 1 - $linebd); - } - - if (empty($leftChar) || $leftChar === ' ') { - $amount++; - } else if (!empty($rightChar)) { - if ($this->_smushem($leftChar, $rightChar) !== null) { - $amount++; - } - } - - $maxSmush = min($amount, $maxSmush); - } - - return $maxSmush; - } - - /** - * Given two characters, attempts to smush them into one, according to the - * current smushmode. Returns smushed character or false if no smushing can - * be done. - * - * Smushmode values are sum of following (all values smush blanks): - * - * 1: Smush equal chars (not hardblanks) - * 2: Smush '_' with any char in hierarchy below - * 4: hierarchy: "|", "/\", "[]", "{}", "()", "<>" - * Each class in hier. can be replaced by later class. - * 8: [ + ] -> |, { + } -> |, ( + ) -> | - * 16: / + \ -> X, > + < -> X (only in that order) - * 32: hardblank + hardblank -> hardblank - * - * @param string $leftChar Left character to smush - * @param string $rightChar Right character to smush - * @return string - */ - protected function _smushem($leftChar, $rightChar) - { - if ($leftChar === ' ') { - return $rightChar; - } - - if ($rightChar === ' ') { - return $leftChar; - } - - if ($this->_previousCharWidth < 2 || $this->_currentCharWidth < 2) { - // Disallows overlapping if the previous character or the current - // character has a width of one or zero. - return null; - } - - if (($this->_smushMode & self::SM_SMUSH) === 0) { - // Kerning - return null; - } - - if (($this->_smushMode & 63) === 0) { - // This is smushing by universal overlapping - if ($leftChar === ' ') { - return $rightChar; - } else if ($rightChar === ' ') { - return $leftChar; - } else if ($leftChar === $this->_hardBlank) { - return $rightChar; - } else if ($rightChar === $this->_hardBlank) { - return $rightChar; - } else if ($this->_rightToLeft === 1) { - return $leftChar; - } else { - // Occurs in the absence of above exceptions - return $rightChar; - } - } - - if (($this->_smushMode & self::SM_HARDBLANK) > 0) { - if ($leftChar === $this->_hardBlank && $rightChar === $this->_hardBlank) { - return $leftChar; - } - } - - if ($leftChar === $this->_hardBlank && $rightChar === $this->_hardBlank) { - return null; - } - - if (($this->_smushMode & self::SM_EQUAL) > 0) { - if ($leftChar === $rightChar) { - return $leftChar; - } - } - - if (($this->_smushMode & self::SM_LOWLINE) > 0) { - if ($leftChar === '_' && strchr('|/\\[]{}()<>', $rightChar) !== false) { - return $rightChar; - } else if ($rightChar === '_' && strchr('|/\\[]{}()<>', $leftChar) !== false) { - return $leftChar; - } - } - - if (($this->_smushMode & self::SM_HIERARCHY) > 0) { - if ($leftChar === '|' && strchr('/\\[]{}()<>', $rightChar) !== false) { - return $rightChar; - } else if ($rightChar === '|' && strchr('/\\[]{}()<>', $leftChar) !== false) { - return $leftChar; - } else if (strchr('/\\', $leftChar) && strchr('[]{}()<>', $rightChar) !== false) { - return $rightChar; - } else if (strchr('/\\', $rightChar) && strchr('[]{}()<>', $leftChar) !== false) { - return $leftChar; - } else if (strchr('[]', $leftChar) && strchr('{}()<>', $rightChar) !== false) { - return $rightChar; - } else if (strchr('[]', $rightChar) && strchr('{}()<>', $leftChar) !== false) { - return $leftChar; - } else if (strchr('{}', $leftChar) && strchr('()<>', $rightChar) !== false) { - return $rightChar; - } else if (strchr('{}', $rightChar) && strchr('()<>', $leftChar) !== false) { - return $leftChar; - } else if (strchr('()', $leftChar) && strchr('<>', $rightChar) !== false) { - return $rightChar; - } else if (strchr('()', $rightChar) && strchr('<>', $leftChar) !== false) { - return $leftChar; - } - } - - if (($this->_smushMode & self::SM_PAIR) > 0) { - if ($leftChar === '[' && $rightChar === ']') { - return '|'; - } else if ($rightChar === '[' && $leftChar === ']') { - return '|'; - } else if ($leftChar === '{' && $rightChar === '}') { - return '|'; - } else if ($rightChar === '{' && $leftChar === '}') { - return '|'; - } else if ($leftChar === '(' && $rightChar === ')') { - return '|'; - } else if ($rightChar === '(' && $leftChar === ')') { - return '|'; - } - } - - if (($this->_smushMode & self::SM_BIGX) > 0) { - if ($leftChar === '/' && $rightChar === '\\') { - return '|'; - } else if ($rightChar === '/' && $leftChar === '\\') { - return 'Y'; - } else if ($leftChar === '>' && $rightChar === '<') { - return 'X'; - } - } - - return null; - } - - /** - * Load the specified font - * - * @param string $fontFile Font file to load - * @throws Zend_Text_Figlet_Exception When font file was not found - * @throws Zend_Text_Figlet_Exception When GZIP library is required but not found - * @throws Zend_Text_Figlet_Exception When font file is not readable - * @return void - */ - 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'); - } - - $fontFile = 'compress.zlib://' . $fontFile; - $compressed = true; - } else { - $compressed = false; - } - - // 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'); - } - - // If the file is not compressed, lock the stream - if (!$compressed) { - flock($fp, LOCK_SH); - } - - // Get magic - $magic = $this->_readMagic($fp); - - // Get the header - $numsRead = sscanf(fgets($fp, 1000), - '%*c%c %d %*d %d %d %d %d %d', - $this->_hardBlank, - $this->_charHeight, - $this->_maxLength, - $smush, - $cmtLines, - $rightToLeft, - $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'); - } - - // Set default right to left - if ($numsRead < 6) { - $rightToLeft = 0; - } - - // If no smush2, decode smush into smush2 - if ($numsRead < 7) { - if ($smush === 2) { - $this->_fontSmush = self::SM_KERN; - } else if ($smush < 0) { - $this->_fontSmush = 0; - } else { - $this->_fontSmush = (($smush & 31) | self::SM_SMUSH); - } - } - - // Correct char height && maxlength - $this->_charHeight = max(1, $this->_charHeight); - $this->_maxLength = max(1, $this->_maxLength); - - // Give ourselves some extra room - $this->_maxLength += 100; - - // See if we have to override smush settings - $this->_setUsedSmush(); - - // Get left to right value - if ($this->_rightToLeft === null) { - $this->_rightToLeft = $rightToLeft; - } - - // Get justification value - if ($this->_justification === null) { - $this->_justification = (2 * $this->_rightToLeft); - } - - // Skip all comment lines - for ($line = 1; $line <= $cmtLines; $line++) { - $this->_skipToEol($fp); - } - - // Fetch all ASCII characters - for ($asciiCode = 32; $asciiCode < 127; $asciiCode++) { - $this->_charList[$asciiCode] = $this->_loadChar($fp); - } - - // Fetch all german characters - foreach ($this->_germanChars as $uniCode) { - $char = $this->_loadChar($fp); - - if ($char === false) { - fclose($fp); - return; - } - - if (trim(implode('', $char)) !== '') { - $this->_charList[$uniCode] = $char; - } - } - - // At the end fetch all extended characters - while (!feof($fp)) { - // Get the Unicode - list($uniCode) = explode(' ', fgets($fp, 2048)); - - if (empty($uniCode)) { - continue; - } - - // Convert it if required - if (substr($uniCode, 0, 2) === '0x') { - $uniCode = hexdec(substr($uniCode, 2)); - } else if (substr($uniCode, 0, 1) === '0' and - $uniCode !== '0' or - substr($uniCode, 0, 2) === '-0') { - $uniCode = octdec($uniCode); - } else { - $uniCode = (int) $uniCode; - } - - // Now fetch the character - $char = $this->_loadChar($fp); - - if ($char === false) { - fclose($fp); - return; - } - - $this->_charList[$uniCode] = $char; - } - - fclose($fp); - - $this->_fontLoaded = true; - } - - /** - * Set the used smush mode, according to smush override, user smsush and - * font smush. - * - * @return void - */ - protected function _setUsedSmush() - { - if ($this->_smushOverride === self::SMO_NO) { - $this->_smushMode = $this->_fontSmush; - } else if ($this->_smushOverride === self::SMO_YES) { - $this->_smushMode = $this->_userSmush; - } else if ($this->_smushOverride === self::SMO_FORCE) { - $this->_smushMode = ($this->_fontSmush | $this->_userSmush); - } - } - - /** - * Reads a four-character magic string from a stream - * - * @param resource $fp File pointer to the font file - * @return string - */ - protected function _readMagic($fp) - { - $magic = ''; - - for ($i = 0; $i < 4; $i++) { - $magic .= fgetc($fp); - } - - return $magic; - } - - /** - * Skip a stream to the end of line - * - * @param resource $fp File pointer to the font file - * @return void - */ - protected function _skipToEol($fp) - { - $dummy = fgetc($fp); - while ($dummy !== false && !feof($fp)) { - if ($dummy === "\n") { - return; - } - - if ($dummy === "\r") { - $dummy = fgetc($fp); - - if (!feof($fp) && $dummy !== "\n") { - fseek($fp, -1, SEEK_SET); - } - - return; - } - - $dummy = fgetc($fp); - } - } - - /** - * Load a single character from the font file - * - * @param resource $fp File pointer to the font file - * @return array - */ - protected function _loadChar($fp) - { - $char = array(); - - for ($i = 0; $i < $this->_charHeight; $i++) { - if (feof($fp)) { - return false; - } - - $line = rtrim(fgets($fp, 2048), "\r\n"); - - if (preg_match('#(.)\\1?$#', $line, $result) === 1) { - $line = str_replace($result[1], '', $line); - } - - $char[] = $line; - } - - return $char; - } - - /** - * Unicode compatible ord() method - * - * @param string $c The char to get the value from - * @return integer - */ - protected function _uniOrd($c) - { - $h = ord($c[0]); - - if ($h <= 0x7F) { - $ord = $h; - } else if ($h < 0xC2) { - $ord = 0; - } else if ($h <= 0xDF) { - $ord = (($h & 0x1F) << 6 | (ord($c[1]) & 0x3F)); - } else if ($h <= 0xEF) { - $ord = (($h & 0x0F) << 12 | (ord($c[1]) & 0x3F) << 6 | (ord($c[2]) & 0x3F)); - } else if ($h <= 0xF4) { - $ord = (($h & 0x0F) << 18 | (ord($c[1]) & 0x3F) << 12 | - (ord($c[2]) & 0x3F) << 6 | (ord($c[3]) & 0x3F)); - } else { - $ord = 0; - } - - return $ord; - } -} diff --git a/library/vendor/Zend/Text/Figlet/Exception.php b/library/vendor/Zend/Text/Figlet/Exception.php deleted file mode 100644 index b501a84d3..000000000 --- a/library/vendor/Zend/Text/Figlet/Exception.php +++ /dev/null @@ -1,38 +0,0 @@ -# - # - # - # - # - # - ## -?# - # - # - # - # - # - ## -@# - # - # - # - # - # - ## - ___ # - / _ \\ # - / //\ \\ # -| ___ ||# -|_|| |_||# -`-` `-` # - ## - ______ # -| \\ # -| --$ // # -| -- \\ # -|______// # -`------` # - ## - _____ # - / ____|| # -/ //---`' # -\ \\___ # - \_____|| # - `----` # - ## - _____ # -| __ \\ # -| |$ \ || # -| |__/ || # -|_____// # - -----` # - ## - _____ # - | ___|| # - | ||__ # - | ||__ # - |_____|| # - `-----` # - ## - ______ # - /_____// # - `____ ` # - /___// # - `__ ` # - /_// # - `-` ## - _____ # - / ___|| # -| //$__ # -| \\_\ || # - \____// # - `---` # - ## - __ _ # -| || | || # -| '--' || # -| .--. || # -|_|| |_|| # -`-` `-` # - ## - ______ # - /_ _// # - -| ||- # - _| ||_ # - /_____// # - `-----` # - ## - ______ # - /_ _// # - | || # - _| || # - /__// # - `--` # - ## - _ __ # - | |/ // # - | ' // # - | . \\ # - |_|\_\\ # - `-` --` # - ## - __ # - | || # - | || # - | ||__ # - |____// # - `----` # - ## - _ _ # -| \ / || # -| \/ || # -| . . || # -|_|\/|_|| # -`-` `-` # - ## - _ _ # - | \| || # - | ' || # - | . || # - |_|\_|| # - `-` -` # - ## - ___ # - / _ \\ # - | /$\ || # - | \_/ || # - \___// # - `---` # - ## - ____ # - | _ \\ # - | |_| || # - | .__// # - |_|--` # - `-` # - ## - ___ # - / _ \\ # -| /$\ || # -| \_/ || # - \___ \\ # - `---` # - ## - ____ # - | _ \\ # - | |_| || # - | . // # - |_|\_\\ # - `-` --` # - ## - _____ # - / ___// # - \___ \\ # - / $ // # - /____// # -`-----` # - ## - ______ # - /_ _// # - `-| |,- # - | || # - |_|| # - `-`' # - ## - _ _ # -| || | || # -| || | || # -| \\_/ || # - \____// # - `---` # - ## -__ __ # -\ \\ / // # - \ \/ // # - \ // # - \// # - ` # - ## - _ _ # -| | | || # -| |/\| || # -| /\ || # -|_// \_|| # -`-` `-` # - ## - __ __ # - \ \\/ // # - \ $ // # - / . \\ # - /_//\_\\ # - `-` --` # - ## - __ __ # - \ \\/ // # - \ ` // # - | || # - |_|| # - `-`' # - ## - ______ # -|____ // # - / // # - / // # - / //__ # -/______|| # -`------` ## -[# - # - # - # - # - # - ## -\# - # - # - # - # - # - ## -]# - # - # - # - # - # - ## -^# - # - # - # - # - # - ## -_# - # - # - # - # - # - ## -`# - # - # - # - # - # - ## - ___ # - / _ \\ # - / //\ \\ # -| ___ ||# -|_|| |_||# -`-` `-` # - ## - ______ # -| \\ # -| --$ // # -| -- \\ # -|______// # -`------` # - ## - _____ # - / ____|| # -/ //---`' # -\ \\___ # - \_____|| # - `----` # - ## - _____ # -| __ \\ # -| |$ \ || # -| |__/ || # -|_____// # - -----` # - ## - _____ # - | ___|| # - | ||__ # - | ||__ # - |_____|| # - `-----` # - ## - ______ # - /_____// # - `____ ` # - /___// # - `__ ` # - /_// # - `-` ## - _____ # - / ___|| # -| //$__ # -| \\_\ || # - \____// # - `---` # - ## - __ _ # -| || | || # -| '--' || # -| .--. || # -|_|| |_|| # -`-` `-` # - ## - ______ # - /_ _// # - -| ||- # - _| ||_ # - /_____// # - `-----` # - ## - ______ # - /_ _// # - | || # - _| || # - /__// # - `--` # - ## - _ __ # - | |/ // # - | ' // # - | . \\ # - |_|\_\\ # - `-` --` # - ## - __ # - | || # - | || # - | ||__ # - |____// # - `----` # - ## - _ _ # -| \ / || # -| \/ || # -| . . || # -|_|\/|_|| # -`-` `-` # - ## - _ _ # - | \| || # - | ' || # - | . || # - |_|\_|| # - `-` -` # - ## - ___ # - / _ \\ # - | /$\ || # - | \_/ || # - \___// # - `---` # - ## - # - ____ # - | \\ # - | [] || # - | __// # - |_|`-` # - `-` ## - # - ___ # - / || # - | [] || # - \__ || # - -|_|| # - `-` ## - ____ # - | _ \\ # - | |_| || # - | . // # - |_|\_\\ # - `-` --` # - ## - _____ # - / ___// # - \___ \\ # - / $ // # - /____// # -`-----` # - ## - ______ # - /_ _// # - `-| |,- # - | || # - |_|| # - `-`' # - ## - _ _ # -| || | || # -| || | || # -| \\_/ || # - \____// # - `---` # - ## -__ __ # -\ \\ / // # - \ \/ // # - \ // # - \// # - ` # - ## - _ _ # -| | | || # -| |/\| || # -| /\ || # -|_// \_|| # -`-` `-` # - ## - __ __ # - \ \\/ // # - \ $ // # - / . \\ # - /_//\_\\ # - `-` --` # - ## - __ __ # - \ \\/ // # - \ ` // # - | || # - |_|| # - `-`' # - ## - _____ # - |__ // # - / // # - / //__ # - /_____|| # - `-----` # - ## -{# - # - # - # - # - # - ## -|# - # - # - # - # - # - ## -}# - # - # - # - # - # - ## -~# - # - # - # - # - # - ## - []|_[]| # - / _ \\ # - / //\ \\ # -| $___$ ||# -|_||$ |_||# -`-` `-` # - ## - []|_[]| # - / _ \\ # - | /$\ || # - | \_/ || # - \___// # - ---` # - ## - []| []| # -| ||$| || # -| ||$| || # -| \\_/ || # - \____// # - `---` # - ## - []|_[]| # - / _ \\ # - / //\ \\ # -| $___$ ||# -|_||$ |_||# -`-` `-` # - ## - []|_[]| # - / _ \\ # - | /$\ || # - | \_/ || # - \___// # - ---` # - ## - []| []| # -| ||$| || # -| ||$| || # -| \\_/ || # - \____// # - `---` # - ## - ,--. # - | _$ \\ # - | // # - | |\ \\ # - |$ ___\\ # - |_|----` # - - ## -162 CENT SIGN - _ # - | || # - / __// # -| (__` # - \ \\ # - |_|` # - `-` ## -215 MULTIPLICATION SIGN - # - # - \\// # - \\ # - //\\ # - # - ## diff --git a/library/vendor/Zend/Text/MultiByte.php b/library/vendor/Zend/Text/MultiByte.php deleted file mode 100644 index ad6a91656..000000000 --- a/library/vendor/Zend/Text/MultiByte.php +++ /dev/null @@ -1,143 +0,0 @@ -= $width) { - $result .= iconv_substr($string, $lastStart, $current - $lastStart, $charset) . $break; - $lastStart = $current + 1; - } - - $lastSpace = $current; - } elseif ($current - $lastStart >= $width && $cut && $lastStart >= $lastSpace) { - $result .= iconv_substr($string, $lastStart, $current - $lastStart, $charset) . $break; - $lastStart = $lastSpace = $current; - } elseif ($current - $lastStart >= $width && $lastStart < $lastSpace) { - $result .= iconv_substr($string, $lastStart, $lastSpace - $lastStart, $charset) . $break; - $lastStart = $lastSpace = $lastSpace + 1; - } - } - - if ($lastStart !== $current) { - $result .= iconv_substr($string, $lastStart, $current - $lastStart, $charset); - } - - return $result; - } - - /** - * String padding - * - * @param string $input - * @param integer $padLength - * @param string $padString - * @param integer $padType - * @param string $charset - * @return string - */ - public static function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT, $charset = 'utf-8') - { - $return = ''; - $lengthOfPadding = $padLength - iconv_strlen($input, $charset); - $padStringLength = iconv_strlen($padString, $charset); - - if ($padStringLength === 0 || $lengthOfPadding <= 0) { - $return = $input; - } else { - $repeatCount = floor($lengthOfPadding / $padStringLength); - - if ($padType === STR_PAD_BOTH) { - $lastStringLeft = ''; - $lastStringRight = ''; - $repeatCountLeft = $repeatCountRight = ($repeatCount - $repeatCount % 2) / 2; - - $lastStringLength = $lengthOfPadding - 2 * $repeatCountLeft * $padStringLength; - $lastStringLeftLength = $lastStringRightLength = floor($lastStringLength / 2); - $lastStringRightLength += $lastStringLength % 2; - - $lastStringLeft = iconv_substr($padString, 0, $lastStringLeftLength, $charset); - $lastStringRight = iconv_substr($padString, 0, $lastStringRightLength, $charset); - - $return = str_repeat($padString, $repeatCountLeft) . $lastStringLeft - . $input - . str_repeat($padString, $repeatCountRight) . $lastStringRight; - } else { - $lastString = iconv_substr($padString, 0, $lengthOfPadding % $padStringLength, $charset); - - if ($padType === STR_PAD_LEFT) { - $return = str_repeat($padString, $repeatCount) . $lastString . $input; - } else { - $return = $input . str_repeat($padString, $repeatCount) . $lastString; - } - } - } - - return $return; - } -} diff --git a/library/vendor/Zend/Text/Table.php b/library/vendor/Zend/Text/Table.php deleted file mode 100644 index 9f0980232..000000000 --- a/library/vendor/Zend/Text/Table.php +++ /dev/null @@ -1,533 +0,0 @@ -setOptions($options); - } else if ($options instanceof Zend_Config) { - $this->setConfig($options); - } - - // Check if column widths were set - // @todo When column widths were not set, assume auto-sizing - if ($this->_columnWidths === null) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('You must define the column widths'); - } - - // If no decorator was given, use default unicode decorator - if ($this->_decorator === null) { - if (self::getOutputCharset() === 'utf-8') { - $this->setDecorator('unicode'); - } else { - $this->setDecorator('ascii'); - } - } - } - - /** - * Set options from array - * - * @param array $options Configuration for Zend_Text_Table - * @return Zend_Text_Table - */ - public function setOptions(array $options) - { - foreach ($options as $key => $value) { - if (in_array(strtolower($key), $this->_skipOptions)) { - continue; - } - - $method = 'set' . ucfirst($key); - if (method_exists($this, $method)) { - $this->$method($value); - } - } - - return $this; - } - - /** - * Set options from config object - * - * @param Zend_Config $config Configuration for Zend_Text_Table - * @return Zend_Text_Table - */ - public function setConfig(Zend_Config $config) - { - return $this->setOptions($config->toArray()); - } - - /** - * Set column widths - * - * @param array $columnWidths Widths of all columns - * @throws Zend_Text_Table_Exception When no columns were supplied - * @throws Zend_Text_Table_Exception When a column has an invalid width - * @return Zend_Text_Table - */ - public function setColumnWidths(array $columnWidths) - { - if (count($columnWidths) === 0) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('You must supply at least one column'); - } - - foreach ($columnWidths as $columnNum => $columnWidth) { - if (is_int($columnWidth) === false or $columnWidth < 1) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('Column ' . $columnNum . ' has an invalid' - . ' column width'); - } - } - - $this->_columnWidths = $columnWidths; - - return $this; - } - - /** - * Set auto separation mode - * - * @param integer $autoSeparate Auto separation mode - * @return Zend_Text_Table - */ - public function setAutoSeparate($autoSeparate) - { - $this->_autoSeparate = (int) $autoSeparate; - return $this; - } - - /** - * Set decorator - * - * @param Zend_Text_Table_Decorator_Interface|string $decorator Decorator to use - * @return Zend_Text_Table - */ - public function setDecorator($decorator) - { - if ($decorator instanceof Zend_Text_Table_Decorator_Interface) { - $this->_decorator = $decorator; - } else { - $classname = $this->getPluginLoader()->load($decorator); - $this->_decorator = new $classname; - } - - return $this; - } - - /** - * Set the column padding - * - * @param integer $padding The padding for the columns - * @return Zend_Text_Table - */ - public function setPadding($padding) - { - $this->_padding = max(0, (int) $padding); - return $this; - } - - /** - * Get the plugin loader for decorators - * - * @return Zend_Loader_PluginLoader - */ - public function getPluginLoader() - { - if ($this->_pluginLoader === null) { - $prefix = 'Zend_Text_Table_Decorator_'; - $pathPrefix = 'Zend/Text/Table/Decorator/'; - - require_once 'Zend/Loader/PluginLoader.php'; - $this->_pluginLoader = new Zend_Loader_PluginLoader(array($prefix => $pathPrefix)); - } - - return $this->_pluginLoader; - } - - /** - * Set default column align for rows created by appendRow(array $data) - * - * @param integer $columnNum - * @param string $align - * @return Zend_Text_Table - */ - public function setDefaultColumnAlign($columnNum, $align) - { - $this->_defaultColumnAligns[$columnNum] = $align; - - return $this; - } - - /** - * Set the input charset for column contents - * - * @param string $charset - */ - public static function setInputCharset($charset) - { - self::$_inputCharset = strtolower($charset); - } - - /** - * Get the input charset for column contents - * - * @param string $charset - */ - public static function getInputCharset() - { - return self::$_inputCharset; - } - - /** - * Set the output charset for column contents - * - * @param string $charset - */ - public static function setOutputCharset($charset) - { - self::$_outputCharset = strtolower($charset); - } - - /** - * Get the output charset for column contents - * - * @param string $charset - */ - public static function getOutputCharset() - { - return self::$_outputCharset; - } - - /** - * Append a row to the table - * - * @param array|Zend_Text_Table_Row $row The row to append to the table - * @throws Zend_Text_Table_Exception When $row is neither an array nor Zend_Zext_Table_Row - * @throws Zend_Text_Table_Exception When a row contains too many columns - * @return Zend_Text_Table - */ - public function appendRow($row) - { - if (!is_array($row) && !($row instanceof Zend_Text_Table_Row)) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('$row must be an array or instance of Zend_Text_Table_Row'); - } - - if (is_array($row)) { - if (count($row) > count($this->_columnWidths)) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('Row contains too many columns'); - } - - require_once 'Zend/Text/Table/Row.php'; - require_once 'Zend/Text/Table/Column.php'; - - $data = $row; - $row = new Zend_Text_Table_Row(); - $colNum = 0; - foreach ($data as $columnData) { - if (isset($this->_defaultColumnAligns[$colNum])) { - $align = $this->_defaultColumnAligns[$colNum]; - } else { - $align = null; - } - - $row->appendColumn(new Zend_Text_Table_Column($columnData, $align)); - $colNum++; - } - } - - $this->_rows[] = $row; - - return $this; - } - - /** - * Render the table - * - * @throws Zend_Text_Table_Exception When no rows were added to the table - * @return string - */ - public function render() - { - // There should be at least one row - if (count($this->_rows) === 0) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('No rows were added to the table yet'); - } - - // Initiate the result variable - $result = ''; - - // Count total columns - $totalNumColumns = count($this->_columnWidths); - - // Now render all rows, starting from the first one - $numRows = count($this->_rows); - foreach ($this->_rows as $rowNum => $row) { - // Get all column widths - if (isset($columnWidths) === true) { - $lastColumnWidths = $columnWidths; - } - - $renderedRow = $row->render($this->_columnWidths, $this->_decorator, $this->_padding); - $columnWidths = $row->getColumnWidths(); - $numColumns = count($columnWidths); - - // Check what we have to draw - if ($rowNum === 0) { - // If this is the first row, draw the table top - $result .= $this->_decorator->getTopLeft(); - - foreach ($columnWidths as $columnNum => $columnWidth) { - $result .= str_repeat($this->_decorator->getHorizontal(), - $columnWidth); - - if (($columnNum + 1) === $numColumns) { - $result .= $this->_decorator->getTopRight(); - } else { - $result .= $this->_decorator->getHorizontalDown(); - } - } - - $result .= "\n"; - } else { - // Else check if we have to draw the row separator - if ($this->_autoSeparate & self::AUTO_SEPARATE_ALL) { - $drawSeparator = true; - } else if ($rowNum === 1 && $this->_autoSeparate & self::AUTO_SEPARATE_HEADER) { - $drawSeparator = true; - } else if ($rowNum === ($numRows - 1) && $this->_autoSeparate & self::AUTO_SEPARATE_FOOTER) { - $drawSeparator = true; - } else { - $drawSeparator = false; - } - - if ($drawSeparator) { - $result .= $this->_decorator->getVerticalRight(); - - $currentUpperColumn = 0; - $currentLowerColumn = 0; - $currentUpperWidth = 0; - $currentLowerWidth = 0; - - // Loop through all column widths - foreach ($this->_columnWidths as $columnNum => $columnWidth) { - // Add the horizontal line - $result .= str_repeat($this->_decorator->getHorizontal(), - $columnWidth); - - // If this is the last line, break out - if (($columnNum + 1) === $totalNumColumns) { - break; - } - - // Else check, which connector style has to be used - $connector = 0x0; - $currentUpperWidth += $columnWidth; - $currentLowerWidth += $columnWidth; - - if ($lastColumnWidths[$currentUpperColumn] === $currentUpperWidth) { - $connector |= 0x1; - $currentUpperColumn += 1; - $currentUpperWidth = 0; - } else { - $currentUpperWidth += 1; - } - - if ($columnWidths[$currentLowerColumn] === $currentLowerWidth) { - $connector |= 0x2; - $currentLowerColumn += 1; - $currentLowerWidth = 0; - } else { - $currentLowerWidth += 1; - } - - switch ($connector) { - case 0x0: - $result .= $this->_decorator->getHorizontal(); - break; - - case 0x1: - $result .= $this->_decorator->getHorizontalUp(); - break; - - case 0x2: - $result .= $this->_decorator->getHorizontalDown(); - break; - - case 0x3: - $result .= $this->_decorator->getCross(); - break; - - default: - // This can never happen, but the CS tells I have to have it ... - break; - } - } - - $result .= $this->_decorator->getVerticalLeft() . "\n"; - } - } - - // Add the rendered row to the result - $result .= $renderedRow; - - // If this is the last row, draw the table bottom - if (($rowNum + 1) === $numRows) { - $result .= $this->_decorator->getBottomLeft(); - - foreach ($columnWidths as $columnNum => $columnWidth) { - $result .= str_repeat($this->_decorator->getHorizontal(), - $columnWidth); - - if (($columnNum + 1) === $numColumns) { - $result .= $this->_decorator->getBottomRight(); - } else { - $result .= $this->_decorator->getHorizontalUp(); - } - } - - $result .= "\n"; - } - } - - return $result; - } - - /** - * Magic method which returns the rendered table - * - * @return string - */ - public function __toString() - { - try { - return $this->render(); - } catch (Exception $e) { - trigger_error($e->getMessage(), E_USER_ERROR); - } - - } -} diff --git a/library/vendor/Zend/Text/Table/Column.php b/library/vendor/Zend/Text/Table/Column.php deleted file mode 100644 index cd1547062..000000000 --- a/library/vendor/Zend/Text/Table/Column.php +++ /dev/null @@ -1,243 +0,0 @@ -setContent($content, $charset); - } - - if ($align !== null) { - $this->setAlign($align); - } - - if ($colSpan !== null) { - $this->setColSpan($colSpan); - } - } - - /** - * Set the content. - * - * If $charset is not defined, it is assumed that $content is encoded in - * the charset defined via Zend_Text_Table::setInputCharset() (defaults - * to utf-8). - * - * @param string $content Content of the column - * @param string $charset The charset of the content - * @throws Zend_Text_Table_Exception When $content is not a string - * @return Zend_Text_Table_Column - */ - public function setContent($content, $charset = null) - { - if (is_string($content) === false) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('$content must be a string'); - } - - if ($charset === null) { - $inputCharset = Zend_Text_Table::getInputCharset(); - } else { - $inputCharset = strtolower($charset); - } - - $outputCharset = Zend_Text_Table::getOutputCharset(); - - if ($inputCharset !== $outputCharset) { - if (PHP_OS !== 'AIX') { - // AIX does not understand these character sets - $content = iconv($inputCharset, $outputCharset, $content); - } - - } - - $this->_content = $content; - - return $this; - } - - /** - * Set the align - * - * @param string $align Align of the column - * @throws Zend_Text_Table_Exception When supplied align is invalid - * @return Zend_Text_Table_Column - */ - public function setAlign($align) - { - if (in_array($align, $this->_allowedAligns) === false) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('Invalid align supplied'); - } - - $this->_align = $align; - - return $this; - } - - /** - * Set the colspan - * - * @param int $colSpan - * @throws Zend_Text_Table_Exception When $colSpan is smaller than 1 - * @return Zend_Text_Table_Column - */ - public function setColSpan($colSpan) - { - if (is_int($colSpan) === false or $colSpan < 1) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('$colSpan must be an integer and greater than 0'); - } - - $this->_colSpan = $colSpan; - - return $this; - } - - /** - * Get the colspan - * - * @return integer - */ - public function getColSpan() - { - return $this->_colSpan; - } - - /** - * Render the column width the given column width - * - * @param integer $columnWidth The width of the column - * @param integer $padding The padding for the column - * @throws Zend_Text_Table_Exception When $columnWidth is lower than 1 - * @throws Zend_Text_Table_Exception When padding is greater than columnWidth - * @return string - */ - public function render($columnWidth, $padding = 0) - { - if (is_int($columnWidth) === false or $columnWidth < 1) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('$columnWidth must be an integer and greater than 0'); - } - - $columnWidth -= ($padding * 2); - - if ($columnWidth < 1) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('Padding (' . $padding . ') is greater than column width'); - } - - switch ($this->_align) { - case self::ALIGN_LEFT: - $padMode = STR_PAD_RIGHT; - break; - - case self::ALIGN_CENTER: - $padMode = STR_PAD_BOTH; - break; - - case self::ALIGN_RIGHT: - $padMode = STR_PAD_LEFT; - break; - - default: - // This can never happen, but the CS tells I have to have it ... - break; - } - - $outputCharset = Zend_Text_Table::getOutputCharset(); - $lines = explode("\n", Zend_Text_MultiByte::wordWrap($this->_content, $columnWidth, "\n", true, $outputCharset)); - $paddedLines = array(); - - foreach ($lines AS $line) { - $paddedLines[] = str_repeat(' ', $padding) - . Zend_Text_MultiByte::strPad($line, $columnWidth, ' ', $padMode, $outputCharset) - . str_repeat(' ', $padding); - } - - $result = implode("\n", $paddedLines); - - return $result; - } -} diff --git a/library/vendor/Zend/Text/Table/Decorator/Ascii.php b/library/vendor/Zend/Text/Table/Decorator/Ascii.php deleted file mode 100644 index bfc6fb574..000000000 --- a/library/vendor/Zend/Text/Table/Decorator/Ascii.php +++ /dev/null @@ -1,147 +0,0 @@ -_uniChar(0x250C); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getTopRight() - { - return $this->_uniChar(0x2510); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getBottomLeft() - { - return $this->_uniChar(0x2514); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getBottomRight() - { - return $this->_uniChar(0x2518); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getVertical() - { - return $this->_uniChar(0x2502); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getHorizontal() - { - return $this->_uniChar(0x2500); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getCross() - { - return $this->_uniChar(0x253C); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getVerticalRight() - { - return $this->_uniChar(0x251C); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getVerticalLeft() - { - return $this->_uniChar(0x2524); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getHorizontalDown() - { - return $this->_uniChar(0x252C); - } - - /** - * Defined by Zend_Text_Table_Decorator_Interface - * - * @return string - */ - public function getHorizontalUp() - { - return $this->_uniChar(0x2534); - } - - /** - * Convert am unicode character code to a character - * - * @param integer $code - * @return string|false - */ - protected function _uniChar($code) - { - if ($code <= 0x7F) { - $char = chr($code); - } else if ($code <= 0x7FF) { - $char = chr(0xC0 | $code >> 6) - . chr(0x80 | $code & 0x3F); - } else if ($code <= 0xFFFF) { - $char = chr(0xE0 | $code >> 12) - . chr(0x80 | $code >> 6 & 0x3F) - . chr(0x80 | $code & 0x3F); - } else if ($code <= 0x10FFFF) { - $char = chr(0xF0 | $code >> 18) - . chr(0x80 | $code >> 12 & 0x3F) - . chr(0x80 | $code >> 6 & 0x3F) - . chr(0x80 | $code & 0x3F); - } else { - return false; - } - - return $char; - } -} diff --git a/library/vendor/Zend/Text/Table/Exception.php b/library/vendor/Zend/Text/Table/Exception.php deleted file mode 100644 index d39402f6d..000000000 --- a/library/vendor/Zend/Text/Table/Exception.php +++ /dev/null @@ -1,38 +0,0 @@ -appendColumn($column); - - return $this; - } - - /** - * Append a column to the row - * - * @param Zend_Text_Table_Column $column The column to append to the row - * @return Zend_Text_Table_Row - */ - public function appendColumn(Zend_Text_Table_Column $column) - { - $this->_columns[] = $column; - - return $this; - } - - /** - * Get a column by it's index - * - * Returns null, when the index is out of range - * - * @param integer $index - * @return Zend_Text_Table_Column|null - */ - public function getColumn($index) - { - if (!isset($this->_columns[$index])) { - return null; - } - - return $this->_columns[$index]; - } - - /** - * Get all columns of the row - * - * @return array - */ - public function getColumns() - { - return $this->_columns; - } - - /** - * Get the widths of all columns, which were rendered last - * - * @throws Zend_Text_Table_Exception When no columns were rendered yet - * @return integer - */ - public function getColumnWidths() - { - if ($this->_columnWidths === null) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('No columns were rendered yet'); - } - - return $this->_columnWidths; - } - - /** - * Render the row - * - * @param array $columnWidths Width of all columns - * @param Zend_Text_Table_Decorator_Interface $decorator Decorator for the row borders - * @param integer $padding Padding for the columns - * @throws Zend_Text_Table_Exception When there are too many columns - * @return string - */ - public function render(array $columnWidths, - Zend_Text_Table_Decorator_Interface $decorator, - $padding = 0) - { - // Prepare an array to store all column widths - $this->_columnWidths = array(); - - // If there is no single column, create a column which spans over the - // entire row - if (count($this->_columns) === 0) { - require_once 'Zend/Text/Table/Column.php'; - $this->appendColumn(new Zend_Text_Table_Column(null, null, count($columnWidths))); - } - - // First we have to render all columns, to get the maximum height - $renderedColumns = array(); - $maxHeight = 0; - $colNum = 0; - foreach ($this->_columns as $column) { - // Get the colspan of the column - $colSpan = $column->getColSpan(); - - // Verify if there are enough column widths defined - if (($colNum + $colSpan) > count($columnWidths)) { - require_once 'Zend/Text/Table/Exception.php'; - throw new Zend_Text_Table_Exception('Too many columns'); - } - - // Calculate the column width - $columnWidth = ($colSpan - 1 + array_sum(array_slice($columnWidths, - $colNum, - $colSpan))); - - // Render the column and split it's lines into an array - $result = explode("\n", $column->render($columnWidth, $padding)); - - // Store the width of the rendered column - $this->_columnWidths[] = $columnWidth; - - // Store the rendered column and calculate the new max height - $renderedColumns[] = $result; - $maxHeight = max($maxHeight, count($result)); - - // Set up the internal column number - $colNum += $colSpan; - } - - // If the row doesnt contain enough columns to fill the entire row, fill - // it with an empty column - if ($colNum < count($columnWidths)) { - $remainingWidth = (count($columnWidths) - $colNum - 1) + - array_sum(array_slice($columnWidths, - $colNum)); - $renderedColumns[] = array(str_repeat(' ', $remainingWidth)); - - $this->_columnWidths[] = $remainingWidth; - } - - // Add each single column line to the result - $result = ''; - for ($line = 0; $line < $maxHeight; $line++) { - $result .= $decorator->getVertical(); - - foreach ($renderedColumns as $index => $renderedColumn) { - if (isset($renderedColumn[$line]) === true) { - $result .= $renderedColumn[$line]; - } else { - $result .= str_repeat(' ', $this->_columnWidths[$index]); - } - - $result .= $decorator->getVertical(); - } - - $result .= "\n"; - } - - return $result; - } -} diff --git a/library/vendor/Zend/TimeSync.php b/library/vendor/Zend/TimeSync.php index bf56fe25a..5b05c4bc3 100644 --- a/library/vendor/Zend/TimeSync.php +++ b/library/vendor/Zend/TimeSync.php @@ -23,7 +23,6 @@ /** * Zend_Date */ -require_once 'Zend/Date.php'; /** * @category Zend @@ -164,7 +163,6 @@ class Zend_TimeSync implements IteratorAggregate if (isset($this->_timeservers[$alias]) === true) { $this->_current = $this->_timeservers[$alias]; } else { - require_once 'Zend/TimeSync/Exception.php'; throw new Zend_TimeSync_Exception("'$alias' does not point to valid timeserver"); } } @@ -185,7 +183,6 @@ class Zend_TimeSync implements IteratorAggregate if (isset(Zend_TimeSync::$options[$key]) === true) { return Zend_TimeSync::$options[$key]; } else { - require_once 'Zend/TimeSync/Exception.php'; throw new Zend_TimeSync_Exception("'$key' does not point to valid option"); } } @@ -204,14 +201,12 @@ class Zend_TimeSync implements IteratorAggregate if (isset($this->_current) && $this->_current !== false) { return $this->_current; } else { - require_once 'Zend/TimeSync/Exception.php'; throw new Zend_TimeSync_Exception('there is no timeserver set'); } } if (isset($this->_timeservers[$alias]) === true) { return $this->_timeservers[$alias]; } else { - require_once 'Zend/TimeSync/Exception.php'; throw new Zend_TimeSync_Exception("'$alias' does not point to valid timeserver"); } } @@ -239,7 +234,6 @@ class Zend_TimeSync implements IteratorAggregate */ public function getDate($locale = null) { - require_once 'Zend/TimeSync/Exception.php'; foreach ($this->_timeservers as $alias => $server) { $this->_current = $server; try { @@ -288,13 +282,11 @@ class Zend_TimeSync implements IteratorAggregate $protocol = ucfirst(strtolower($protocol)); if (!in_array($protocol, $this->_allowedSchemes)) { - require_once 'Zend/TimeSync/Exception.php'; throw new Zend_TimeSync_Exception("'$protocol' is not a supported protocol"); } $className = 'Zend_TimeSync_' . $protocol; if (!class_exists($className)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($className); } $timeServerObj = new $className($adress, $port); diff --git a/library/vendor/Zend/TimeSync/Exception.php b/library/vendor/Zend/TimeSync/Exception.php index 55c0bfc4e..c1a33e4ae 100644 --- a/library/vendor/Zend/TimeSync/Exception.php +++ b/library/vendor/Zend/TimeSync/Exception.php @@ -22,7 +22,6 @@ /** * Zend_Exception */ -require_once 'Zend/Exception.php'; /** * Exception class for Zend_TimeSync diff --git a/library/vendor/Zend/TimeSync/Ntp.php b/library/vendor/Zend/TimeSync/Ntp.php index a0f26b43a..0c52530dc 100644 --- a/library/vendor/Zend/TimeSync/Ntp.php +++ b/library/vendor/Zend/TimeSync/Ntp.php @@ -22,7 +22,6 @@ /** * Zend_TimeSync_Protocol */ -require_once 'Zend/TimeSync/Protocol.php'; /** * NTP Protocol handling class diff --git a/library/vendor/Zend/TimeSync/Sntp.php b/library/vendor/Zend/TimeSync/Sntp.php index e49d92932..6ad0a5ef2 100644 --- a/library/vendor/Zend/TimeSync/Sntp.php +++ b/library/vendor/Zend/TimeSync/Sntp.php @@ -22,7 +22,6 @@ /** * Zend_TimeSync_Protocol */ -require_once 'Zend/TimeSync/Protocol.php'; /** * SNTP Protocol handling class diff --git a/library/vendor/Zend/Tool/Framework/Action/Base.php b/library/vendor/Zend/Tool/Framework/Action/Base.php deleted file mode 100644 index 817c06c99..000000000 --- a/library/vendor/Zend/Tool/Framework/Action/Base.php +++ /dev/null @@ -1,95 +0,0 @@ -setName($options); - } - // implement $options here in the future if this is needed - } - } - - /** - * setName() - * - * @param string $name - * @return Zend_Tool_Framework_Action_Base - */ - public function setName($name) - { - $this->_name = $name; - return $this; - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - if ($this->_name == null) { - $this->_name = $this->_parseName(); - } - return $this->_name; - } - - /** - * _parseName - internal method to determine the name of an action when one is not explicity provided. - * - * @param Zend_Tool_Framework_Action_Interface $action - * @return string - */ - protected function _parseName() - { - $className = get_class($this); - $actionName = substr($className, strrpos($className, '_')+1); - return $actionName; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Action/Exception.php b/library/vendor/Zend/Tool/Framework/Action/Exception.php deleted file mode 100644 index e6a0b7925..000000000 --- a/library/vendor/Zend/Tool/Framework/Action/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ -_registry = $registry; - } - - /** - * addAction() - * - * @param Zend_Tool_Framework_Action_Interface $action - * @return Zend_Tool_Framework_Action_Repository - */ - public function addAction(Zend_Tool_Framework_Action_Interface $action, $overrideExistingAction = false) - { - $actionName = $action->getName(); - - if ($actionName == '' || $actionName == 'Base') { - require_once 'Zend/Tool/Framework/Action/Exception.php'; - throw new Zend_Tool_Framework_Action_Exception('An action name for the provided action could not be determined.'); - } - - if (!$overrideExistingAction && array_key_exists(strtolower($actionName), $this->_actions)) { - require_once 'Zend/Tool/Framework/Action/Exception.php'; - throw new Zend_Tool_Framework_Action_Exception('An action by the name ' . $actionName - . ' is already registered and $overrideExistingAction is set to false.'); - } - - $this->_actions[strtolower($actionName)] = $action; - return $this; - } - - /** - * process() - this is called when the client is done constructing (after init()) - * - * @return unknown - */ - public function process() - { - return null; - } - - /** - * getActions() - get all actions in the repository - * - * @return array - */ - public function getActions() - { - return $this->_actions; - } - - /** - * getAction() - get an action by a specific name - * - * @param string $actionName - * @return Zend_Tool_Framework_Action_Interface - */ - public function getAction($actionName) - { - if (!array_key_exists(strtolower($actionName), $this->_actions)) { - return null; - } - - return $this->_actions[strtolower($actionName)]; - } - - /** - * count() required by the Countable interface - * - * @return int - */ - public function count() - { - return count($this->_actions); - } - - /** - * getIterator() - get all actions, this supports the IteratorAggregate interface - * - * @return array - */ - public function getIterator() - { - return new ArrayIterator($this->_actions); - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Abstract.php b/library/vendor/Zend/Tool/Framework/Client/Abstract.php deleted file mode 100644 index 6f342f8e1..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Abstract.php +++ /dev/null @@ -1,333 +0,0 @@ -setClient($this); - - // NOTE: at this moment, $this->_registry should contain the registry object - - if ($options) { - $this->setOptions($options); - } - } - - public function setOptions(Array $options) - { - foreach ($options as $optionName => $optionValue) { - $setMethodName = 'set' . $optionName; - if (method_exists($this, $setMethodName)) { - $this->{$setMethodName}($optionValue); - } - } - } - - /** - * getName() - Return the client name which can be used to - * query the manifest if need be. - * - * @return string The client name - */ - abstract public function getName(); - - /** - * initialized() - This will initialize the client for use - * - */ - public function initialize() - { - // if its already initialized, no need to initialize again - if ($this->_isInitialized) { - return; - } - - // run any preInit - $this->_preInit(); - - $manifest = $this->_registry->getManifestRepository(); - $manifest->addManifest(new Zend_Tool_Framework_Client_Manifest()); - - // setup the debug log - if (!$this->_debugLogger instanceof Zend_Log) { - require_once 'Zend/Log.php'; - require_once 'Zend/Log/Writer/Null.php'; - $this->_debugLogger = new Zend_Log(new Zend_Log_Writer_Null()); - } - - // let the loader load, then the repositories process whats been loaded - $this->_registry->getLoader()->load(); - - // process the action repository - $this->_registry->getActionRepository()->process(); - - // process the provider repository - $this->_registry->getProviderRepository()->process(); - - // process the manifest repository - $this->_registry->getManifestRepository()->process(); - - if ($this instanceof Zend_Tool_Framework_Client_Interactive_InputInterface) { - require_once 'Zend/Tool/Framework/Client/Interactive/InputHandler.php'; - } - - if ($this instanceof Zend_Tool_Framework_Client_Interactive_OutputInterface) { - $this->_registry->getResponse()->setContentCallback(array($this, 'handleInteractiveOutput')); - } - - } - - - /** - * This method should be implemented by the client implementation to - * construct and set custom inflectors, request and response objects. - */ - protected function _preInit() - { - } - - /** - * This method *must* be implemented by the client implementation to - * parse out and setup the request objects action, provider and parameter - * information. - */ - abstract protected function _preDispatch(); - - /** - * This method should be implemented by the client implementation to - * take the output of the response object and return it (in an client - * specific way) back to the Tooling Client. - */ - protected function _postDispatch() - { - } - - /** - * setRegistry() - Required by the Zend_Tool_Framework_Registry_EnabledInterface - * interface which ensures proper registry dependency resolution - * - * @param Zend_Tool_Framework_Registry_Interface $registry - * @return Zend_Tool_Framework_Client_Abstract - */ - public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) - { - $this->_registry = $registry; - return $this; - } - - /** - * getRegistry(); - * - * @return Zend_Tool_Framework_Registry_Interface - */ - public function getRegistry() - { - return $this->_registry; - } - - /** - * hasInteractiveInput() - Convienence method for determining if this - * client can handle interactive input, and thus be able to run the - * promptInteractiveInput - * - * @return bool - */ - public function hasInteractiveInput() - { - return ($this instanceof Zend_Tool_Framework_Client_Interactive_InputInterface); - } - - public function promptInteractiveInput($inputRequest) - { - if (!$this->hasInteractiveInput()) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('promptInteractive() cannot be called on a non-interactive client.'); - } - - $inputHandler = new Zend_Tool_Framework_Client_Interactive_InputHandler(); - $inputHandler->setClient($this); - $inputHandler->setInputRequest($inputRequest); - return $inputHandler->handle(); - - } - - /** - * This method should be called in order to "handle" a Tooling Client - * request that has come to the client that has been implemented. - */ - public function dispatch() - { - $this->initialize(); - - try { - - $this->_preDispatch(); - - if ($this->_registry->getRequest()->isDispatchable()) { - - if ($this->_registry->getRequest()->getActionName() == null) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Client failed to setup the action name.'); - } - - if ($this->_registry->getRequest()->getProviderName() == null) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Client failed to setup the provider name.'); - } - - $this->_handleDispatch(); - - } - - } catch (Exception $exception) { - $this->_registry->getResponse()->setException($exception); - } - - $this->_postDispatch(); - } - - public function convertToClientNaming($string) - { - return $string; - } - - public function convertFromClientNaming($string) - { - return $string; - } - - protected function _handleDispatch() - { - // get the provider repository - $providerRepository = $this->_registry->getProviderRepository(); - - $request = $this->_registry->getRequest(); - - // get the dispatchable provider signature - $providerSignature = $providerRepository->getProviderSignature($request->getProviderName()); - - // get the actual provider - $provider = $providerSignature->getProvider(); - - // ensure that we can pretend if this is a pretend request - if ($request->isPretend() && (!$provider instanceof Zend_Tool_Framework_Provider_Pretendable)) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Dispatcher error - provider does not support pretend'); - } - - // get the action name - $actionName = $this->_registry->getRequest()->getActionName(); - $specialtyName = $this->_registry->getRequest()->getSpecialtyName(); - - if (!$actionableMethod = $providerSignature->getActionableMethodByActionName($actionName, $specialtyName)) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Dispatcher error - actionable method not found'); - } - - // get the actual method and param information - $methodName = $actionableMethod['methodName']; - $methodParameters = $actionableMethod['parameterInfo']; - - // get the provider params - $requestParameters = $this->_registry->getRequest()->getProviderParameters(); - - // @todo This seems hackish, determine if there is a better way - $callParameters = array(); - foreach ($methodParameters as $methodParameterName => $methodParameterValue) { - if (!array_key_exists($methodParameterName, $requestParameters) && $methodParameterValue['optional'] == false) { - if ($this instanceof Zend_Tool_Framework_Client_Interactive_InputInterface) { - $promptSting = $this->getMissingParameterPromptString($provider, $actionableMethod['action'], $methodParameterValue['name']); - $parameterPromptValue = $this->promptInteractiveInput($promptSting)->getContent(); - if ($parameterPromptValue == null) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Value supplied for required parameter "' . $methodParameterValue['name'] . '" is empty'); - } - $callParameters[] = $parameterPromptValue; - } else { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('A required parameter "' . $methodParameterValue['name'] . '" was not supplied.'); - } - } else { - $callParameters[] = (array_key_exists($methodParameterName, $requestParameters)) ? $requestParameters[$methodParameterName] : $methodParameterValue['default']; - } - } - - $this->_handleDispatchExecution($provider, $methodName, $callParameters); - } - - protected function _handleDispatchExecution($class, $methodName, $callParameters) - { - if (method_exists($class, $methodName)) { - call_user_func_array(array($class, $methodName), $callParameters); - } elseif (method_exists($class, $methodName . 'Action')) { - call_user_func_array(array($class, $methodName . 'Action'), $callParameters); - } else { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Not a supported method.'); - } - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Config.php b/library/vendor/Zend/Tool/Framework/Client/Config.php deleted file mode 100644 index 4cc726e78..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Config.php +++ /dev/null @@ -1,244 +0,0 @@ -setOptions($options); - } - } - - /** - * @param array $options - */ - public function setOptions(Array $options) - { - foreach ($options as $optionName => $optionValue) { - $setMethodName = 'set' . $optionName; - if (method_exists($this, $setMethodName)) { - $this->{$setMethodName}($optionValue); - } - } - } - - /** - * @param string $configFilepath - * @return Zend_Tool_Framework_Client_Config - */ - public function setConfigFilepath($configFilepath) - { - if (!file_exists($configFilepath)) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Provided path to config ' . $configFilepath . ' does not exist'); - } - - $this->_configFilepath = $configFilepath; - $this->loadConfig($configFilepath); - - return $this; - } - - /** - * Load the configuration from the given path. - * - * @param string $configFilepath - */ - protected function loadConfig($configFilepath) - { - $suffix = substr($configFilepath, -4); - - switch ($suffix) { - case '.ini': - require_once 'Zend/Config/Ini.php'; - $this->_config = new Zend_Config_Ini($configFilepath, null, array('allowModifications' => true)); - break; - case '.xml': - require_once 'Zend/Config/Xml.php'; - $this->_config = new Zend_Config_Xml($configFilepath, null, array('allowModifications' => true)); - break; - case '.php': - require_once 'Zend/Config.php'; - $this->_config = new Zend_Config(include $configFilepath, true); - break; - default: - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Unknown config file type ' - . $suffix . ' at location ' . $configFilepath - ); - } - } - - /** - * Return the filepath of the configuration. - * - * @return string - */ - public function getConfigFilepath() - { - return $this->_configFilepath; - } - - /** - * Get a configuration value. - * - * @param string $name - * @param string $defaultValue - * @return mixed - */ - public function get($name, $defaultValue=null) - { - return $this->getConfigInstance()->get($name, $defaultValue); - } - - /** - * Get a configuration value - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - return $this->getConfigInstance()->{$name}; - } - - /** - * Check if a configuration value isset. - * - * @param string $name - * @return boolean - */ - public function __isset($name) - { - if($this->exists() == false) { - return false; - } - return isset($this->getConfigInstance()->{$name}); - } - - /** - * @param string $name - */ - public function __unset($name) - { - unset($this->getConfigInstance()->$name); - } - - /** - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - return $this->getConfigInstance()->$name = $value; - } - - /** - * Check if the User profile has a configuration. - * - * @return bool - */ - public function exists() - { - return ($this->_config!==null); - } - - /** - * @throws Zend_Tool_Framework_Client_Exception - * @return Zend_Config - */ - public function getConfigInstance() - { - if(!$this->exists()) { - require_once "Zend/Tool/Framework/Client/Exception.php"; - throw new Zend_Tool_Framework_Client_Exception("Client has no persistent configuration."); - } - - return $this->_config; - } - - /** - * Save changes to the configuration into persistence. - * - * @return bool - */ - public function save() - { - if($this->exists()) { - $writer = $this->getConfigWriter(); - $writer->write($this->getConfigFilepath(), $this->getConfigInstance(), true); - $this->loadConfig($this->getConfigFilepath()); - - return true; - } - return false; - } - - /** - * Get the config writer that corresponds to the current config file type. - * - * @return Zend_Config_Writer_FileAbstract - */ - protected function getConfigWriter() - { - $suffix = substr($this->getConfigFilepath(), -4); - switch($suffix) { - case '.ini': - require_once "Zend/Config/Writer/Ini.php"; - $writer = new Zend_Config_Writer_Ini(); - $writer->setRenderWithoutSections(); - break; - case '.xml': - require_once "Zend/Config/Writer/Xml.php"; - $writer = new Zend_Config_Writer_Xml(); - break; - case '.php': - require_once "Zend/Config/Writer/Array.php"; - $writer = new Zend_Config_Writer_Array(); - break; - default: - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Unknown config file type ' - . $suffix . ' at location ' . $this->getConfigFilepath() - ); - } - return $writer; - } -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Console.php b/library/vendor/Zend/Tool/Framework/Client/Console.php deleted file mode 100644 index ed4338a60..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Console.php +++ /dev/null @@ -1,312 +0,0 @@ -dispatch(); - } - - /** - * getName() - return the name of the client, in this case 'console' - * - * @return string - */ - public function getName() - { - return 'console'; - } - - /** - * setConfigOptions() - * - * @param array $configOptions - */ - public function setConfigOptions($configOptions) - { - $this->_configOptions = $configOptions; - return $this; - } - - /** - * setStorageOptions() - * - * @param array $storageOptions - */ - public function setStorageOptions($storageOptions) - { - $this->_storageOptions = $storageOptions; - return $this; - } - - /** - * @param array $classesToLoad - */ - public function setClassesToLoad($classesToLoad) - { - $this->_classesToLoad = $classesToLoad; - return $this; - } - - /** - * _init() - Tasks processed before the constructor, generally setting up objects to use - * - */ - protected function _preInit() - { - $config = $this->_registry->getConfig(); - - if ($this->_configOptions != null) { - $config->setOptions($this->_configOptions); - } - - $storage = $this->_registry->getStorage(); - - if ($this->_storageOptions != null && isset($this->_storageOptions['directory'])) { - $storage->setAdapter( - new Zend_Tool_Framework_Client_Storage_Directory($this->_storageOptions['directory']) - ); - } - - // which classes are essential to initializing Zend_Tool_Framework_Client_Console - $classesToLoad = array( - 'Zend_Tool_Framework_Client_Console_Manifest', - 'Zend_Tool_Framework_System_Manifest' - ); - - if ($this->_classesToLoad) { - if (is_string($this->_classesToLoad)) { - $classesToLoad[] = $this->_classesToLoad; - } elseif (is_array($this->_classesToLoad)) { - $classesToLoad = array_merge($classesToLoad, $this->_classesToLoad); - } - } - - // add classes to the basic loader from the config file basicloader.classes.1 .. - if (isset($config->basicloader) && isset($config->basicloader->classes)) { - foreach ($config->basicloader->classes as $classKey => $className) { - array_push($classesToLoad, $className); - } - } - - $this->_registry->setLoader( - new Zend_Tool_Framework_Loader_BasicLoader(array('classesToLoad' => $classesToLoad)) - ); - - return; - } - - /** - * _preDispatch() - Tasks handed after initialization but before dispatching - * - */ - protected function _preDispatch() - { - $response = $this->_registry->getResponse(); - - $response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_AlignCenter()); - $response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_Indention()); - $response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_Blockize()); - - if (function_exists('posix_isatty')) { - $response->addContentDecorator(new Zend_Tool_Framework_Client_Console_ResponseDecorator_Colorizer()); - } - - $response->addContentDecorator(new Zend_Tool_Framework_Client_Response_ContentDecorator_Separator()) - ->setDefaultDecoratorOptions(array('separator' => true)); - - $optParser = new Zend_Tool_Framework_Client_Console_ArgumentParser(); - $optParser->setArguments($_SERVER['argv']) - ->setRegistry($this->_registry) - ->parse(); - - return; - } - - /** - * _postDispatch() - Tasks handled after dispatching - * - */ - protected function _postDispatch() - { - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - if ($response->isException()) { - $helpSystem = new Zend_Tool_Framework_Client_Console_HelpSystem(); - $helpSystem->setRegistry($this->_registry) - ->respondWithErrorMessage($response->getException()->getMessage(), $response->getException()) - ->respondWithSpecialtyAndParamHelp( - $request->getProviderName(), - $request->getActionName() - ); - } - - echo PHP_EOL; - return; - } - - /** - * handleInteractiveInputRequest() is required by the Interactive InputInterface - * - * - * @param Zend_Tool_Framework_Client_Interactive_InputRequest $inputRequest - * @return string - */ - public function handleInteractiveInputRequest(Zend_Tool_Framework_Client_Interactive_InputRequest $inputRequest) - { - fwrite(STDOUT, $inputRequest->getContent() . PHP_EOL . 'zf> '); - $inputContent = fgets(STDIN); - return rtrim($inputContent); // remove the return from the end of the string - } - - /** - * handleInteractiveOutput() is required by the Interactive OutputInterface - * - * This allows us to display output immediately from providers, rather - * than displaying it after the provider is done. - * - * @param string $output - */ - public function handleInteractiveOutput($output) - { - echo $output; - } - - /** - * getMissingParameterPromptString() - * - * @param Zend_Tool_Framework_Provider_Interface $provider - * @param Zend_Tool_Framework_Action_Interface $actionInterface - * @param string $missingParameterName - * @return string - */ - public function getMissingParameterPromptString(Zend_Tool_Framework_Provider_Interface $provider, Zend_Tool_Framework_Action_Interface $actionInterface, $missingParameterName) - { - return 'Please provide a value for $' . $missingParameterName; - } - - - /** - * convertToClientNaming() - * - * Convert words to client specific naming, in this case is lower, dash separated - * - * Filters are lazy-loaded. - * - * @param string $string - * @return string - */ - public function convertToClientNaming($string) - { - if (!$this->_filterToClientNaming) { - $filter = new Zend_Filter(); - $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash()); - $filter->addFilter(new Zend_Filter_StringToLower()); - - $this->_filterToClientNaming = $filter; - } - - return $this->_filterToClientNaming->filter($string); - } - - /** - * convertFromClientNaming() - * - * Convert words from client specific naming to code naming - camelcased - * - * Filters are lazy-loaded. - * - * @param string $string - * @return string - */ - public function convertFromClientNaming($string) - { - if (!$this->_filterFromClientNaming) { - $this->_filterFromClientNaming = new Zend_Filter_Word_DashToCamelCase(); - } - - return $this->_filterFromClientNaming->filter($string); - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Console/ArgumentParser.php b/library/vendor/Zend/Tool/Framework/Client/Console/ArgumentParser.php deleted file mode 100644 index 77d85c0f2..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Console/ArgumentParser.php +++ /dev/null @@ -1,539 +0,0 @@ -_argumentsOriginal = $this->_argumentsWorking = $arguments; - return $this; - } - - /** - * setRegistry() - * - * @param Zend_Tool_Framework_Registry_Interface $registry - * @return Zend_Tool_Framework_Client_Console_ArgumentParser - */ - public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) - { - // get the client registry - $this->_registry = $registry; - - // set manifest repository, request, response for easy access - $this->_manifestRepository = $this->_registry->getManifestRepository(); - $this->_request = $this->_registry->getRequest(); - $this->_response = $this->_registry->getResponse(); - return $this; - } - - /** - * Parse() - This method does the work of parsing the arguments into the enpooint request, - * this will also (during help operations) fill the response in with information as needed - * - * @return null - */ - public function parse() - { - - if ($this->_request == null || $this->_response == null) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('The client registry must have both a request and response registered.'); - } - - // setup the help options - $helpResponseOptions = array(); - - // check to see if the first cli arg is the script name - if ($this->_argumentsWorking[0] == $_SERVER['SCRIPT_NAME' ]) { - array_shift($this->_argumentsWorking); - } - - // process global options - try { - $this->_parseGlobalPart(); - } catch (Zend_Tool_Framework_Client_Exception $exception) { - $this->_createHelpResponse(array('error' => $exception->getMessage())); - return; - } - - // ensure there are arguments left - if (count($this->_argumentsWorking) == 0) { - $this->_request->setDispatchable(false); // at this point request is not dispatchable - - // check to see if this was a help request - if ($this->_help) { - $this->_createHelpResponse(); - } else { - $this->_createHelpResponse(array('error' => 'An action and provider is required.')); - } - return; - } - - // process the action part of the command line - try { - $this->_parseActionPart(); - } catch (Zend_Tool_Framework_Client_Exception $exception) { - $this->_request->setDispatchable(false); - $this->_createHelpResponse(array('error' => $exception->getMessage())); - return; - } - - if ($this->_helpKnownAction) { - $helpResponseOptions = array_merge( - $helpResponseOptions, - array('actionName' => $this->_request->getActionName()) - ); - } - - /* @TODO Action Parameter Requirements */ - - // make sure there are more "words" on the command line - if (count($this->_argumentsWorking) == 0) { - $this->_request->setDispatchable(false); // at this point request is not dispatchable - - // check to see if this is a help request - if ($this->_help) { - $this->_createHelpResponse($helpResponseOptions); - } else { - $this->_createHelpResponse(array_merge($helpResponseOptions, array('error' => 'A provider is required.'))); - } - return; - } - - - // process the provider part of the command line - try { - $this->_parseProviderPart(); - } catch (Zend_Tool_Framework_Client_Exception $exception) { - $this->_request->setDispatchable(false); - $this->_createHelpResponse(array('error' => $exception->getMessage())); - return; - } - - if ($this->_helpKnownProvider) { - $helpResponseOptions = array_merge( - $helpResponseOptions, - array('providerName' => $this->_request->getProviderName()) - ); - } - - if ($this->_helpKnownSpecialty) { - $helpResponseOptions = array_merge( - $helpResponseOptions, - array('specialtyName' => $this->_request->getSpecialtyName()) - ); - } - - // if there are arguments on the command line, lets process them as provider options - if (count($this->_argumentsWorking) != 0) { - $this->_parseProviderOptionsPart(); - } - - // if there is still arguments lingering around, we can assume something is wrong - if (count($this->_argumentsWorking) != 0) { - $this->_request->setDispatchable(false); // at this point request is not dispatchable - if ($this->_help) { - $this->_createHelpResponse($helpResponseOptions); - } else { - $this->_createHelpResponse(array_merge( - $helpResponseOptions, - array('error' => 'Unknown arguments left on the command line: ' . implode(' ', $this->_argumentsWorking)) - )); - } - return; - } - - // everything was processed and this is a request for help information - if ($this->_help) { - $this->_request->setDispatchable(false); // at this point request is not dispatchable - $this->_createHelpResponse($helpResponseOptions); - } - - return; - } - - /** - * Internal routine for parsing global options from the command line - * - * @return null - */ - protected function _parseGlobalPart() - { - $getoptOptions = array(); - $getoptOptions['help|h'] = 'HELP'; - $getoptOptions['verbose|v'] = 'VERBOSE'; - $getoptOptions['pretend|p'] = 'PRETEND'; - $getoptOptions['debug|d'] = 'DEBUG'; - $getoptParser = new Zend_Console_Getopt($getoptOptions, $this->_argumentsWorking, array('parseAll' => false)); - - // @todo catch any exceptions here - $getoptParser->parse(); - - foreach ($getoptParser->getOptions() as $option) { - if ($option == 'pretend') { - $this->_request->setPretend(true); - } elseif ($option == 'debug') { - $this->_request->setDebug(true); - } elseif ($option == 'verbose') { - $this->_request->setVerbose(true); - } else { - $property = '_'.$option; - $this->{$property} = true; - } - } - - $this->_argumentsWorking = $getoptParser->getRemainingArgs(); - - return; - } - - /** - * Internal routine for parsing the action name from the arguments - * - * @return null - */ - protected function _parseActionPart() - { - // the next "word" should be the action name - $consoleActionName = array_shift($this->_argumentsWorking); - - if ($consoleActionName == '?') { - $this->_help = true; - return; - } - - $actionSearchCriteria = array( - 'type' => 'Tool', - 'name' => 'actionName', - 'value' => $consoleActionName, - 'clientName' => 'console' - ); - - // is the action name valid? - $actionMetadata = $this->_manifestRepository->getMetadata($actionSearchCriteria); - - // check for normalized names as well (all lower, no separators) - if (!$actionMetadata) { - $actionSearchCriteria['name'] = 'normalizedActionName'; - $actionSearchCriteria['value'] = strtolower(str_replace(array('-', '_'), '', $consoleActionName)); - $actionSearchCriteria['clientName'] = 'all'; - $actionMetadata = $this->_manifestRepository->getMetadata($actionSearchCriteria); - } - - // if no action, handle error - if (!$actionMetadata) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('Action \'' . $consoleActionName . '\' is not a valid action.'); - } - - // prepare action request name - $this->_helpKnownAction = true; - $this->_request->setActionName($actionMetadata->getActionName()); - return; - } - - /** - * Internal routine for parsing the provider part of the command line arguments - * - * @return null - */ - protected function _parseProviderPart() - { - // get the cli "word" as the provider name from command line - $consoleProviderFull = array_shift($this->_argumentsWorking); - $consoleSpecialtyName = '_global'; - - // if there is notation for specialties? If so, break them up - if (strstr($consoleProviderFull, '.')) { - list($consoleProviderName, $consoleSpecialtyName) = explode('.', $consoleProviderFull); - } else { - $consoleProviderName = $consoleProviderFull; - } - - if ($consoleProviderName == '?') { - $this->_help = true; - return; - } - - $providerSearchCriteria = array( - 'type' => 'Tool', - 'name' => 'providerName', - 'value' => $consoleProviderName, - 'clientName' => 'console' - ); - - // get the cli provider names from the manifest - $providerMetadata = $this->_manifestRepository->getMetadata($providerSearchCriteria); - - // check for normalized names as well (all lower, no separators) - if (!$providerMetadata) { - $providerSearchCriteria['name'] = 'normalizedProviderName'; - $providerSearchCriteria['value'] = strtolower(str_replace(array('-', '_'), '', $consoleProviderName)); - $providerSearchCriteria['clientName'] = 'all'; - $providerMetadata = $this->_manifestRepository->getMetadata($providerSearchCriteria); - } - - if (!$providerMetadata) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception( - 'Provider \'' . $consoleProviderFull . '\' is not a valid provider.' - ); - } - - $this->_helpKnownProvider = true; - $this->_request->setProviderName($providerMetadata->getProviderName()); - - if ($consoleSpecialtyName == '?') { - $this->_help = true; - return; - } - - $providerSpecialtySearchCriteria = array( - 'type' => 'Tool', - 'name' => 'specialtyName', - 'value' => $consoleSpecialtyName, - 'providerName' => $providerMetadata->getProviderName(), - 'clientName' => 'console' - ); - - $providerSpecialtyMetadata = $this->_manifestRepository->getMetadata($providerSpecialtySearchCriteria); - - if (!$providerSpecialtyMetadata) { - $providerSpecialtySearchCriteria['name'] = 'normalizedSpecialtyName'; - $providerSpecialtySearchCriteria['value'] = strtolower(str_replace(array('-', '_'), '', $consoleSpecialtyName)); - $providerSpecialtySearchCriteria['clientName'] = 'all'; - $providerSpecialtyMetadata = $this->_manifestRepository->getMetadata($providerSpecialtySearchCriteria); - } - - if (!$providerSpecialtyMetadata) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception( - 'Provider \'' . $consoleSpecialtyName . '\' is not a valid specialty.' - ); - } - - $this->_helpKnownSpecialty = true; - $this->_request->setSpecialtyName($providerSpecialtyMetadata->getSpecialtyName()); - return; - } - - /** - * Internal routine for parsing the provider options from the command line - * - * @return null - */ - protected function _parseProviderOptionsPart() - { - if (current($this->_argumentsWorking) == '?') { - $this->_help = true; - return; - } - - $searchParams = array( - 'type' => 'Tool', - 'providerName' => $this->_request->getProviderName(), - 'actionName' => $this->_request->getActionName(), - 'specialtyName' => $this->_request->getSpecialtyName(), - 'clientName' => 'console' - ); - - $actionableMethodLongParamsMetadata = $this->_manifestRepository->getMetadata( - array_merge($searchParams, array('name' => 'actionableMethodLongParams')) - ); - - $actionableMethodShortParamsMetadata = $this->_manifestRepository->getMetadata( - array_merge($searchParams, array('name' => 'actionableMethodShortParams')) - ); - - $paramNameShortValues = $actionableMethodShortParamsMetadata->getValue(); - - $getoptOptions = array(); - $wordArguments = array(); - $longParamCanonicalNames = array(); - - $actionableMethodLongParamsMetadataReference = $actionableMethodLongParamsMetadata->getReference(); - foreach ($actionableMethodLongParamsMetadata->getValue() as $parameterNameLong => $consoleParameterNameLong) { - $optionConfig = $consoleParameterNameLong . '|'; - - $parameterInfo = $actionableMethodLongParamsMetadataReference['parameterInfo'][$parameterNameLong]; - - // process ParameterInfo into array for command line option matching - if ($parameterInfo['type'] == 'string' || $parameterInfo['type'] == 'bool') { - $optionConfig .= $paramNameShortValues[$parameterNameLong] - . (($parameterInfo['optional']) ? '-' : '=') . 's'; - } elseif (in_array($parameterInfo['type'], array('int', 'integer', 'float'))) { - $optionConfig .= $paramNameShortValues[$parameterNameLong] - . (($parameterInfo['optional']) ? '-' : '=') . 'i'; - } else { - $optionConfig .= $paramNameShortValues[$parameterNameLong] . '-s'; - } - - $getoptOptions[$optionConfig] = ($parameterInfo['description'] != '') ? $parameterInfo['description'] : 'No description available.'; - - - // process ParameterInfo into array for command line WORD (argument) matching - $wordArguments[$parameterInfo['position']]['parameterName'] = $parameterInfo['name']; - $wordArguments[$parameterInfo['position']]['optional'] = $parameterInfo['optional']; - $wordArguments[$parameterInfo['position']]['type'] = $parameterInfo['type']; - - // keep a translation of console to canonical names - $longParamCanonicalNames[$consoleParameterNameLong] = $parameterNameLong; - } - - - if (!$getoptOptions) { - // no options to parse here, return - return; - } - - // if non-option arguments exist, attempt to process them before processing options - $wordStack = array(); - while (($wordOnTop = array_shift($this->_argumentsWorking))) { - if (substr($wordOnTop, 0, 1) != '-') { - array_push($wordStack, $wordOnTop); - } else { - // put word back on stack and move on - array_unshift($this->_argumentsWorking, $wordOnTop); - break; - } - - if (count($wordStack) == count($wordArguments)) { - // when we get at most the number of arguments we are expecting - // then break out. - break; - } - - } - - if ($wordStack && $wordArguments) { - for ($wordIndex = 1; $wordIndex <= count($wordArguments); $wordIndex++) { - if (!array_key_exists($wordIndex-1, $wordStack) || !array_key_exists($wordIndex, $wordArguments)) { - break; - } - $this->_request->setProviderParameter($wordArguments[$wordIndex]['parameterName'], $wordStack[$wordIndex-1]); - unset($wordStack[$wordIndex-1]); - } - } - - $getoptParser = new Zend_Console_Getopt($getoptOptions, $this->_argumentsWorking, array('parseAll' => false)); - $getoptParser->parse(); - foreach ($getoptParser->getOptions() as $option) { - $value = $getoptParser->getOption($option); - $providerParamOption = $longParamCanonicalNames[$option]; - $this->_request->setProviderParameter($providerParamOption, $value); - } - - $this->_argumentsWorking = $getoptParser->getRemainingArgs(); - - return; - } - - /** - * _createHelpResponse - * - * @param unknown_type $options - */ - protected function _createHelpResponse($options = array()) - { - require_once 'Zend/Tool/Framework/Client/Console/HelpSystem.php'; - $helpSystem = new Zend_Tool_Framework_Client_Console_HelpSystem(); - $helpSystem->setRegistry($this->_registry); - - if (isset($options['error'])) { - $helpSystem->respondWithErrorMessage($options['error']); - } - - if (isset($options['actionName']) && isset($options['providerName'])) { - $helpSystem->respondWithSpecialtyAndParamHelp($options['providerName'], $options['actionName']); - } elseif (isset($options['actionName'])) { - $helpSystem->respondWithActionHelp($options['actionName']); - } elseif (isset($options['providerName'])) { - $helpSystem->respondWithProviderHelp($options['providerName']); - } else { - $helpSystem->respondWithGeneralHelp(); - } - - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Console/HelpSystem.php b/library/vendor/Zend/Tool/Framework/Client/Console/HelpSystem.php deleted file mode 100644 index 42edea90b..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Console/HelpSystem.php +++ /dev/null @@ -1,378 +0,0 @@ -_registry = $registry; - $this->_response = $registry->getResponse(); - return $this; - } - - /** - * respondWithErrorMessage() - * - * @param string $errorMessage - * @param Exception $exception - */ - public function respondWithErrorMessage($errorMessage, Exception $exception = null) - { - // break apart the message into wrapped chunks - $errorMessages = explode(PHP_EOL, wordwrap($errorMessage, 70, PHP_EOL, false)); - - $text = 'An Error Has Occurred'; - $this->_response->appendContent($text, array('color' => array('hiWhite', 'bgRed'), 'aligncenter' => true)); - $this->_response->appendContent($errorMessage, array('indention' => 1, 'blockize' => 72, 'color' => array('white', 'bgRed'))); - - if ($exception && $this->_registry->getRequest()->isDebug()) { - $this->_response->appendContent($exception->getTraceAsString()); - } - - $this->_response->appendContent(null, array('separator' => true)); - return $this; - } - - /** - * respondWithGeneralHelp() - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - public function respondWithGeneralHelp() - { - $this->_respondWithHeader(); - - $noSeparator = array('separator' => false); - - $this->_response->appendContent('Usage:', array('color' => 'green')) - ->appendContent(' ', $noSeparator) - ->appendContent('zf', array_merge(array('color' => 'cyan'), $noSeparator)) - ->appendContent(' [--global-opts]', $noSeparator) - ->appendContent(' action-name', array_merge(array('color' => 'cyan'), $noSeparator)) - ->appendContent(' [--action-opts]', $noSeparator) - ->appendContent(' provider-name', array_merge(array('color' => 'cyan'), $noSeparator)) - ->appendContent(' [--provider-opts]', $noSeparator) - ->appendContent(' [provider parameters ...]') - ->appendContent(' Note: You may use "?" in any place of the above usage string to ask for more specific help information.', array('color'=>'yellow')) - ->appendContent(' Example: "zf ? version" will list all available actions for the version provider.', array('color'=>'yellow', 'separator' => 2)) - ->appendContent('Providers and their actions:', array('color' => 'green')); - - $this->_respondWithSystemInformation(); - return $this; - } - - /** - * respondWithActionHelp() - * - * @param string $actionName - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - public function respondWithActionHelp($actionName) - { - $this->_respondWithHeader(); - $this->_response->appendContent('Providers that support the action "' . $actionName . '"', array('color' => 'green')); - $this->_respondWithSystemInformation(null, $actionName); - return $this; - } - - /** - * respondWithSpecialtyAndParamHelp() - * - * @param string $providerName - * @param string $actionName - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - public function respondWithSpecialtyAndParamHelp($providerName, $actionName) - { - $this->_respondWithHeader(); - $this->_response->appendContent( - 'Details for action "' . $actionName . '" and provider "' . $providerName . '"', - array('color' => 'green') - ); - $this->_respondWithSystemInformation($providerName, $actionName, true); - return $this; - } - - /** - * respondWithProviderHelp() - * - * @param string $providerName - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - public function respondWithProviderHelp($providerName) - { - $this->_respondWithHeader(); - $this->_response->appendContent('Actions supported by provider "' . $providerName . '"', array('color' => 'green')); - $this->_respondWithSystemInformation($providerName); - return $this; - } - - /** - * _respondWithHeader() - * - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - protected function _respondWithHeader() - { - /** - * @see Zend_Version - */ - require_once 'Zend/Version.php'; - $this->_response->appendContent('Zend Framework', array('color' => array('hiWhite'), 'separator' => false)); - $this->_response->appendContent(' Command Line Console Tool v' . Zend_Version::VERSION . ''); - return $this; - } - - /** - * _respondWithSystemInformation() - * - * @param string $providerNameFilter - * @param string $actionNameFilter - * @param bool $includeAllSpecialties - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - protected function _respondWithSystemInformation($providerNameFilter = null, $actionNameFilter = null, $includeAllSpecialties = false) - { - $manifest = $this->_registry->getManifestRepository(); - - $providerMetadatasSearch = array( - 'type' => 'Tool', - 'name' => 'providerName', - 'clientName' => 'console' - ); - - if (is_string($providerNameFilter)) { - $providerMetadatasSearch = array_merge($providerMetadatasSearch, array('providerName' => $providerNameFilter)); - } - - $actionMetadatasSearch = array( - 'type' => 'Tool', - 'name' => 'actionName', - 'clientName' => 'console' - ); - - if (is_string($actionNameFilter)) { - $actionMetadatasSearch = array_merge($actionMetadatasSearch, array('actionName' => $actionNameFilter)); - } - - // get the metadata's for the things to display - $displayProviderMetadatas = $manifest->getMetadatas($providerMetadatasSearch); - $displayActionMetadatas = $manifest->getMetadatas($actionMetadatasSearch); - - // create index of actionNames - for ($i = 0; $i < count($displayActionMetadatas); $i++) { - $displayActionNames[] = $displayActionMetadatas[$i]->getActionName(); - } - - foreach ($displayProviderMetadatas as $providerMetadata) { - - $providerNameDisplayed = false; - - $providerName = $providerMetadata->getProviderName(); - $providerSignature = $providerMetadata->getReference(); - - foreach ($providerSignature->getActions() as $actionInfo) { - - $actionName = $actionInfo->getName(); - - // check to see if this action name is valid - if (($foundActionIndex = array_search($actionName, $displayActionNames)) === false) { - continue; - } else { - $actionMetadata = $displayActionMetadatas[$foundActionIndex]; - } - - $specialtyMetadata = $manifest->getMetadata(array( - 'type' => 'Tool', - 'name' => 'specialtyName', - 'providerName' => $providerName, - 'specialtyName' => '_Global', - 'clientName' => 'console' - )); - - // lets do the main _Global action first - $actionableGlobalLongParamMetadata = $manifest->getMetadata(array( - 'type' => 'Tool', - 'name' => 'actionableMethodLongParams', - 'providerName' => $providerName, - 'specialtyName' => '_Global', - 'actionName' => $actionName, - 'clientName' => 'console' - )); - - $actionableGlobalMetadatas = $manifest->getMetadatas(array( - 'type' => 'Tool', - 'name' => 'actionableMethodLongParams', - 'providerName' => $providerName, - 'actionName' => $actionName, - 'clientName' => 'console' - )); - - if ($actionableGlobalLongParamMetadata) { - - if (!$providerNameDisplayed) { - $this->_respondWithProviderName($providerMetadata); - $providerNameDisplayed = true; - } - - $this->_respondWithCommand($providerMetadata, $actionMetadata, $specialtyMetadata, $actionableGlobalLongParamMetadata); - - $actionIsGlobal = true; - } else { - $actionIsGlobal = false; - } - - // check for providers without a _Global action - $isSingleSpecialProviderAction = false; - if (!$actionIsGlobal && count($actionableGlobalMetadatas) == 1) { - $isSingleSpecialProviderAction = true; - $this->_respondWithProviderName($providerMetadata); - $providerNameDisplayed = true; - } - - if ($includeAllSpecialties || $isSingleSpecialProviderAction) { - - foreach ($providerSignature->getSpecialties() as $specialtyName) { - - if ($specialtyName == '_Global') { - continue; - } - - $specialtyMetadata = $manifest->getMetadata(array( - 'type' => 'Tool', - 'name' => 'specialtyName', - 'providerName' => $providerMetadata->getProviderName(), - 'specialtyName' => $specialtyName, - 'clientName' => 'console' - )); - - $actionableSpecialtyLongMetadata = $manifest->getMetadata(array( - 'type' => 'Tool', - 'name' => 'actionableMethodLongParams', - 'providerName' => $providerMetadata->getProviderName(), - 'specialtyName' => $specialtyName, - 'actionName' => $actionName, - 'clientName' => 'console' - )); - - if($actionableSpecialtyLongMetadata) { - $this->_respondWithCommand($providerMetadata, $actionMetadata, $specialtyMetadata, $actionableSpecialtyLongMetadata); - } - - } - } - - // reset the special flag for single provider action with specialty - $isSingleSpecialProviderAction = false; - - if (!$includeAllSpecialties && count($actionableGlobalMetadatas) > 1) { - $this->_response->appendContent(' Note: There are specialties, use ', array('color' => 'yellow', 'separator' => false)); - $this->_response->appendContent( - 'zf ' . $actionMetadata->getValue() . ' ' . $providerMetadata->getValue() . '.?', - array('color' => 'cyan', 'separator' => false) - ); - $this->_response->appendContent(' to get specific help on them.', array('color' => 'yellow')); - } - - } - - if ($providerNameDisplayed) { - $this->_response->appendContent(null, array('separator' => true)); - } - } - return $this; - } - - /** - * _respondWithProviderName() - * - * @param Zend_Tool_Framework_Metadata_Tool $providerMetadata - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - protected function _respondWithProviderName(Zend_Tool_Framework_Metadata_Tool $providerMetadata) - { - $this->_response->appendContent(' ' . $providerMetadata->getProviderName()); - return $this; - } - - /** - * _respondWithCommand() - * - * @param Zend_Tool_Framework_Metadata_Tool $providerMetadata - * @param Zend_Tool_Framework_Metadata_Tool $actionMetadata - * @param Zend_Tool_Framework_Metadata_Tool $specialtyMetadata - * @param Zend_Tool_Framework_Metadata_Tool $parameterLongMetadata - * @return Zend_Tool_Framework_Client_Console_HelpSystem - */ - protected function _respondWithCommand( - Zend_Tool_Framework_Metadata_Tool $providerMetadata, - Zend_Tool_Framework_Metadata_Tool $actionMetadata, - Zend_Tool_Framework_Metadata_Tool $specialtyMetadata, - Zend_Tool_Framework_Metadata_Tool $parameterLongMetadata)//, - //Zend_Tool_Framework_Metadata_Tool $parameterShortMetadata) - { - $this->_response->appendContent( - ' zf ' . $actionMetadata->getValue() . ' ' . $providerMetadata->getValue(), - array('color' => 'cyan', 'separator' => false) - ); - - if ($specialtyMetadata->getSpecialtyName() != '_Global') { - $this->_response->appendContent('.' . $specialtyMetadata->getValue(), array('color' => 'cyan', 'separator' => false)); - } - - foreach ($parameterLongMetadata->getValue() as $paramName => $consoleParamName) { - $methodInfo = $parameterLongMetadata->getReference(); - $paramString = ' ' . $consoleParamName; - if ( ($defaultValue = $methodInfo['parameterInfo'][$paramName]['default']) != null) { - $paramString .= '[=' . $defaultValue . ']'; - } - $this->_response->appendContent($paramString . '', array('separator' => false)); - } - - $this->_response->appendContent(null, array('separator' => true)); - return $this; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Console/Manifest.php b/library/vendor/Zend/Tool/Framework/Client/Console/Manifest.php deleted file mode 100644 index db592db93..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Console/Manifest.php +++ /dev/null @@ -1,209 +0,0 @@ -_registry = $registry; - return $this; - } - - /** - * getMetadata() is required by the Manifest Interface. - * - * These are the following metadatas that will be setup: - * - * actionName - * - metadata for actions - * - value will be a dashed name for the action named in 'actionName' - * providerName - * - metadata for providers - * - value will be a dashed-name for the provider named in 'providerName' - * providerSpecialtyNames - * - metadata for providers - * actionableMethodLongParameters - * - metadata for providers - * actionableMethodShortParameters - * - metadata for providers - * - * @return array Array of Metadatas - */ - public function getMetadata() - { - $metadatas = array(); - - // setup the camelCase to dashed filter to use since cli expects dashed named - $ccToDashedFilter = new Zend_Filter(); - $ccToDashedFilter - ->addFilter(new Zend_Filter_Word_CamelCaseToDash()) - ->addFilter(new Zend_Filter_StringToLower()); - - // get the registry to get the action and provider repository - $actionRepository = $this->_registry->getActionRepository(); - $providerRepository = $this->_registry->getProviderRepository(); - - // loop through all actions and create a metadata for each - foreach ($actionRepository->getActions() as $action) { - // each action metadata will be called - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'actionName', - 'value' => $ccToDashedFilter->filter($action->getName()), - 'reference' => $action, - 'actionName' => $action->getName(), - 'clientName' => 'console', - 'clientReference' => $this->_registry->getClient() - )); - } - - foreach ($providerRepository->getProviderSignatures() as $providerSignature) { - - // create the metadata for the provider's cliProviderName - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'providerName', - 'value' => $ccToDashedFilter->filter($providerSignature->getName()), - 'reference' => $providerSignature, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'clientReference' => $this->_registry->getClient() - )); - - // create the metadatas for the per provider specialites in providerSpecaltyNames - foreach ($providerSignature->getSpecialties() as $specialty) { - - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'specialtyName', - 'value' => $ccToDashedFilter->filter($specialty), - 'reference' => $providerSignature, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $specialty, - 'clientReference' => $this->_registry->getClient() - )); - - } - - // $actionableMethod is keyed by the methodName (but not used) - foreach ($providerSignature->getActionableMethods() as $actionableMethodData) { - - $methodLongParams = array(); - $methodShortParams = array(); - - // $actionableMethodData get both the long and short names - foreach ($actionableMethodData['parameterInfo'] as $parameterInfoData) { - - // filter to dashed - $methodLongParams[$parameterInfoData['name']] = $ccToDashedFilter->filter($parameterInfoData['name']); - - // simply lower the character, (its only 1 char after all) - $methodShortParams[$parameterInfoData['name']] = strtolower($parameterInfoData['name'][0]); - - } - - // create metadata for the long name cliActionableMethodLongParameters - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'actionableMethodLongParams', - 'value' => $methodLongParams, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $actionableMethodData['specialty'], - 'actionName' => $actionableMethodData['actionName'], - 'reference' => &$actionableMethodData, - 'clientReference' => $this->_registry->getClient() - )); - - // create metadata for the short name cliActionableMethodShortParameters - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'actionableMethodShortParams', - 'value' => $methodShortParams, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $actionableMethodData['specialty'], - 'actionName' => $actionableMethodData['actionName'], - 'reference' => &$actionableMethodData, - 'clientReference' => $this->_registry->getClient() - )); - - } - - } - - return $metadatas; - } - - public function getIndex() - { - return 10000; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/AlignCenter.php b/library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/AlignCenter.php deleted file mode 100644 index 09285d24e..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/AlignCenter.php +++ /dev/null @@ -1,66 +0,0 @@ - '30m', - 'hiBlack' => '1;30m', - 'bgBlack' => '40m', - // reds - 'red' => '31m', - 'hiRed' => '1;31m', - 'bgRed' => '41m', - // greens - 'green' => '32m', - 'hiGreen' => '1;32m', - 'bgGreen' => '42m', - // yellows - 'yellow' => '33m', - 'hiYellow' => '1;33m', - 'bgYellow' => '43m', - // blues - 'blue' => '34m', - 'hiBlue' => '1;34m', - 'bgBlue' => '44m', - // magentas - 'magenta' => '35m', - 'hiMagenta' => '1;35m', - 'bgMagenta' => '45m', - // cyans - 'cyan' => '36m', - 'hiCyan' => '1;36m', - 'bgCyan' => '46m', - // whites - 'white' => '37m', - 'hiWhite' => '1;37m', - 'bgWhite' => '47m' - ); - - public function getName() - { - return 'color'; - } - - public function decorate($content, $color) - { - if (is_string($color)) { - $color = array($color); - } - - $newContent = ''; - - foreach ($color as $c) { - if (array_key_exists($c, $this->_colorOptions)) { - $newContent .= "\033[" . $this->_colorOptions[$c]; - } - } - - $newContent .= $content . "\033[m"; - - return $newContent; - } - - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/Indention.php b/library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/Indention.php deleted file mode 100644 index a1372af97..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Console/ResponseDecorator/Indention.php +++ /dev/null @@ -1,56 +0,0 @@ -_client = $client; - return $this; - } - - public function setInputRequest($inputRequest) - { - if (is_string($inputRequest)) { - require_once 'Zend/Tool/Framework/Client/Interactive/InputRequest.php'; - $inputRequest = new Zend_Tool_Framework_Client_Interactive_InputRequest($inputRequest); - } elseif (!$inputRequest instanceof Zend_Tool_Framework_Client_Interactive_InputRequest) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('promptInteractive() requires either a string or an instance of Zend_Tool_Framework_Client_Interactive_InputRequest.'); - } - - $this->_inputRequest = $inputRequest; - return $this; - } - - public function handle() - { - $inputResponse = $this->_client->handleInteractiveInputRequest($this->_inputRequest); - - if (is_string($inputResponse)) { - require_once 'Zend/Tool/Framework/Client/Interactive/InputResponse.php'; - $inputResponse = new Zend_Tool_Framework_Client_Interactive_InputResponse($inputResponse); - } elseif (!$inputResponse instanceof Zend_Tool_Framework_Client_Interactive_InputResponse) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('The registered $_interactiveCallback for the client must either return a string or an instance of Zend_Tool_Framework_Client_Interactive_InputResponse.'); - } - - return $inputResponse; - } - - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Interactive/InputInterface.php b/library/vendor/Zend/Tool/Framework/Client/Interactive/InputInterface.php deleted file mode 100644 index a12a833b5..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Interactive/InputInterface.php +++ /dev/null @@ -1,41 +0,0 @@ -setContent($content); - } - } - - public function setContent($content) - { - $this->_content = $content; - return $this; - } - - public function getContent() - { - return $this->_content; - } - - public function __toString() - { - return $this->_content; - } -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Interactive/InputResponse.php b/library/vendor/Zend/Tool/Framework/Client/Interactive/InputResponse.php deleted file mode 100644 index 5a6804385..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Interactive/InputResponse.php +++ /dev/null @@ -1,52 +0,0 @@ -setContent($content); - } - } - - public function setContent($content) - { - $this->_content = $content; - return $this; - } - - public function getContent() - { - return $this->_content; - } - - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Interactive/OutputInterface.php b/library/vendor/Zend/Tool/Framework/Client/Interactive/OutputInterface.php deleted file mode 100644 index 03ecfcc48..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Interactive/OutputInterface.php +++ /dev/null @@ -1,33 +0,0 @@ -_registry = $registry; - return $this; - } - - /** - * getMetadata() is required by the Manifest Interface. - * - * These are the following metadatas that will be setup: - * - * normalizedActionName - * - metadata for actions - * - value will be a dashed name for the action named in 'actionName' - * normalizedProviderName - * - metadata for providers - * - value will be a dashed-name for the provider named in 'providerName' - * normalizedProviderSpecialtyNames - * - metadata for providers - * normalizedActionableMethodLongParameters - * - metadata for providers - * normalizedActionableMethodShortParameters - * - metadata for providers - * - * @return array Array of Metadatas - */ - public function getMetadata() - { - $metadatas = array(); - - // setup the camelCase to dashed filter to use since cli expects dashed named - $lowerFilter = new Zend_Filter(); - $lowerFilter->addFilter(new Zend_Filter_StringToLower()); - - // get the registry to get the action and provider repository - $actionRepository = $this->_registry->getActionRepository(); - $providerRepository = $this->_registry->getProviderRepository(); - - // loop through all actions and create a metadata for each - foreach ($actionRepository->getActions() as $action) { - // each action metadata will be called - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'normalizedActionName', - 'value' => $lowerFilter->filter($action->getName()), - 'reference' => $action, - 'actionName' => $action->getName(), - 'clientName' => 'all' - )); - } - - foreach ($providerRepository->getProviderSignatures() as $providerSignature) { - - // create the metadata for the provider's cliProviderName - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'normalizedProviderName', - 'value' => $lowerFilter->filter($providerSignature->getName()), - 'reference' => $providerSignature, - 'clientName' => 'all', - 'providerName' => $providerSignature->getName() - )); - - // create the metadatas for the per provider specialites in providerSpecaltyNames - foreach ($providerSignature->getSpecialties() as $specialty) { - - if ($specialty == '_Global') { - continue; - } - - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'normalizedSpecialtyName', - 'value' => $lowerFilter->filter($specialty), - 'reference' => $providerSignature, - 'clientName' => 'all', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $specialty - )); - - } - - // $actionableMethod is keyed by the methodName (but not used) - foreach ($providerSignature->getActionableMethods() as $actionableMethodData) { - - $methodLongParams = array(); - $methodShortParams = array(); - - // $actionableMethodData get both the long and short names - foreach ($actionableMethodData['parameterInfo'] as $parameterInfoData) { - - // filter to dashed - $methodLongParams[$parameterInfoData['name']] = $lowerFilter->filter($parameterInfoData['name']); - - // simply lower the character, (its only 1 char after all) - $methodShortParams[$parameterInfoData['name']] = strtolower($parameterInfoData['name'][0]); - - } - - // create metadata for the long name cliActionableMethodLongParameters - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'normalizedActionableMethodLongParams', - 'value' => $methodLongParams, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $actionableMethodData['specialty'], - 'actionName' => $actionableMethodData['actionName'], - 'reference' => &$actionableMethodData - )); - - // create metadata for the short name cliActionableMethodShortParameters - $metadatas[] = new Zend_Tool_Framework_Metadata_Tool(array( - 'name' => 'normalizedActionableMethodShortParams', - 'value' => $methodShortParams, - 'clientName' => 'console', - 'providerName' => $providerSignature->getName(), - 'specialtyName' => $actionableMethodData['specialty'], - 'actionName' => $actionableMethodData['actionName'], - 'reference' => &$actionableMethodData - )); - - } - - } - - return $metadatas; - } - - public function getIndex() - { - return 100000; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Request.php b/library/vendor/Zend/Tool/Framework/Client/Request.php deleted file mode 100644 index c3896c680..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Request.php +++ /dev/null @@ -1,299 +0,0 @@ -_providerName = $providerName; - return $this; - } - - /** - * getProviderName() - * - * @return string - */ - public function getProviderName() - { - return $this->_providerName; - } - - /** - * setSpecialtyName() - * - * @param string $specialtyName - * @return Zend_Tool_Framework_Client_Request - */ - public function setSpecialtyName($specialtyName) - { - $this->_specialtyName = $specialtyName; - return $this; - } - - /** - * getSpecialtyName() - * - * @return string - */ - public function getSpecialtyName() - { - return $this->_specialtyName; - } - - /** - * setActionName() - * - * @param string $actionName - * @return Zend_Tool_Framework_Client_Request - */ - public function setActionName($actionName) - { - $this->_actionName = $actionName; - return $this; - } - - /** - * getActionName() - * - * @return string - */ - public function getActionName() - { - return $this->_actionName; - } - - /** - * setActionParameter() - * - * @param string $parameterName - * @param string $parameterValue - * @return Zend_Tool_Framework_Client_Request - */ - public function setActionParameter($parameterName, $parameterValue) - { - $this->_actionParameters[$parameterName] = $parameterValue; - return $this; - } - - /** - * getActionParameters() - * - * @return array - */ - public function getActionParameters() - { - return $this->_actionParameters; - } - - /** - * getActionParameter() - * - * @param string $parameterName - * @return string - */ - public function getActionParameter($parameterName) - { - return (isset($this->_actionParameters[$parameterName])) ? $this->_actionParameters[$parameterName] : null; - } - - /** - * setProviderParameter() - * - * @param string $parameterName - * @param string $parameterValue - * @return Zend_Tool_Framework_Client_Request - */ - public function setProviderParameter($parameterName, $parameterValue) - { - $this->_providerParameters[$parameterName] = $parameterValue; - return $this; - } - - /** - * getProviderParameters() - * - * @return array - */ - public function getProviderParameters() - { - return $this->_providerParameters; - } - - /** - * getProviderParameter() - * - * @param string $parameterName - * @return string - */ - public function getProviderParameter($parameterName) - { - return (isset($this->_providerParameters[$parameterName])) ? $this->_providerParameters[$parameterName] : null; - } - - /** - * setPretend() - * - * @param bool $pretend - * @return Zend_Tool_Framework_Client_Request - */ - public function setPretend($pretend) - { - $this->_isPretend = (bool) $pretend; - return $this; - } - - /** - * isPretend() - Whether or not this is a pretend request - * - * @return bool - */ - public function isPretend() - { - return $this->_isPretend; - } - - /** - * setDebug() - * - * @param bool $pretend - * @return Zend_Tool_Framework_Client_Request - */ - public function setDebug($debug) - { - $this->_isDebug = (bool) $debug; - return $this; - } - - /** - * isDebug() - Whether or not this is a debug enabled request - * - * @return bool - */ - public function isDebug() - { - return $this->_isDebug; - } - - /** - * setVerbose() - * - * @param bool $verbose - * @return Zend_Tool_Framework_Client_Request - */ - public function setVerbose($verbose) - { - $this->_isVerbose = (bool) $verbose; - return $this; - } - - /** - * isVerbose() - Whether or not this is a verbose enabled request - * - * @return bool - */ - public function isVerbose() - { - return $this->_isVerbose; - } - - /** - * setDispatchable() - * - * @param bool $dispatchable - * @return Zend_Tool_Framework_Client_Request - */ - public function setDispatchable($dispatchable) - { - $this->_isDispatchable = (bool) $dispatchable; - return $this; - } - - /** - * isDispatchable() Is this request Dispatchable? - * - * @return bool - */ - public function isDispatchable() - { - return $this->_isDispatchable; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Response.php b/library/vendor/Zend/Tool/Framework/Client/Response.php deleted file mode 100644 index 97998da89..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Response.php +++ /dev/null @@ -1,223 +0,0 @@ -_callback = $callback; - return $this; - } - - /** - * setContent() - * - * @param string $content - * @return Zend_Tool_Framework_Client_Response - */ - public function setContent($content, Array $decoratorOptions = array()) - { - $content = $this->_applyDecorators($content, $decoratorOptions); - - $this->_content = array(); - $this->appendContent($content); - return $this; - } - - /** - * appendCallback - * - * @param string $content - * @return Zend_Tool_Framework_Client_Response - */ - public function appendContent($content, Array $decoratorOptions = array()) - { - $content = $this->_applyDecorators($content, $decoratorOptions); - - if ($this->_callback !== null) { - call_user_func($this->_callback, $content); - } - - $this->_content[] = $content; - - return $this; - } - - /** - * setDefaultDecoratorOptions() - * - * @param array $decoratorOptions - * @param bool $mergeIntoExisting - * @return Zend_Tool_Framework_Client_Response - */ - public function setDefaultDecoratorOptions(Array $decoratorOptions, $mergeIntoExisting = false) - { - if ($mergeIntoExisting == false) { - $this->_defaultDecoratorOptions = array(); - } - - $this->_defaultDecoratorOptions = array_merge($this->_defaultDecoratorOptions, $decoratorOptions); - return $this; - } - - /** - * getContent() - * - * @return string - */ - public function getContent() - { - return implode('', $this->_content); - } - - /** - * isException() - * - * @return bool - */ - public function isException() - { - return isset($this->_exception); - } - - /** - * setException() - * - * @param Exception $exception - * @return Zend_Tool_Framework_Client_Response - */ - public function setException(Exception $exception) - { - $this->_exception = $exception; - return $this; - } - - /** - * getException() - * - * @return Exception - */ - public function getException() - { - return $this->_exception; - } - - /** - * Add Content Decorator - * - * @param Zend_Tool_Framework_Client_Response_ContentDecorator_Interface $contentDecorator - * @return unknown - */ - public function addContentDecorator(Zend_Tool_Framework_Client_Response_ContentDecorator_Interface $contentDecorator) - { - $decoratorName = strtolower($contentDecorator->getName()); - $this->_decorators[$decoratorName] = $contentDecorator; - return $this; - } - - /** - * getContentDecorators() - * - * @return array - */ - public function getContentDecorators() - { - return $this->_decorators; - } - - /** - * __toString() to cast to a string - * - * @return string - */ - public function __toString() - { - return (string) implode('', $this->_content); - } - - /** - * _applyDecorators() apply a group of decorators - * - * @param string $content - * @param array $decoratorOptions - * @return string - */ - protected function _applyDecorators($content, Array $decoratorOptions) - { - $options = array_merge($this->_defaultDecoratorOptions, $decoratorOptions); - - $options = array_change_key_case($options, CASE_LOWER); - - if ($options) { - foreach ($this->_decorators as $decoratorName => $decorator) { - if (array_key_exists($decoratorName, $options)) { - $content = $decorator->decorate($content, $options[$decoratorName]); - } - } - } - - return $content; - - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Response/ContentDecorator/Interface.php b/library/vendor/Zend/Tool/Framework/Client/Response/ContentDecorator/Interface.php deleted file mode 100644 index ec29803da..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Response/ContentDecorator/Interface.php +++ /dev/null @@ -1,35 +0,0 @@ -_separator = $separator; - return $this; - } - - /** - * getSeparator() - * - * @return string - */ - public function getSeparator() - { - return $this->_separator; - } - - public function decorate($content, $decoratorValue) - { - $run = 1; - if (is_bool($decoratorValue) && $decoratorValue === false) { - return $content; - } - - if (is_int($decoratorValue)) { - $run = $decoratorValue; - } - - for ($i = 0; $i < $run; $i++) { - $content .= $this->_separator; - } - - return $content; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Storage.php b/library/vendor/Zend/Tool/Framework/Client/Storage.php deleted file mode 100644 index 1d4ebe205..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Storage.php +++ /dev/null @@ -1,117 +0,0 @@ -setAdapter($options['adapter']); - } - } - - public function setAdapter($adapter) - { - if (is_string($adapter)) { - $storageAdapterClass = 'Zend_Tool_Framework_Client_Storage_' . ucfirst($adapter); - Zend_Loader::loadClass($storageAdapterClass); - $adapter = new $storageAdapterClass(); - } - $this->_adapter = $adapter; - } - - public function isEnabled() - { - return ($this->_adapter instanceof Zend_Tool_Framework_Client_Storage_AdapterInterface); - } - - public function put($name, $value) - { - if (!$this->_adapter) { - return false; - } - - $this->_adapter->put($name, $value); - - return $this; - } - - public function get($name, $defaultValue = false) - { - if (!$this->_adapter) { - return false; - } - - if ($this->_adapter->has($name)) { - return $this->_adapter->get($name); - } else { - return $defaultValue; - } - - } - - public function has($name) - { - if (!$this->_adapter) { - return false; - } - - return $this->_adapter->has($name); - } - - public function remove($name) - { - if (!$this->_adapter) { - return false; - } - - $this->_adapter->remove($name); - - return $this; - } - - public function getStreamUri($name) - { - if (!$this->_adapter) { - return false; - } - - return $this->_adapter->getStreamUri($name); - } -} diff --git a/library/vendor/Zend/Tool/Framework/Client/Storage/AdapterInterface.php b/library/vendor/Zend/Tool/Framework/Client/Storage/AdapterInterface.php deleted file mode 100644 index e3e717ab9..000000000 --- a/library/vendor/Zend/Tool/Framework/Client/Storage/AdapterInterface.php +++ /dev/null @@ -1,42 +0,0 @@ -_directoryPath = $directoryPath; - } - - public function put($name, $value) - { - return file_put_contents($this->_directoryPath . DIRECTORY_SEPARATOR . $name, $value); - } - - public function get($name) - { - return file_get_contents($this->_directoryPath . DIRECTORY_SEPARATOR . $name); - } - - public function has($name) - { - return file_exists($this->_directoryPath . DIRECTORY_SEPARATOR . $name); - } - - public function remove($name) - { - return unlink($this->_directoryPath . DIRECTORY_SEPARATOR . $name); - } - - public function getStreamUri($name) - { - return $this->_directoryPath . DIRECTORY_SEPARATOR . $name; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Exception.php b/library/vendor/Zend/Tool/Framework/Exception.php deleted file mode 100644 index 970243c9d..000000000 --- a/library/vendor/Zend/Tool/Framework/Exception.php +++ /dev/null @@ -1,36 +0,0 @@ -_registry = $registry; - return $this; - } - - /** - * load() - called by the client initialize routine to load files - * - */ - public function load() - { - $this->_retrievedFiles = $this->getRetrievedFiles(); - $this->_loadedClasses = array(); - - $manifestRepository = $this->_registry->getManifestRepository(); - $providerRepository = $this->_registry->getProviderRepository(); - - $loadedClasses = array(); - - // loop through files and find the classes declared by loading the file - foreach ($this->_retrievedFiles as $file) { - if(is_dir($file)) { - continue; - } - - $classesLoadedBefore = get_declared_classes(); - $oldLevel = error_reporting(E_ALL | ~E_STRICT); // remove strict so that other packages wont throw warnings - // should we lint the files here? i think so - include_once $file; - error_reporting($oldLevel); // restore old error level - $classesLoadedAfter = get_declared_classes(); - $loadedClasses = array_merge($loadedClasses, array_diff($classesLoadedAfter, $classesLoadedBefore)); - } - - // loop through the loaded classes and ensure that - foreach ($loadedClasses as $loadedClass) { - - // reflect class to see if its something we want to load - $reflectionClass = new ReflectionClass($loadedClass); - if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface') - && !$reflectionClass->isAbstract()) - { - $manifestRepository->addManifest($reflectionClass->newInstance()); - $this->_loadedClasses[] = $loadedClass; - } - - if ($reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface') - && !$reflectionClass->isAbstract() - && !$providerRepository->hasProvider($reflectionClass->getName(), false)) - { - $providerRepository->addProvider($reflectionClass->newInstance()); - $this->_loadedClasses[] = $loadedClass; - } - - } - - return $this->_loadedClasses; - } - - /** - * getRetrievedFiles() - * - * @return array Array of Files Retrieved - */ - public function getRetrievedFiles() - { - if ($this->_retrievedFiles == null) { - $this->_retrievedFiles = $this->_getFiles(); - } - - return $this->_retrievedFiles; - } - - /** - * getLoadedClasses() - * - * @return array Array of Loaded Classes - */ - public function getLoadedClasses() - { - return $this->_loadedClasses; - } - - -} diff --git a/library/vendor/Zend/Tool/Framework/Loader/BasicLoader.php b/library/vendor/Zend/Tool/Framework/Loader/BasicLoader.php deleted file mode 100644 index d65921c45..000000000 --- a/library/vendor/Zend/Tool/Framework/Loader/BasicLoader.php +++ /dev/null @@ -1,157 +0,0 @@ -setOptions($options); - } - } - - public function setOptions(Array $options) - { - foreach ($options as $optionName => $optionValue) { - $setMethod = 'set' . $optionName; - if (method_exists($this, $setMethod)) { - $this->{$setMethod}($optionValue); - } - } - } - - /** - * setRegistry() - required by the enabled interface to get an instance of - * the registry - * - * @param Zend_Tool_Framework_Registry_Interface $registry - * @return Zend_Tool_Framework_Loader_Abstract - */ - public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) - { - $this->_registry = $registry; - return $this; - } - - /** - * @param array $classesToLoad - * @return Zend_Tool_Framework_Loader_Abstract - */ - public function setClassesToLoad(array $classesToLoad) - { - $this->_classesToLoad = $classesToLoad; - return $this; - } - - public function load() - { - $manifestRegistry = $this->_registry->getManifestRepository(); - $providerRegistry = $this->_registry->getProviderRepository(); - - $loadedClasses = array(); - - // loop through the loaded classes and ensure that - foreach ($this->_classesToLoad as $class) { - - if (!class_exists($class)) { - Zend_Loader::loadClass($class); - } - - // reflect class to see if its something we want to load - $reflectionClass = new ReflectionClass($class); - if ($this->_isManifestImplementation($reflectionClass)) { - $manifestRegistry->addManifest($reflectionClass->newInstance()); - $loadedClasses[] = $class; - } - - if ($this->_isProviderImplementation($reflectionClass)) { - $providerRegistry->addProvider($reflectionClass->newInstance()); - $loadedClasses[] = $class; - } - - } - - return $loadedClasses; - } - - /** - * @param ReflectionClass $reflectionClass - * @return bool - */ - private function _isManifestImplementation($reflectionClass) - { - return ( - $reflectionClass->implementsInterface('Zend_Tool_Framework_Manifest_Interface') - && !$reflectionClass->isAbstract() - ); - } - - /** - * @param ReflectionClass $reflectionClass - * @return bool - */ - private function _isProviderImplementation($reflectionClass) - { - $providerRegistry = $this->_registry->getProviderRepository(); - - return ( - $reflectionClass->implementsInterface('Zend_Tool_Framework_Provider_Interface') - && !$reflectionClass->isAbstract() - && !$providerRegistry->hasProvider($reflectionClass->getName(), false) - ); - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Loader/IncludePathLoader.php b/library/vendor/Zend/Tool/Framework/Loader/IncludePathLoader.php deleted file mode 100644 index 237483538..000000000 --- a/library/vendor/Zend/Tool/Framework/Loader/IncludePathLoader.php +++ /dev/null @@ -1,139 +0,0 @@ -_fileIsBlacklisted($file)) { - continue; - } - - // ensure that the same named file from separate include_paths is not loaded - $relativeItem = preg_replace('#^' . preg_quote($realIncludePath . DIRECTORY_SEPARATOR, '#') . '#', '', $item->getRealPath()); - - // no links allowed here for now - if ($item->isLink()) { - continue; - } - - // no items that are relavitely the same are allowed - if (in_array($relativeItem, $relativeItems)) { - continue; - } - - $relativeItems[] = $relativeItem; - $files[] = $item->getRealPath(); - } - } - - return $files; - } - - /** - * - * @param string $file - * @return bool - */ - protected function _fileIsBlacklisted($file) - { - $blacklist = array( - "PHPUnit".DIRECTORY_SEPARATOR."Framework", - "Zend".DIRECTORY_SEPARATOR."OpenId".DIRECTORY_SEPARATOR."Provider" - ); - - foreach($blacklist AS $blacklitedPattern) { - if(strpos($file, $blacklitedPattern) !== false) { - return true; - } - } - return false; - } -} diff --git a/library/vendor/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php b/library/vendor/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php deleted file mode 100644 index 50c9c7409..000000000 --- a/library/vendor/Zend/Tool/Framework/Loader/IncludePathLoader/RecursiveFilterIterator.php +++ /dev/null @@ -1,91 +0,0 @@ -_denyDirectoryPattern = $denyDirectoryPattern; - $this->_acceptFilePattern = $acceptFilePattern; - parent::__construct($iterator); - } - - /** - * accept() - Which iterable items to accept or deny, required by FilterInterface - * - * @return unknown - */ - public function accept() - { - $currentNode = $this->current(); - $currentNodeRealPath = $currentNode->getRealPath(); - - // if the current node is a directory AND doesn't match the denyDirectory pattern, accept - if ($currentNode->isDir() - && !preg_match('#' . $this->_denyDirectoryPattern . '#', $currentNodeRealPath)) { - return true; - } - - // if the file matches the accept file pattern, accept - $acceptable = (preg_match('#' . $this->_acceptFilePattern . '#', $currentNodeRealPath)) ? true : false; - return $acceptable; - } - - /** - * getChildren() - overridden from RecursiveFilterIterator to allow the persistence of - * the $_denyDirectoryPattern and the $_acceptFilePattern when sub iterators of this filter - * are needed to be created. - * - * @return Zend_Tool_Framework_Loader_IncludePathLoader_RecursiveFilterIterator - */ - public function getChildren() - { - if (empty($this->ref)) { - $this->ref = new ReflectionClass($this); - } - - return $this->ref->newInstance( - $this->getInnerIterator()->getChildren(), - $this->_denyDirectoryPattern, - $this->_acceptFilePattern - ); - } - -} - diff --git a/library/vendor/Zend/Tool/Framework/Loader/Interface.php b/library/vendor/Zend/Tool/Framework/Loader/Interface.php deleted file mode 100644 index f734a7cc1..000000000 --- a/library/vendor/Zend/Tool/Framework/Loader/Interface.php +++ /dev/null @@ -1,42 +0,0 @@ -_registry = $registry; - return $this; - } - - /** - * addManifest() - Add a manifest for later processing - * - * @param Zend_Tool_Framework_Manifest_Interface $manifest - * @return Zend_Tool_Framework_Manifest_Repository - */ - public function addManifest(Zend_Tool_Framework_Manifest_Interface $manifest) - { - // we need to get an index number so that manifests with - // higher indexes have priority over others - $index = count($this->_manifests); - - if ($manifest instanceof Zend_Tool_Framework_Registry_EnabledInterface) { - $manifest->setRegistry($this->_registry); - } - - // if the manifest supplies a getIndex() method, use it - if ($manifest instanceof Zend_Tool_Framework_Manifest_Indexable) { - $index = $manifest->getIndex(); - } - - // get the required objects from the framework registry - $actionRepository = $this->_registry->getActionRepository(); - $providerRepository = $this->_registry->getProviderRepository(); - - // load providers if interface supports that method - if ($manifest instanceof Zend_Tool_Framework_Manifest_ProviderManifestable) { - $providers = $manifest->getProviders(); - if (!is_array($providers)) { - $providers = array($providers); - } - - foreach ($providers as $provider) { - - // if provider is a string, try and load it as an object - if (is_string($provider)) { - $provider = new $provider(); - } - - if (!$provider instanceof Zend_Tool_Framework_Provider_Interface) { - require_once 'Zend/Tool/Framework/Manifest/Exception.php'; - throw new Zend_Tool_Framework_Manifest_Exception( - 'A provider provided by the ' . get_class($manifest) - . ' does not implement Zend_Tool_Framework_Provider_Interface' - ); - } - if (!$providerRepository->hasProvider($provider, false)) { - $providerRepository->addProvider($provider); - } - } - - } - - // load actions if interface supports that method - if ($manifest instanceof Zend_Tool_Framework_Manifest_ActionManifestable) { - $actions = $manifest->getActions(); - if (!is_array($actions)) { - $actions = array($actions); - } - - foreach ($actions as $action) { - if (is_string($action)) { - $action = new Zend_Tool_Framework_Action_Base($action); - } - $actionRepository->addAction($action); - } - } - - // should we detect collisions here? does it even matter? - $this->_manifests[$index] = $manifest; - ksort($this->_manifests); - - return $this; - } - - /** - * getManifests() - * - * @return Zend_Tool_Framework_Manifest_Interface[] - */ - public function getManifests() - { - return $this->_manifests; - } - - /** - * addMetadata() - add a metadata peice by peice - * - * @param Zend_Tool_Framework_Manifest_Metadata $metadata - * @return Zend_Tool_Framework_Manifest_Repository - */ - public function addMetadata(Zend_Tool_Framework_Metadata_Interface $metadata) - { - $this->_metadatas[] = $metadata; - return $this; - } - - /** - * process() - Process is expected to be called at the end of client construction time. - * By this time, the loader has run and loaded any found manifests into the repository - * for loading - * - * @return Zend_Tool_Framework_Manifest_Repository - */ - public function process() - { - - foreach ($this->_manifests as $manifest) { - if ($manifest instanceof Zend_Tool_Framework_Manifest_MetadataManifestable) { - $metadatas = $manifest->getMetadata(); - if (!is_array($metadatas)) { - $metadatas = array($metadatas); - } - - foreach ($metadatas as $metadata) { - if (is_array($metadata)) { - if (!class_exists('Zend_Tool_Framework_Metadata_Dynamic')) { - require_once 'Zend/Tool/Framework/Metadata/Dynamic.php'; - } - $metadata = new Zend_Tool_Framework_Metadata_Dynamic($metadata); - } - - if (!$metadata instanceof Zend_Tool_Framework_Metadata_Interface) { - require_once 'Zend/Tool/Framework/Manifest/Exception.php'; - throw new Zend_Tool_Framework_Manifest_Exception( - 'A Zend_Tool_Framework_Metadata_Interface object was not found in manifest ' . get_class($manifest) - ); - } - - $this->addMetadata($metadata); - } - - } - } - - return $this; - } - - /** - * getMetadatas() - This is the main search function for the repository. - * - * example: This will retrieve all metadata that matches the following criteria - * $manifestRepo->getMetadatas(array( - * 'providerName' => 'Version', - * 'actionName' => 'show' - * )); - * - * @param array $searchProperties - * @param bool $includeNonExistentProperties - * @return Zend_Tool_Framework_Manifest_Metadata[] - */ - public function getMetadatas(Array $searchProperties = array(), $includeNonExistentProperties = true) - { - - $returnMetadatas = array(); - - // loop through the metadatas so that we can search each individual one - foreach ($this->_metadatas as $metadata) { - - // each value will be retrieved from the metadata, each metadata should - // implement a getter method to retrieve the value - foreach ($searchProperties as $searchPropertyName => $searchPropertyValue) { - if (method_exists($metadata, 'get' . $searchPropertyName)) { - if ($metadata->{'get' . $searchPropertyName}() != $searchPropertyValue) { - // if the metadata supports a specific property but the value does not - // match, move on - continue 2; - } - } elseif (!$includeNonExistentProperties) { - // if the option $includeNonExitentProperties is false, then move on as - // we dont want to include this metadata if non existent - // search properties are not inside the target (current) metadata - continue 2; - } - } - - // all searching has been accounted for, if we reach this point, then the metadata - // is good and we can return it - $returnMetadatas[] = $metadata; - - } - - return $returnMetadatas; - } - - /** - * getMetadata() - This will proxy to getMetadatas(), but will only return a single metadata. This method - * should be used in situations where the search criteria is known to only find a single metadata object - * - * @param array $searchProperties - * @param bool $includeNonExistentProperties - * @return Zend_Tool_Framework_Manifest_Metadata - */ - public function getMetadata(Array $searchProperties = array(), $includeNonExistentProperties = true) - { - $metadatas = $this->getMetadatas($searchProperties, $includeNonExistentProperties); - return array_shift($metadatas); - } - - /** - * __toString() - cast to string - * - * @return string - */ - public function __toString() - { - $metadatasByType = array(); - - foreach ($this->_metadatas as $metadata) { - if (!array_key_exists($metadata->getType(), $metadatasByType)) { - $metadatasByType[$metadata->getType()] = array(); - } - $metadatasByType[$metadata->getType()][] = $metadata; - } - - $string = ''; - foreach ($metadatasByType as $type => $metadatas) { - $string .= $type . PHP_EOL; - foreach ($metadatas as $metadata) { - $metadataString = ' ' . $metadata->__toString() . PHP_EOL; - //$metadataString = str_replace(PHP_EOL, PHP_EOL . ' ', $metadataString); - $string .= $metadataString; - } - } - - return $string; - } - - /** - * count() - required by the Countable Interface - * - * @return int - */ - public function count() - { - return count($this->_metadatas); - } - - /** - * getIterator() - required by the IteratorAggregate interface - * - * @return ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->_metadatas); - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Metadata/Attributable.php b/library/vendor/Zend/Tool/Framework/Metadata/Attributable.php deleted file mode 100644 index 869f5d5e2..000000000 --- a/library/vendor/Zend/Tool/Framework/Metadata/Attributable.php +++ /dev/null @@ -1,33 +0,0 @@ -setOptions($options); - } - } - - /** - * setOptions() - standard issue implementation, this will set any - * options that are supported via a set method. - * - * @param array $options - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setOptions(Array $options) - { - foreach ($options as $optionName => $optionValue) { - $setMethod = 'set' . $optionName; - if (method_exists($this, $setMethod)) { - $this->{$setMethod}($optionValue); - } - } - - return $this; - } - - /** - * getType() - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * setType() - * - * @param string $type - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setType($type) - { - $this->_type = $type; - return $this; - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * setName() - * - * @param string $name - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setName($name) - { - $this->_name = $name; - return $this; - } - - /** - * getValue() - * - * @return mixed - */ - public function getValue() - { - return $this->_value; - } - - /** - * setValue() - * - * @param unknown_type $Value - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setValue($value) - { - $this->_value = $value; - return $this; - } - - /** - * setReference() - * - * @param mixed $reference - * @return Zend_Tool_Framework_Metadata_Basic - */ - public function setReference($reference) - { - $this->_reference = $reference; - return $this; - } - - /** - * getReference() - * - * @return mixed - */ - public function getReference() - { - return $this->_reference; - } - - /** - * getAttributes() - this will retrieve any attributes of this object that exist as properties - * This is most useful for printing metadata. - * - * @param const $type - * @return array - */ - public function getAttributes($type = self::ATTRIBUTES_ALL, $stringRepresentationOfNonScalars = false) - { - $thisReflection = new ReflectionObject($this); - - $metadataPairValues = array(); - - foreach (get_object_vars($this) as $varName => $varValue) { - if ($type == self::ATTRIBUTES_NO_PARENT && ($thisReflection->getProperty($varName)->getDeclaringClass()->getName() == 'Zend_Tool_Framework_Metadata_Basic')) { - continue; - } - - if ($stringRepresentationOfNonScalars) { - - if (is_object($varValue)) { - $varValue = '(object)'; - } - - if ($varValue === null) { - $varValue = '(null)'; - } - - } - - $metadataPairValues[ltrim($varName, '_')] = $varValue; - } - - return $metadataPairValues; - } - - /** - * __toString() - string representation of this object - * - * @return string - */ - public function __toString() - { - return 'Type: ' . $this->_type . ', Name: ' . $this->_name . ', Value: ' . (is_array($this->_value) ? http_build_query($this->_value) : (string) $this->_value); - } -} diff --git a/library/vendor/Zend/Tool/Framework/Metadata/Dynamic.php b/library/vendor/Zend/Tool/Framework/Metadata/Dynamic.php deleted file mode 100644 index 2fbf6af62..000000000 --- a/library/vendor/Zend/Tool/Framework/Metadata/Dynamic.php +++ /dev/null @@ -1,219 +0,0 @@ -setOptions($options); - } - } - - public function setOptions(Array $options = array()) - { - foreach ($options as $optName => $optValue) { - $methodName = 'set' . $optName; - $this->{$methodName}($optValue); - } - } - - /** - * setType() - * - * @param string $type - * @return Zend_Tool_Framework_Metadata_Dynamic - */ - public function setType($type) - { - $this->_type = $type; - return $this; - } - - /** - * getType() - * - * The type of metadata this describes - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * setName() - * - * @param string $name - * @return Zend_Tool_Framework_Metadata_Dynamic - */ - public function setName($name) - { - $this->_name = $name; - return $this; - } - - /** - * getName() - * - * Metadata name - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * setValue() - * - * @param mixed $value - * @return Zend_Tool_Framework_Metadata_Dynamic - */ - public function setValue($value) - { - $this->_value = $value; - return $this; - } - - /** - * getValue() - * - * Metadata Value - * - * @return string - */ - public function getValue() - { - return $this->_value; - } - - public function getAttributes() - { - return $this->_dynamicAttributes; - } - - /** - * __isset() - * - * Check if an attrbute is set - * - * @param string $name - * @return bool - */ - public function __isset($name) - { - return isset($this->_dynamicAttributes[$name]); - } - - /** - * __unset() - * - * @param string $name - * @return null - */ - public function __unset($name) - { - unset($this->_dynamicAttributes[$name]); - return; - } - - /** - * __get() - Get a property via property call $metadata->foo - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - if (method_exists($this, 'get' . $name)) { - return $this->{'get' . $name}(); - } elseif (array_key_exists($name, $this->_dynamicAttributes)) { - return $this->_dynamicAttributes[$name]; - } else { - require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this metadata.'); - } - } - - /** - * __set() - Set a property via the magic set $metadata->foo = 'foo' - * - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - if (method_exists($this, 'set' . $name)) { - $this->{'set' . $name}($value); - return $this; - } else { - $this->_dynamicAttributes[$name] = $value; - return $this; - } -// { -// require_once 'Zend/Tool/Framework/Registry/Exception.php'; -// throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this registry.'); -// } - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Metadata/Interface.php b/library/vendor/Zend/Tool/Framework/Metadata/Interface.php deleted file mode 100644 index d7e327bf3..000000000 --- a/library/vendor/Zend/Tool/Framework/Metadata/Interface.php +++ /dev/null @@ -1,52 +0,0 @@ -_clientName = $clientName; - return $this; - } - - public function getClientName() - { - return $this->_clientName; - } - - /** - * setActionName() - * - * @param string $actionName - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setActionName($actionName) - { - $this->_actionName = $actionName; - return $this; - } - - /** - * getActionName() - * - * @return string - */ - public function getActionName() - { - return $this->_actionName; - } - - /** - * setProviderName() - * - * @param string $providerName - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setProviderName($providerName) - { - $this->_providerName = $providerName; - return $this; - } - - /** - * getProviderName() - * - * @return string - */ - public function getProviderName() - { - return $this->_providerName; - } - - /** - * setSpecialtyName() - * - * @param string $specialtyName - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setSpecialtyName($specialtyName) - { - $this->_specialtyName = $specialtyName; - return $this; - } - - /** - * getSpecialtyName() - * - * @return string - */ - public function getSpecialtyName() - { - return $this->_specialtyName; - } - - /** - * setClientReference() - * - * @param Zend_Tool_Framework_Client_Abstract $client - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setClientReference(Zend_Tool_Framework_Client_Abstract $client) - { - $this->_clientReference = $client; - return $this; - } - - /** - * getClientReference() - * - * @return Zend_Tool_Framework_Client_Abstract - */ - public function getClientReference() - { - return $this->_clientReference; - } - - /** - * setActionReference() - * - * @param Zend_Tool_Framework_Action_Interface $action - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setActionReference(Zend_Tool_Framework_Action_Interface $action) - { - $this->_actionReference = $action; - return $this; - } - - /** - * getActionReference() - * - * @return Zend_Tool_Framework_Action_Interface - */ - public function getActionReference() - { - return $this->_actionReference; - } - - /** - * setProviderReference() - * - * @param Zend_Tool_Framework_Provider_Interface $provider - * @return Zend_Tool_Framework_Metadata_Tool - */ - public function setProviderReference(Zend_Tool_Framework_Provider_Interface $provider) - { - $this->_providerReference = $provider; - return $this; - } - - /** - * getProviderReference() - * - * @return Zend_Tool_Framework_Provider_Interface - */ - public function getProviderReference() - { - return $this->_providerReference; - } - - /** - * __toString() cast to string - * - * @return string - */ - public function __toString() - { - $string = parent::__toString(); - $string .= ' (ProviderName: ' . $this->_providerName - . ', ActionName: ' . $this->_actionName - . ', SpecialtyName: ' . $this->_specialtyName - . ')'; - - return $string; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Provider/Abstract.php b/library/vendor/Zend/Tool/Framework/Provider/Abstract.php deleted file mode 100644 index 889ce00be..000000000 --- a/library/vendor/Zend/Tool/Framework/Provider/Abstract.php +++ /dev/null @@ -1,68 +0,0 @@ -_registry = $registry; - return $this; - } - - -} diff --git a/library/vendor/Zend/Tool/Framework/Provider/DocblockManifestable.php b/library/vendor/Zend/Tool/Framework/Provider/DocblockManifestable.php deleted file mode 100644 index 19bd7d6d7..000000000 --- a/library/vendor/Zend/Tool/Framework/Provider/DocblockManifestable.php +++ /dev/null @@ -1,30 +0,0 @@ -_registry = $registry; - return $this; - } - - /** - * Set the ProcessOnAdd flag - * - * @param unknown_type $processOnAdd - * @return unknown - */ - public function setProcessOnAdd($processOnAdd = true) - { - $this->_processOnAdd = (bool) $processOnAdd; - return $this; - } - - /** - * Add a provider to the repository for processing - * - * @param Zend_Tool_Framework_Provider_Interface $provider - * @return Zend_Tool_Framework_Provider_Repository - */ - public function addProvider(Zend_Tool_Framework_Provider_Interface $provider, $overwriteExistingProvider = false) - { - if ($provider instanceof Zend_Tool_Framework_Registry_EnabledInterface) { - $provider->setRegistry($this->_registry); - } - - if (method_exists($provider, 'getName')) { - $providerName = $provider->getName(); - } else { - $providerName = $this->_parseName($provider); - } - - // if a provider by the given name already exist, and its not set as overwritable, throw exception - if (!$overwriteExistingProvider && - (array_key_exists($providerName, $this->_unprocessedProviders) - || array_key_exists($providerName, $this->_providers))) - { - require_once 'Zend/Tool/Framework/Provider/Exception.php'; - throw new Zend_Tool_Framework_Provider_Exception('A provider by the name ' . $providerName - . ' is already registered and $overrideExistingProvider is set to false.'); - } - - $this->_unprocessedProviders[$providerName] = $provider; - - // if process has already been called, process immediately. - if ($this->_processOnAdd) { - $this->process(); - } - - return $this; - } - - public function hasProvider($providerOrClassName, $processedOnly = true) - { - if ($providerOrClassName instanceof Zend_Tool_Framework_Provider_Interface) { - $targetProviderClassName = get_class($providerOrClassName); - } else { - $targetProviderClassName = (string) $providerOrClassName; - } - - if (!$processedOnly) { - foreach ($this->_unprocessedProviders as $unprocessedProvider) { - if (get_class($unprocessedProvider) == $targetProviderClassName) { - return true; - } - } - } - - foreach ($this->_providers as $processedProvider) { - if (get_class($processedProvider) == $targetProviderClassName) { - return true; - } - } - - return false; - } - - /** - * Process all of the unprocessed providers - * - */ - public function process() - { - - // process all providers in the unprocessedProviders array - //foreach ($this->_unprocessedProviders as $providerName => $provider) { - reset($this->_unprocessedProviders); - while ($this->_unprocessedProviders) { - - $providerName = key($this->_unprocessedProviders); - $provider = array_shift($this->_unprocessedProviders); - - // create a signature for the provided provider - $providerSignature = new Zend_Tool_Framework_Provider_Signature($provider); - - if ($providerSignature instanceof Zend_Tool_Framework_Registry_EnabledInterface) { - $providerSignature->setRegistry($this->_registry); - } - - $providerSignature->process(); - - // ensure the name is lowercased for easier searching - $providerName = strtolower($providerName); - - // add to the appropraite place - $this->_providerSignatures[$providerName] = $providerSignature; - $this->_providers[$providerName] = $providerSignature->getProvider(); - - if ($provider instanceof Zend_Tool_Framework_Provider_Initializable) { - $provider->initialize(); - } - - } - - } - - /** - * getProviders() Get all the providers in the repository - * - * @return array - */ - public function getProviders() - { - return $this->_providers; - } - - /** - * getProviderSignatures() Get all the provider signatures - * - * @return array - */ - public function getProviderSignatures() - { - return $this->_providerSignatures; - } - - /** - * getProvider() - * - * @param string $providerName - * @return Zend_Tool_Framework_Provider_Interface - */ - public function getProvider($providerName) - { - return $this->_providers[strtolower($providerName)]; - } - - /** - * getProviderSignature() - * - * @param string $providerName - * @return Zend_Tool_Framework_Provider_Signature - */ - public function getProviderSignature($providerName) - { - return $this->_providerSignatures[strtolower($providerName)]; - } - - /** - * count() - return the number of providers - * - * @return int - */ - public function count() - { - return count($this->_providers); - } - - /** - * getIterator() - Required by the IteratorAggregate Interface - * - * @return ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->getProviders()); - } - - /** - * _parseName - internal method to determine the name of an action when one is not explicity provided. - * - * @param Zend_Tool_Framework_Action_Interface $action - * @return string - */ - protected function _parseName(Zend_Tool_Framework_Provider_Interface $provider) - { - $className = get_class($provider); - $providerName = $className; - if (strpos($providerName, '_') !== false) { - $providerName = substr($providerName, strrpos($providerName, '_')+1); - } - if (substr($providerName, -8) == 'Provider') { - $providerName = substr($providerName, 0, strlen($providerName)-8); - } - return $providerName; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Provider/Signature.php b/library/vendor/Zend/Tool/Framework/Provider/Signature.php deleted file mode 100644 index 1bfbcb4bf..000000000 --- a/library/vendor/Zend/Tool/Framework/Provider/Signature.php +++ /dev/null @@ -1,394 +0,0 @@ -_provider = $provider; - $this->_providerReflection = new Zend_Reflection_Class($provider); - } - - /** - * setRegistry() - * - * @param Zend_Tool_Framework_Registry_Interface $registry - * @return Zend_Tool_Framework_Provider_Signature - */ - public function setRegistry(Zend_Tool_Framework_Registry_Interface $registry) - { - $this->_registry = $registry; - return $this; - } - - public function process() - { - if ($this->_isProcessed) { - return; - } - - $this->_process(); - } - - /** - * getName() of the provider - * - * @return unknown - */ - public function getName() - { - return $this->_name; - } - - /** - * Get the provider for this signature - * - * @return Zend_Tool_Framework_Provider_Interface - */ - public function getProvider() - { - return $this->_provider; - } - - /** - * getProviderReflection() - * - * @return Zend_Reflection_Class - */ - public function getProviderReflection() - { - return $this->_providerReflection; - } - - /** - * getSpecialities() - * - * @return array - */ - public function getSpecialties() - { - return $this->_specialties; - } - - /** - * getActions() - * - * @return array Array of Actions - */ - public function getActions() - { - return $this->_actions; - } - - /** - * getActionableMethods() - * - * @return array - */ - public function getActionableMethods() - { - return $this->_actionableMethods; - } - - /** - * getActionableMethod() - Get an actionable method by name, this will return an array of - * useful information about what can be exectued on this provider - * - * @param string $methodName - * @return array - */ - public function getActionableMethod($methodName) - { - if (isset($this->_actionableMethods[$methodName])) { - return $this->_actionableMethods[$methodName]; - } - - return false; - } - - /** - * getActionableMethodByActionName() - Get an actionable method by its action name, this - * will return an array of useful information about what can be exectued on this provider - * - * @param string $actionName - * @return array - */ - public function getActionableMethodByActionName($actionName, $specialtyName = '_Global') - { - foreach ($this->_actionableMethods as $actionableMethod) { - if ($actionName == $actionableMethod['actionName'] - && $specialtyName == $actionableMethod['specialty']) { - return $actionableMethod; - } - } - - return false; - } - - /** - * _process() is called at construction time and is what will build the signature information - * for determining what is actionable - * - */ - protected function _process() - { - $this->_isProcessed = true; - $this->_processName(); - $this->_processSpecialties(); - $this->_processActionableMethods(); - } - - /** - * _processName(); - * - */ - protected function _processName() - { - if (method_exists($this->_provider, 'getName')) { - $this->_name = $this->_provider->getName(); - } - - if ($this->_name == null) { - $className = get_class($this->_provider); - $name = $className; - if (strpos($name, '_')) { - $name = substr($name, strrpos($name, '_')+1); - } - $name = preg_replace('#(Provider|Manifest)$#', '', $name); - $this->_name = $name; - } - } - - /** - * _processSpecialties() - Break out the specialty names for this provider - * - */ - protected function _processSpecialties() - { - $specialties = array(); - - if ($this->_providerReflection->hasMethod('getSpecialties')) { - $specialties = $this->_provider->getSpecialties(); - if (!is_array($specialties)) { - require_once 'Zend/Tool/Framework/Provider/Exception.php'; - throw new Zend_Tool_Framework_Provider_Exception( - 'Provider ' . get_class($this->_provider) . ' must return an array for method getSpecialties().' - ); - } - } else { - $defaultProperties = $this->_providerReflection->getDefaultProperties(); - $specialties = (isset($defaultProperties['_specialties'])) ? $defaultProperties['_specialties'] : array(); - if (!is_array($specialties)) { - require_once 'Zend/Tool/Framework/Provider/Exception.php'; - throw new Zend_Tool_Framework_Provider_Exception( - 'Provider ' . get_class($this->_provider) . '\'s property $_specialties must be an array.' - ); - } - } - - $this->_specialties = array_merge(array('_Global'), $specialties); - - } - - /** - * _processActionableMethods() - process all methods that can be called on this provider. - * - */ - protected function _processActionableMethods() - { - - $specialtyRegex = '#(.*)(' . implode('|', $this->_specialties) . ')$#i'; - - - $methods = $this->_providerReflection->getMethods(); - - $actionableMethods = array(); - foreach ($methods as $method) { - - $methodName = $method->getName(); - - /** - * the following will determine what methods are actually actionable - * public, non-static, non-underscore prefixed, classes that dont - * contain the name " - */ - if (!$method->getDeclaringClass()->isInstantiable() - || !$method->isPublic() - || $methodName[0] == '_' - || $method->isStatic() - || in_array($methodName, array('getContextClasses', 'getName')) // other protected public methods will nee to go here - ) { - continue; - } - - /** - * check to see if the method was a required method by a Zend_Tool_* interface - */ - foreach ($method->getDeclaringClass()->getInterfaces() as $methodDeclaringClassInterface) { - if (strpos($methodDeclaringClassInterface->getName(), 'Zend_Tool_') === 0 - && $methodDeclaringClassInterface->hasMethod($methodName)) { - continue 2; - } - } - - $actionableName = ucfirst($methodName); - - if (substr($actionableName, -6) == 'Action') { - $actionableName = substr($actionableName, 0, -6); - } - - $actionableMethods[$methodName]['methodName'] = $methodName; - - $matches = null; - if (preg_match($specialtyRegex, $actionableName, $matches)) { - $actionableMethods[$methodName]['actionName'] = $matches[1]; - $actionableMethods[$methodName]['specialty'] = $matches[2]; - } else { - $actionableMethods[$methodName]['actionName'] = $actionableName; - $actionableMethods[$methodName]['specialty'] = '_Global'; - } - - // get the action, and create non-existent actions when they dont exist (the true part below) - $action = $this->_registry->getActionRepository()->getAction($actionableMethods[$methodName]['actionName']); - if ($action == null) { - $action = new Zend_Tool_Framework_Action_Base($actionableMethods[$methodName]['actionName']); - $this->_registry->getActionRepository()->addAction($action); - } - $actionableMethods[$methodName]['action'] = $action; - - if (!in_array($actionableMethods[$methodName]['action'], $this->_actions)) { - $this->_actions[] = $actionableMethods[$methodName]['action']; - } - - $parameterInfo = array(); - $position = 1; - foreach ($method->getParameters() as $parameter) { - $currentParam = $parameter->getName(); - $parameterInfo[$currentParam]['position'] = $position++; - $parameterInfo[$currentParam]['optional'] = $parameter->isOptional(); - $parameterInfo[$currentParam]['default'] = ($parameter->isOptional()) ? $parameter->getDefaultValue() : null; - $parameterInfo[$currentParam]['name'] = $currentParam; - $parameterInfo[$currentParam]['type'] = 'string'; - $parameterInfo[$currentParam]['description'] = null; - } - - $matches = null; - if (($docComment = $method->getDocComment()) != '' && - (preg_match_all('/@param\s+(\w+)+\s+(\$\S+)\s+(.*?)(?=(?:\*\s*@)|(?:\*\/))/s', $docComment, $matches))) - { - for ($i=0; $i <= count($matches[0])-1; $i++) { - $currentParam = ltrim($matches[2][$i], '$'); - - if ($currentParam != '' && isset($parameterInfo[$currentParam])) { - - $parameterInfo[$currentParam]['type'] = $matches[1][$i]; - - $descriptionSource = $matches[3][$i]; - - if ($descriptionSource != '') { - $parameterInfo[$currentParam]['description'] = trim($descriptionSource); - } - - } - - } - - } - - $actionableMethods[$methodName]['parameterInfo'] = $parameterInfo; - - } - - $this->_actionableMethods = $actionableMethods; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Registry.php b/library/vendor/Zend/Tool/Framework/Registry.php deleted file mode 100644 index cd1d034ca..000000000 --- a/library/vendor/Zend/Tool/Framework/Registry.php +++ /dev/null @@ -1,419 +0,0 @@ -_client); - unset($this->_loader); - unset($this->_actionRepository); - unset($this->_providerRepository); - unset($this->_request); - unset($this->_response); - } - -// public function __construct() -// { -// // no instantiation from outside -// } - - /** - * Enter description here... - * - * @param Zend_Tool_Framework_Client_Abstract $client - * @return Zend_Tool_Framework_Registry - */ - public function setClient(Zend_Tool_Framework_Client_Abstract $client) - { - $this->_client = $client; - if ($this->isObjectRegistryEnablable($this->_client)) { - $this->enableRegistryOnObject($this->_client); - } - return $this; - } - - /** - * getClient() return the client in the registry - * - * @return Zend_Tool_Framework_Client_Abstract - */ - public function getClient() - { - return $this->_client; - } - - /** - * setConfig() - * - * @param Zend_Tool_Framework_Client_Config $config - * @return Zend_Tool_Framework_Registry - */ - public function setConfig(Zend_Tool_Framework_Client_Config $config) - { - $this->_config = $config; - return $this; - } - - /** - * getConfig() - * - * @return Zend_Tool_Framework_Client_Config - */ - public function getConfig() - { - if ($this->_config === null) { - require_once 'Zend/Tool/Framework/Client/Config.php'; - $this->setConfig(new Zend_Tool_Framework_Client_Config()); - } - - return $this->_config; - } - - /** - * setStorage() - * - * @param Zend_Tool_Framework_Client_Storage $storage - * @return Zend_Tool_Framework_Registry - */ - public function setStorage(Zend_Tool_Framework_Client_Storage $storage) - { - $this->_storage = $storage; - return $this; - } - - /** - * getConfig() - * - * @return Zend_Tool_Framework_Client_Storage - */ - public function getStorage() - { - if ($this->_storage === null) { - require_once 'Zend/Tool/Framework/Client/Storage.php'; - $this->setStorage(new Zend_Tool_Framework_Client_Storage()); - } - - return $this->_storage; - } - - /** - * setLoader() - * - * @param Zend_Tool_Framework_Loader_Interface $loader - * @return Zend_Tool_Framework_Registry - */ - public function setLoader(Zend_Tool_Framework_Loader_Interface $loader) - { - $this->_loader = $loader; - if ($this->isObjectRegistryEnablable($this->_loader)) { - $this->enableRegistryOnObject($this->_loader); - } - return $this; - } - - /** - * getLoader() - * - * @return Zend_Tool_Framework_Loader_Abstract - */ - public function getLoader() - { - if ($this->_loader === null) { - require_once 'Zend/Tool/Framework/Loader/IncludePathLoader.php'; - $this->setLoader(new Zend_Tool_Framework_Loader_IncludePathLoader()); - } - - return $this->_loader; - } - - /** - * setActionRepository() - * - * @param Zend_Tool_Framework_Action_Repository $actionRepository - * @return Zend_Tool_Framework_Registry - */ - public function setActionRepository(Zend_Tool_Framework_Action_Repository $actionRepository) - { - $this->_actionRepository = $actionRepository; - if ($this->isObjectRegistryEnablable($this->_actionRepository)) { - $this->enableRegistryOnObject($this->_actionRepository); - } - return $this; - } - - /** - * getActionRepository() - * - * @return Zend_Tool_Framework_Action_Repository - */ - public function getActionRepository() - { - if ($this->_actionRepository == null) { - require_once 'Zend/Tool/Framework/Action/Repository.php'; - $this->setActionRepository(new Zend_Tool_Framework_Action_Repository()); - } - - return $this->_actionRepository; - } - - /** - * setProviderRepository() - * - * @param Zend_Tool_Framework_Provider_Repository $providerRepository - * @return Zend_Tool_Framework_Registry - */ - public function setProviderRepository(Zend_Tool_Framework_Provider_Repository $providerRepository) - { - $this->_providerRepository = $providerRepository; - if ($this->isObjectRegistryEnablable($this->_providerRepository)) { - $this->enableRegistryOnObject($this->_providerRepository); - } - return $this; - } - - /** - * getProviderRepository() - * - * @return Zend_Tool_Framework_Provider_Repository - */ - public function getProviderRepository() - { - if ($this->_providerRepository == null) { - require_once 'Zend/Tool/Framework/Provider/Repository.php'; - $this->setProviderRepository(new Zend_Tool_Framework_Provider_Repository()); - } - - return $this->_providerRepository; - } - - /** - * setManifestRepository() - * - * @param Zend_Tool_Framework_Manifest_Repository $manifestRepository - * @return Zend_Tool_Framework_Registry - */ - public function setManifestRepository(Zend_Tool_Framework_Manifest_Repository $manifestRepository) - { - $this->_manifestRepository = $manifestRepository; - if ($this->isObjectRegistryEnablable($this->_manifestRepository)) { - $this->enableRegistryOnObject($this->_manifestRepository); - } - return $this; - } - - /** - * getManifestRepository() - * - * @return Zend_Tool_Framework_Manifest_Repository - */ - public function getManifestRepository() - { - if ($this->_manifestRepository == null) { - require_once 'Zend/Tool/Framework/Manifest/Repository.php'; - $this->setManifestRepository(new Zend_Tool_Framework_Manifest_Repository()); - } - - return $this->_manifestRepository; - } - - /** - * setRequest() - * - * @param Zend_Tool_Framework_Client_Request $request - * @return Zend_Tool_Framework_Registry - */ - public function setRequest(Zend_Tool_Framework_Client_Request $request) - { - $this->_request = $request; - return $this; - } - - /** - * getRequest() - * - * @return Zend_Tool_Framework_Client_Request - */ - public function getRequest() - { - if ($this->_request == null) { - require_once 'Zend/Tool/Framework/Client/Request.php'; - $this->setRequest(new Zend_Tool_Framework_Client_Request()); - } - - return $this->_request; - } - - /** - * setResponse() - * - * @param Zend_Tool_Framework_Client_Response $response - * @return Zend_Tool_Framework_Registry - */ - public function setResponse(Zend_Tool_Framework_Client_Response $response) - { - $this->_response = $response; - return $this; - } - - /** - * getResponse() - * - * @return Zend_Tool_Framework_Client_Response - */ - public function getResponse() - { - if ($this->_response == null) { - require_once 'Zend/Tool/Framework/Client/Response.php'; - $this->setResponse(new Zend_Tool_Framework_Client_Response()); - } - - return $this->_response; - } - - /** - * __get() - Get a property via property call $registry->foo - * - * @param string $name - * @return mixed - */ - public function __get($name) - { - if (method_exists($this, 'get' . $name)) { - return $this->{'get' . $name}(); - } else { - require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this registry.'); - } - } - - /** - * __set() - Set a property via the magic set $registry->foo = 'foo' - * - * @param string $name - * @param mixed $value - */ - public function __set($name, $value) - { - if (method_exists($this, 'set' . $name)) { - $this->{'set' . $name}($value); - return; - } else { - require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('Property ' . $name . ' was not located in this registry.'); - } - } - - /** - * isObjectRegistryEnablable() - Check whether an object is registry enablable - * - * @param object $object - * @return bool - */ - public function isObjectRegistryEnablable($object) - { - if (!is_object($object)) { - require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('isObjectRegistryEnablable() expects an object.'); - } - - return ($object instanceof Zend_Tool_Framework_Registry_EnabledInterface); - } - - /** - * enableRegistryOnObject() - make an object registry enabled - * - * @param object $object - * @return Zend_Tool_Framework_Registry - */ - public function enableRegistryOnObject($object) - { - if (!$this->isObjectRegistryEnablable($object)) { - require_once 'Zend/Tool/Framework/Registry/Exception.php'; - throw new Zend_Tool_Framework_Registry_Exception('Object provided is not registry enablable, check first with Zend_Tool_Framework_Registry::isObjectRegistryEnablable()'); - } - - $object->setRegistry($this); - return $this; - } - -} diff --git a/library/vendor/Zend/Tool/Framework/Registry/EnabledInterface.php b/library/vendor/Zend/Tool/Framework/Registry/EnabledInterface.php deleted file mode 100644 index 5a97c8bd3..000000000 --- a/library/vendor/Zend/Tool/Framework/Registry/EnabledInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -_registry->getConfig(); - - $resp = $this->_registry->getResponse(); - if ($userConfig->exists()) { - require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception( - "A configuration already exists, cannot create a new one."); - } - - $homeDirectory = $this->_detectHomeDirectory(); - - $writer = new Zend_Config_Writer_Ini(); - $writer->setRenderWithoutSections(); - $filename = $homeDirectory."/.zf.ini"; - - $config = array( - 'php' => array( - 'include_path' => get_include_path(), - ), - ); - $writer->write($filename, new Zend_Config($config)); - - $resp = $this->_registry->getResponse(); - $resp->appendContent("Successfully written Zend Tool config."); - $resp->appendContent("It is located at: ".$filename); - } - - /** - * @return string - */ - protected function _detectHomeDirectory() - { - $envVars = array("ZF_HOME", "HOME", "HOMEPATH"); - foreach($envVars AS $env) { - $homeDirectory = getenv($env); - if ($homeDirectory != false && file_exists($homeDirectory)) { - return $homeDirectory; - } - } - require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception("Cannot detect user home directory, set ZF_HOME enviroment variable."); - } - - /** - * Show Zend Tool User Configuration - * - * @return void - */ - public function show() - { - $userConfig = $this->_loadUserConfigIfExists(); - $configArray = $userConfig->getConfigInstance()->toArray(); - - $resp = $this->_registry->getResponse(); - - $i = 0; - $tree = ""; - foreach($configArray AS $k => $v) { - $i++; - $tree .= $this->_printTree($k, $v, 1, count($configArray)==$i); - } - $resp->appendContent("User Configuration: ".$userConfig->getConfigFilepath(), array("color" => "green")); - $resp->appendContent($tree, array("indention" => 2)); - } - - /** - * - * @param string $key - * @param string $value - * @param int $level - * @return string - */ - protected function _printTree($key, $value, $level=1, $isLast=false) - { - $this->_levelCompleted[$level] = false; - - $prefix = ""; - for ($i = 1; $i < $level; $i++) { - if ($this->_levelCompleted[$i] == true) { - $prefix .= " "; - } else { - $prefix .= "| "; - } - } - if ($isLast) { - $pointer = "`-- "; - } else { - $pointer = "|-- "; - } - - $tree = ""; - if (is_array($value)) { - $tree .= $prefix.$pointer.$key.PHP_EOL; - - if ($isLast == true) { - $this->_levelCompleted[$level] = true; - } - - $i = 0; - foreach ($value as $k => $v) { - $i++; - $tree .= $this->_printTree($k, $v, $level+1, (count($value)==$i)); - } - } else { - $tree .= $prefix.$pointer.$key.": ".trim($value).PHP_EOL; - } - - return $tree; - } - - public function enable() - { - $resp = $this->_registry->getResponse(); - $resp->appendContent('Use either "zf enable config.provider" or "zf enable config.manifest".'); - } - - public function disable() - { - $resp = $this->_registry->getResponse(); - $resp->appendContent('Use either "zf disable config.provider" or "zf disable config.manifest".'); - } - - /** - * @param string $className - */ - public function enableProvider($className) - { - Zend_Loader::loadClass($className); - $reflClass = new ReflectionClass($className); - if (!in_array("Zend_Tool_Framework_Provider_Interface", $reflClass->getInterfaceNames())) { - require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception("Given class is not a provider"); - } - $this->_doEnable($className); - } - - protected function _doEnable($className) - { - - $userConfig = $this->_loadUserConfigIfExists(); - - if (!isset($userConfig->basicloader)) { - $userConfig->basicloader = array(); - } - if (!isset($userConfig->basicloader->classes)) { - $userConfig->basicloader->classes = array(); - } - - $providerClasses = $userConfig->basicloader->classes->toArray(); - if (!in_array($className, $providerClasses)) { - if (count($providerClasses)) { - $pos = max(array_keys($providerClasses))+1; - } else { - $pos = 0; - } - $userConfig->basicloader->classes->$pos = $className; - - if ($userConfig->save()) { - $this->_registry->getResponse()->appendContent( - "Provider/Manifest '".$className."' was enabled for usage with Zend Tool.", - array("color" => "green", "aligncenter" => true) - ); - } else { - require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception( - "Could not write user configuration to persistence." - ); - } - } else { - require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception( - "Provider/Manifest '".$className."' is already enabled." - ); - } - } - - /** - * @param string $className - */ - public function enableManifest($className) - { - Zend_Loader::loadClass($className); - $reflClass = new ReflectionClass($className); - if (!in_array("Zend_Tool_Framework_Manifest_Interface", $reflClass->getInterfaceNames())) { - require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception("Given class is not a manifest."); - } - $this->_doEnable($className); - } - - /** - * @param string $className - */ - public function disableManifest($className) - { - $this->disableProvider($className); - } - - /** - * @param string $className - */ - public function disableProvider($className) - { - $userConfig = $this->_loadUserConfigIfExists(); - - if (!isset($userConfig->basicloader)) { - $userConfig->basicloader = array(); - } - if (!isset($userConfig->basicloader->classes)) { - $userConfig->basicloader->classes = array(); - } - - $providerClasses = $userConfig->basicloader->classes->toArray(); - if (($key = array_search($className, $providerClasses)) !== false) { - unset($userConfig->basicloader->classes->$key); - - if ($userConfig->save()) { - $this->_registry->getResponse()->appendContent( - "Provider/Manifest '".$className."' was disabled.", - array("color" => "green", "aligncenter" => true) - ); - } else { - require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception( - "Could not write user configuration to persistence." - ); - } - } else { - require_once "Zend/Tool/Framework/Exception.php"; - throw new Zend_Tool_Framework_Exception( - "Provider/Manifest '".$className."' is not enabled." - ); - } - } - - /** - * @return Zend_Tool_Framework_Client_Config - */ - protected function _loadUserConfigIfExists() - { - /* @var $userConfig Zend_Tool_Framework_Client_Config */ - $userConfig = $this->_registry->getConfig(); - - $resp = $this->_registry->getResponse(); - if (!$userConfig->exists()) { - $resp->appendContent("User has no config file.", array("aligncenter" => true, "color" => array('hiWhite', 'bgRed'))); - } - - return $userConfig; - } -} diff --git a/library/vendor/Zend/Tool/Framework/System/Provider/Manifest.php b/library/vendor/Zend/Tool/Framework/System/Provider/Manifest.php deleted file mode 100644 index 83f903523..000000000 --- a/library/vendor/Zend/Tool/Framework/System/Provider/Manifest.php +++ /dev/null @@ -1,114 +0,0 @@ -_registry = $registry; - } - - public function getName() - { - return 'Manifest'; - } - - public function show() - { - - $manifestRepository = $this->_registry->getManifestRepository(); - $response = $this->_registry->getResponse(); - - $metadataTree = array(); - - $longestAttrNameLen = 50; - - foreach ($manifestRepository as $metadata) { - - $metadataType = $metadata->getType(); - $metadataName = $metadata->getName(); - $metadataAttrs = $metadata->getAttributes('attributesParent'); - - if (!$metadataAttrs) { - $metadataAttrs = '(None)'; - } else { - $metadataAttrs = urldecode(http_build_query($metadataAttrs, null, ', ')); - } - - if (!array_key_exists($metadataType, $metadataTree)) { - $metadataTree[$metadataType] = array(); - } - - if (!array_key_exists($metadataName, $metadataTree[$metadataType])) { - $metadataTree[$metadataType][$metadataName] = array(); - } - - if (!array_key_exists($metadataAttrs, $metadataTree[$metadataType][$metadataName])) { - $metadataTree[$metadataType][$metadataName][$metadataAttrs] = array(); - } - - $longestAttrNameLen = (strlen($metadataAttrs) > $longestAttrNameLen) ? strlen($metadataAttrs) : $longestAttrNameLen; - - $metadataValue = $metadata->getValue(); - if (is_array($metadataValue) && count($metadataValue) > 0) { - $metadataValue = urldecode(http_build_query($metadataValue, null, ', ')); - } elseif (is_array($metadataValue)) { - $metadataValue = '(empty array)'; - } - - $metadataTree[$metadataType][$metadataName][$metadataAttrs][] = $metadataValue; - } - - foreach ($metadataTree as $metadataType => $metadatasByName) { - $response->appendContent($metadataType); - foreach ($metadatasByName as $metadataName => $metadatasByAttributes) { - $response->appendContent(" " . $metadataName); - foreach ($metadatasByAttributes as $metadataAttributeName => $metadataValues) { - foreach ($metadataValues as $metadataValue) { - $string = sprintf(" %-{$longestAttrNameLen}.{$longestAttrNameLen}s : ", $metadataAttributeName) - . $metadataValue; - $response->appendContent($string); - } - } - } - } - - } -} diff --git a/library/vendor/Zend/Tool/Framework/System/Provider/Phpinfo.php b/library/vendor/Zend/Tool/Framework/System/Provider/Phpinfo.php deleted file mode 100644 index 2b10bb6b9..000000000 --- a/library/vendor/Zend/Tool/Framework/System/Provider/Phpinfo.php +++ /dev/null @@ -1,38 +0,0 @@ -_registry = $registry; - return $this; - } - - /** - * Show Action - * - * @param string $mode The mode switch can be one of: major, minor, or mini (default) - * @param bool $nameIncluded - */ - public function show($mode = self::MODE_MINI, $nameIncluded = true) - { - - $versionInfo = $this->_splitVersion(); - - switch($mode) { - case self::MODE_MINOR: - unset($versionInfo['mini']); - break; - case self::MODE_MAJOR: - unset($versionInfo['mini'], $versionInfo['minor']); - break; - } - - $output = implode('.', $versionInfo); - - if ($nameIncluded) { - $output = 'Zend Framework Version: ' . $output; - } - - $this->_registry->response->appendContent($output); - } - - public function showMajorPart($nameIncluded = true) - { - $versionNumbers = $this->_splitVersion(); - $output = (($nameIncluded == true) ? 'ZF Major Version: ' : null) . $versionNumbers['major']; - $this->_registry->response->appendContent($output); - } - - public function showMinorPart($nameIncluded = true) - { - $versionNumbers = $this->_splitVersion(); - $output = (($nameIncluded == true) ? 'ZF Minor Version: ' : null) . $versionNumbers['minor']; - $this->_registry->response->appendContent($output); - } - - public function showMiniPart($nameIncluded = true) - { - $versionNumbers = $this->_splitVersion(); - $output = (($nameIncluded == true) ? 'ZF Mini Version: ' : null) . $versionNumbers['mini']; - $this->_registry->response->appendContent($output); - } - - protected function _splitVersion() - { - list($major, $minor, $mini) = explode('.', Zend_Version::VERSION); - return array('major' => $major, 'minor' => $minor, 'mini' => $mini); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Content/Engine.php b/library/vendor/Zend/Tool/Project/Context/Content/Engine.php deleted file mode 100644 index e28ca8cb2..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Content/Engine.php +++ /dev/null @@ -1,106 +0,0 @@ -_storage = $storage; - $this->_engines = array( - new Zend_Tool_Project_Context_Content_Engine_CodeGenerator($storage, $this->_keyInStorage), - new Zend_Tool_Project_Context_Content_Engine_Phtml($storage, $this->_keyInStorage), - ); - } - - /** - * getContent() - * - * @param Zend_Tool_Project_Context_Interface $context - * @param string $methodName - * @param mixed $parameters - * @return string - */ - public function getContent(Zend_Tool_Project_Context_Interface $context, $methodName, $parameters) - { - $content = null; - - foreach ($this->_engines as $engine) { - if ($engine->hasContent($context, $methodName, $parameters)) { - $content = $engine->getContent($context, $methodName, $parameters); - - if ($content != null) { - break; - } - - } - - } - - if ($content == null) { - return false; - } - - return $content; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php b/library/vendor/Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php deleted file mode 100644 index b29346782..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php +++ /dev/null @@ -1,98 +0,0 @@ -_storage = $storage; - $this->_contentPrefix = $contentPrefix; - } - - /** - * hasContent() - * - * @param Zend_Tool_Project_Context_Interface $context - * @param string $method - * @return string - */ - public function hasContent(Zend_Tool_Project_Context_Interface $context, $method) - { - return $this->_storage->has($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.php'); - } - - /** - * getContent() - * - * @param Zend_Tool_Project_Context_Interface $context - * @param string $method - * @param mixed $parameters - * @return string - */ - public function getContent(Zend_Tool_Project_Context_Interface $context, $method, $parameters) - { - $streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.php'); - - if (method_exists($context, 'getCodeGenerator')) { - $codeGenerator = $context->getCodeGenerator(); - } else { - $codeGenerator = new Zend_CodeGenerator_Php_File(); - } - - $codeGenerator = include $streamUri; - - if (!$codeGenerator instanceof Zend_CodeGenerator_Abstract) { - throw new Zend_Tool_Project_Exception('Custom file at ' . $streamUri . ' did not return the $codeGenerator object.'); - } - - return $codeGenerator->generate(); - } - - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Content/Engine/Phtml.php b/library/vendor/Zend/Tool/Project/Context/Content/Engine/Phtml.php deleted file mode 100644 index 7a7cbef0a..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Content/Engine/Phtml.php +++ /dev/null @@ -1,89 +0,0 @@ -_storage = $storage; - $this->_contentPrefix = $contentPrefix; - } - - /** - * hasContext() - * - * @param Zend_Tool_Project_Context_Interface $context - * @param string $method - * @return string - */ - public function hasContent(Zend_Tool_Project_Context_Interface $context, $method) - { - return $this->_storage->has($this->_contentPrefix . '/' . $context . '/' . $method . '.phtml'); - } - - /** - * getContent() - * - * @param Zend_Tool_Project_Context_Interface $context - * @param string $method - * @param mixed $parameters - */ - public function getContent(Zend_Tool_Project_Context_Interface $context, $method, $parameters) - { - $streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.phtml'); - - ob_start(); - include $streamUri; - $content = ob_get_clean(); - - return $content; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Exception.php b/library/vendor/Zend/Tool/Project/Context/Exception.php deleted file mode 100644 index 458f2e5d5..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Exception.php +++ /dev/null @@ -1,33 +0,0 @@ -_resource->getParentResource()->getContext()->getPath(); - $this->_baseDirectory = $parentBaseDirectory; - return $this; - } - - /** - * setResource() - * - * @param Zend_Tool_Project_Profile_Resource $resource - * @return Zend_Tool_Project_Context_Filesystem_Abstract - */ - public function setResource(Zend_Tool_Project_Profile_Resource $resource) - { - $this->_resource = $resource; - return $this; - } - - /** - * setBaseDirectory() - * - * @param string $baseDirectory - * @return Zend_Tool_Project_Context_Filesystem_Abstract - */ - public function setBaseDirectory($baseDirectory) - { - $this->_baseDirectory = rtrim(str_replace('\\', '/', $baseDirectory), '/'); - return $this; - } - - /** - * getBaseDirectory() - * - * @return string - */ - public function getBaseDirectory() - { - return $this->_baseDirectory; - } - - /** - * setFilesystemName() - * - * @param string $filesystemName - * @return Zend_Tool_Project_Context_Filesystem_Abstract - */ - public function setFilesystemName($filesystemName) - { - $this->_filesystemName = $filesystemName; - return $this; - } - - /** - * getFilesystemName() - * - * @return string - */ - public function getFilesystemName() - { - return $this->_filesystemName; - } - - /** - * getPath() - * - * @return string - */ - public function getPath() - { - $path = $this->_baseDirectory; - if ($this->_filesystemName) { - $path .= '/' . $this->_filesystemName; - } - return $path; - } - - /** - * exists() - * - * @return bool - */ - public function exists() - { - return file_exists($this->getPath()); - } - - /** - * create() - * - * Create this resource/context - * - */ - abstract public function create(); - - /** - * delete() - * - * Delete this resouce/context - * - */ - abstract public function delete(); - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Filesystem/Directory.php b/library/vendor/Zend/Tool/Project/Context/Filesystem/Directory.php deleted file mode 100644 index 12e9435b3..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Filesystem/Directory.php +++ /dev/null @@ -1,87 +0,0 @@ -_resource->getParentResource()) instanceof Zend_Tool_Project_Profile_Resource) { - if ((($parentContext = $parentResource->getContext()) instanceof Zend_Tool_Project_Context_Filesystem_Abstract) - && (!$parentContext->exists())) { - $parentResource->create(); - } - } - - if (!file_exists($this->getPath())) { - mkdir($this->getPath()); - } - - return $this; - } - - /** - * delete() - * - * @return Zend_Tool_Project_Context_Filesystem_Directory - */ - public function delete() - { - $this->_resource->setDeleted(true); - rmdir($this->getPath()); - - return $this; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Filesystem/File.php b/library/vendor/Zend/Tool/Project/Context/Filesystem/File.php deleted file mode 100644 index 645a4b763..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Filesystem/File.php +++ /dev/null @@ -1,174 +0,0 @@ -_resource->hasAttribute('filesystemName')) { - $this->_filesystemName = $this->_resource->getAttribute('filesystemName'); - } - - // check to see if this file is - if ($this->getName() == 'file') { - $this->_initFileOnlyContext(); - } - - // @potential-todo check to ensure that this 'file' resource has no children - parent::init(); - return $this; - } - - /** - * getPersistentAttributes() - * - * @return array - */ - public function getPersistentAttributes() - { - $returnAttrs = array(); - if ($this->_filesystemName !== null) { - $returnAttrs['filesystemName'] = $this->_filesystemName; - } - return $returnAttrs; - } - - /** - * setResource() - * - * @param unknown_type $resource - */ - public function setResource(Zend_Tool_Project_Profile_Resource $resource) - { - $this->_resource = $resource; - $this->_resource->setAppendable(false); - return $this; - } - - /** - * getResource() - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function getResource() - { - return $this->_resource; - } - - /** - * create() - * - * @return Zend_Tool_Project_Context_Filesystem_File - */ - public function create() - { - // check to ensure the parent exists, if not, call it and create it - if (($parentResource = $this->_resource->getParentResource()) instanceof Zend_Tool_Project_Profile_Resource) { - if ((($parentContext = $parentResource->getContext()) instanceof Zend_Tool_Project_Context_Filesystem_Abstract) - && (!$parentContext->exists())) { - $parentResource->create(); - } - } - - - if (file_exists($this->getPath())) { - // @todo propt user to determine if its ok to overwrite file - } - - file_put_contents($this->getPath(), $this->getContents()); - return $this; - } - - /** - * delete() - * - * @return Zend_Tool_Project_Context_Filesystem_File - */ - public function delete() - { - unlink($this->getPath()); - $this->_resource->setDeleted(true); - return $this; - } - - /** - * getContents() - * - * @return null - */ - public function getContents() - { - return $this->_content; - } - - protected function _initFileOnlyContext() - { - if ($this->_resource->hasAttribute('defaultContentCallback')) { - $contentFunc = $this->_resource->getAttribute('defaultContentCallback'); - if (is_callable($contentFunc)) { - $this->_content = call_user_func_array($contentFunc, array($this)); - } - } - if ($this->_filesystemName == null) { - $this->_filesystemName = 'file.txt'; - } - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Interface.php b/library/vendor/Zend/Tool/Project/Context/Interface.php deleted file mode 100644 index 6eb2af6f5..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Interface.php +++ /dev/null @@ -1,38 +0,0 @@ -addContextClass('Zend_Tool_Project_Context_System_ProjectDirectory') - ->addContextClass('Zend_Tool_Project_Context_System_ProjectProfileFile') - ->addContextClass('Zend_Tool_Project_Context_System_ProjectProvidersDirectory'); - self::$_isInitialized = true; - } - } - - public function addContextsFromDirectory($directory, $prefix) - { - $prefix = trim($prefix, '_') . '_'; - foreach (new DirectoryIterator($directory) as $directoryItem) { - if ($directoryItem->isDot() || (substr($directoryItem->getFilename(), -4) !== '.php')) { - continue; - } - $class = $prefix . substr($directoryItem->getFilename(), 0, -4); - $this->addContextClass($class); - } - } - - - public function addContextClass($contextClass) - { - if (!class_exists($contextClass)) { - require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($contextClass); - } - $reflectionContextClass = new ReflectionClass($contextClass); - if ($reflectionContextClass->isInstantiable()) { - $context = new $contextClass(); - return $this->addContext($context); - } - return $this; - } - - /** - * Enter description here... - * - * @param Zend_Tool_Project_Context_Interface $context - * @return Zend_Tool_Project_Context_Repository - */ - public function addContext(Zend_Tool_Project_Context_Interface $context) - { - $isSystem = ($context instanceof Zend_Tool_Project_Context_System_Interface); - $isTopLevel = ($context instanceof Zend_Tool_Project_Context_System_TopLevelRestrictable); - $isOverwritable = !($context instanceof Zend_Tool_Project_Context_System_NotOverwritable); - - $index = (count($this->_contexts)) ? max(array_keys($this->_contexts)) + 1 : 1; - - $normalName = $this->_normalizeName($context->getName()); - - if (isset($this->_shortContextNames[$normalName]) && ($this->_contexts[$this->_shortContextNames[$normalName]]['isOverwritable'] === false) ) { - require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('Context ' . $context->getName() . ' is not overwriteable.'); - } - - $this->_shortContextNames[$normalName] = $index; - $this->_contexts[$index] = array( - 'isTopLevel' => $isTopLevel, - 'isSystem' => $isSystem, - 'isOverwritable' => $isOverwritable, - 'normalName' => $normalName, - 'context' => $context - ); - - return $this; - } - - public function getContext($name) - { - if (!$this->hasContext($name)) { - require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('Context by name ' . $name . ' does not exist in the registry.'); - } - - $name = $this->_normalizeName($name); - return clone $this->_contexts[$this->_shortContextNames[$name]]['context']; - } - - public function hasContext($name) - { - $name = $this->_normalizeName($name); - return (isset($this->_shortContextNames[$name]) ? true : false); - } - - public function isSystemContext($name) - { - if (!$this->hasContext($name)) { - return false; - } - - $name = $this->_normalizeName($name); - $index = $this->_shortContextNames[$name]; - return $this->_contexts[$index]['isSystemContext']; - } - - public function isTopLevelContext($name) - { - if (!$this->hasContext($name)) { - return false; - } - $name = $this->_normalizeName($name); - $index = $this->_shortContextNames[$name]; - return $this->_contexts[$index]['isTopLevel']; - } - - public function isOverwritableContext($name) - { - if (!$this->hasContext($name)) { - return false; - } - $name = $this->_normalizeName($name); - $index = $this->_shortContextNames[$name]; - return $this->_contexts[$index]['isOverwritable']; - } - - public function count() - { - return count($this->_contexts); - } - - protected function _normalizeName($name) - { - return strtolower($name); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/System/Interface.php b/library/vendor/Zend/Tool/Project/Context/System/Interface.php deleted file mode 100644 index f79faa973..000000000 --- a/library/vendor/Zend/Tool/Project/Context/System/Interface.php +++ /dev/null @@ -1,37 +0,0 @@ -_resource->getAttribute('path'); - - // if not, get from profile - if ($projectDirectory == null) { - $projectDirectory = $this->_resource->getProfile()->getAttribute('projectDirectory'); - } - - // if not, exception. - if ($projectDirectory == null) { - require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('projectDirectory cannot find the directory for this project.'); - } - - $this->_baseDirectory = rtrim($projectDirectory, '\\/'); - return $this; - } - - /** - * create() - * - * @return Zend_Tool_Project_Context_System_ProjectDirectory - */ - public function create() - { - if (file_exists($this->getPath())) { - /* - foreach (new DirectoryIterator($this->getPath()) as $item) { - if (!$item->isDot()) { - if ($registry->getClient()->isInteractive()) { - // @todo prompt for override - } else { - require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('This directory is not empty, project creation aborted.'); - } - break; - } - } - */ - } - - parent::create(); - return $this; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/System/ProjectProfileFile.php b/library/vendor/Zend/Tool/Project/Context/System/ProjectProfileFile.php deleted file mode 100644 index dfaa573af..000000000 --- a/library/vendor/Zend/Tool/Project/Context/System/ProjectProfileFile.php +++ /dev/null @@ -1,118 +0,0 @@ -_profile = $profile; - return $this; - } - - /** - * save() - * - * Proxy to create - * - * @return Zend_Tool_Project_Context_System_ProjectProfileFile - */ - public function save() - { - parent::create(); - return $this; - } - - /** - * getContents() - * - * @return string - */ - public function getContents() - { - $parser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $profile = $this->_resource->getProfile(); - $xml = $parser->serialize($profile); - return $xml; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/System/ProjectProvidersDirectory.php b/library/vendor/Zend/Tool/Project/Context/System/ProjectProvidersDirectory.php deleted file mode 100644 index 52fb266fa..000000000 --- a/library/vendor/Zend/Tool/Project/Context/System/ProjectProvidersDirectory.php +++ /dev/null @@ -1,87 +0,0 @@ -getPath())) { - - $providerRepository = $registry->getProviderRepository(); - - foreach (new DirectoryIterator($this->getPath()) as $item) { - if ($item->isFile() && (($suffixStart = strpos($item->getFilename(), 'Provider.php')) !== false)) { - $className = substr($item->getFilename(), 0, $suffixStart+8); - // $loadableFiles[$className] = $item->getPathname(); - include_once $item->getPathname(); - $providerRepository->addProvider(new $className()); - } - } - } - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/System/TopLevelRestrictable.php b/library/vendor/Zend/Tool/Project/Context/System/TopLevelRestrictable.php deleted file mode 100644 index 5680bb253..000000000 --- a/library/vendor/Zend/Tool/Project/Context/System/TopLevelRestrictable.php +++ /dev/null @@ -1,37 +0,0 @@ -_resource; - do { - $resourceName = $currentResource->getName(); - if ($resourceName == 'ApplicationDirectory' || $resourceName == 'ModuleDirectory') { - $containingResource = $currentResource; - break; - } - } while ($currentResource instanceof Zend_Tool_Project_Profile_Resource - && $currentResource = $currentResource->getParentResource()); - - $fullClassName = ''; - - // go find the proper prefix - if (isset($containingResource)) { - if ($containingResource->getName() == 'ApplicationDirectory') { - $prefix = $containingResource->getAttribute('classNamePrefix'); - $fullClassName = $prefix; - } elseif ($containingResource->getName() == 'ModuleDirectory') { - $filter = new Zend_Filter_Word_DashToCamelCase(); - $prefix = $filter->filter(ucfirst($containingResource->getAttribute('moduleName'))) . '_'; - $fullClassName = $prefix; - } - } - - if ($classContextName) { - $fullClassName .= rtrim($classContextName, '_') . '_'; - } - $fullClassName .= $localClassName; - - return $fullClassName; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/ActionMethod.php b/library/vendor/Zend/Tool/Project/Context/Zf/ActionMethod.php deleted file mode 100644 index 0ff7a9539..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/ActionMethod.php +++ /dev/null @@ -1,224 +0,0 @@ -_actionName = $this->_resource->getAttribute('actionName'); - - $this->_resource->setAppendable(false); - $this->_controllerResource = $this->_resource->getParentResource(); - if (!$this->_controllerResource->getContext() instanceof Zend_Tool_Project_Context_Zf_ControllerFile) { - require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('ActionMethod must be a sub resource of a ControllerFile'); - } - // make the ControllerFile node appendable so we can tack on the actionMethod. - $this->_resource->getParentResource()->setAppendable(true); - - $this->_controllerPath = $this->_controllerResource->getContext()->getPath(); - - /* - * This code block is now commented, its doing to much for init() - * - if ($this->_controllerPath != '' && self::hasActionMethod($this->_controllerPath, $this->_actionName)) { - require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('An action named ' . $this->_actionName . 'Action already exists in this controller'); - } - */ - - return $this; - } - - /** - * getPersistentAttributes - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'actionName' => $this->getActionName() - ); - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'ActionMethod'; - } - - /** - * setResource() - * - * @param Zend_Tool_Project_Profile_Resource $resource - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function setResource(Zend_Tool_Project_Profile_Resource $resource) - { - $this->_resource = $resource; - return $this; - } - - /** - * setActionName() - * - * @param string $actionName - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function setActionName($actionName) - { - $this->_actionName = $actionName; - return $this; - } - - /** - * getActionName() - * - * @return string - */ - public function getActionName() - { - return $this->_actionName; - } - - /** - * create() - * - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function create() - { - if (self::createActionMethod($this->_controllerPath, $this->_actionName) === false) { - require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception( - 'Could not create action within controller ' . $this->_controllerPath - . ' with action name ' . $this->_actionName - ); - } - return $this; - } - - /** - * delete() - * - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function delete() - { - // @todo do this - return $this; - } - - /** - * createAcionMethod() - * - * @param string $controllerPath - * @param string $actionName - * @param string $body - * @return true - */ - public static function createActionMethod($controllerPath, $actionName, $body = ' // action body') - { - if (!file_exists($controllerPath)) { - return false; - } - - $controllerCodeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($controllerPath, true, true); - $controllerCodeGenFile->getClass()->setMethod(array( - 'name' => $actionName . 'Action', - 'body' => $body - )); - - file_put_contents($controllerPath, $controllerCodeGenFile->generate()); - return true; - } - - /** - * hasActionMethod() - * - * @param string $controllerPath - * @param string $actionName - * @return bool - */ - public static function hasActionMethod($controllerPath, $actionName) - { - if (!file_exists($controllerPath)) { - return false; - } - - $controllerCodeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($controllerPath, true, true); - return $controllerCodeGenFile->getClass()->hasMethod($actionName . 'Action'); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/ApisDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/ApisDirectory.php deleted file mode 100644 index 540482b6e..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/ApisDirectory.php +++ /dev/null @@ -1,55 +0,0 @@ -_type = $this->_resource->getAttribute('type'); - parent::init(); - return $this; - } - - /** - * getPersistentAttributes() - * - * @return array - */ - public function getPersistentAttributes() - { - return array('type' => $this->_type); - } - - /** - * getContents() - * - * @return string - */ - public function getContents() - { - if ($this->_content === null) { - if (file_exists($this->getPath())) { - $this->_content = file_get_contents($this->getPath()); - } else { - $this->_content = $this->_getDefaultContents(); - } - - } - - return $this->_content; - } - - public function getAsZendConfig($section = 'production') - { - return new Zend_Config_Ini($this->getPath(), $section); - } - - /** - * addStringItem() - * - * @param string $key - * @param string $value - * @param string $section - * @param bool $quoteValue - * @return Zend_Tool_Project_Context_Zf_ApplicationConfigFile - */ - public function addStringItem($key, $value, $section = 'production', $quoteValue = true) - { - // null quote value means to auto-detect - if ($quoteValue === null) { - $quoteValue = preg_match('#[\"\']#', $value) ? false : true; - } - - if ($quoteValue == true) { - $value = '"' . $value . '"'; - } - - $contentLines = preg_split('#[\n\r]#', $this->getContents()); - - $newLines = array(); - $insideSection = false; - - foreach ($contentLines as $contentLineIndex => $contentLine) { - - if ($insideSection === false && preg_match('#^\[' . $section . '#', $contentLine)) { - $insideSection = true; - } - - $newLines[] = $contentLine; - if ($insideSection) { - // if its blank, or a section heading - if (isset($contentLines[$contentLineIndex + 1]{0}) && $contentLines[$contentLineIndex + 1]{0} == '[') { - $newLines[] = $key . ' = ' . $value; - $insideSection = null; - } else if (!isset($contentLines[$contentLineIndex + 1])){ - $newLines[] = $key . ' = ' . $value; - $insideSection = null; - } - } - } - - $this->_content = implode("\n", $newLines); - return $this; - } - - /** - * - * @param array $item - * @param string $section - * @param bool $quoteValue - * @return Zend_Tool_Project_Context_Zf_ApplicationConfigFile - */ - public function addItem($item, $section = 'production', $quoteValue = true) - { - $stringItems = array(); - $stringValues = array(); - $configKeyNames = array(); - - $rii = new RecursiveIteratorIterator( - new RecursiveArrayIterator($item), - RecursiveIteratorIterator::SELF_FIRST - ); - - $lastDepth = 0; - - // loop through array structure recursively to create proper keys - foreach ($rii as $name => $value) { - $lastDepth = $rii->getDepth(); - - if (is_array($value)) { - array_push($configKeyNames, $name); - } else { - $stringItems[] = implode('.', $configKeyNames) . '.' . $name; - $stringValues[] = $value; - } - } - - foreach ($stringItems as $stringItemIndex => $stringItem) { - $this->addStringItem($stringItem, $stringValues[$stringItemIndex], $section, $quoteValue); - } - - return $this; - } - - public function removeStringItem($key, $section = 'production') - { - $contentLines = file($this->getPath()); - - $newLines = array(); - $insideSection = false; - - foreach ($contentLines as $contentLineIndex => $contentLine) { - - if ($insideSection === false && preg_match('#^\[' . $section . '#', $contentLine)) { - $insideSection = true; - } - - if ($insideSection) { - // if its blank, or a section heading - if ((trim($contentLine) == null) || ($contentLines[$contentLineIndex + 1][0] == '[')) { - $insideSection = null; - } - } - - if (!preg_match('#' . $key . '\s?=.*#', $contentLine)) { - $newLines[] = $contentLine; - } - } - - $this->_content = implode('', $newLines); - } - - public function removeItem($item, $section = 'production') - { - $stringItems = array(); - $stringValues = array(); - $configKeyNames = array(); - - $rii = new RecursiveIteratorIterator( - new RecursiveArrayIterator($item), - RecursiveIteratorIterator::SELF_FIRST - ); - - $lastDepth = 0; - - // loop through array structure recursively to create proper keys - foreach ($rii as $name => $value) { - $lastDepth = $rii->getDepth(); - - if (is_array($value)) { - array_push($configKeyNames, $name); - } else { - $stringItems[] = implode('.', $configKeyNames) . '.' . $name; - $stringValues[] = $value; - } - } - - foreach ($stringItems as $stringItemIndex => $stringItem) { - $this->removeStringItem($stringItem, $section); - } - - return $this; - } - - protected function _getDefaultContents() - { - - $contents =<<_resource->hasAttribute('classNamePrefix')) { - $this->_classNamePrefix = $this->_resource->getAttribute('classNamePrefix'); - } - parent::init(); - } - - /** - * getPersistentAttributes - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'classNamePrefix' => $this->getClassNamePrefix() - ); - } - - public function getName() - { - return 'ApplicationDirectory'; - } - - public function setClassNamePrefix($classNamePrefix) - { - $this->_classNamePrefix = $classNamePrefix; - } - - public function getClassNamePrefix() - { - return $this->_classNamePrefix; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/BootstrapFile.php b/library/vendor/Zend/Tool/Project/Context/Zf/BootstrapFile.php deleted file mode 100644 index e815c9deb..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/BootstrapFile.php +++ /dev/null @@ -1,119 +0,0 @@ -_applicationConfigFile = $this->_resource->getProfile()->search('ApplicationConfigFile'); - $this->_applicationDirectory = $this->_resource->getProfile()->search('ApplicationDirectory'); - - if (($this->_applicationConfigFile === false) || ($this->_applicationDirectory === false)) { - throw new Exception('To use the BootstrapFile context, your project requires the use of both the "ApplicationConfigFile" and "ApplicationDirectory" contexts.'); - } - - - } - - /** - * getContents() - * - * @return array - */ - public function getContents() - { - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'classes' => array( - new Zend_CodeGenerator_Php_Class(array( - 'name' => 'Bootstrap', - 'extendedClass' => 'Zend_Application_Bootstrap_Bootstrap', - )), - ) - )); - - return $codeGenFile->generate(); - } - - public function getApplicationInstance() - { - if ($this->_applicationInstance == null) { - if ($this->_applicationConfigFile->getContext()->exists()) { - define('APPLICATION_PATH', $this->_applicationDirectory->getPath()); - $applicationOptions = array(); - $applicationOptions['config'] = $this->_applicationConfigFile->getPath(); - - $this->_applicationInstance = new Zend_Application( - 'development', - $applicationOptions - ); - } - } - - return $this->_applicationInstance; - } -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/CacheDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/CacheDirectory.php deleted file mode 100644 index d6b37ca7f..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/CacheDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_controllerName = $this->_resource->getAttribute('controllerName'); - $this->_moduleName = $this->_resource->getAttribute('moduleName'); - $this->_filesystemName = ucfirst($this->_controllerName) . 'Controller.php'; - parent::init(); - } - - /** - * getPersistentAttributes - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'controllerName' => $this->getControllerName() - ); - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'ControllerFile'; - } - - /** - * getControllerName() - * - * @return string - */ - public function getControllerName() - { - return $this->_controllerName; - } - - /** - * getContents() - * - * @return string - */ - public function getContents() - { - $filter = new Zend_Filter_Word_DashToCamelCase(); - - $className = ($this->_moduleName) ? $filter->filter(ucfirst($this->_moduleName)) . '_' : ''; - $className .= ucfirst($this->_controllerName) . 'Controller'; - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'fileName' => $this->getPath(), - 'classes' => array( - new Zend_CodeGenerator_Php_Class(array( - 'name' => $className, - 'extendedClass' => 'Zend_Controller_Action', - 'methods' => array( - new Zend_CodeGenerator_Php_Method(array( - 'name' => 'init', - 'body' => '/* Initialize action controller here */', - )) - ) - )) - ) - )); - - - if ($className == 'ErrorController') { - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'fileName' => $this->getPath(), - 'classes' => array( - new Zend_CodeGenerator_Php_Class(array( - 'name' => $className, - 'extendedClass' => 'Zend_Controller_Action', - 'methods' => array( - new Zend_CodeGenerator_Php_Method(array( - 'name' => 'errorAction', - 'body' => <<_getParam('error_handler'); - -if (!\$errors || !\$errors instanceof ArrayObject) { - \$this->view->message = 'You have reached the error page'; - return; -} - -switch (\$errors->type) { - case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: - case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER: - case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION: - // 404 error -- controller or action not found - \$this->getResponse()->setHttpResponseCode(404); - \$priority = Zend_Log::NOTICE; - \$this->view->message = 'Page not found'; - break; - default: - // application error - \$this->getResponse()->setHttpResponseCode(500); - \$priority = Zend_Log::CRIT; - \$this->view->message = 'Application error'; - break; -} - -// Log exception, if logger available -if (\$log = \$this->getLog()) { - \$log->log(\$this->view->message, \$priority, \$errors->exception); - \$log->log('Request Parameters', \$priority, \$errors->request->getParams()); -} - -// conditionally display exceptions -if (\$this->getInvokeArg('displayExceptions') == true) { - \$this->view->exception = \$errors->exception; -} - -\$this->view->request = \$errors->request; -EOS - )), - new Zend_CodeGenerator_Php_Method(array( - 'name' => 'getLog', - 'body' => <<getInvokeArg('bootstrap'); -if (!\$bootstrap->hasResource('Log')) { - return false; -} -\$log = \$bootstrap->getResource('Log'); -return \$log; -EOS - )), - ) - )) - ) - )); - - } - - // store the generator into the registry so that the addAction command can use the same object later - Zend_CodeGenerator_Php_File::registerFileCodeGenerator($codeGenFile); // REQUIRES filename to be set - return $codeGenFile->generate(); - } - - /** - * addAction() - * - * @param string $actionName - */ - public function addAction($actionName) - { - $classCodeGen = $this->getCodeGenerator(); - $classCodeGen->setMethod(array('name' => $actionName . 'Action', 'body' => ' // action body here')); - file_put_contents($this->getPath(), $classCodeGen->generate()); - } - - /** - * getCodeGenerator() - * - * @return Zend_CodeGenerator_Php_Class - */ - public function getCodeGenerator() - { - $codeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($this->getPath()); - $codeGenFileClasses = $codeGenFile->getClasses(); - $class = array_shift($codeGenFileClasses); - return $class; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/ControllersDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/ControllersDirectory.php deleted file mode 100644 index fe6cd4dc1..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/ControllersDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_dbTableName = $this->_resource->getAttribute('dbTableName'); - $this->_actualTableName = $this->_resource->getAttribute('actualTableName'); - $this->_filesystemName = ucfirst($this->_dbTableName) . '.php'; - parent::init(); - } - - public function getPersistentAttributes() - { - return array('dbTableName' => $this->_dbTableName); - } - - public function getContents() - { - $className = $this->getFullClassName($this->_dbTableName, 'Model_DbTable'); - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'fileName' => $this->getPath(), - 'classes' => array( - new Zend_CodeGenerator_Php_Class(array( - 'name' => $className, - 'extendedClass' => 'Zend_Db_Table_Abstract', - 'properties' => array( - new Zend_CodeGenerator_Php_Property(array( - 'name' => '_name', - 'visibility' => Zend_CodeGenerator_Php_Property::VISIBILITY_PROTECTED, - 'defaultValue' => $this->_actualTableName - )) - ), - - )) - ) - )); - return $codeGenFile->generate(); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/DocsDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/DocsDirectory.php deleted file mode 100644 index cc047ea17..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/DocsDirectory.php +++ /dev/null @@ -1,61 +0,0 @@ -_formName = $this->_resource->getAttribute('formName'); - $this->_filesystemName = ucfirst($this->_formName) . '.php'; - parent::init(); - } - - /** - * getPersistentAttributes - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'formName' => $this->getFormName() - ); - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'FormFile'; - } - - public function getFormName() - { - return $this->_formName; - } - - public function getContents() - { - - $className = $this->getFullClassName($this->_formName, 'Form'); - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'fileName' => $this->getPath(), - 'classes' => array( - new Zend_CodeGenerator_Php_Class(array( - 'name' => $className, - 'extendedClass' => 'Zend_Form', - 'methods' => array( - new Zend_CodeGenerator_Php_Method(array( - 'name' => 'init', - 'body' => '/* Form Elements & Other Definitions Here ... */', - )) - ) - - )) - ) - )); - return $codeGenFile->generate(); - } -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/FormsDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/FormsDirectory.php deleted file mode 100644 index 433733d7a..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/FormsDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_resource->getAttribute('layoutName')) { - $this->_layoutName = $layoutName; - } else { - throw new Exception('Either a forActionName or scriptName is required.'); - } - - parent::init(); - return $this; - } - - /** - * getPersistentAttributes() - * - * @return unknown - */ - public function getPersistentAttributes() - { - $attributes = array(); - - if ($this->_layoutName) { - $attributes['layoutName'] = $this->_layoutName; - } - - return $attributes; - } - - /** - * getContents() - * - * @return string - */ - public function getContents() - { - $contents = <<layout()->content; ?> -EOS; - - return $contents; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/LayoutScriptsDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/LayoutScriptsDirectory.php deleted file mode 100644 index 52df0b412..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/LayoutScriptsDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_modelName = $this->_resource->getAttribute('modelName'); - $this->_filesystemName = ucfirst($this->_modelName) . '.php'; - parent::init(); - } - - /** - * getPersistentAttributes - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'modelName' => $this->getModelName() - ); - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'ModelFile'; - } - - public function getModelName() - { - return $this->_modelName; - } - - public function getContents() - { - - $className = $this->getFullClassName($this->_modelName, 'Model'); - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'fileName' => $this->getPath(), - 'classes' => array( - new Zend_CodeGenerator_Php_Class(array( - 'name' => $className, - )) - ) - )); - return $codeGenFile->generate(); - } - - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/ModelsDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/ModelsDirectory.php deleted file mode 100644 index 45b6f5a26..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/ModelsDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_filesystemName = $this->_moduleName = $this->_resource->getAttribute('moduleName'); - parent::init(); - return $this; - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'ModuleDirectory'; - } - - /** - * getPersistentAttributes - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'moduleName' => $this->getModuleName() - ); - } - - /** - * getModuleName() - * - * @return string - */ - public function getModuleName() - { - return $this->_moduleName; - } - - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/ModulesDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/ModulesDirectory.php deleted file mode 100644 index 06c793c94..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/ModulesDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_projectProviderName = $this->_resource->getAttribute('projectProviderName'); - $this->_actionNames = $this->_resource->getAttribute('actionNames'); - $this->_filesystemName = ucfirst($this->_projectProviderName) . 'Provider.php'; - - if (strpos($this->_actionNames, ',')) { - $this->_actionNames = explode(',', $this->_actionNames); - } else { - $this->_actionNames = ($this->_actionNames) ? array($this->_actionNames) : array(); - } - - parent::init(); - return $this; - } - - /** - * getPersistentAttributes() - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'projectProviderName' => $this->getProjectProviderName(), - 'actionNames' => implode(',', $this->_actionNames) - ); - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'ProjectProviderFile'; - } - - /** - * getProjectProviderName() - * - * @return string - */ - public function getProjectProviderName() - { - return $this->_projectProviderName; - } - - /** - * getContents() - * - * @return string - */ - public function getContents() - { - - $filter = new Zend_Filter_Word_DashToCamelCase(); - - $className = $filter->filter($this->_projectProviderName) . 'Provider'; - - $class = new Zend_CodeGenerator_Php_Class(array( - 'name' => $className, - 'extendedClass' => 'Zend_Tool_Project_Provider_Abstract' - )); - - $methods = array(); - foreach ($this->_actionNames as $actionName) { - $methods[] = new Zend_CodeGenerator_Php_Method(array( - 'name' => $actionName, - 'body' => ' /** @todo Implementation */' - )); - } - - if ($methods) { - $class->setMethods($methods); - } - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'requiredFiles' => array( - 'Zend/Tool/Project/Provider/Abstract.php', - 'Zend/Tool/Project/Provider/Exception.php' - ), - 'classes' => array($class) - )); - - return $codeGenFile->generate(); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/PublicDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/PublicDirectory.php deleted file mode 100644 index 5ab3b1b0e..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/PublicDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ - <<bootstrap() - ->run(); -EOS - )); - return $codeGenerator->generate(); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/PublicScriptsDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/PublicScriptsDirectory.php deleted file mode 100644 index fe44d8009..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/PublicScriptsDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_forActionName = $this->_resource->getAttribute('forActionName'); - - $this->_resource->setAppendable(false); - $this->_testApplicationControllerResource = $this->_resource->getParentResource(); - if (!$this->_testApplicationControllerResource->getContext() instanceof Zend_Tool_Project_Context_Zf_TestApplicationControllerFile) { - require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception('ActionMethod must be a sub resource of a TestApplicationControllerFile'); - } - // make the ControllerFile node appendable so we can tack on the actionMethod. - $this->_resource->getParentResource()->setAppendable(true); - - $this->_testApplicationControllerPath = $this->_testApplicationControllerResource->getContext()->getPath(); - - return $this; - } - - /** - * getPersistentAttributes - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'forActionName' => $this->getForActionName() - ); - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'TestApplicationActionMethod'; - } - - /** - * setResource() - * - * @param Zend_Tool_Project_Profile_Resource $resource - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function setResource(Zend_Tool_Project_Profile_Resource $resource) - { - $this->_resource = $resource; - return $this; - } - - /** - * getActionName() - * - * @return string - */ - public function getForActionName() - { - return $this->_forActionName; - } - - /** - * create() - * - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function create() - { - $file = $this->_testApplicationControllerPath; - - if (!file_exists($file)) { - require_once 'Zend/Tool/Project/Context/Exception.php'; - throw new Zend_Tool_Project_Context_Exception( - 'Could not create action within test controller ' . $file - . ' with action name ' . $this->_forActionName - ); - } - - $actionParam = $this->getForActionName(); - $controllerParam = $this->_resource->getParentResource()->getForControllerName(); - //$moduleParam = null;// - - /* @var $controllerDirectoryResource Zend_Tool_Project_Profile_Resource */ - $controllerDirectoryResource = $this->_resource->getParentResource()->getParentResource(); - if ($controllerDirectoryResource->getParentResource()->getName() == 'TestApplicationModuleDirectory') { - $moduleParam = $controllerDirectoryResource->getParentResource()->getForModuleName(); - } else { - $moduleParam = 'default'; - } - - - - if ($actionParam == 'index' && $controllerParam == 'Index' && $moduleParam == 'default') { - $assert = '$this->assertQueryContentContains("div#welcome h3", "This is your project\'s main page");'; - } else { - $assert = <<assertQueryContentContains( - 'div#view-content p', - 'View script for controller ' . \$params['controller'] . ' and script/action name ' . \$params['action'] . '' - ); -EOS; - } - - $codeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($file, true, true); - $codeGenFile->getClass()->setMethod(array( - 'name' => 'test' . ucfirst($actionParam) . 'Action', - 'body' => << '$actionParam', 'controller' => '$controllerParam', 'module' => '$moduleParam'); -\$urlParams = \$this->urlizeOptions(\$params); -\$url = \$this->url(\$urlParams); -\$this->dispatch(\$url); - -// assertions -\$this->assertModule(\$urlParams['module']); -\$this->assertController(\$urlParams['controller']); -\$this->assertAction(\$urlParams['action']); -$assert - -EOS - )); - - file_put_contents($file, $codeGenFile->generate()); - - return $this; - } - - /** - * delete() - * - * @return Zend_Tool_Project_Context_Zf_ActionMethod - */ - public function delete() - { - // @todo do this - return $this; - } - - /** - * hasActionMethod() - * - * @param string $controllerPath - * @param string $actionName - * @return bool - */ - /* - public static function hasActionMethod($controllerPath, $actionName) - { - if (!file_exists($controllerPath)) { - return false; - } - - $controllerCodeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($controllerPath, true, true); - return $controllerCodeGenFile->getClass()->hasMethod('test' . $actionName . 'Action'); - } - */ - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationBootstrapFile.php b/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationBootstrapFile.php deleted file mode 100644 index 5352aed9b..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationBootstrapFile.php +++ /dev/null @@ -1,57 +0,0 @@ -_forControllerName = $this->_resource->getAttribute('forControllerName'); - $this->_filesystemName = ucfirst($this->_forControllerName) . 'ControllerTest.php'; - parent::init(); - return $this; - } - - /** - * getPersistentAttributes() - * - * @return unknown - */ - public function getPersistentAttributes() - { - $attributes = array(); - - if ($this->_forControllerName) { - $attributes['forControllerName'] = $this->getForControllerName(); - } - - return $attributes; - } - - public function getForControllerName() - { - return $this->_forControllerName; - } - - /** - * getContents() - * - * @return string - */ - public function getContents() - { - - $filter = new Zend_Filter_Word_DashToCamelCase(); - - $className = $filter->filter($this->_forControllerName) . 'ControllerTest'; - - /* @var $controllerDirectoryResource Zend_Tool_Project_Profile_Resource */ - $controllerDirectoryResource = $this->_resource->getParentResource(); - if ($controllerDirectoryResource->getParentResource()->getName() == 'TestApplicationModuleDirectory') { - $className = $filter->filter(ucfirst($controllerDirectoryResource->getParentResource()->getForModuleName())) - . '_' . $className; - } - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'classes' => array( - new Zend_CodeGenerator_Php_Class(array( - 'name' => $className, - 'extendedClass' => 'Zend_Test_PHPUnit_ControllerTestCase', - 'methods' => array( - new Zend_CodeGenerator_Php_Method(array( - 'name' => 'setUp', - 'body' => <<bootstrap = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini'); -parent::setUp(); -EOS - )) - ) - )) - ) - )); - - return $codeGenFile->generate(); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationDirectory.php deleted file mode 100644 index 8ec3297b7..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_filesystemName = $this->_forModuleName = $this->_resource->getAttribute('forModuleName'); - parent::init(); - return $this; - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'TestApplicationModuleDirectory'; - } - - /** - * getPersistentAttributes - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'forModuleName' => $this->getForModuleName() - ); - } - - /** - * getModuleName() - * - * @return string - */ - public function getForModuleName() - { - return $this->_forModuleName; - } - - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationModulesDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationModulesDirectory.php deleted file mode 100644 index e4d60986e..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/TestApplicationModulesDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_forClassName = $this->_resource->getAttribute('forClassName'); - $this->_filesystemName = ucfirst(ltrim(strrchr($this->_forClassName, '_'), '_')) . 'Test.php'; - parent::init(); - return $this; - } - - /** - * getContents() - * - * @return string - */ - public function getContents() - { - - $filter = new Zend_Filter_Word_DashToCamelCase(); - - $className = $filter->filter($this->_forClassName) . 'Test'; - - $codeGenFile = new Zend_CodeGenerator_Php_File(array( - 'requiredFiles' => array( - 'PHPUnit/Framework/TestCase.php' - ), - 'classes' => array( - new Zend_CodeGenerator_Php_Class(array( - 'name' => $className, - 'extendedClass' => 'PHPUnit_Framework_TestCase', - 'methods' => array( - new Zend_CodeGenerator_Php_Method(array( - 'name' => 'setUp', - 'body' => ' /* Setup Routine */' - )), - new Zend_CodeGenerator_Php_Method(array( - 'name' => 'tearDown', - 'body' => ' /* Tear Down Routine */' - )) - ) - )) - ) - )); - - return $codeGenFile->generate(); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/TestLibraryNamespaceDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/TestLibraryNamespaceDirectory.php deleted file mode 100644 index 645683456..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/TestLibraryNamespaceDirectory.php +++ /dev/null @@ -1,88 +0,0 @@ -_namespaceName = $this->_resource->getAttribute('namespaceName'); - $this->_filesystemName = $this->_namespaceName; - parent::init(); - return $this; - } - - /** - * getPersistentAttributes() - * - * @return array - */ - public function getPersistentAttributes() - { - $attributes = array(); - $attributes['namespaceName'] = $this->_namespaceName; - - return $attributes; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/TestPHPUnitBootstrapFile.php b/library/vendor/Zend/Tool/Project/Context/Zf/TestPHPUnitBootstrapFile.php deleted file mode 100644 index 1ebf07976..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/TestPHPUnitBootstrapFile.php +++ /dev/null @@ -1,88 +0,0 @@ - <<generate(); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/TestPHPUnitConfigFile.php b/library/vendor/Zend/Tool/Project/Context/Zf/TestPHPUnitConfigFile.php deleted file mode 100644 index 73b71f974..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/TestPHPUnitConfigFile.php +++ /dev/null @@ -1,81 +0,0 @@ - - - ./application - - - ./library - - - - - - - - -EOS; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/TestsDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/TestsDirectory.php deleted file mode 100644 index 17213a15a..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/TestsDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_forControllerName = $this->_resource->getAttribute('forControllerName'); - $this->_filesystemName = $this->_convertControllerNameToFilesystemName($this->_forControllerName); - parent::init(); - return $this; - } - - /** - * getPersistentAttributes() - * - * @return array - */ - public function getPersistentAttributes() - { - return array( - 'forControllerName' => $this->_forControllerName - ); - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'ViewControllerScriptsDirectory'; - } - - protected function _convertControllerNameToFilesystemName($controllerName) - { - $filter = new Zend_Filter(); - $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash()) - ->addFilter(new Zend_Filter_StringToLower()); - return $filter->filter($controllerName); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/ViewFiltersDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/ViewFiltersDirectory.php deleted file mode 100644 index 6e124c91f..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/ViewFiltersDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_resource->getAttribute('forActionName')) { - $this->_forActionName = $forActionName; - $this->_filesystemName = $this->_convertActionNameToFilesystemName($forActionName) . '.phtml'; - } elseif ($scriptName = $this->_resource->getAttribute('scriptName')) { - $this->_scriptName = $scriptName; - $this->_filesystemName = $scriptName . '.phtml'; - } else { - throw new Exception('Either a forActionName or scriptName is required.'); - } - - parent::init(); - return $this; - } - - /** - * getPersistentAttributes() - * - * @return unknown - */ - public function getPersistentAttributes() - { - $attributes = array(); - - if ($this->_forActionName) { - $attributes['forActionName'] = $this->_forActionName; - } - - if ($this->_scriptName) { - $attributes['scriptName'] = $this->_scriptName; - } - - return $attributes; - } - - /** - * getContents() - * - * @return string - */ - public function getContents() - { - $contents = ''; - - $controllerName = $this->_resource->getParentResource()->getAttribute('forControllerName'); - - $viewsDirectoryResource = $this->_resource - ->getParentResource() // view script - ->getParentResource() // view controller dir - ->getParentResource(); // views dir - if ($viewsDirectoryResource->getParentResource()->getName() == 'ModuleDirectory') { - $moduleName = $viewsDirectoryResource->getParentResource()->getModuleName(); - } else { - $moduleName = 'default'; - } - - if ($this->_filesystemName == 'error.phtml') { // should also check that the above directory is forController=error - $contents .= << - - - - Zend Framework Default Application - - -

An error occurred

-

message ?>

- - exception)): ?> - -

Exception information:

-

- Message: exception->getMessage() ?> -

- -

Stack trace:

-
exception->getTraceAsString() ?>
-  
- -

Request Parameters:

-
escape(var_export(\$this->request->getParams(), true)) ?>
-  
- - - - - - -EOS; - } elseif ($this->_forActionName == 'index' && $controllerName == 'Index' && $moduleName == 'default') { - - $contents =<< - a:link, - a:visited - { - color: #0398CA; - } - - span#zf-name - { - color: #91BE3F; - } - - div#welcome - { - color: #FFFFFF; - background-image: url(http://framework.zend.com/images/bkg_header.jpg); - width: 600px; - height: 400px; - border: 2px solid #444444; - overflow: hidden; - text-align: center; - } - - div#more-information - { - background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif); - height: 100%; - } - -
-

Welcome to the Zend Framework!

- -

This is your project's main page

- -
-

-

- Helpful Links:
- Zend Framework Website | - Zend Framework Manual -

-
-
-EOS; - - } else { - $controllerName = $this->_resource->getParentResource()->getAttribute('forControllerName'); - $actionName = $this->_forActionName; - $contents = <<
-
-

View script for controller $controllerName and script/action name $actionName

-
-EOS; - } - return $contents; - } - - protected function _convertActionNameToFilesystemName($actionName) - { - $filter = new Zend_Filter(); - $filter->addFilter(new Zend_Filter_Word_CamelCaseToDash()) - ->addFilter(new Zend_Filter_StringToLower()); - return $filter->filter($actionName); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Context/Zf/ViewScriptsDirectory.php b/library/vendor/Zend/Tool/Project/Context/Zf/ViewScriptsDirectory.php deleted file mode 100644 index a73aea9d4..000000000 --- a/library/vendor/Zend/Tool/Project/Context/Zf/ViewScriptsDirectory.php +++ /dev/null @@ -1,57 +0,0 @@ -_getZfPath(); - if ($zfPath != false) { - $zfIterator = new RecursiveDirectoryIterator($zfPath); - foreach ($rii = new RecursiveIteratorIterator($zfIterator, RecursiveIteratorIterator::SELF_FIRST) as $file) { - $relativePath = preg_replace('#^'.preg_quote(realpath($zfPath), '#').'#', '', realpath($file->getPath())) . DIRECTORY_SEPARATOR . $file->getFilename(); - if (strpos($relativePath, DIRECTORY_SEPARATOR . '.') !== false) { - continue; - } - - if ($file->isDir()) { - mkdir($this->getBaseDirectory() . DIRECTORY_SEPARATOR . $this->getFilesystemName() . $relativePath); - } else { - copy($file->getPathname(), $this->getBaseDirectory() . DIRECTORY_SEPARATOR . $this->getFilesystemName() . $relativePath); - } - - } - } - } - - /** - * _getZfPath() - * - * @return string|false - */ - protected function _getZfPath() - { - require_once 'Zend/Loader.php'; - foreach (Zend_Loader::explodeIncludePath() as $includePath) { - if (!file_exists($includePath) || $includePath[0] == '.') { - continue; - } - - if (realpath($checkedPath = rtrim($includePath, '\\/') . '/Zend/Loader.php') !== false && file_exists($checkedPath)) { - return dirname($checkedPath); - } - } - - return false; - } - -} diff --git a/library/vendor/Zend/Tool/Project/Exception.php b/library/vendor/Zend/Tool/Project/Exception.php deleted file mode 100644 index fa2531403..000000000 --- a/library/vendor/Zend/Tool/Project/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ -setOptions($options); - } - - $this->_topResources = new Zend_Tool_Project_Profile_Resource_Container(); - } - - /** - * Process options and either set a profile property or - * set a profile 'attribute' - * - * @param array $options - */ - public function setOptions(Array $options) - { - $this->setAttributes($options); - } - - /** - * getIterator() - reqruied by the RecursiveIterator interface - * - * @return RecursiveIteratorIterator - */ - public function getIterator() - { - require_once 'Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php'; - - return new RecursiveIteratorIterator( - new Zend_Tool_Project_Profile_Iterator_EnabledResourceFilter($this), - RecursiveIteratorIterator::SELF_FIRST - ); - } - - /** - * loadFromData() - Load a profile from data provided by the - * 'profilData' attribute - * - */ - public function loadFromData() - { - if (!isset($this->_attributes['profileData'])) { - require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('loadFromData() must have "profileData" set.'); - } - - $profileFileParser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $profileFileParser->unserialize($this->_attributes['profileData'], $this); - - $this->rewind(); - } - - /** - * isLoadableFromFile() - can a profile be loaded from a file - * - * wether or not a profile can be loaded from the - * file in attribute 'projectProfileFile', or from a file named - * '.zfproject.xml' inside a directory in key 'projectDirectory' - * - * @return bool - */ - public function isLoadableFromFile() - { - if (!isset($this->_attributes['projectProfileFile']) && !isset($this->_attributes['projectDirectory'])) { - return false; - } - - if (isset($this->_attributes['projectProfileFile'])) { - $projectProfileFilePath = $this->_attributes['projectProfileFile']; - if (!file_exists($projectProfileFilePath)) { - return false; - } - } else { - $projectProfileFilePath = rtrim($this->_attributes['projectDirectory'], '/\\') . '/.zfproject.xml'; - if (!file_exists($projectProfileFilePath)) { - return false; - } - } - - return true; - } - - /** - * loadFromFile() - Load data from file - * - * this attempts to load a project profile file from a variety of locations depending - * on what information the user provided vie $options or attributes, specifically the - * 'projectDirectory' or 'projectProfileFile' - * - */ - public function loadFromFile() - { - // if no data is supplied, need either a projectProfileFile or a projectDirectory - if (!isset($this->_attributes['projectProfileFile']) && !isset($this->_attributes['projectDirectory'])) { - require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('loadFromFile() must have at least "projectProfileFile" or "projectDirectory" set.'); - } - - if (isset($this->_attributes['projectProfileFile'])) { - $projectProfileFilePath = $this->_attributes['projectProfileFile']; - if (!file_exists($projectProfileFilePath)) { - require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('"projectProfileFile" was supplied but file was not found at location ' . $projectProfileFilePath); - } - $this->_attributes['projectDirectory'] = dirname($projectProfileFilePath); - } else { - $projectProfileFilePath = rtrim($this->_attributes['projectDirectory'], '/\\') . '/.zfproject.xml'; - if (!file_exists($projectProfileFilePath)) { - require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('"projectDirectory" was supplied but no profile file file was not found at location ' . $projectProfileFilePath); - } - $this->_attributes['projectProfileFile'] = $projectProfileFilePath; - } - - $profileData = file_get_contents($projectProfileFilePath); - - $profileFileParser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $profileFileParser->unserialize($profileData, $this); - - $this->rewind(); - } - - /** - * storeToFile() - store the current profile to file - * - * This will store the profile in memory to a place on disk determined by the attributes - * available, specifically if the key 'projectProfileFile' is available - * - */ - public function storeToFile() - { - $file = null; - - if (isset($this->_attributes['projectProfileFile'])) { - $file = $this->_attributes['projectProfileFile']; - } - - if ($file == null) { - require_once 'Zend/Tool/Project/Exception.php'; - throw new Zend_Tool_Project_Exception('storeToFile() must have a "projectProfileFile" attribute set.'); - } - - $parser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $xml = $parser->serialize($this); - file_put_contents($file, $xml); - } - - /** - * storeToData() - create a string representation of the profile in memory - * - * @return string - */ - public function storeToData() - { - $parser = new Zend_Tool_Project_Profile_FileParser_Xml(); - $xml = $parser->serialize($this); - return $xml; - } - - /** - * __toString() - cast this profile to string to be able to view it. - * - * @return string - */ - public function __toString() - { - $string = ''; - foreach ($this as $resource) { - $string .= $resource->getName() . PHP_EOL; - $rii = new RecursiveIteratorIterator($resource, RecursiveIteratorIterator::SELF_FIRST); - foreach ($rii as $item) { - $string .= str_repeat(' ', $rii->getDepth()+1) . $item->getName() - . ((count($attributes = $item->getAttributes()) > 0) ? ' [' . http_build_query($attributes) . ']' : '') - . PHP_EOL; - } - } - return $string; - } -} diff --git a/library/vendor/Zend/Tool/Project/Profile/Exception.php b/library/vendor/Zend/Tool/Project/Profile/Exception.php deleted file mode 100644 index 35c65f547..000000000 --- a/library/vendor/Zend/Tool/Project/Profile/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ -_contextRepository = Zend_Tool_Project_Context_Repository::getInstance(); - } - - /** - * serialize() - * - * create an xml string from the provided profile - * - * @param Zend_Tool_Project_Profile $profile - * @return string - */ - public function serialize(Zend_Tool_Project_Profile $profile) - { - - $profile = clone $profile; - - $this->_profile = $profile; - $xmlElement = new SimpleXMLElement(''); - - if ($profile->hasAttribute('type')) { - $xmlElement->addAttribute('type', $profile->getAttribute('type')); - } - - if ($profile->hasAttribute('version')) { - $xmlElement->addAttribute('version', $profile->getAttribute('version')); - } - - self::_serializeRecurser($profile, $xmlElement); - - $doc = new DOMDocument('1.0'); - $doc->formatOutput = true; - $domnode = dom_import_simplexml($xmlElement); - $domnode = $doc->importNode($domnode, true); - $domnode = $doc->appendChild($domnode); - - return $doc->saveXML(); - } - - /** - * unserialize() - * - * Create a structure in the object $profile from the structure specficied - * in the xml string provided - * - * @param string xml data - * @param Zend_Tool_Project_Profile The profile to use as the top node - * @return Zend_Tool_Project_Profile - */ - public function unserialize($data, Zend_Tool_Project_Profile $profile) - { - if ($data == null) { - throw new Exception('contents not available to unserialize.'); - } - - $this->_profile = $profile; - - $xmlDataIterator = new SimpleXMLIterator($data); - - if ($xmlDataIterator->getName() != 'projectProfile') { - throw new Exception('Profiles must start with a projectProfile node'); - } - - if (isset($xmlDataIterator['type'])) { - $this->_profile->setAttribute('type', (string) $xmlDataIterator['type']); - } - - if (isset($xmlDataIterator['version'])) { - $this->_profile->setAttribute('version', (string) $xmlDataIterator['version']); - } - - // start un-serialization of the xml doc - $this->_unserializeRecurser($xmlDataIterator); - - // contexts should be initialized after the unwinding of the profile structure - $this->_lazyLoadContexts(); - - return $this->_profile; - - } - - /** - * _serializeRecurser() - * - * This method will be used to traverse the depths of the structure - * when *serializing* an xml structure into a string - * - * @param array $resources - * @param SimpleXmlElement $xmlNode - */ - protected function _serializeRecurser($resources, SimpleXmlElement $xmlNode) - { - // @todo find a better way to handle concurrency.. if no clone, _position in node gets messed up - //if ($resources instanceof Zend_Tool_Project_Profile_Resource) { - // $resources = clone $resources; - //} - - foreach ($resources as $resource) { - - if ($resource->isDeleted()) { - continue; - } - - $resourceName = $resource->getContext()->getName(); - $resourceName[0] = strtolower($resourceName[0]); - - $newNode = $xmlNode->addChild($resourceName); - - //$reflectionClass = new ReflectionClass($resource->getContext()); - - if ($resource->isEnabled() == false) { - $newNode->addAttribute('enabled', 'false'); - } - - foreach ($resource->getPersistentAttributes() as $paramName => $paramValue) { - $newNode->addAttribute($paramName, $paramValue); - } - - if ($resource->hasChildren()) { - self::_serializeRecurser($resource, $newNode); - } - - } - - } - - - /** - * _unserializeRecurser() - * - * This method will be used to traverse the depths of the structure - * as needed to *unserialize* the profile from an xmlIterator - * - * @param SimpleXMLIterator $xmlIterator - * @param Zend_Tool_Project_Profile_Resource $resource - */ - protected function _unserializeRecurser(SimpleXMLIterator $xmlIterator, Zend_Tool_Project_Profile_Resource $resource = null) - { - - foreach ($xmlIterator as $resourceName => $resourceData) { - - $contextName = $resourceName; - $subResource = new Zend_Tool_Project_Profile_Resource($contextName); - $subResource->setProfile($this->_profile); - - if ($resourceAttributes = $resourceData->attributes()) { - $attributes = array(); - foreach ($resourceAttributes as $attrName => $attrValue) { - $attributes[$attrName] = (string) $attrValue; - } - $subResource->setAttributes($attributes); - } - - if ($resource) { - $resource->append($subResource, false); - } else { - $this->_profile->append($subResource); - } - - if ($this->_contextRepository->isOverwritableContext($contextName) == false) { - $subResource->initializeContext(); - } - - if ($xmlIterator->hasChildren()) { - self::_unserializeRecurser($xmlIterator->getChildren(), $subResource); - } - } - } - - /** - * _lazyLoadContexts() - * - * This method will call initializeContext on the resources in a profile - * @todo determine if this method belongs inside the profile - * - */ - protected function _lazyLoadContexts() - { - - foreach ($this->_profile as $topResource) { - $rii = new RecursiveIteratorIterator($topResource, RecursiveIteratorIterator::SELF_FIRST); - foreach ($rii as $resource) { - $resource->initializeContext(); - } - } - - } - -} diff --git a/library/vendor/Zend/Tool/Project/Profile/Iterator/ContextFilter.php b/library/vendor/Zend/Tool/Project/Profile/Iterator/ContextFilter.php deleted file mode 100644 index b074614e4..000000000 --- a/library/vendor/Zend/Tool/Project/Profile/Iterator/ContextFilter.php +++ /dev/null @@ -1,211 +0,0 @@ -_rawOptions = $options; - if ($options) { - $this->setOptions($options); - } - } - - /** - * setOptions() - * - * @param array $options - */ - public function setOptions(Array $options) - { - foreach ($options as $optionName => $optionValue) { - if (substr($optionName, -1, 1) != 's') { - $optionName .= 's'; - } - if (method_exists($this, 'set' . $optionName)) { - $this->{'set' . $optionName}($optionValue); - } - } - } - - /** - * setAcceptTypes() - * - * @param array|string $acceptTypes - * @return Zend_Tool_Project_Profile_Iterator_ContextFilter - */ - public function setAcceptTypes($acceptTypes) - { - if (!is_array($acceptTypes)) { - $acceptTypes = array($acceptTypes); - } - - $this->_acceptTypes = $acceptTypes; - return $this; - } - - /** - * setDenyTypes() - * - * @param array|string $denyTypes - * @return Zend_Tool_Project_Profile_Iterator_ContextFilter - */ - public function setDenyTypes($denyTypes) - { - if (!is_array($denyTypes)) { - $denyTypes = array($denyTypes); - } - - $this->_denyTypes = $denyTypes; - return $this; - } - - /** - * setAcceptNames() - * - * @param array|string $acceptNames - * @return Zend_Tool_Project_Profile_Iterator_ContextFilter - */ - public function setAcceptNames($acceptNames) - { - if (!is_array($acceptNames)) { - $acceptNames = array($acceptNames); - } - - foreach ($acceptNames as $n => $v) { - $acceptNames[$n] = strtolower($v); - } - - $this->_acceptNames = $acceptNames; - return $this; - } - - /** - * setDenyNames() - * - * @param array|string $denyNames - * @return Zend_Tool_Project_Profile_Iterator_ContextFilter - */ - public function setDenyNames($denyNames) - { - if (!is_array($denyNames)) { - $denyNames = array($denyNames); - } - - foreach ($denyNames as $n => $v) { - $denyNames[$n] = strtolower($v); - } - - $this->_denyNames = $denyNames; - return $this; - } - - /** - * accept() is required by teh RecursiveFilterIterator - * - * @return bool - */ - public function accept() - { - $currentItem = $this->current(); - - if (in_array(strtolower($currentItem->getName()), $this->_acceptNames)) { - return true; - } elseif (in_array(strtolower($currentItem->getName()), $this->_denyNames)) { - return false; - } - - foreach ($this->_acceptTypes as $acceptType) { - if ($currentItem->getContent() instanceof $acceptType) { - return true; - } - } - - foreach ($this->_denyTypes as $denyType) { - if ($currentItem->getContext() instanceof $denyType) { - return false; - } - } - - return true; - } - - /** - * getChildren() - * - * This is here due to a bug/design issue in PHP - * @link - * - * @return unknown - */ - function getChildren() - { - - if (empty($this->ref)) { - $this->ref = new ReflectionClass($this); - } - - return $this->ref->newInstance($this->getInnerIterator()->getChildren(), $this->_rawOptions); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php b/library/vendor/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php deleted file mode 100644 index 65b46b6ff..000000000 --- a/library/vendor/Zend/Tool/Project/Profile/Iterator/EnabledResourceFilter.php +++ /dev/null @@ -1,43 +0,0 @@ -current()->isEnabled(); - } -} diff --git a/library/vendor/Zend/Tool/Project/Profile/Resource.php b/library/vendor/Zend/Tool/Project/Profile/Resource.php deleted file mode 100644 index 58b08cd5d..000000000 --- a/library/vendor/Zend/Tool/Project/Profile/Resource.php +++ /dev/null @@ -1,262 +0,0 @@ -setContext($context); - } - - /** - * setContext() - * - * @param string|Zend_Tool_Project_Context_Interface $context - * @return Zend_Tool_Project_Profile_Resource - */ - public function setContext($context) - { - $this->_context = $context; - return $this; - } - - /** - * getContext() - * - * @return Zend_Tool_Project_Context_Interface - */ - public function getContext() - { - return $this->_context; - } - - /** - * getName() - Get the resource name - * - * Name is derived from the context name - * - * @return string - */ - public function getName() - { - if (is_string($this->_context)) { - return $this->_context; - } elseif ($this->_context instanceof Zend_Tool_Project_Context_Interface) { - return $this->_context->getName(); - } else { - throw new Zend_Tool_Project_Exception('Invalid context in resource'); - } - } - - /** - * setProfile() - * - * @param Zend_Tool_Project_Profile $profile - * @return Zend_Tool_Project_Profile_Resource - */ - public function setProfile(Zend_Tool_Project_Profile $profile) - { - $this->_profile = $profile; - return $this; - } - - /** - * getProfile - * - * @return Zend_Tool_Project_Profile - */ - public function getProfile() - { - return $this->_profile; - } - - /** - * getPersistentAttributes() - * - * @return array - */ - public function getPersistentAttributes() - { - if (method_exists($this->_context, 'getPersistentAttributes')) { - return $this->_context->getPersistentAttributes(); - } - - return array(); - } - - /** - * setEnabled() - * - * @param bool $enabled - * @return Zend_Tool_Project_Profile_Resource - */ - public function setEnabled($enabled = true) - { - // convert fuzzy types to bool - $this->_enabled = (!in_array($enabled, array('false', 'disabled', 0, -1, false), true)) ? true : false; - return $this; - } - - /** - * isEnabled() - * - * @return bool - */ - public function isEnabled() - { - return $this->_enabled; - } - - /** - * setDeleted() - * - * @param bool $deleted - * @return Zend_Tool_Project_Profile_Resource - */ - public function setDeleted($deleted = true) - { - $this->_deleted = (bool) $deleted; - return $this; - } - - /** - * isDeleted() - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function isDeleted() - { - return $this->_deleted; - } - - /** - * initializeContext() - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function initializeContext() - { - if ($this->_isContextInitialized) { - return; - } - if (is_string($this->_context)) { - $this->_context = Zend_Tool_Project_Context_Repository::getInstance()->getContext($this->_context); - } - - if (method_exists($this->_context, 'setResource')) { - $this->_context->setResource($this); - } - - if (method_exists($this->_context, 'init')) { - $this->_context->init(); - } - - $this->_isContextInitialized = true; - return $this; - } - - /** - * __toString() - * - * @return string - */ - public function __toString() - { - return $this->_context->getName(); - } - - /** - * __call() - * - * @param string $method - * @param array $arguments - * @return Zend_Tool_Project_Profile_Resource - */ - public function __call($method, $arguments) - { - if (method_exists($this->_context, $method)) { - if (!$this->isEnabled()) { - $this->setEnabled(true); - } - return call_user_func_array(array($this->_context, $method), $arguments); - } else { - throw new Zend_Tool_Project_Profile_Exception('cannot call ' . $method); - } - } - -} diff --git a/library/vendor/Zend/Tool/Project/Profile/Resource/Container.php b/library/vendor/Zend/Tool/Project/Profile/Resource/Container.php deleted file mode 100644 index 4f06f6f55..000000000 --- a/library/vendor/Zend/Tool/Project/Profile/Resource/Container.php +++ /dev/null @@ -1,421 +0,0 @@ - - * - * - * - * @param Zend_Tool_Project_Profile_Resource_SearchConstraints|string|array $searchParameters - * @return Zend_Tool_Project_Profile_Resource - */ - public function search($matchSearchConstraints, $nonMatchSearchConstraints = null) - { - if (!$matchSearchConstraints instanceof Zend_Tool_Project_Profile_Resource_SearchConstraints) { - $matchSearchConstraints = new Zend_Tool_Project_Profile_Resource_SearchConstraints($matchSearchConstraints); - } - - $this->rewind(); - - /** - * @todo This should be re-written with better support for a filter iterator, its the way to go - */ - - if ($nonMatchSearchConstraints) { - $filterIterator = new Zend_Tool_Project_Profile_Iterator_ContextFilter($this, array('denyNames' => $nonMatchSearchConstraints)); - $riIterator = new RecursiveIteratorIterator($filterIterator, RecursiveIteratorIterator::SELF_FIRST); - } else { - $riIterator = new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST); - } - - $foundResource = false; - $currentConstraint = $matchSearchConstraints->getConstraint(); - $foundDepth = 0; - - foreach ($riIterator as $currentResource) { - - // if current depth is less than found depth, end - if ($riIterator->getDepth() < $foundDepth) { - break; - } - - if (strtolower($currentResource->getName()) == strtolower($currentConstraint->name)) { - - $paramsMatch = true; - - // @todo check to ensure params match (perhaps) - if (count($currentConstraint->params) > 0) { - $currentResourceAttributes = $currentResource->getAttributes(); - if (!is_array($currentConstraint->params)) { - require_once 'Zend/Tool/Project/Profile/Exception.php'; - throw new Zend_Tool_Project_Profile_Exception('Search parameter specifics must be in the form of an array for key "' - . $currentConstraint->name .'"'); - } - foreach ($currentConstraint->params as $paramName => $paramValue) { - if (!isset($currentResourceAttributes[$paramName]) || $currentResourceAttributes[$paramName] != $paramValue) { - $paramsMatch = false; - break; - } - } - } - - if ($paramsMatch) { - $foundDepth = $riIterator->getDepth(); - - if (($currentConstraint = $matchSearchConstraints->getConstraint()) == null) { - $foundResource = $currentResource; - break; - } - } - - } - - } - - return $foundResource; - } - - /** - * createResourceAt() - * - * @param array|Zend_Tool_Project_Profile_Resource_SearchConstraints $appendResourceOrSearchConstraints - * @param string $context - * @param array $attributes - * @return Zend_Tool_Project_Profile_Resource - */ - public function createResourceAt($appendResourceOrSearchConstraints, $context, Array $attributes = array()) - { - if (!$appendResourceOrSearchConstraints instanceof Zend_Tool_Project_Profile_Resource_Container) { - if (($parentResource = $this->search($appendResourceOrSearchConstraints)) == false) { - require_once 'Zend/Tool/Project/Profile/Exception.php'; - throw new Zend_Tool_Project_Profile_Exception('No node was found to append to.'); - } - } else { - $parentResource = $appendResourceOrSearchConstraints; - } - - return $parentResource->createResource($context, $attributes); - } - - /** - * createResource() - * - * Method to create a resource with a given context with specific attributes - * - * @param string $context - * @param array $attributes - * @return Zend_Tool_Project_Profile_Resource - */ - public function createResource($context, Array $attributes = array()) - { - if (is_string($context)) { - $contextRegistry = Zend_Tool_Project_Context_Repository::getInstance(); - if ($contextRegistry->hasContext($context)) { - $context = $contextRegistry->getContext($context); - } else { - require_once 'Zend/Tool/Project/Profile/Exception.php'; - throw new Zend_Tool_Project_Profile_Exception('Context by name ' . $context . ' was not found in the context registry.'); - } - } elseif (!$context instanceof Zend_Tool_Project_Context_Interface) { - require_once 'Zend/Tool/Project/Profile/Exception.php'; - throw new Zend_Tool_Project_Profile_Exception('Context must be of type string or Zend_Tool_Project_Context_Interface.'); - } - - $newResource = new Zend_Tool_Project_Profile_Resource($context); - - if ($attributes) { - $newResource->setAttributes($attributes); - } - - /** - * Interesting logic here: - * - * First set the parentResource (this will also be done inside append). This will allow - * the initialization routine to change the appendability of the parent resource. This - * is important to allow specific resources to be appendable by very specific sub-resources. - */ - $newResource->setParentResource($this); - $newResource->initializeContext(); - $this->append($newResource); - - return $newResource; - } - - /** - * setAttributes() - * - * persist the attributes if the resource will accept them - * - * @param array $attributes - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function setAttributes(Array $attributes) - { - foreach ($attributes as $attrName => $attrValue) { - $setMethod = 'set' . $attrName; - if (method_exists($this, $setMethod)) { - $this->{$setMethod}($attrValue); - } else { - $this->setAttribute($attrName, $attrValue); - } - } - return $this; - } - - /** - * getAttributes() - * - * @return array - */ - public function getAttributes() - { - return $this->_attributes; - } - - /** - * setAttribute() - * - * @param string $name - * @param mixed $value - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function setAttribute($name, $value) - { - $this->_attributes[$name] = $value; - return $this; - } - - /** - * getAttribute() - * - * @param string $name - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function getAttribute($name) - { - return (array_key_exists($name, $this->_attributes)) ? $this->_attributes[$name] : null; - } - - /** - * hasAttribute() - * - * @param string $name - * @return bool - */ - public function hasAttribute($name) - { - return array_key_exists($name, $this->_attributes); - } - - /** - * setAppendable() - * - * @param bool $appendable - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function setAppendable($appendable) - { - $this->_appendable = (bool) $appendable; - return $this; - } - - /** - * isAppendable() - * - * @return bool - */ - public function isAppendable() - { - return $this->_appendable; - } - - /** - * setParentResource() - * - * @param Zend_Tool_Project_Profile_Resource_Container $parentResource - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function setParentResource(Zend_Tool_Project_Profile_Resource_Container $parentResource) - { - $this->_parentResource = $parentResource; - return $this; - } - - /** - * getParentResource() - * - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function getParentResource() - { - return $this->_parentResource; - } - - /** - * append() - * - * @param Zend_Tool_Project_Profile_Resource_Container $resource - * @return Zend_Tool_Project_Profile_Resource_Container - */ - public function append(Zend_Tool_Project_Profile_Resource_Container $resource) - { - if (!$this->isAppendable()) { - throw new Exception('Resource by name ' . (string) $this . ' is not appendable'); - } - array_push($this->_subResources, $resource); - $resource->setParentResource($this); - - return $this; - } - - /** - * current() - required by RecursiveIterator - * - * @return Zend_Tool_Project_Profile_Resource - */ - public function current() - { - return current($this->_subResources); - } - - /** - * key() - required by RecursiveIterator - * - * @return int - */ - public function key() - { - return key($this->_subResources); - } - - /** - * next() - required by RecursiveIterator - * - * @return bool - */ - public function next() - { - return next($this->_subResources); - } - - /** - * rewind() - required by RecursiveIterator - * - * @return bool - */ - public function rewind() - { - return reset($this->_subResources); - } - - /** - * valid() - - required by RecursiveIterator - * - * @return bool - */ - public function valid() - { - return (bool) $this->current(); - } - - /** - * hasChildren() - * - * @return bool - */ - public function hasChildren() - { - return (count($this->_subResources > 0)) ? true : false; - } - - /** - * getChildren() - * - * @return array - */ - public function getChildren() - { - return $this->current(); - } - - /** - * count() - * - * @return int - */ - public function count() - { - return count($this->_subResources); - } - - /** - * __clone() - * - */ - public function __clone() - { - $this->rewind(); - foreach ($this->_subResources as $index => $resource) { - $this->_subResources[$index] = clone $resource; - } - } - -} diff --git a/library/vendor/Zend/Tool/Project/Profile/Resource/SearchConstraints.php b/library/vendor/Zend/Tool/Project/Profile/Resource/SearchConstraints.php deleted file mode 100644 index e43bbeb77..000000000 --- a/library/vendor/Zend/Tool/Project/Profile/Resource/SearchConstraints.php +++ /dev/null @@ -1,117 +0,0 @@ -addConstraint($options); - } elseif (is_array($options)) { - $this->setOptions($options); - } - } - - /** - * setOptions() - * - * @param array $option - * @return Zend_Tool_Project_Profile_Resource_SearchConstraints - */ - public function setOptions(Array $option) - { - foreach ($option as $optionName => $optionValue) { - if (is_int($optionName)) { - $this->addConstraint($optionValue); - } elseif (is_string($optionName)) { - $this->addConstraint(array('name' => $optionName, 'params' => $optionValue)); - } - } - - return $this; - } - - /** - * addConstraint() - * - * @param string|array $constraint - * @return Zend_Tool_Project_Profile_Resource_SearchConstraints - */ - public function addConstraint($constraint) - { - if (is_string($constraint)) { - $name = $constraint; - $params = array(); - } elseif (is_array($constraint)) { - $name = $constraint['name']; - $params = $constraint['params']; - } - - $constraint = $this->_makeConstraint($name, $params); - - array_push($this->_constraints, $constraint); - return $this; - } - - /** - * getConstraint() - * - * @return ArrayObject - */ - public function getConstraint() - { - return array_shift($this->_constraints); - } - - /** - * _makeConstraint - * - * @param string $name - * @param mixed $params - * @return ArrayObject - */ - protected function _makeConstraint($name, $params) - { - $value = array('name' => $name, 'params' => $params); - return new ArrayObject($value, ArrayObject::ARRAY_AS_PROPS); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Abstract.php b/library/vendor/Zend/Tool/Project/Provider/Abstract.php deleted file mode 100644 index 66bf1e239..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Abstract.php +++ /dev/null @@ -1,279 +0,0 @@ -addContextsFromDirectory( - dirname(dirname(__FILE__)) . '/Context/Zf/', 'Zend_Tool_Project_Context_Zf_' - ); - $contextRegistry->addContextsFromDirectory( - dirname(dirname(__FILE__)) . '/Context/Filesystem/', 'Zend_Tool_Project_Context_Filesystem_' - ); - - // determine if there are project specfic providers ONCE - $profilePath = $this->_findProfileDirectory(); - if ($this->_hasProjectProviderDirectory($profilePath . DIRECTORY_SEPARATOR . '.zfproject.xml')) { - $profile = $this->_loadProfile(); - // project providers directory resource - $ppd = $profile->search('ProjectProvidersDirectory'); - $ppd->loadProviders($this->_registry); - } - - self::$_isInitialized = true; - } - - // load up the extending providers required context classes - if ($contextClasses = $this->getContextClasses()) { - $this->_loadContextClassesIntoRegistry($contextClasses); - } - - } - - public function getContextClasses() - { - return array(); - } - - /** - * _getProject is designed to find if there is project file in the context of where - * the client has been called from.. The search order is as follows.. - * - traversing downwards from (PWD) - current working directory - * - if an enpoint variable has been registered in teh client registry - key=workingDirectory - * - if an ENV variable with the key ZFPROJECT_PATH is found - * - * @param bool $loadProfileFlag Whether or not to throw an exception when no profile is found - * @param string $projectDirectory The project directory to use to search - * @param bool $searchParentDirectories Whether or not to search upper level direcotries - * @return Zend_Tool_Project_Profile - */ - protected function _loadProfile($loadProfileFlag = self::NO_PROFILE_THROW_EXCEPTION, $projectDirectory = null, $searchParentDirectories = true) - { - $foundPath = $this->_findProfileDirectory($projectDirectory, $searchParentDirectories); - - if ($foundPath == false) { - if ($loadProfileFlag == self::NO_PROFILE_THROW_EXCEPTION) { - throw new Zend_Tool_Project_Provider_Exception('A project profile was not found.'); - } else { - return false; - } - } - - $profile = new Zend_Tool_Project_Profile(); - $profile->setAttribute('projectDirectory', $foundPath); - $profile->loadFromFile(); - $this->_loadedProfile = $profile; - return $profile; - } - - protected function _findProfileDirectory($projectDirectory = null, $searchParentDirectories = true) - { - // use the cwd if no directory was provided - if ($projectDirectory == null) { - $projectDirectory = getcwd(); - } elseif (realpath($projectDirectory) == false) { - throw new Zend_Tool_Project_Provider_Exception('The $projectDirectory supplied does not exist.'); - } - - $profile = new Zend_Tool_Project_Profile(); - - $parentDirectoriesArray = explode(DIRECTORY_SEPARATOR, ltrim($projectDirectory, DIRECTORY_SEPARATOR)); - while ($parentDirectoriesArray) { - $projectDirectoryAssembled = implode(DIRECTORY_SEPARATOR, $parentDirectoriesArray); - - if (DIRECTORY_SEPARATOR !== "\\") { - $projectDirectoryAssembled = DIRECTORY_SEPARATOR . $projectDirectoryAssembled; - } - - $profile->setAttribute('projectDirectory', $projectDirectoryAssembled); - if ($profile->isLoadableFromFile()) { - unset($profile); - return $projectDirectoryAssembled; - } - - // break after first run if we are not to check upper directories - if ($searchParentDirectories == false) { - break; - } - - array_pop($parentDirectoriesArray); - } - - return false; - } - - /** - * Load the project profile from the current working directory, if not throw exception - * - * @return Zend_Tool_Project_Profile - */ - protected function _loadProfileRequired() - { - $profile = $this->_loadProfile(); - if ($profile === false) { - require_once 'Zend/Tool/Project/Provider/Exception.php'; - throw new Zend_Tool_Project_Provider_Exception('A project profile was not found in the current working directory.'); - } - return $profile; - } - - /** - * Return the currently loaded profile - * - * @return Zend_Tool_Project_Profile - */ - protected function _getProfile($loadProfileFlag = self::NO_PROFILE_THROW_EXCEPTION) - { - if (!$this->_loadedProfile) { - if (($this->_loadProfile($loadProfileFlag) === false) && ($loadProfileFlag === self::NO_PROFILE_RETURN_FALSE)) { - return false; - } - } - - return $this->_loadedProfile; - } - - /** - * _storeProfile() - * - * This method will store the profile into its proper location - * - */ - protected function _storeProfile() - { - $projectProfileFile = $this->_loadedProfile->search('ProjectProfileFile'); - - $name = $projectProfileFile->getContext()->getPath(); - - $this->_registry->getResponse()->appendContent('Updating project profile \'' . $name . '\''); - - $projectProfileFile->getContext()->save(); - } - - protected function _getContentForContext(Zend_Tool_Project_Context_Interface $context, $methodName, $parameters) - { - $storage = $this->_registry->getStorage(); - if (!$storage->isEnabled()) { - return false; - } - - if (!class_exists('Zend_Tool_Project_Context_Content_Engine')) { - require_once 'Zend/Tool/Project/Context/Content/Engine.php'; - } - - $engine = new Zend_Tool_Project_Context_Content_Engine($storage); - return $engine->getContent($context, $methodName, $parameters); - } - - protected function _hasProjectProviderDirectory($pathToProfileFile) - { - // do some static analysis of the file so that we can determin whether or not to incure - // the cost of loading the profile before the system is fully bootstrapped - if (!file_exists($pathToProfileFile)) { - return false; - } - - $contents = file_get_contents($pathToProfileFile); - if (strstr($contents, 'addContextClass($contextClass); - } - } -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Action.php b/library/vendor/Zend/Tool/Project/Provider/Action.php deleted file mode 100644 index 7c96ae7ab..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Action.php +++ /dev/null @@ -1,242 +0,0 @@ -createResource('ActionMethod', array('actionName' => $actionName)); - - return $actionMethod; - } - - /** - * hasResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $actionName - * @param string $controllerName - * @param string $moduleName - * @return Zend_Tool_Project_Profile_Resource - */ - public static function hasResource(Zend_Tool_Project_Profile $profile, $actionName, $controllerName, $moduleName = null) - { - if (!is_string($actionName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Action::createResource() expects \"actionName\" is the name of a action resource to create.'); - } - - if (!is_string($controllerName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Action::createResource() expects \"controllerName\" is the name of a controller resource to create.'); - } - - $controllerFile = self::_getControllerFileResource($profile, $controllerName, $moduleName); - - if ($controllerFile == null) { - throw new Zend_Tool_Project_Provider_Exception('Controller ' . $controllerName . ' was not found.'); - } - - return (($controllerFile->search(array('actionMethod' => array('actionName' => $actionName)))) instanceof Zend_Tool_Project_Profile_Resource); - } - - /** - * _getControllerFileResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $controllerName - * @param string $moduleName - * @return Zend_Tool_Project_Profile_Resource - */ - protected static function _getControllerFileResource(Zend_Tool_Project_Profile $profile, $controllerName, $moduleName = null) - { - $profileSearchParams = array(); - - if ($moduleName != null && is_string($moduleName)) { - $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName)); - } - - $profileSearchParams[] = 'controllersDirectory'; - $profileSearchParams['controllerFile'] = array('controllerName' => $controllerName); - - return $profile->search($profileSearchParams); - } - - /** - * create() - * - * @param string $name Action name for controller, in camelCase format. - * @param string $controllerName Controller name action should be applied to. - * @param bool $viewIncluded Whether the view should the view be included. - * @param string $module Module name action should be applied to. - */ - public function create($name, $controllerName = 'Index', $viewIncluded = true, $module = null) - { - - $this->_loadProfile(); - - // get request/response object - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - // determine if testing is enabled in the project - require_once 'Zend/Tool/Project/Provider/Test.php'; - $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - if ($testingEnabled && !Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { - $testingEnabled = false; - $response->appendContent( - 'Note: PHPUnit is required in order to generate controller test stubs.', - array('color' => array('yellow')) - ); - } - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('Action names should be camel cased.'); - } - - $originalName = $name; - $originalControllerName = $controllerName; - - // ensure it is camelCase (lower first letter) - $name = strtolower(substr($name, 0, 1)) . substr($name, 1); - - // ensure controller is MixedCase - $controllerName = ucfirst($controllerName); - - if (self::hasResource($this->_loadedProfile, $name, $controllerName, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This controller (' . $controllerName . ') already has an action named (' . $name . ')'); - } - - $actionMethodResource = self::createResource($this->_loadedProfile, $name, $controllerName, $module); - - $testActionMethodResource = null; - if ($testingEnabled) { - $testActionMethodResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $controllerName, $name, $module); - } - - // alert the user about inline converted names - $tense = (($request->isPretend()) ? 'would be' : 'is'); - - if ($name !== $originalName) { - $response->appendContent( - 'Note: The canonical action name that ' . $tense - . ' used with other providers is "' . $name . '";' - . ' not "' . $originalName . '" as supplied', - array('color' => array('yellow')) - ); - } - - if ($controllerName !== $originalControllerName) { - $response->appendContent( - 'Note: The canonical controller name that ' . $tense - . ' used with other providers is "' . $controllerName . '";' - . ' not "' . $originalControllerName . '" as supplied', - array('color' => array('yellow')) - ); - } - - unset($tense); - - if ($request->isPretend()) { - $response->appendContent( - 'Would create an action named ' . $name . - ' inside controller at ' . $actionMethodResource->getParentResource()->getContext()->getPath() - ); - - if ($testActionMethodResource) { - $response->appendContent('Would create an action test in ' . $testActionMethodResource->getParentResource()->getContext()->getPath()); - } - - } else { - $response->appendContent( - 'Creating an action named ' . $name . - ' inside controller at ' . $actionMethodResource->getParentResource()->getContext()->getPath() - ); - $actionMethodResource->create(); - - if ($testActionMethodResource) { - $response->appendContent('Creating an action test in ' . $testActionMethodResource->getParentResource()->getContext()->getPath()); - $testActionMethodResource->create(); - } - - $this->_storeProfile(); - } - - if ($viewIncluded) { - $viewResource = Zend_Tool_Project_Provider_View::createResource($this->_loadedProfile, $name, $controllerName, $module); - - if ($this->_registry->getRequest()->isPretend()) { - $response->appendContent( - 'Would create a view script for the ' . $name . ' action method at ' . $viewResource->getContext()->getPath() - ); - } else { - $response->appendContent( - 'Creating a view script for the ' . $name . ' action method at ' . $viewResource->getContext()->getPath() - ); - $viewResource->create(); - $this->_storeProfile(); - } - - } - - } - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Application.php b/library/vendor/Zend/Tool/Project/Provider/Application.php deleted file mode 100644 index d65f7feba..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Application.php +++ /dev/null @@ -1,87 +0,0 @@ -_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $originalClassNamePrefix = $classNamePrefix; - - if (substr($classNamePrefix, -1) != '_') { - $classNamePrefix .= '_'; - } - - $configFileResource = $profile->search('ApplicationConfigFile'); - $zc = $configFileResource->getAsZendConfig('production'); - if ($zc->appnamespace == $classNamePrefix) { - throw new Zend_Tool_Project_Exception('The requested name ' . $classNamePrefix . ' is already the prefix.'); - } - - // remove the old - $configFileResource->removeStringItem('appnamespace', 'production'); - $configFileResource->create(); - - // add the new - $configFileResource->addStringItem('appnamespace', $classNamePrefix, 'production', true); - $configFileResource->create(); - - // update the project profile - $applicationDirectory = $profile->search('ApplicationDirectory'); - $applicationDirectory->setClassNamePrefix($classNamePrefix); - - $response = $this->_registry->getResponse(); - - if ($originalClassNamePrefix !== $classNamePrefix) { - $response->appendContent( - 'Note: the name provided "' . $originalClassNamePrefix . '" was' - . ' altered to "' . $classNamePrefix . '" for correctness.', - array('color' => 'yellow') - ); - } - - // note to the user - $response->appendContent('Note: All existing models will need to be altered to this new namespace by hand', array('color' => 'yellow')); - $response->appendContent('application.ini updated with new appnamespace ' . $classNamePrefix); - - // store profile - $this->_storeProfile(); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Controller.php b/library/vendor/Zend/Tool/Project/Provider/Controller.php deleted file mode 100644 index 606eea0c9..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Controller.php +++ /dev/null @@ -1,209 +0,0 @@ -createResource( - 'controllerFile', - array('controllerName' => $controllerName, 'moduleName' => $moduleName) - ); - - return $newController; - } - - /** - * hasResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $controllerName - * @param string $moduleName - * @return boolean - */ - public static function hasResource(Zend_Tool_Project_Profile $profile, $controllerName, $moduleName = null) - { - if (!is_string($controllerName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Controller::createResource() expects \"controllerName\" is the name of a controller resource to create.'); - } - - $controllersDirectory = self::_getControllersDirectoryResource($profile, $moduleName); - return ($controllersDirectory &&($controllersDirectory->search(array('controllerFile' => array('controllerName' => $controllerName)))) instanceof Zend_Tool_Project_Profile_Resource); - } - - /** - * _getControllersDirectoryResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $moduleName - * @return Zend_Tool_Project_Profile_Resource - */ - protected static function _getControllersDirectoryResource(Zend_Tool_Project_Profile $profile, $moduleName = null) - { - $profileSearchParams = array(); - - if ($moduleName != null && is_string($moduleName)) { - $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName)); - } - - $profileSearchParams[] = 'controllersDirectory'; - - return $profile->search($profileSearchParams); - } - - /** - * Create a new controller - * - * @param string $name The name of the controller to create, in camelCase. - * @param bool $indexActionIncluded Whether or not to create the index action. - */ - public function create($name, $indexActionIncluded = true, $module = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // get request & response - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - // determine if testing is enabled in the project - require_once 'Zend/Tool/Project/Provider/Test.php'; - $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - if ($testingEnabled && !Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { - $testingEnabled = false; - $response->appendContent( - 'Note: PHPUnit is required in order to generate controller test stubs.', - array('color' => array('yellow')) - ); - } - - $originalName = $name; - $name = ucfirst($name); - - if (self::hasResource($this->_loadedProfile, $name, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This project already has a controller named ' . $name); - } - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('Controller names should be camel cased.'); - } - - try { - $controllerResource = self::createResource($this->_loadedProfile, $name, $module); - if ($indexActionIncluded) { - $indexActionResource = Zend_Tool_Project_Provider_Action::createResource($this->_loadedProfile, 'index', $name, $module); - $indexActionViewResource = Zend_Tool_Project_Provider_View::createResource($this->_loadedProfile, 'index', $name, $module); - } - if ($testingEnabled) { - $testActionResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $name, 'index', $module); - } - - } catch (Exception $e) { - $response->setException($e); - return; - } - - // determime if we need to note to the user about the name - if (($name !== $originalName)) { - $tense = (($request->isPretend()) ? 'would be' : 'is'); - $response->appendContent( - 'Note: The canonical controller name that ' . $tense - . ' used with other providers is "' . $name . '";' - . ' not "' . $originalName . '" as supplied', - array('color' => array('yellow')) - ); - unset($tense); - } - - // do the creation - if ($request->isPretend()) { - - $response->appendContent('Would create a controller at ' . $controllerResource->getContext()->getPath()); - - if (isset($indexActionResource)) { - $response->appendContent('Would create an index action method in controller ' . $name); - $response->appendContent('Would create a view script for the index action method at ' . $indexActionViewResource->getContext()->getPath()); - } - - if ($testingEnabled) { - $response->appendContent('Would create a controller test file at ' . $testActionResource->getParentResource()->getContext()->getPath()); - } - - } else { - - $response->appendContent('Creating a controller at ' . $controllerResource->getContext()->getPath()); - $controllerResource->create(); - - if (isset($indexActionResource)) { - $response->appendContent('Creating an index action method in controller ' . $name); - $indexActionResource->create(); - $response->appendContent('Creating a view script for the index action method at ' . $indexActionViewResource->getContext()->getPath()); - $indexActionViewResource->create(); - } - - if ($testingEnabled) { - $response->appendContent('Creating a controller test file at ' . $testActionResource->getParentResource()->getContext()->getPath()); - $testActionResource->getParentResource()->create(); - $testActionResource->create(); - } - - $this->_storeProfile(); - } - - } - - - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/DbAdapter.php b/library/vendor/Zend/Tool/Project/Provider/DbAdapter.php deleted file mode 100644 index 61e77084b..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/DbAdapter.php +++ /dev/null @@ -1,139 +0,0 @@ -_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $appConfigFileResource = $profile->search('applicationConfigFile'); - - if ($appConfigFileResource == false) { - throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); - } - - $this->_appConfigFilePath = $appConfigFileResource->getPath(); - - $this->_config = new Zend_Config_Ini($this->_appConfigFilePath, null, array('skipExtends' => true, 'allowModifications' => true)); - - if ($sectionName != 'production') { - $this->_sectionName = $sectionName; - } - - if (!isset($this->_config->{$this->_sectionName})) { - throw new Zend_Tool_Project_Exception('The config does not have a ' . $this->_sectionName . ' section.'); - } - - if (isset($this->_config->{$this->_sectionName}->resources->db)) { - throw new Zend_Tool_Project_Exception('The config already has a db resource configured in section ' . $this->_sectionName . '.'); - } - - if ($dsn) { - $this->_configureViaDSN($dsn); - //} elseif ($interactivelyPrompt) { - // $this->_promptForConfig(); - } else { - $this->_registry->getResponse()->appendContent('Nothing to do!'); - } - - - } - - protected function _configureViaDSN($dsn) - { - $dsnVars = array(); - - if (strpos($dsn, '=') === false) { - throw new Zend_Tool_Project_Provider_Exception('At least one name value pair is expected, typcially ' - . 'in the format of "adapter=Mysqli&username=uname&password=mypass&dbname=mydb"' - ); - } - - parse_str($dsn, $dsnVars); - - // parse_str suffers when magic_quotes is enabled - if (get_magic_quotes_gpc()) { - array_walk_recursive($dsnVars, array($this, '_cleanMagicQuotesInValues')); - } - - $dbConfigValues = array('resources' => array('db' => null)); - - if (isset($dsnVars['adapter'])) { - $dbConfigValues['resources']['db']['adapter'] = $dsnVars['adapter']; - unset($dsnVars['adapter']); - } - - $dbConfigValues['resources']['db']['params'] = $dsnVars; - - $isPretend = $this->_registry->getRequest()->isPretend(); - - // get the config resource - $applicationConfig = $this->_loadedProfile->search('ApplicationConfigFile'); - $applicationConfig->addItem($dbConfigValues, $this->_sectionName, null); - - $response = $this->_registry->getResponse(); - - if ($isPretend) { - $response->appendContent('A db configuration for the ' . $this->_sectionName - . ' section would be written to the application config file with the following contents: ' - ); - $response->appendContent($applicationConfig->getContents()); - } else { - $applicationConfig->create(); - $response->appendContent('A db configuration for the ' . $this->_sectionName - . ' section has been written to the application config file.' - ); - } - } - - protected function _cleanMagicQuotesInValues(&$value, $key) - { - $value = stripslashes($value); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/DbTable.php b/library/vendor/Zend/Tool/Project/Provider/DbTable.php deleted file mode 100644 index 128e51982..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/DbTable.php +++ /dev/null @@ -1,225 +0,0 @@ - array('moduleName' => $moduleName)); - } - - $profileSearchParams[] = 'modelsDirectory'; - - $modelsDirectory = $profile->search($profileSearchParams); - - if (!($modelsDirectory instanceof Zend_Tool_Project_Profile_Resource)) { - throw new Zend_Tool_Project_Provider_Exception( - 'A models directory was not found' . - (($moduleName) ? ' for module ' . $moduleName . '.' : '.') - ); - } - - if (!($dbTableDirectory = $modelsDirectory->search('DbTableDirectory'))) { - $dbTableDirectory = $modelsDirectory->createResource('DbTableDirectory'); - } - - $dbTableFile = $dbTableDirectory->createResource('DbTableFile', array('dbTableName' => $dbTableName, 'actualTableName' => $actualTableName)); - - return $dbTableFile; - } - - public static function hasResource(Zend_Tool_Project_Profile $profile, $dbTableName, $moduleName = null) - { - $profileSearchParams = array(); - - if ($moduleName != null && is_string($moduleName)) { - $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName)); - } - - $profileSearchParams[] = 'modelsDirectory'; - - $modelsDirectory = $profile->search($profileSearchParams); - - if (!($modelsDirectory instanceof Zend_Tool_Project_Profile_Resource) - || !($dbTableDirectory = $modelsDirectory->search('DbTableDirectory'))) { - return false; - } - - $dbTableFile = $dbTableDirectory->search(array('DbTableFile' => array('dbTableName' => $dbTableName))); - - return ($dbTableFile instanceof Zend_Tool_Project_Profile_Resource) ? true : false; - } - - - public function create($name, $actualTableName, $module = null, $forceOverwrite = false) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('DbTable names should be camel cased.'); - } - - $originalName = $name; - $name = ucfirst($name); - - if ($actualTableName == '') { - throw new Zend_Tool_Project_Provider_Exception('You must provide both the DbTable name as well as the actual db table\'s name.'); - } - - if (self::hasResource($this->_loadedProfile, $name, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This project already has a DbTable named ' . $name); - } - - // get request/response object - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - // alert the user about inline converted names - $tense = (($request->isPretend()) ? 'would be' : 'is'); - - if ($name !== $originalName) { - $response->appendContent( - 'Note: The canonical model name that ' . $tense - . ' used with other providers is "' . $name . '";' - . ' not "' . $originalName . '" as supplied', - array('color' => array('yellow')) - ); - } - - try { - $tableResource = self::createResource($this->_loadedProfile, $name, $actualTableName, $module); - } catch (Exception $e) { - $response = $this->_registry->getResponse(); - $response->setException($e); - return; - } - - // do the creation - if ($request->isPretend()) { - $response->appendContent('Would create a DbTable at ' . $tableResource->getContext()->getPath()); - } else { - $response->appendContent('Creating a DbTable at ' . $tableResource->getContext()->getPath()); - $tableResource->create(); - $this->_storeProfile(); - } - } - - /** - * @param string $module Module name action should be applied to. - * @param bool $forceOverwrite Whether should force overwriting previous classes generated - * @return void - */ - public function createFromDatabase($module = null, $forceOverwrite = false) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $bootstrapResource = $this->_loadedProfile->search('BootstrapFile'); - - /* @var $zendApp Zend_Application */ - $zendApp = $bootstrapResource->getApplicationInstance(); - - try { - $zendApp->bootstrap('db'); - } catch (Zend_Application_Exception $e) { - throw new Zend_Tool_Project_Provider_Exception('Db resource not available, you might need to configure a DbAdapter.'); - return; - } - - /* @var $db Zend_Db_Adapter_Abstract */ - $db = $zendApp->getBootstrap()->getResource('db'); - - $tableResources = array(); - foreach ($db->listTables() as $actualTableName) { - - $dbTableName = $this->_convertTableNameToClassName($actualTableName); - - if (!$forceOverwrite && self::hasResource($this->_loadedProfile, $dbTableName, $module)) { - throw new Zend_Tool_Project_Provider_Exception( - 'This DbTable resource already exists, if you wish to overwrite it, ' - . 'pass the "forceOverwrite" flag to this provider.' - ); - } - - $tableResources[] = self::createResource( - $this->_loadedProfile, - $dbTableName, - $actualTableName, - $module - ); - } - - if (count($tableResources) == 0) { - $this->_registry->getResponse()->appendContent('There are no tables in the selected database to write.'); - } - - // do the creation - if ($this->_registry->getRequest()->isPretend()) { - - foreach ($tableResources as $tableResource) { - $this->_registry->getResponse()->appendContent('Would create a DbTable at ' . $tableResource->getContext()->getPath()); - } - - } else { - - foreach ($tableResources as $tableResource) { - $this->_registry->getResponse()->appendContent('Creating a DbTable at ' . $tableResource->getContext()->getPath()); - $tableResource->create(); - } - - $this->_storeProfile(); - } - - - } - - protected function _convertTableNameToClassName($tableName) - { - if ($this->_nameFilter == null) { - $this->_nameFilter = new Zend_Filter(); - $this->_nameFilter - ->addFilter(new Zend_Filter_Word_UnderscoreToCamelCase()); - } - - return $this->_nameFilter->filter($tableName); - } - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Exception.php b/library/vendor/Zend/Tool/Project/Provider/Exception.php deleted file mode 100644 index a3dc659fb..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ -createResource( - 'formFile', - array('formName' => $formName, 'moduleName' => $moduleName) - ); - - return $newForm; - } - - /** - * hasResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $formName - * @param string $moduleName - * @return Zend_Tool_Project_Profile_Resource - */ - public static function hasResource(Zend_Tool_Project_Profile $profile, $formName, $moduleName = null) - { - if (!is_string($formName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Form::createResource() expects \"formName\" is the name of a form resource to check for existence.'); - } - - $formsDirectory = self::_getFormsDirectoryResource($profile, $moduleName); - return (($formsDirectory->search(array('formFile' => array('formName' => $formName)))) instanceof Zend_Tool_Project_Profile_Resource); - } - - /** - * _getFormsDirectoryResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $moduleName - * @return Zend_Tool_Project_Profile_Resource - */ - protected static function _getFormsDirectoryResource(Zend_Tool_Project_Profile $profile, $moduleName = null) - { - $profileSearchParams = array(); - - if ($moduleName != null && is_string($moduleName)) { - $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName)); - } - - $profileSearchParams[] = 'formsDirectory'; - - return $profile->search($profileSearchParams); - } - - public function enable($module = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // determine if testing is enabled in the project - $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - $formDirectoryResource = self::_getFormsDirectoryResource($this->_loadedProfile, $module); - - if ($formDirectoryResource->isEnabled()) { - throw new Zend_Tool_Project_Provider_Exception('This project already has forms enabled.'); - } else { - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would enable forms directory at ' . $formDirectoryResource->getContext()->getPath()); - } else { - $this->_registry->getResponse()->appendContent('Enabling forms directory at ' . $formDirectoryResource->getContext()->getPath()); - $formDirectoryResource->setEnabled(true); - $formDirectoryResource->create(); - $this->_storeProfile(); - } - - } - } - - /** - * Create a new form - * - * @param string $name - * @param string $module - */ - public function create($name, $module = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // determine if testing is enabled in the project - $testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - if (self::hasResource($this->_loadedProfile, $name, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This project already has a form named ' . $name); - } - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('Form names should be camel cased.'); - } - - $name = ucwords($name); - - try { - $formResource = self::createResource($this->_loadedProfile, $name, $module); - - if ($testingEnabled) { - $testFormResource = null; - // $testFormResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $name, 'index', $module); - } - - } catch (Exception $e) { - $response = $this->_registry->getResponse(); - $response->setException($e); - return; - } - - // do the creation - if ($this->_registry->getRequest()->isPretend()) { - - $this->_registry->getResponse()->appendContent('Would create a form at ' . $formResource->getContext()->getPath()); - - if ($testFormResource) { - $this->_registry->getResponse()->appendContent('Would create a form test file at ' . $testFormResource->getContext()->getPath()); - } - - } else { - - $this->_registry->getResponse()->appendContent('Creating a form at ' . $formResource->getContext()->getPath()); - $formResource->create(); - - if ($testFormResource) { - $this->_registry->getResponse()->appendContent('Creating a form test file at ' . $testFormResource->getContext()->getPath()); - $testFormResource->create(); - } - - $this->_storeProfile(); - } - - } - - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Layout.php b/library/vendor/Zend/Tool/Project/Provider/Layout.php deleted file mode 100644 index 320de1e39..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Layout.php +++ /dev/null @@ -1,140 +0,0 @@ -search('applicationDirectory'); - $layoutDirectory = $applicationDirectory->search('layoutsDirectory'); - - if ($layoutDirectory == false) { - $layoutDirectory = $applicationDirectory->createResource('layoutsDirectory'); - } - - $layoutScriptsDirectory = $layoutDirectory->search('layoutScriptsDirectory'); - - if ($layoutScriptsDirectory == false) { - $layoutScriptsDirectory = $layoutDirectory->createResource('layoutScriptsDirectory'); - } - - $layoutScriptFile = $layoutScriptsDirectory->search('layoutScriptFile', array('layoutName' => 'layout')); - - if ($layoutScriptFile == false) { - $layoutScriptFile = $layoutScriptsDirectory->createResource('layoutScriptFile', array('layoutName' => 'layout')); - } - - return $layoutScriptFile; - } - - public function enable() - { - $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $applicationConfigResource = $profile->search('ApplicationConfigFile'); - - if (!$applicationConfigResource) { - throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); - } - - $zc = $applicationConfigResource->getAsZendConfig(); - - if (isset($zc->resources) && isset($zc->resources->layout)) { - $this->_registry->getResponse()->appendContent('A layout resource already exists in this project\'s application configuration file.'); - return; - } - - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would add "resources.layout.layoutPath" key to the application config file.'); - } else { - $applicationConfigResource->addStringItem('resources.layout.layoutPath', $this->_layoutPath, 'production', false); - $applicationConfigResource->create(); - - $this->_registry->getResponse()->appendContent('A layout entry has been added to the application config file.'); - - $layoutScriptFile = self::createResource($profile); - if (!$layoutScriptFile->exists()) { - $layoutScriptFile->create(); - $this->_registry->getResponse()->appendContent( - 'A default layout has been created at ' - . $layoutScriptFile->getPath() - ); - - } - - $this->_storeProfile(); - } - } - - public function disable() - { - $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $applicationConfigResource = $this->_getApplicationConfigResource($profile); - $zc = $applicationConfigResource->getAsZendConfig(); - - if (isset($zc->resources) && !isset($zc->resources->layout)) { - $this->_registry->getResponse()->appendContent('No layout configuration exists in application config file.'); - return; - } - - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would remove "resources.layout.layoutPath" key from the application config file.'); - } else { - - // Remove the resources.layout.layoutPath directive from application config - $applicationConfigResource->removeStringItem('resources.layout.layoutPath', $this->_layoutPath, 'production', false); - $applicationConfigResource->create(); - - // Tell the user about the good work we've done - $this->_registry->getResponse()->appendContent('Layout entry has been removed from the application config file.'); - - $this->_storeProfile(); - } - } - - protected function _getApplicationConfigResource(Zend_Tool_Project_Profile $profile) - { - $applicationConfigResource = $profile->search('ApplicationConfigFile'); - if (!$applicationConfigResource) { - throw new Zend_Tool_Project_Exception('A project with an application config file is required to use this provider.'); - } - - return $applicationConfigResource; - } -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Manifest.php b/library/vendor/Zend/Tool/Project/Provider/Manifest.php deleted file mode 100644 index d1f28beeb..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Manifest.php +++ /dev/null @@ -1,75 +0,0 @@ -createResource( - 'modelFile', - array('modelName' => $modelName, 'moduleName' => $moduleName) - ); - - return $newModel; - } - - /** - * hasResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $modelName - * @param string $moduleName - * @return Zend_Tool_Project_Profile_Resource - */ - public static function hasResource(Zend_Tool_Project_Profile $profile, $modelName, $moduleName = null) - { - if (!is_string($modelName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_Model::createResource() expects \"modelName\" is the name of a model resource to check for existence.'); - } - - $modelsDirectory = self::_getModelsDirectoryResource($profile, $moduleName); - - if (!$modelsDirectory instanceof Zend_Tool_Project_Profile_Resource) { - return false; - } - - return (($modelsDirectory->search(array('modelFile' => array('modelName' => $modelName)))) instanceof Zend_Tool_Project_Profile_Resource); - } - - /** - * _getModelsDirectoryResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $moduleName - * @return Zend_Tool_Project_Profile_Resource - */ - protected static function _getModelsDirectoryResource(Zend_Tool_Project_Profile $profile, $moduleName = null) - { - $profileSearchParams = array(); - - if ($moduleName != null && is_string($moduleName)) { - $profileSearchParams = array('modulesDirectory', 'moduleDirectory' => array('moduleName' => $moduleName)); - } - - $profileSearchParams[] = 'modelsDirectory'; - - return $profile->search($profileSearchParams); - } - - /** - * Create a new model - * - * @param string $name - * @param string $module - */ - public function create($name, $module = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - $originalName = $name; - - $name = ucwords($name); - - // determine if testing is enabled in the project - $testingEnabled = false; //Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - $testModelResource = null; - - // Check that there is not a dash or underscore, return if doesnt match regex - if (preg_match('#[_-]#', $name)) { - throw new Zend_Tool_Project_Provider_Exception('Model names should be camel cased.'); - } - - if (self::hasResource($this->_loadedProfile, $name, $module)) { - throw new Zend_Tool_Project_Provider_Exception('This project already has a model named ' . $name); - } - - // get request/response object - $request = $this->_registry->getRequest(); - $response = $this->_registry->getResponse(); - - // alert the user about inline converted names - $tense = (($request->isPretend()) ? 'would be' : 'is'); - - if ($name !== $originalName) { - $response->appendContent( - 'Note: The canonical model name that ' . $tense - . ' used with other providers is "' . $name . '";' - . ' not "' . $originalName . '" as supplied', - array('color' => array('yellow')) - ); - } - - try { - $modelResource = self::createResource($this->_loadedProfile, $name, $module); - - if ($testingEnabled) { - // $testModelResource = Zend_Tool_Project_Provider_Test::createApplicationResource($this->_loadedProfile, $name, 'index', $module); - } - - } catch (Exception $e) { - $response->setException($e); - return; - } - - // do the creation - if ($request->isPretend()) { - - $response->appendContent('Would create a model at ' . $modelResource->getContext()->getPath()); - - if ($testModelResource) { - $response->appendContent('Would create a model test file at ' . $testModelResource->getContext()->getPath()); - } - - } else { - - $response->appendContent('Creating a model at ' . $modelResource->getContext()->getPath()); - $modelResource->create(); - - if ($testModelResource) { - $response->appendContent('Creating a model test file at ' . $testModelResource->getContext()->getPath()); - $testModelResource->create(); - } - - $this->_storeProfile(); - } - - } - - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Module.php b/library/vendor/Zend/Tool/Project/Provider/Module.php deleted file mode 100644 index 44898ce87..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Module.php +++ /dev/null @@ -1,181 +0,0 @@ -search('applicationDirectory'); - $targetModuleEnabledResources = array( - 'ControllersDirectory', 'ModelsDirectory', 'ViewsDirectory', - 'ViewScriptsDirectory', 'ViewHelpersDirectory', 'ViewFiltersDirectory' - ); - } - - // find the actual modules directory we will use to house our module - $modulesDirectory = $profile->search('modulesDirectory'); - - // if there is a module directory already, except - if ($modulesDirectory->search(array('moduleDirectory' => array('moduleName' => $moduleName)))) { - throw new Zend_Tool_Project_Provider_Exception('A module named "' . $moduleName . '" already exists.'); - } - - // create the module directory - $moduleDirectory = $modulesDirectory->createResource('moduleDirectory', array('moduleName' => $moduleName)); - - // create a context filter so that we can pull out only what we need from the module skeleton - $moduleContextFilterIterator = new Zend_Tool_Project_Profile_Iterator_ContextFilter( - $targetModuleResource, - array( - 'denyNames' => array('ModulesDirectory', 'ViewControllerScriptsDirectory'), - 'denyType' => 'Zend_Tool_Project_Context_Filesystem_File' - ) - ); - - // the iterator for the module skeleton - $targetIterator = new RecursiveIteratorIterator($moduleContextFilterIterator, RecursiveIteratorIterator::SELF_FIRST); - - // initialize some loop state information - $currentDepth = 0; - $parentResources = array(); - $currentResource = $moduleDirectory; - - // loop through the target module skeleton - foreach ($targetIterator as $targetSubResource) { - - $depthDifference = $targetIterator->getDepth() - $currentDepth; - $currentDepth = $targetIterator->getDepth(); - - if ($depthDifference === 1) { - // if we went down into a child, make note - array_push($parentResources, $currentResource); - // this will have always been set previously by another loop - $currentResource = $currentChildResource; - } elseif ($depthDifference < 0) { - // if we went up to a parent, make note - $i = $depthDifference; - do { - // if we went out more than 1 parent, get to the correct parent - $currentResource = array_pop($parentResources); - } while ($i-- > 0); - } - - // get parameters for the newly created module resource - $params = $targetSubResource->getAttributes(); - $currentChildResource = $currentResource->createResource($targetSubResource->getName(), $params); - - // based of the provided list (Currently up top), enable specific resources - if (isset($targetModuleEnabledResources)) { - $currentChildResource->setEnabled(in_array($targetSubResource->getName(), $targetModuleEnabledResources)); - } else { - $currentChildResource->setEnabled($targetSubResource->isEnabled()); - } - - } - - return $moduleDirectory; - } - - /** - * create() - * - * @param string $name - */ - public function create($name) //, $moduleProfile = null) - { - $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION); - - // determine if testing is enabled in the project - require_once 'Zend/Tool/Project/Provider/Test.php'; - //$testingEnabled = Zend_Tool_Project_Provider_Test::isTestingEnabled($this->_loadedProfile); - - $resources = self::createResources($this->_loadedProfile, $name); - - $response = $this->_registry->getResponse(); - - if ($this->_registry->getRequest()->isPretend()) { - $response->appendContent('I would create the following module and artifacts:'); - foreach (new RecursiveIteratorIterator($resources, RecursiveIteratorIterator::SELF_FIRST) as $resource) { - if (is_callable(array($resource->getContext(), 'getPath'))) { - $response->appendContent($resource->getContext()->getPath()); - } - } - } else { - $response->appendContent('Creating the following module and artifacts:'); - $enabledFilter = new Zend_Tool_Project_Profile_Iterator_EnabledResourceFilter($resources); - foreach (new RecursiveIteratorIterator($enabledFilter, RecursiveIteratorIterator::SELF_FIRST) as $resource) { - $response->appendContent($resource->getContext()->getPath()); - $resource->create(); - } - - $response->appendContent('Added a key for path module directory to the application.ini file'); - $appConfigFile = $this->_loadedProfile->search('ApplicationConfigFile'); - $appConfigFile->removeStringItem('resources.frontController.moduleDirectory', 'production'); - $appConfigFile->addStringItem('resources.frontController.moduleDirectory', 'APPLICATION_PATH "/modules"', 'production', false); - - if (strtolower($name) == 'default') { - $response->appendContent('Added a key for the default module to the application.ini file'); - $appConfigFile->addStringItem('resources.frontController.params.prefixDefaultModule', '1', 'production'); - } - - $appConfigFile->create(); - - // store changes to the profile - $this->_storeProfile(); - } - - } - -} - diff --git a/library/vendor/Zend/Tool/Project/Provider/Profile.php b/library/vendor/Zend/Tool/Project/Provider/Profile.php deleted file mode 100644 index c0d4dd2e8..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Profile.php +++ /dev/null @@ -1,54 +0,0 @@ -_loadProfile(); - - $profileIterator = $this->_loadedProfile->getIterator(); - - foreach ($profileIterator as $profileItem) { - $this->_registry->getResponse()->appendContent( - str_repeat(' ', $profileIterator->getDepth()) . $profileItem - ); - } - - } -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Project.php b/library/vendor/Zend/Tool/Project/Provider/Project.php deleted file mode 100644 index 30d04b60c..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Project.php +++ /dev/null @@ -1,254 +0,0 @@ -_loadProfile(self::NO_PROFILE_RETURN_FALSE, $path); - - if ($profile !== false) { - require_once 'Zend/Tool/Framework/Client/Exception.php'; - throw new Zend_Tool_Framework_Client_Exception('A project already exists here'); - } - - $profileData = null; - - if ($fileOfProfile != null && file_exists($fileOfProfile)) { - $profileData = file_get_contents($fileOfProfile); - } - - $storage = $this->_registry->getStorage(); - if ($profileData == '' && $nameOfProfile != null && $storage->isEnabled()) { - $profileData = $storage->get('project/profiles/' . $nameOfProfile . '.xml'); - } - - if ($profileData == '') { - $profileData = $this->_getDefaultProfile(); - } - - $newProfile = new Zend_Tool_Project_Profile(array( - 'projectDirectory' => $path, - 'profileData' => $profileData - )); - - $newProfile->loadFromData(); - - $response = $this->_registry->getResponse(); - - $response->appendContent('Creating project at ' . $path); - $response->appendContent('Note: ', array('separator' => false, 'color' => 'yellow')); - $response->appendContent( - 'This command created a web project, ' - . 'for more information setting up your VHOST, please see docs/README'); - - if (!Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { - $response->appendContent('Testing Note: ', array('separator' => false, 'color' => 'yellow')); - $response->appendContent('PHPUnit was not found in your include_path, therefore no testing actions will be created.'); - } - - foreach ($newProfile->getIterator() as $resource) { - $resource->create(); - } - } - - public function show() - { - $this->_registry->getResponse()->appendContent('You probably meant to run "show project.info".', array('color' => 'yellow')); - } - - public function showInfo() - { - $profile = $this->_loadProfile(self::NO_PROFILE_RETURN_FALSE); - if (!$profile) { - $this->_registry->getResponse()->appendContent('No project found.'); - } else { - $this->_registry->getResponse()->appendContent('Working with project located at: ' . $profile->getAttribute('projectDirectory')); - } - } - - protected function _getDefaultProfile() - { - $testAction = ''; - if (Zend_Tool_Project_Provider_Test::isPHPUnitAvailable()) { - $testAction = ' '; - } - - $version = Zend_Version::VERSION; - - $data = << - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -$testAction - - - - - - - -EOS; - return $data; - } - - public static function getDefaultReadmeContents($caller = null) - { - $projectDirResource = $caller->getResource()->getProfile()->search('projectDirectory'); - if ($projectDirResource) { - $name = ltrim(strrchr($projectDirResource->getPath(), DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR); - $path = $projectDirResource->getPath() . '/public'; - } else { - $path = '/path/to/public'; - } - - return <<< EOS -README -====== - -This directory should be used to place project specfic documentation including -but not limited to project notes, generated API/phpdoc documentation, or -manual files generated or hand written. Ideally, this directory would remain -in your development environment only and should not be deployed with your -application to it's final production location. - - -Setting Up Your VHOST -===================== - -The following is a sample VHOST you might want to consider for your project. - - - DocumentRoot "$path" - ServerName $name.local - - # This should be omitted in the production environment - SetEnv APPLICATION_ENV development - - - Options Indexes MultiViews FollowSymLinks - AllowOverride All - Order allow,deny - Allow from all - - - - -EOS; - } -} diff --git a/library/vendor/Zend/Tool/Project/Provider/ProjectProvider.php b/library/vendor/Zend/Tool/Project/Provider/ProjectProvider.php deleted file mode 100644 index 440080679..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/ProjectProvider.php +++ /dev/null @@ -1,97 +0,0 @@ -createResourceAt($profileSearchParams, 'projectProviderFile', array('projectProviderName' => $projectProviderName, 'actionNames' => $actionNames)); - - return $projectProvider; - } - - /** - * getName() - * - * @return string - */ - public function getName() - { - return 'ProjectProvider'; - } - - /** - * Create stub for Zend_Tool Project Provider - * - * @var string $name class name for new Zend_Tool Project Provider - * @var array|string $actions list of provider methods - * @throws Zend_Tool_Project_Provider_Exception - */ - public function create($name, $actions = null) - { - $profile = $this->_loadProfileRequired(); - - $projectProvider = self::createResource($profile, $name, $actions); - - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse()->appendContent('Would create a project provider named ' . $name - . ' in location ' . $projectProvider->getPath() - ); - } else { - $this->_registry->getResponse()->appendContent('Creating a project provider named ' . $name - . ' in location ' . $projectProvider->getPath() - ); - $projectProvider->create(); - $this->_storeProfile(); - } - - } -} diff --git a/library/vendor/Zend/Tool/Project/Provider/Test.php b/library/vendor/Zend/Tool/Project/Provider/Test.php deleted file mode 100644 index 31316027b..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/Test.php +++ /dev/null @@ -1,198 +0,0 @@ -search($profileSearchParams); - - return $testsDirectory->isEnabled(); - } - - public static function isPHPUnitAvailable() - { - if (class_exists('PHPUnit_Runner_Version', false)) { - return true; - } - - $included = @include 'PHPUnit/Runner/Version.php'; - - if ($included === false) { - return false; - } else { - return true; - } - } - - /** - * createApplicationResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $controllerName - * @param string $actionName - * @param string $moduleName - * @return Zend_Tool_Project_Profile_Resource - */ - public static function createApplicationResource(Zend_Tool_Project_Profile $profile, $controllerName, $actionName, $moduleName = null) - { - if (!is_string($controllerName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_View::createApplicationResource() expects \"controllerName\" is the name of a controller resource to create.'); - } - - if (!is_string($actionName)) { - throw new Zend_Tool_Project_Provider_Exception('Zend_Tool_Project_Provider_View::createApplicationResource() expects \"actionName\" is the name of a controller resource to create.'); - } - - $testsDirectoryResource = $profile->search('testsDirectory'); - - // parentOfController could either be application/ or a particular module folder, which is why we use this name - if (($testParentOfControllerDirectoryResource = $testsDirectoryResource->search('testApplicationDirectory')) === false) { - $testParentOfControllerDirectoryResource = $testsDirectoryResource->createResource('testApplicationDirectory'); - } - - if ($moduleName) { - if (($testAppModulesDirectoryResource = $testParentOfControllerDirectoryResource->search('testApplicationModulesDirectory')) === false) { - $testAppModulesDirectoryResource = $testParentOfControllerDirectoryResource->createResource('testApplicationModulesDirectory'); - } - - if (($testAppModuleDirectoryResource = $testAppModulesDirectoryResource->search(array('testApplicationModuleDirectory' => array('forModuleName' => $moduleName)))) === false) { - $testAppModuleDirectoryResource = $testAppModulesDirectoryResource->createResource('testApplicationModuleDirectory', array('forModuleName' => $moduleName)); - } - - $testParentOfControllerDirectoryResource = $testAppModuleDirectoryResource; - } - - if (($testAppControllerDirectoryResource = $testParentOfControllerDirectoryResource->search('testApplicationControllerDirectory', 'testApplicationModuleDirectory')) === false) { - $testAppControllerDirectoryResource = $testParentOfControllerDirectoryResource->createResource('testApplicationControllerDirectory'); - } - - if (($testAppControllerFileResource = $testAppControllerDirectoryResource->search(array('testApplicationControllerFile' => array('forControllerName' => $controllerName)))) === false) { - $testAppControllerFileResource = $testAppControllerDirectoryResource->createResource('testApplicationControllerFile', array('forControllerName' => $controllerName)); - } - - return $testAppControllerFileResource->createResource('testApplicationActionMethod', array('forActionName' => $actionName)); - } - - /** - * createLibraryResource() - * - * @param Zend_Tool_Project_Profile $profile - * @param string $libraryClassName - * @return Zend_Tool_Project_Profile_Resource - */ - public static function createLibraryResource(Zend_Tool_Project_Profile $profile, $libraryClassName) - { - $testLibraryDirectoryResource = $profile->search(array('TestsDirectory', 'TestLibraryDirectory')); - - - $fsParts = explode('_', $libraryClassName); - - $currentDirectoryResource = $testLibraryDirectoryResource; - - while ($nameOrNamespacePart = array_shift($fsParts)) { - - if (count($fsParts) > 0) { - - if (($libraryDirectoryResource = $currentDirectoryResource->search(array('TestLibraryNamespaceDirectory' => array('namespaceName' => $nameOrNamespacePart)))) === false) { - $currentDirectoryResource = $currentDirectoryResource->createResource('TestLibraryNamespaceDirectory', array('namespaceName' => $nameOrNamespacePart)); - } else { - $currentDirectoryResource = $libraryDirectoryResource; - } - - } else { - - if (($libraryFileResource = $currentDirectoryResource->search(array('TestLibraryFile' => array('forClassName' => $libraryClassName)))) === false) { - $libraryFileResource = $currentDirectoryResource->createResource('TestLibraryFile', array('forClassName' => $libraryClassName)); - } - - } - - } - - return $libraryFileResource; - } - - public function enable() - { - - } - - public function disable() - { - - } - - /** - * create() - * - * @param string $libraryClassName - */ - public function create($libraryClassName) - { - $profile = $this->_loadProfile(); - - if (!self::isTestingEnabled($profile)) { - $this->_registry->getResponse()->appendContent('Testing is not enabled for this project.'); - } - - $testLibraryResource = self::createLibraryResource($profile, $libraryClassName); - - $response = $this->_registry->getResponse(); - - if ($this->_registry->getRequest()->isPretend()) { - $response->appendContent('Would create a library stub in location ' . $testLibraryResource->getContext()->getPath()); - } else { - $response->appendContent('Creating a library stub in location ' . $testLibraryResource->getContext()->getPath()); - $testLibraryResource->create(); - $this->_storeProfile(); - } - - } - -} diff --git a/library/vendor/Zend/Tool/Project/Provider/View.php b/library/vendor/Zend/Tool/Project/Provider/View.php deleted file mode 100644 index 6ecccf1db..000000000 --- a/library/vendor/Zend/Tool/Project/Provider/View.php +++ /dev/null @@ -1,118 +0,0 @@ - array('moduleName' => $moduleName)); - $noModuleSearch = null; - } else { - $noModuleSearch = array('modulesDirectory'); - } - - $profileSearchParams[] = 'viewsDirectory'; - $profileSearchParams[] = 'viewScriptsDirectory'; - - if (($viewScriptsDirectory = $profile->search($profileSearchParams, $noModuleSearch)) === false) { - require_once 'Zend/Tool/Project/Provider/Exception.php'; - throw new Zend_Tool_Project_Provider_Exception('This project does not have a viewScriptsDirectory resource.'); - } - - $profileSearchParams['viewControllerScriptsDirectory'] = array('forControllerName' => $controllerName); - - // @todo check if below is failing b/c of above search params - if (($viewControllerScriptsDirectory = $viewScriptsDirectory->search($profileSearchParams)) === false) { - $viewControllerScriptsDirectory = $viewScriptsDirectory->createResource('viewControllerScriptsDirectory', array('forControllerName' => $controllerName)); - } - - $newViewScriptFile = $viewControllerScriptsDirectory->createResource('ViewScriptFile', array('forActionName' => $actionName)); - - return $newViewScriptFile; - } - - /** - * create() - * - * @param string $controllerName - * @param string $actionNameOrSimpleName - */ - public function create($controllerName, $actionNameOrSimpleName, $module = null) - { - - if ($controllerName == '' || $actionNameOrSimpleName == '') { - require_once 'Zend/Tool/Project/Provider/Exception.php'; - throw new Zend_Tool_Project_Provider_Exception('ControllerName and/or ActionName are empty.'); - } - - $profile = $this->_loadProfile(); - - $view = self::createResource($profile, $actionNameOrSimpleName, $controllerName, $module); - - if ($this->_registry->getRequest()->isPretend()) { - $this->_registry->getResponse( - 'Would create a view script in location ' . $view->getContext()->getPath() - ); - } else { - $this->_registry->getResponse( - 'Creating a view script in location ' . $view->getContext()->getPath() - ); - $view->create(); - $this->_storeProfile(); - } - - } -} diff --git a/library/vendor/Zend/Translate.php b/library/vendor/Zend/Translate.php index 46bec43dc..de9f5309d 100644 --- a/library/vendor/Zend/Translate.php +++ b/library/vendor/Zend/Translate.php @@ -22,12 +22,10 @@ /** * @see Zend_Loader */ -require_once 'Zend/Loader.php'; /** * @see Zend_Translate_Adapter */ -require_once 'Zend/Translate/Adapter.php'; /** @@ -143,7 +141,6 @@ class Zend_Translate { 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"); } } @@ -218,7 +215,6 @@ class Zend_Translate { if (method_exists($this->_adapter, $method)) { return call_user_func_array(array($this->_adapter, $method), $options); } - require_once 'Zend/Translate/Exception.php'; throw new Zend_Translate_Exception("Unknown method '" . $method . "' called!"); } } diff --git a/library/vendor/Zend/Translate/Adapter.php b/library/vendor/Zend/Translate/Adapter.php index efaaa05a2..f21ef3ce2 100644 --- a/library/vendor/Zend/Translate/Adapter.php +++ b/library/vendor/Zend/Translate/Adapter.php @@ -23,12 +23,10 @@ /** * @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 @@ -216,7 +214,6 @@ abstract class Zend_Translate_Adapter { } if (!isset($options['content']) || empty($options['content'])) { - require_once 'Zend/Translate/Exception.php'; throw new Zend_Translate_Exception("Required option 'content' is missing"); } @@ -226,7 +223,6 @@ abstract class Zend_Translate_Adapter { } 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'); } @@ -239,7 +235,6 @@ abstract class Zend_Translate_Adapter { $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); } @@ -353,7 +348,6 @@ abstract class Zend_Translate_Adapter { } else if ((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'); } @@ -431,7 +425,6 @@ abstract class Zend_Translate_Adapter { 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); } @@ -620,7 +613,6 @@ abstract class Zend_Translate_Adapter { 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); } @@ -958,7 +950,6 @@ abstract class Zend_Translate_Adapter { */ public static function clearCache($tag = null) { - require_once 'Zend/Cache.php'; if (self::$_cacheTags) { if ($tag == null) { $tag = 'Zend_Translate'; diff --git a/library/vendor/Zend/Translate/Adapter/Array.php b/library/vendor/Zend/Translate/Adapter/Array.php deleted file mode 100644 index 2dd298eb0..000000000 --- a/library/vendor/Zend/Translate/Adapter/Array.php +++ /dev/null @@ -1,81 +0,0 @@ -_data = array(); - if (!is_array($data)) { - if (file_exists($data)) { - ob_start(); - $data = include($data); - ob_end_clean(); - } - } - if (!is_array($data)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception("Error including array or file '".$data."'"); - } - - if (!isset($this->_data[$locale])) { - $this->_data[$locale] = array(); - } - - $this->_data[$locale] = $data + $this->_data[$locale]; - return $this->_data; - } - - /** - * returns the adapters name - * - * @return string - */ - public function toString() - { - return "Array"; - } -} diff --git a/library/vendor/Zend/Translate/Adapter/Csv.php b/library/vendor/Zend/Translate/Adapter/Csv.php deleted file mode 100644 index 300de2768..000000000 --- a/library/vendor/Zend/Translate/Adapter/Csv.php +++ /dev/null @@ -1,121 +0,0 @@ -_options['delimiter'] = ";"; - $this->_options['length'] = 0; - $this->_options['enclosure'] = '"'; - - if ($options instanceof Zend_Config) { - $options = $options->toArray(); - } else if (func_num_args() > 1) { - $args = func_get_args(); - $options = array(); - $options['content'] = array_shift($args); - - if (!empty($args)) { - $options['locale'] = array_shift($args); - } - - if (!empty($args)) { - $opt = array_shift($args); - $options = array_merge($opt, $options); - } - } else if (!is_array($options)) { - $options = array('content' => $options); - } - - parent::__construct($options); - } - - /** - * Load translation data - * - * @param string|array $filename Filename and full path to the translation source - * @param string $locale Locale/Language to add data for, identical with locale identifier, - * see Zend_Locale for more information - * @param array $option OPTIONAL Options to use - * @return array - */ - protected function _loadTranslationData($filename, $locale, array $options = array()) - { - $this->_data = array(); - $options = $options + $this->_options; - $this->_file = @fopen($filename, 'rb'); - if (!$this->_file) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Error opening translation file \'' . $filename . '\'.'); - } - - while(($data = fgetcsv($this->_file, $options['length'], $options['delimiter'], $options['enclosure'])) !== false) { - if (substr($data[0], 0, 1) === '#') { - continue; - } - - if (!isset($data[1])) { - continue; - } - - if (count($data) == 2) { - $this->_data[$locale][$data[0]] = $data[1]; - } else { - $singular = array_shift($data); - $this->_data[$locale][$singular] = $data; - } - } - - return $this->_data; - } - - /** - * returns the adapters name - * - * @return string - */ - public function toString() - { - return "Csv"; - } -} diff --git a/library/vendor/Zend/Translate/Adapter/Gettext.php b/library/vendor/Zend/Translate/Adapter/Gettext.php deleted file mode 100644 index 81a7841ea..000000000 --- a/library/vendor/Zend/Translate/Adapter/Gettext.php +++ /dev/null @@ -1,169 +0,0 @@ -_bigEndian === false) { - return unpack('V' . $bytes, fread($this->_file, 4 * $bytes)); - } else { - return unpack('N' . $bytes, fread($this->_file, 4 * $bytes)); - } - } - - /** - * Load translation data (MO file reader) - * - * @param string $filename MO file to add, full path must be given for access - * @param string $locale New Locale/Language to set, identical with locale identifier, - * see Zend_Locale for more information - * @param array $option OPTIONAL Options to use - * @throws Zend_Translation_Exception - * @return array - */ - protected function _loadTranslationData($filename, $locale, array $options = array()) - { - $this->_data = array(); - $this->_bigEndian = false; - $this->_file = @fopen($filename, 'rb'); - if (!$this->_file) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Error opening translation file \'' . $filename . '\'.'); - } - if (@filesize($filename) < 10) { - @fclose($this->_file); - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('\'' . $filename . '\' is not a gettext file'); - } - - // get Endian - $input = $this->_readMOData(1); - if (strtolower(substr(dechex($input[1]), -8)) == "950412de") { - $this->_bigEndian = false; - } else if (strtolower(substr(dechex($input[1]), -8)) == "de120495") { - $this->_bigEndian = true; - } else { - @fclose($this->_file); - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('\'' . $filename . '\' is not a gettext file'); - } - // read revision - not supported for now - $input = $this->_readMOData(1); - - // number of bytes - $input = $this->_readMOData(1); - $total = $input[1]; - - // number of original strings - $input = $this->_readMOData(1); - $OOffset = $input[1]; - - // number of translation strings - $input = $this->_readMOData(1); - $TOffset = $input[1]; - - // fill the original table - fseek($this->_file, $OOffset); - $origtemp = $this->_readMOData(2 * $total); - fseek($this->_file, $TOffset); - $transtemp = $this->_readMOData(2 * $total); - - for($count = 0; $count < $total; ++$count) { - if ($origtemp[$count * 2 + 1] != 0) { - fseek($this->_file, $origtemp[$count * 2 + 2]); - $original = @fread($this->_file, $origtemp[$count * 2 + 1]); - $original = explode("\0", $original); - } else { - $original[0] = ''; - } - - if ($transtemp[$count * 2 + 1] != 0) { - fseek($this->_file, $transtemp[$count * 2 + 2]); - $translate = fread($this->_file, $transtemp[$count * 2 + 1]); - $translate = explode("\0", $translate); - if ((count($original) > 1)) { - $this->_data[$locale][$original[0]] = $translate; - array_shift($original); - foreach ($original as $orig) { - $this->_data[$locale][$orig] = ''; - } - } else { - $this->_data[$locale][$original[0]] = $translate[0]; - } - } - } - - @fclose($this->_file); - - $this->_data[$locale][''] = trim($this->_data[$locale]['']); - if (empty($this->_data[$locale][''])) { - $this->_adapterInfo[$filename] = 'No adapter information available'; - } else { - $this->_adapterInfo[$filename] = $this->_data[$locale]['']; - } - - unset($this->_data[$locale]['']); - return $this->_data; - } - - /** - * Returns the adapter informations - * - * @return array Each loaded adapter information as array value - */ - public function getAdapterInfo() - { - return $this->_adapterInfo; - } - - /** - * Returns the adapter name - * - * @return string - */ - public function toString() - { - return "Gettext"; - } -} diff --git a/library/vendor/Zend/Translate/Adapter/Ini.php b/library/vendor/Zend/Translate/Adapter/Ini.php deleted file mode 100644 index 7935f20ee..000000000 --- a/library/vendor/Zend/Translate/Adapter/Ini.php +++ /dev/null @@ -1,74 +0,0 @@ -_data = array(); - if (!file_exists($data)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception("Ini file '".$data."' not found"); - } - - $inidata = parse_ini_file($data, false); - if (!isset($this->_data[$locale])) { - $this->_data[$locale] = array(); - } - - $this->_data[$locale] = array_merge($this->_data[$locale], $inidata); - return $this->_data; - } - - /** - * returns the adapters name - * - * @return string - */ - public function toString() - { - return "Ini"; - } -} diff --git a/library/vendor/Zend/Translate/Adapter/Qt.php b/library/vendor/Zend/Translate/Adapter/Qt.php deleted file mode 100644 index db543ff64..000000000 --- a/library/vendor/Zend/Translate/Adapter/Qt.php +++ /dev/null @@ -1,175 +0,0 @@ -_data = array(); - if (!is_readable($filename)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.'); - } - - $this->_target = $locale; - - $encoding = $this->_findEncoding($filename); - $this->_file = xml_parser_create($encoding); - xml_set_object($this->_file, $this); - xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($this->_file, "_startElement", "_endElement"); - xml_set_character_data_handler($this->_file, "_contentElement"); - - try { - Zend_Xml_Security::scanFile($filename); - } catch (Zend_Xml_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception( - $e->getMessage() - ); - } - - if (!xml_parse($this->_file, file_get_contents($filename))) { - $ex = sprintf('XML error: %s at line %d of file %s', - xml_error_string(xml_get_error_code($this->_file)), - xml_get_current_line_number($this->_file), - $filename); - xml_parser_free($this->_file); - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception($ex); - } - - return $this->_data; - } - - private function _startElement($file, $name, $attrib) - { - switch(strtolower($name)) { - case 'message': - $this->_source = null; - $this->_stag = false; - $this->_ttag = false; - $this->_scontent = null; - $this->_tcontent = null; - break; - case 'source': - $this->_stag = true; - break; - case 'translation': - $this->_ttag = true; - break; - default: - break; - } - } - - private function _endElement($file, $name) - { - switch (strtolower($name)) { - case 'source': - $this->_stag = false; - break; - - case 'translation': - if (!empty($this->_scontent) and !empty($this->_tcontent) or - (isset($this->_data[$this->_target][$this->_scontent]) === false)) { - $this->_data[$this->_target][$this->_scontent] = $this->_tcontent; - } - $this->_ttag = false; - break; - - default: - break; - } - } - - private function _contentElement($file, $data) - { - if ($this->_stag === true) { - $this->_scontent .= $data; - } - - if ($this->_ttag === true) { - $this->_tcontent .= $data; - } - } - - private function _findEncoding($filename) - { - $file = file_get_contents($filename, null, null, 0, 100); - if (strpos($file, "encoding") !== false) { - $encoding = substr($file, strpos($file, "encoding") + 9); - $encoding = substr($encoding, 1, strpos($encoding, $encoding[0], 1) - 1); - return $encoding; - } - return 'UTF-8'; - } - - /** - * Returns the adapter name - * - * @return string - */ - public function toString() - { - return "Qt"; - } -} diff --git a/library/vendor/Zend/Translate/Adapter/Tbx.php b/library/vendor/Zend/Translate/Adapter/Tbx.php deleted file mode 100644 index 107107c4e..000000000 --- a/library/vendor/Zend/Translate/Adapter/Tbx.php +++ /dev/null @@ -1,180 +0,0 @@ -_data = array(); - if (!is_readable($filename)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.'); - } - - $encoding = $this->_findEncoding($filename); - $this->_file = xml_parser_create($encoding); - xml_set_object($this->_file, $this); - xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($this->_file, "_startElement", "_endElement"); - xml_set_character_data_handler($this->_file, "_contentElement"); - - try { - Zend_Xml_Security::scanFile($filename); - } catch (Zend_Xml_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception( - $e->getMessage() - ); - } - - if (!xml_parse($this->_file, file_get_contents($filename))) { - $ex = sprintf('XML error: %s at line %d of file %s', - xml_error_string(xml_get_error_code($this->_file)), - xml_get_current_line_number($this->_file), - $filename); - xml_parser_free($this->_file); - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception($ex); - } - - return $this->_data; - } - - private function _startElement($file, $name, $attrib) - { - if ($this->_term !== null) { - $this->_content .= "<".$name; - foreach($attrib as $key => $value) { - $this->_content .= " $key=\"$value\""; - } - $this->_content .= ">"; - } else { - switch(strtolower($name)) { - case 'termentry': - $this->_termentry = null; - break; - case 'langset': - if (isset($attrib['xml:lang']) === true) { - $this->_langset = $attrib['xml:lang']; - if (isset($this->_data[$this->_langset]) === false) { - $this->_data[$this->_langset] = array(); - } - } - break; - case 'term': - $this->_term = true; - $this->_content = null; - break; - default: - break; - } - } - } - - private function _endElement($file, $name) - { - if (($this->_term !== null) and ($name != "term")) { - $this->_content .= ""; - } else { - switch (strtolower($name)) { - case 'langset': - $this->_langset = null; - break; - case 'term': - $this->_term = null; - if (empty($this->_termentry)) { - $this->_termentry = $this->_content; - } - if (!empty($this->_content) or (isset($this->_data[$this->_langset][$this->_termentry]) === false)) { - $this->_data[$this->_langset][$this->_termentry] = $this->_content; - } - break; - default: - break; - } - } - } - - private function _contentElement($file, $data) - { - if ($this->_term !== null) { - $this->_content .= $data; - } - } - - private function _findEncoding($filename) - { - $file = file_get_contents($filename, null, null, 0, 100); - if (strpos($file, "encoding") !== false) { - $encoding = substr($file, strpos($file, "encoding") + 9); - $encoding = substr($encoding, 1, strpos($encoding, $encoding[0], 1) - 1); - return $encoding; - } - return 'UTF-8'; - } - - /** - * Returns the adapter name - * - * @return string - */ - public function toString() - { - return "Tbx"; - } -} diff --git a/library/vendor/Zend/Translate/Adapter/Tmx.php b/library/vendor/Zend/Translate/Adapter/Tmx.php deleted file mode 100644 index d6572592d..000000000 --- a/library/vendor/Zend/Translate/Adapter/Tmx.php +++ /dev/null @@ -1,248 +0,0 @@ -_data = array(); - if (!is_readable($filename)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.'); - } - - if (isset($options['useId'])) { - $this->_useId = (boolean) $options['useId']; - } - - $encoding = $this->_findEncoding($filename); - $this->_file = xml_parser_create($encoding); - xml_set_object($this->_file, $this); - xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($this->_file, "_startElement", "_endElement"); - xml_set_character_data_handler($this->_file, "_contentElement"); - - try { - Zend_Xml_Security::scanFile($filename); - } catch (Zend_Xml_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception( - $e->getMessage() - ); - } - - if (!xml_parse($this->_file, file_get_contents($filename))) { - $ex = sprintf('XML error: %s at line %d of file %s', - xml_error_string(xml_get_error_code($this->_file)), - xml_get_current_line_number($this->_file), - $filename); - xml_parser_free($this->_file); - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception($ex); - } - - return $this->_data; - } - - /** - * Internal method, called by xml element handler at start - * - * @param resource $file File handler - * @param string $name Elements name - * @param array $attrib Attributes for this element - */ - protected function _startElement($file, $name, $attrib) - { - if ($this->_seg !== null) { - $this->_content .= "<".$name; - foreach($attrib as $key => $value) { - $this->_content .= " $key=\"$value\""; - } - $this->_content .= ">"; - } else { - switch(strtolower($name)) { - case 'header': - if (empty($this->_useId) && isset($attrib['srclang'])) { - if (Zend_Locale::isLocale($attrib['srclang'])) { - $this->_srclang = Zend_Locale::findLocale($attrib['srclang']); - } else { - if (!$this->_options['disableNotices']) { - if ($this->_options['log']) { - $this->_options['log']->notice("The language '{$attrib['srclang']}' can not be set because it does not exist."); - } else { - trigger_error("The language '{$attrib['srclang']}' can not be set because it does not exist.", E_USER_NOTICE); - } - } - - $this->_srclang = $attrib['srclang']; - } - } - break; - case 'tu': - if (isset($attrib['tuid'])) { - $this->_tu = $attrib['tuid']; - } - break; - case 'tuv': - if (isset($attrib['xml:lang'])) { - if (Zend_Locale::isLocale($attrib['xml:lang'])) { - $this->_tuv = Zend_Locale::findLocale($attrib['xml:lang']); - } else { - if (!$this->_options['disableNotices']) { - if ($this->_options['log']) { - $this->_options['log']->notice("The language '{$attrib['xml:lang']}' can not be set because it does not exist."); - } else { - trigger_error("The language '{$attrib['xml:lang']}' can not be set because it does not exist.", E_USER_NOTICE); - } - } - - $this->_tuv = $attrib['xml:lang']; - } - - if (!isset($this->_data[$this->_tuv])) { - $this->_data[$this->_tuv] = array(); - } - } - break; - case 'seg': - $this->_seg = true; - $this->_content = null; - break; - default: - break; - } - } - } - - - /** - * Internal method, called by xml element handler at end - * - * @param resource $file File handler - * @param string $name Elements name - */ - protected function _endElement($file, $name) - { - if (($this->_seg !== null) and ($name !== 'seg')) { - $this->_content .= ""; - } else { - switch (strtolower($name)) { - case 'tu': - $this->_tu = null; - break; - case 'tuv': - $this->_tuv = null; - break; - case 'seg': - $this->_seg = null; - if (!empty($this->_srclang) && ($this->_srclang == $this->_tuv)) { - $this->_tu = $this->_content; - } - - if (!empty($this->_content) or (!isset($this->_data[$this->_tuv][$this->_tu]))) { - $this->_data[$this->_tuv][$this->_tu] = $this->_content; - } - break; - default: - break; - } - } - } - - /** - * Internal method, called by xml element handler for content - * - * @param resource $file File handler - * @param string $data Elements content - */ - protected function _contentElement($file, $data) - { - if (($this->_seg !== null) and ($this->_tu !== null) and ($this->_tuv !== null)) { - $this->_content .= $data; - } - } - - - /** - * Internal method, detects the encoding of the xml file - * - * @param string $name Filename - * @return string Encoding - */ - protected function _findEncoding($filename) - { - $file = file_get_contents($filename, null, null, 0, 100); - if (strpos($file, "encoding") !== false) { - $encoding = substr($file, strpos($file, "encoding") + 9); - $encoding = substr($encoding, 1, strpos($encoding, $encoding[0], 1) - 1); - return $encoding; - } - return 'UTF-8'; - } - - /** - * Returns the adapter name - * - * @return string - */ - public function toString() - { - return "Tmx"; - } -} diff --git a/library/vendor/Zend/Translate/Adapter/Xliff.php b/library/vendor/Zend/Translate/Adapter/Xliff.php deleted file mode 100644 index e8c664bd5..000000000 --- a/library/vendor/Zend/Translate/Adapter/Xliff.php +++ /dev/null @@ -1,244 +0,0 @@ -_data = array(); - if (!is_readable($filename)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.'); - } - - if (empty($options['useId'])) { - $this->_useId = false; - } else { - $this->_useId = true; - } - - $encoding = $this->_findEncoding($filename); - $this->_target = $locale; - $this->_file = xml_parser_create($encoding); - xml_set_object($this->_file, $this); - xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($this->_file, "_startElement", "_endElement"); - xml_set_character_data_handler($this->_file, "_contentElement"); - - try { - Zend_Xml_Security::scanFile($filename); - } catch (Zend_Xml_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception( - $e->getMessage() - ); - } - - if (!xml_parse($this->_file, file_get_contents($filename))) { - $ex = sprintf('XML error: %s at line %d of file %s', - xml_error_string(xml_get_error_code($this->_file)), - xml_get_current_line_number($this->_file), - $filename); - xml_parser_free($this->_file); - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception($ex); - } - - return $this->_data; - } - - private function _startElement($file, $name, $attrib) - { - if ($this->_stag === true) { - $this->_scontent .= "<".$name; - foreach($attrib as $key => $value) { - $this->_scontent .= " $key=\"$value\""; - } - $this->_scontent .= ">"; - } else if ($this->_ttag === true) { - $this->_tcontent .= "<".$name; - foreach($attrib as $key => $value) { - $this->_tcontent .= " $key=\"$value\""; - } - $this->_tcontent .= ">"; - } else { - switch(strtolower($name)) { - case 'file': - $this->_source = $attrib['source-language']; - if (isset($attrib['target-language'])) { - $this->_target = $attrib['target-language']; - } - - if (!isset($this->_data[$this->_source])) { - $this->_data[$this->_source] = array(); - } - - if (!isset($this->_data[$this->_target])) { - $this->_data[$this->_target] = array(); - } - - break; - case 'trans-unit': - $this->_transunit = true; - $this->_langId = $attrib['id']; - break; - case 'source': - if ($this->_transunit === true) { - $this->_scontent = null; - $this->_stag = true; - $this->_ttag = false; - } - break; - case 'target': - if ($this->_transunit === true) { - $this->_tcontent = null; - $this->_ttag = true; - $this->_stag = false; - } - break; - default: - break; - } - } - } - - private function _endElement($file, $name) - { - if (($this->_stag === true) and ($name !== 'source')) { - $this->_scontent .= ""; - } else if (($this->_ttag === true) and ($name !== 'target')) { - $this->_tcontent .= ""; - } else { - switch (strtolower($name)) { - case 'trans-unit': - $this->_transunit = null; - $this->_langId = null; - $this->_scontent = null; - $this->_tcontent = null; - break; - case 'source': - if ($this->_useId) { - if (!empty($this->_scontent) && !empty($this->_langId) && - !isset($this->_data[$this->_source][$this->_langId])) { - $this->_data[$this->_source][$this->_langId] = $this->_scontent; - } - } else { - if (!empty($this->_scontent) && - !isset($this->_data[$this->_source][$this->_scontent])) { - $this->_data[$this->_source][$this->_scontent] = $this->_scontent; - } - } - $this->_stag = false; - break; - case 'target': - if ($this->_useId) { - if (!empty($this->_tcontent) && !empty($this->_langId) && - !isset($this->_data[$this->_target][$this->_langId])) { - $this->_data[$this->_target][$this->_langId] = $this->_tcontent; - } - } else { - if (!empty($this->_tcontent) && !empty($this->_scontent) && - !isset($this->_data[$this->_target][$this->_scontent])) { - $this->_data[$this->_target][$this->_scontent] = $this->_tcontent; - } - } - $this->_ttag = false; - break; - default: - break; - } - } - } - - private function _contentElement($file, $data) - { - if (($this->_transunit !== null) and ($this->_source !== null) and ($this->_stag === true)) { - $this->_scontent .= $data; - } - - if (($this->_transunit !== null) and ($this->_target !== null) and ($this->_ttag === true)) { - $this->_tcontent .= $data; - } - } - - private function _findEncoding($filename) - { - $file = file_get_contents($filename, null, null, 0, 100); - if (strpos($file, "encoding") !== false) { - $encoding = substr($file, strpos($file, "encoding") + 9); - $encoding = substr($encoding, 1, strpos($encoding, $encoding[0], 1) - 1); - return $encoding; - } - return 'UTF-8'; - } - - /** - * Returns the adapter name - * - * @return string - */ - public function toString() - { - return "Xliff"; - } -} diff --git a/library/vendor/Zend/Translate/Adapter/XmlTm.php b/library/vendor/Zend/Translate/Adapter/XmlTm.php deleted file mode 100644 index 87d22695e..000000000 --- a/library/vendor/Zend/Translate/Adapter/XmlTm.php +++ /dev/null @@ -1,154 +0,0 @@ -_data = array(); - $this->_lang = $locale; - if (!is_readable($filename)) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception('Translation file \'' . $filename . '\' is not readable.'); - } - - $encoding = $this->_findEncoding($filename); - $this->_file = xml_parser_create($encoding); - xml_set_object($this->_file, $this); - xml_parser_set_option($this->_file, XML_OPTION_CASE_FOLDING, 0); - xml_set_element_handler($this->_file, "_startElement", "_endElement"); - xml_set_character_data_handler($this->_file, "_contentElement"); - - try { - Zend_Xml_Security::scanFile($filename); - } catch (Zend_Xml_Exception $e) { - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception( - $e->getMessage() - ); - } - - if (!xml_parse($this->_file, file_get_contents($filename))) { - $ex = sprintf('XML error: %s at line %d of file %s', - xml_error_string(xml_get_error_code($this->_file)), - xml_get_current_line_number($this->_file), - $filename); - xml_parser_free($this->_file); - require_once 'Zend/Translate/Exception.php'; - throw new Zend_Translate_Exception($ex); - } - - return $this->_data; - } - - private function _startElement($file, $name, $attrib) - { - switch(strtolower($name)) { - case 'tm:tu': - $this->_tag = $attrib['id']; - $this->_content = null; - break; - default: - break; - } - } - - private function _endElement($file, $name) - { - switch (strtolower($name)) { - case 'tm:tu': - if (!empty($this->_tag) and !empty($this->_content) or - (isset($this->_data[$this->_lang][$this->_tag]) === false)) { - $this->_data[$this->_lang][$this->_tag] = $this->_content; - } - $this->_tag = null; - $this->_content = null; - break; - - default: - break; - } - } - - private function _contentElement($file, $data) - { - if (($this->_tag !== null)) { - $this->_content .= $data; - } - } - - private function _findEncoding($filename) - { - $file = file_get_contents($filename, null, null, 0, 100); - if (strpos($file, "encoding") !== false) { - $encoding = substr($file, strpos($file, "encoding") + 9); - $encoding = substr($encoding, 1, strpos($encoding, $encoding[0], 1) - 1); - return $encoding; - } - return 'UTF-8'; - } - - /** - * Returns the adapter name - * - * @return string - */ - public function toString() - { - return "XmlTm"; - } -} diff --git a/library/vendor/Zend/Translate/Exception.php b/library/vendor/Zend/Translate/Exception.php index 7309a98b2..8502ec127 100644 --- a/library/vendor/Zend/Translate/Exception.php +++ b/library/vendor/Zend/Translate/Exception.php @@ -23,7 +23,6 @@ /** * Zend_Exception */ -require_once 'Zend/Exception.php'; /** diff --git a/library/vendor/Zend/Translate/Plural.php b/library/vendor/Zend/Translate/Plural.php index 69140a4a2..9920828dc 100644 --- a/library/vendor/Zend/Translate/Plural.php +++ b/library/vendor/Zend/Translate/Plural.php @@ -215,7 +215,6 @@ class Zend_Translate_Plural } 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/vendor/Zend/Uri.php b/library/vendor/Zend/Uri.php index e1660d8bf..ca152b5d0 100644 --- a/library/vendor/Zend/Uri.php +++ b/library/vendor/Zend/Uri.php @@ -101,13 +101,11 @@ abstract class Zend_Uri $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,24 +124,20 @@ abstract class Zend_Uri case 'mailto': // TODO default: - require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Scheme \"$scheme\" is not supported"); break; } } - require_once 'Zend/Loader.php'; try { Zend_Loader::loadClass($className); } catch (Exception $e) { - require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("\"$className\" not found"); } $schemeHandler = new $className($scheme, $schemeSpecific); if (! $schemeHandler instanceof Zend_Uri) { - require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("\"$className\" is not an instance of Zend_Uri"); } diff --git a/library/vendor/Zend/Uri/Exception.php b/library/vendor/Zend/Uri/Exception.php index f5a497edd..780ffbce1 100644 --- a/library/vendor/Zend/Uri/Exception.php +++ b/library/vendor/Zend/Uri/Exception.php @@ -22,7 +22,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; /** * Exceptions for Zend_Uri diff --git a/library/vendor/Zend/Uri/Http.php b/library/vendor/Zend/Uri/Http.php index b99f9f816..a964a255c 100644 --- a/library/vendor/Zend/Uri/Http.php +++ b/library/vendor/Zend/Uri/Http.php @@ -22,12 +22,10 @@ /** * @see Zend_Uri */ -require_once 'Zend/Uri.php'; /** * @see Zend_Validate_Hostname */ -require_once 'Zend/Validate/Hostname.php'; /** * HTTP(S) URI handler @@ -152,7 +150,6 @@ class Zend_Uri_Http extends Zend_Uri // Validate the URI if ($this->valid() === false) { - require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception('Invalid URI supplied'); } } @@ -170,7 +167,6 @@ class Zend_Uri_Http extends Zend_Uri 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'); } @@ -179,7 +175,6 @@ class Zend_Uri_Http extends Zend_Uri $schemeSpecific = isset($uri[1]) === true ? $uri[1] : ''; if (in_array($scheme, array('http', 'https')) === false) { - require_once 'Zend/Uri/Exception.php'; throw new Zend_Uri_Exception("Invalid scheme: '$scheme'"); } @@ -201,7 +196,6 @@ class Zend_Uri_Http extends Zend_Uri $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'); } @@ -220,7 +214,6 @@ class Zend_Uri_Http extends Zend_Uri $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'); } @@ -243,7 +236,6 @@ class Zend_Uri_Http extends Zend_Uri 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'); } @@ -316,7 +308,6 @@ class Zend_Uri_Http extends Zend_Uri 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'); } @@ -333,7 +324,6 @@ class Zend_Uri_Http extends Zend_Uri 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"); } @@ -383,7 +373,6 @@ class Zend_Uri_Http extends Zend_Uri 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.'); } @@ -400,7 +389,6 @@ class Zend_Uri_Http extends Zend_Uri 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."); } @@ -455,7 +443,6 @@ class Zend_Uri_Http extends Zend_Uri 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"); } @@ -507,7 +494,6 @@ class Zend_Uri_Http extends Zend_Uri 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."); } @@ -550,7 +536,6 @@ class Zend_Uri_Http extends Zend_Uri $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'); } @@ -567,7 +552,6 @@ class Zend_Uri_Http extends Zend_Uri 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"); } @@ -628,7 +612,6 @@ class Zend_Uri_Http extends Zend_Uri $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'); } @@ -693,7 +676,6 @@ class Zend_Uri_Http extends Zend_Uri // 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"); } @@ -736,7 +718,6 @@ class Zend_Uri_Http extends Zend_Uri $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'); } @@ -753,7 +734,6 @@ class Zend_Uri_Http extends Zend_Uri 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/vendor/Zend/VERSION b/library/vendor/Zend/VERSION new file mode 100644 index 000000000..5a8f2d3ca --- /dev/null +++ b/library/vendor/Zend/VERSION @@ -0,0 +1 @@ +v1.12.20 diff --git a/library/vendor/Zend/Validate.php b/library/vendor/Zend/Validate.php index 956d3119d..c8796e42e 100644 --- a/library/vendor/Zend/Validate.php +++ b/library/vendor/Zend/Validate.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Interface */ -require_once 'Zend/Validate/Interface.php'; /** * @category Zend @@ -198,7 +197,6 @@ class Zend_Validate implements Zend_Validate_Interface $className = ucfirst($classBaseName); try { if (!class_exists($className, false)) { - require_once 'Zend/Loader.php'; foreach($namespaces as $namespace) { $class = $namespace . '_' . $className; $file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; @@ -240,7 +238,6 @@ class Zend_Validate implements Zend_Validate_Interface // 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'"); } @@ -251,7 +248,6 @@ class Zend_Validate implements Zend_Validate_Interface */ public static function getMessageLength() { - require_once 'Zend/Validate/Abstract.php'; return Zend_Validate_Abstract::getMessageLength(); } @@ -262,7 +258,6 @@ class Zend_Validate implements Zend_Validate_Interface */ public static function setMessageLength($length = -1) { - require_once 'Zend/Validate/Abstract.php'; Zend_Validate_Abstract::setMessageLength($length); } @@ -273,7 +268,6 @@ class Zend_Validate implements Zend_Validate_Interface */ public static function getDefaultTranslator($translator = null) { - require_once 'Zend/Validate/Abstract.php'; return Zend_Validate_Abstract::getDefaultTranslator(); } @@ -284,7 +278,6 @@ class Zend_Validate implements Zend_Validate_Interface */ public static function setDefaultTranslator($translator = null) { - require_once 'Zend/Validate/Abstract.php'; Zend_Validate_Abstract::setDefaultTranslator($translator); } } diff --git a/library/vendor/Zend/Validate/Abstract.php b/library/vendor/Zend/Validate/Abstract.php index 87998c576..f3ba55101 100644 --- a/library/vendor/Zend/Validate/Abstract.php +++ b/library/vendor/Zend/Validate/Abstract.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Interface */ -require_once 'Zend/Validate/Interface.php'; /** * @category Zend @@ -149,7 +148,6 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } if (!isset($this->_messageTemplates[$messageKey])) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("No message template exists for key '$messageKey'"); } @@ -191,7 +189,6 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface /** * @see Zend_Validate_Exception */ - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("No property exists by the name '$property'"); } @@ -355,7 +352,6 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } elseif ($translator instanceof Zend_Translate) { $this->_translator = $translator->getAdapter(); } else { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid translator specified'); } return $this; @@ -402,7 +398,6 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface } elseif ($translator instanceof Zend_Translate) { self::$_defaultTranslator = $translator->getAdapter(); } else { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid translator specified'); } } @@ -415,7 +410,6 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface public static function getDefaultTranslator() { if (null === self::$_defaultTranslator) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Translate')) { $translator = Zend_Registry::get('Zend_Translate'); if ($translator instanceof Zend_Translate_Adapter) { diff --git a/library/vendor/Zend/Validate/Alnum.php b/library/vendor/Zend/Validate/Alnum.php index 509183021..190ac44bf 100644 --- a/library/vendor/Zend/Validate/Alnum.php +++ b/library/vendor/Zend/Validate/Alnum.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -132,7 +131,6 @@ class Zend_Validate_Alnum extends Zend_Validate_Abstract /** * @see Zend_Filter_Alnum */ - require_once 'Zend/Filter/Alnum.php'; self::$_filter = new Zend_Filter_Alnum(); } diff --git a/library/vendor/Zend/Validate/Alpha.php b/library/vendor/Zend/Validate/Alpha.php index c9ea9828f..a5dbe40dd 100644 --- a/library/vendor/Zend/Validate/Alpha.php +++ b/library/vendor/Zend/Validate/Alpha.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -132,7 +131,6 @@ class Zend_Validate_Alpha extends Zend_Validate_Abstract /** * @see Zend_Filter_Alpha */ - require_once 'Zend/Filter/Alpha.php'; self::$_filter = new Zend_Filter_Alpha(); } diff --git a/library/vendor/Zend/Validate/Barcode.php b/library/vendor/Zend/Validate/Barcode.php index 4d48d5160..2cc6f1186 100644 --- a/library/vendor/Zend/Validate/Barcode.php +++ b/library/vendor/Zend/Validate/Barcode.php @@ -22,12 +22,10 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @see Zend_Loader */ -require_once 'Zend/Loader.php'; /** * @category Zend @@ -99,7 +97,6 @@ class Zend_Validate_Barcode extends Zend_Validate_Abstract if (array_key_exists('adapter', $adapter)) { $adapter = $adapter['adapter']; } else { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("Missing option 'adapter'"); } } @@ -131,7 +128,6 @@ class Zend_Validate_Barcode extends Zend_Validate_Abstract 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; } @@ -142,7 +138,6 @@ class Zend_Validate_Barcode extends Zend_Validate_Abstract $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/vendor/Zend/Validate/Barcode/AdapterAbstract.php b/library/vendor/Zend/Validate/Barcode/AdapterAbstract.php index 05dc2b9fa..01e240941 100644 --- a/library/vendor/Zend/Validate/Barcode/AdapterAbstract.php +++ b/library/vendor/Zend/Validate/Barcode/AdapterAbstract.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterInterface */ -require_once 'Zend/Validate/Barcode/AdapterInterface.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Code25.php b/library/vendor/Zend/Validate/Barcode/Code25.php index a42048787..e0e540a3f 100644 --- a/library/vendor/Zend/Validate/Barcode/Code25.php +++ b/library/vendor/Zend/Validate/Barcode/Code25.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Code25interleaved.php b/library/vendor/Zend/Validate/Barcode/Code25interleaved.php index 479aa0320..c952781fd 100644 --- a/library/vendor/Zend/Validate/Barcode/Code25interleaved.php +++ b/library/vendor/Zend/Validate/Barcode/Code25interleaved.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Code39.php b/library/vendor/Zend/Validate/Barcode/Code39.php index 37b2f13af..e1554a179 100644 --- a/library/vendor/Zend/Validate/Barcode/Code39.php +++ b/library/vendor/Zend/Validate/Barcode/Code39.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Code39ext.php b/library/vendor/Zend/Validate/Barcode/Code39ext.php index cd99c363c..a295694ca 100644 --- a/library/vendor/Zend/Validate/Barcode/Code39ext.php +++ b/library/vendor/Zend/Validate/Barcode/Code39ext.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Code93.php b/library/vendor/Zend/Validate/Barcode/Code93.php index e09ba17ec..2f83ee870 100644 --- a/library/vendor/Zend/Validate/Barcode/Code93.php +++ b/library/vendor/Zend/Validate/Barcode/Code93.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Code93ext.php b/library/vendor/Zend/Validate/Barcode/Code93ext.php index 6879a8937..8795f00e8 100644 --- a/library/vendor/Zend/Validate/Barcode/Code93ext.php +++ b/library/vendor/Zend/Validate/Barcode/Code93ext.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Ean12.php b/library/vendor/Zend/Validate/Barcode/Ean12.php index e185233f5..67bb14cac 100644 --- a/library/vendor/Zend/Validate/Barcode/Ean12.php +++ b/library/vendor/Zend/Validate/Barcode/Ean12.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Ean13.php b/library/vendor/Zend/Validate/Barcode/Ean13.php index 8daf54237..7554885d2 100644 --- a/library/vendor/Zend/Validate/Barcode/Ean13.php +++ b/library/vendor/Zend/Validate/Barcode/Ean13.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Ean14.php b/library/vendor/Zend/Validate/Barcode/Ean14.php index 12cf49bbc..af62b0e1a 100644 --- a/library/vendor/Zend/Validate/Barcode/Ean14.php +++ b/library/vendor/Zend/Validate/Barcode/Ean14.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Ean18.php b/library/vendor/Zend/Validate/Barcode/Ean18.php index 0f3df06b5..d2fe756ca 100644 --- a/library/vendor/Zend/Validate/Barcode/Ean18.php +++ b/library/vendor/Zend/Validate/Barcode/Ean18.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Ean2.php b/library/vendor/Zend/Validate/Barcode/Ean2.php index e2cec4b11..7124fd0f9 100644 --- a/library/vendor/Zend/Validate/Barcode/Ean2.php +++ b/library/vendor/Zend/Validate/Barcode/Ean2.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Ean5.php b/library/vendor/Zend/Validate/Barcode/Ean5.php index ff5b4bb2a..74654a77f 100644 --- a/library/vendor/Zend/Validate/Barcode/Ean5.php +++ b/library/vendor/Zend/Validate/Barcode/Ean5.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Ean8.php b/library/vendor/Zend/Validate/Barcode/Ean8.php index 6b1caa973..7f61dfb8c 100644 --- a/library/vendor/Zend/Validate/Barcode/Ean8.php +++ b/library/vendor/Zend/Validate/Barcode/Ean8.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Gtin12.php b/library/vendor/Zend/Validate/Barcode/Gtin12.php index 65ff5b9a2..d94a1b567 100644 --- a/library/vendor/Zend/Validate/Barcode/Gtin12.php +++ b/library/vendor/Zend/Validate/Barcode/Gtin12.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Gtin13.php b/library/vendor/Zend/Validate/Barcode/Gtin13.php index 382dccd72..ea66ce1a0 100644 --- a/library/vendor/Zend/Validate/Barcode/Gtin13.php +++ b/library/vendor/Zend/Validate/Barcode/Gtin13.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Gtin14.php b/library/vendor/Zend/Validate/Barcode/Gtin14.php index 6f291b8e3..a2354cb0b 100644 --- a/library/vendor/Zend/Validate/Barcode/Gtin14.php +++ b/library/vendor/Zend/Validate/Barcode/Gtin14.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Identcode.php b/library/vendor/Zend/Validate/Barcode/Identcode.php index 3f622fa63..f02cab78e 100644 --- a/library/vendor/Zend/Validate/Barcode/Identcode.php +++ b/library/vendor/Zend/Validate/Barcode/Identcode.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Intelligentmail.php b/library/vendor/Zend/Validate/Barcode/Intelligentmail.php index cfa2a82e6..d14ac37f0 100644 --- a/library/vendor/Zend/Validate/Barcode/Intelligentmail.php +++ b/library/vendor/Zend/Validate/Barcode/Intelligentmail.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Issn.php b/library/vendor/Zend/Validate/Barcode/Issn.php index a74fa5379..49c705da5 100644 --- a/library/vendor/Zend/Validate/Barcode/Issn.php +++ b/library/vendor/Zend/Validate/Barcode/Issn.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Itf14.php b/library/vendor/Zend/Validate/Barcode/Itf14.php index 4adc7447b..0ed97d152 100644 --- a/library/vendor/Zend/Validate/Barcode/Itf14.php +++ b/library/vendor/Zend/Validate/Barcode/Itf14.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Leitcode.php b/library/vendor/Zend/Validate/Barcode/Leitcode.php index b41b079ea..a79acaca2 100644 --- a/library/vendor/Zend/Validate/Barcode/Leitcode.php +++ b/library/vendor/Zend/Validate/Barcode/Leitcode.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Planet.php b/library/vendor/Zend/Validate/Barcode/Planet.php index 227bc25d2..96ed8811d 100644 --- a/library/vendor/Zend/Validate/Barcode/Planet.php +++ b/library/vendor/Zend/Validate/Barcode/Planet.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Postnet.php b/library/vendor/Zend/Validate/Barcode/Postnet.php index 5aed312cb..a0b0ca3da 100644 --- a/library/vendor/Zend/Validate/Barcode/Postnet.php +++ b/library/vendor/Zend/Validate/Barcode/Postnet.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Royalmail.php b/library/vendor/Zend/Validate/Barcode/Royalmail.php index 98fa38e64..c4c268570 100644 --- a/library/vendor/Zend/Validate/Barcode/Royalmail.php +++ b/library/vendor/Zend/Validate/Barcode/Royalmail.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Sscc.php b/library/vendor/Zend/Validate/Barcode/Sscc.php index e624d7d79..e234bf139 100644 --- a/library/vendor/Zend/Validate/Barcode/Sscc.php +++ b/library/vendor/Zend/Validate/Barcode/Sscc.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Upca.php b/library/vendor/Zend/Validate/Barcode/Upca.php index 7757f2b1b..4b92bd6c1 100644 --- a/library/vendor/Zend/Validate/Barcode/Upca.php +++ b/library/vendor/Zend/Validate/Barcode/Upca.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Barcode/Upce.php b/library/vendor/Zend/Validate/Barcode/Upce.php index 1b2482578..8d8dd2a71 100644 --- a/library/vendor/Zend/Validate/Barcode/Upce.php +++ b/library/vendor/Zend/Validate/Barcode/Upce.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Barcode_AdapterAbstract */ -require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Between.php b/library/vendor/Zend/Validate/Between.php index 53b68261d..09ba84d1e 100644 --- a/library/vendor/Zend/Validate/Between.php +++ b/library/vendor/Zend/Validate/Between.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -115,7 +114,6 @@ class Zend_Validate_Between extends Zend_Validate_Abstract } 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/vendor/Zend/Validate/Callback.php b/library/vendor/Zend/Validate/Callback.php index bb12ecf78..e333cad10 100644 --- a/library/vendor/Zend/Validate/Callback.php +++ b/library/vendor/Zend/Validate/Callback.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -86,7 +85,6 @@ class Zend_Validate_Callback extends Zend_Validate_Abstract } if (null === ($initializedCallack = $this->getCallback())) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('No callback registered'); } } @@ -111,7 +109,6 @@ class Zend_Validate_Callback extends Zend_Validate_Abstract 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/vendor/Zend/Validate/Ccnum.php b/library/vendor/Zend/Validate/Ccnum.php index c3c7029a3..150f64cc9 100644 --- a/library/vendor/Zend/Validate/Ccnum.php +++ b/library/vendor/Zend/Validate/Ccnum.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -80,7 +79,6 @@ class Zend_Validate_Ccnum extends Zend_Validate_Abstract /** * @see Zend_Filter_Digits */ - require_once 'Zend/Filter/Digits.php'; self::$_filter = new Zend_Filter_Digits(); } diff --git a/library/vendor/Zend/Validate/CreditCard.php b/library/vendor/Zend/Validate/CreditCard.php index 170b62250..130262604 100644 --- a/library/vendor/Zend/Validate/CreditCard.php +++ b/library/vendor/Zend/Validate/CreditCard.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -229,7 +228,6 @@ class Zend_Validate_CreditCard extends Zend_Validate_Abstract public function setService($service) { if (!is_callable($service)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid callback given'); } @@ -301,7 +299,6 @@ class Zend_Validate_CreditCard extends Zend_Validate_Abstract 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/vendor/Zend/Validate/Date.php b/library/vendor/Zend/Validate/Date.php index e875aaf55..3851a8e62 100644 --- a/library/vendor/Zend/Validate/Date.php +++ b/library/vendor/Zend/Validate/Date.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -92,7 +91,6 @@ class Zend_Validate_Date extends Zend_Validate_Abstract } if (!array_key_exists('locale', $options)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Locale')) { $options['locale'] = Zend_Registry::get('Zend_Locale'); } @@ -121,7 +119,6 @@ class Zend_Validate_Date extends Zend_Validate_Abstract */ public function setLocale($locale = null) { - require_once 'Zend/Locale.php'; $this->_locale = Zend_Locale::findLocale($locale); return $this; } @@ -170,7 +167,6 @@ class Zend_Validate_Date extends Zend_Validate_Abstract 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); @@ -207,7 +203,6 @@ class Zend_Validate_Date extends Zend_Validate_Abstract private function _checkFormat($value) { try { - require_once 'Zend/Locale/Format.php'; $parsed = Zend_Locale_Format::getDate($value, array( 'date_format' => $this->_format, 'format_type' => 'iso', 'fix_date' => false)); diff --git a/library/vendor/Zend/Validate/Db/Abstract.php b/library/vendor/Zend/Validate/Db/Abstract.php index ffee51f26..b08b1cae5 100644 --- a/library/vendor/Zend/Validate/Db/Abstract.php +++ b/library/vendor/Zend/Validate/Db/Abstract.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Class for Database record validation @@ -123,12 +122,10 @@ abstract class Zend_Validate_Db_Abstract extends Zend_Validate_Abstract } 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!'); } @@ -164,7 +161,6 @@ abstract class Zend_Validate_Db_Abstract extends Zend_Validate_Abstract 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,7 +177,6 @@ abstract class Zend_Validate_Db_Abstract extends Zend_Validate_Abstract 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/vendor/Zend/Validate/Db/NoRecordExists.php b/library/vendor/Zend/Validate/Db/NoRecordExists.php index 4dba8bc63..3d1628ab9 100644 --- a/library/vendor/Zend/Validate/Db/NoRecordExists.php +++ b/library/vendor/Zend/Validate/Db/NoRecordExists.php @@ -22,7 +22,6 @@ /** * @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/vendor/Zend/Validate/Db/RecordExists.php b/library/vendor/Zend/Validate/Db/RecordExists.php index 540af13bc..fb65f705a 100644 --- a/library/vendor/Zend/Validate/Db/RecordExists.php +++ b/library/vendor/Zend/Validate/Db/RecordExists.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Db_Abstract */ -require_once 'Zend/Validate/Db/Abstract.php'; /** * Confirms a record exists in a table. diff --git a/library/vendor/Zend/Validate/Digits.php b/library/vendor/Zend/Validate/Digits.php index 411c4c5b3..b18b59015 100644 --- a/library/vendor/Zend/Validate/Digits.php +++ b/library/vendor/Zend/Validate/Digits.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -77,7 +76,6 @@ class Zend_Validate_Digits extends Zend_Validate_Abstract } if (null === self::$_filter) { - require_once 'Zend/Filter/Digits.php'; self::$_filter = new Zend_Filter_Digits(); } diff --git a/library/vendor/Zend/Validate/EmailAddress.php b/library/vendor/Zend/Validate/EmailAddress.php index 8bffcaec3..de7726a86 100644 --- a/library/vendor/Zend/Validate/EmailAddress.php +++ b/library/vendor/Zend/Validate/EmailAddress.php @@ -22,12 +22,10 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @see Zend_Validate_Hostname */ -require_once 'Zend/Validate/Hostname.php'; /** * @category Zend @@ -288,7 +286,6 @@ class Zend_Validate_EmailAddress extends Zend_Validate_Abstract 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/vendor/Zend/Validate/Exception.php b/library/vendor/Zend/Validate/Exception.php index 4a4e2b2cb..ca88a8be5 100644 --- a/library/vendor/Zend/Validate/Exception.php +++ b/library/vendor/Zend/Validate/Exception.php @@ -22,7 +22,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/File/Count.php b/library/vendor/Zend/Validate/File/Count.php index aa822dfb1..eaa748065 100644 --- a/library/vendor/Zend/Validate/File/Count.php +++ b/library/vendor/Zend/Validate/File/Count.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validator for counting all given files @@ -110,7 +109,6 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract } elseif (is_string($options) || is_numeric($options)) { $options = array('max' => $options); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception ('Invalid options to validator provided'); } @@ -152,13 +150,11 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract } 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}"); } @@ -191,13 +187,11 @@ class Zend_Validate_File_Count extends Zend_Validate_Abstract } 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}"); } diff --git a/library/vendor/Zend/Validate/File/Crc32.php b/library/vendor/Zend/Validate/File/Crc32.php index 9fd47271c..b577c84ea 100644 --- a/library/vendor/Zend/Validate/File/Crc32.php +++ b/library/vendor/Zend/Validate/File/Crc32.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_File_Hash */ -require_once 'Zend/Validate/File/Hash.php'; /** * Validator for the crc32 hash of given files @@ -71,7 +70,6 @@ class Zend_Validate_File_Crc32 extends Zend_Validate_File_Hash } elseif (is_scalar($options)) { $options = array('hash1' => $options); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -158,7 +156,6 @@ class Zend_Validate_File_Crc32 extends Zend_Validate_File_Hash 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/vendor/Zend/Validate/File/ExcludeExtension.php b/library/vendor/Zend/Validate/File/ExcludeExtension.php index e894af6a3..605b71e4d 100644 --- a/library/vendor/Zend/Validate/File/ExcludeExtension.php +++ b/library/vendor/Zend/Validate/File/ExcludeExtension.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/File/Extension.php'; /** * Validator for the excluding file extensions @@ -61,7 +60,6 @@ class Zend_Validate_File_ExcludeExtension extends Zend_Validate_File_Extension 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/vendor/Zend/Validate/File/ExcludeMimeType.php b/library/vendor/Zend/Validate/File/ExcludeMimeType.php index 27d4f5ac3..5b031ce0e 100644 --- a/library/vendor/Zend/Validate/File/ExcludeMimeType.php +++ b/library/vendor/Zend/Validate/File/ExcludeMimeType.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_File_MimeType */ -require_once 'Zend/Validate/File/MimeType.php'; /** * Validator for the mime type of a file @@ -68,7 +67,6 @@ class Zend_Validate_File_ExcludeMimeType extends Zend_Validate_File_MimeType } // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_READABLE); } diff --git a/library/vendor/Zend/Validate/File/Exists.php b/library/vendor/Zend/Validate/File/Exists.php index 8da1ccdd7..d22cfcf50 100644 --- a/library/vendor/Zend/Validate/File/Exists.php +++ b/library/vendor/Zend/Validate/File/Exists.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validator which checks if the file already exists in the directory @@ -72,7 +71,6 @@ class Zend_Validate_File_Exists extends Zend_Validate_Abstract } else if (is_string($directory)) { $directory = explode(',', $directory); } else if (!is_array($directory)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception ('Invalid options to validator provided'); } @@ -123,7 +121,6 @@ class Zend_Validate_File_Exists extends Zend_Validate_Abstract if (is_string($directory)) { $directory = explode(',', $directory); } else if (!is_array($directory)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception ('Invalid options to validator provided'); } diff --git a/library/vendor/Zend/Validate/File/Extension.php b/library/vendor/Zend/Validate/File/Extension.php index 92f9f06a8..e2d057aa3 100644 --- a/library/vendor/Zend/Validate/File/Extension.php +++ b/library/vendor/Zend/Validate/File/Extension.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validator for the file extension of a file @@ -186,7 +185,6 @@ class Zend_Validate_File_Extension extends Zend_Validate_Abstract 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/vendor/Zend/Validate/File/FilesSize.php b/library/vendor/Zend/Validate/File/FilesSize.php index b64813341..e7b4930f2 100644 --- a/library/vendor/Zend/Validate/File/FilesSize.php +++ b/library/vendor/Zend/Validate/File/FilesSize.php @@ -22,7 +22,6 @@ /** * @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 @@ -76,7 +75,6 @@ class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size } elseif (is_scalar($options)) { $options = array('max' => $options); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -104,7 +102,6 @@ class Zend_Validate_File_FilesSize extends Zend_Validate_File_Size */ public function isValid($value, $file = null) { - require_once 'Zend/Loader.php'; if (is_string($value)) { $value = array($value); } diff --git a/library/vendor/Zend/Validate/File/Hash.php b/library/vendor/Zend/Validate/File/Hash.php index 54b036756..55a034714 100644 --- a/library/vendor/Zend/Validate/File/Hash.php +++ b/library/vendor/Zend/Validate/File/Hash.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validator for the hash of given files @@ -70,7 +69,6 @@ class Zend_Validate_File_Hash extends Zend_Validate_Abstract } elseif (is_scalar($options)) { $options = array('hash1' => $options); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -117,7 +115,6 @@ class Zend_Validate_File_Hash extends Zend_Validate_Abstract if (is_string($options)) { $options = array($options); } else if (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("False parameter given"); } @@ -130,7 +127,6 @@ class Zend_Validate_File_Hash extends Zend_Validate_Abstract } if (!in_array($algorithm, $known)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("Unknown algorithm '{$algorithm}'"); } @@ -153,7 +149,6 @@ class Zend_Validate_File_Hash extends Zend_Validate_Abstract 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/vendor/Zend/Validate/File/ImageSize.php b/library/vendor/Zend/Validate/File/ImageSize.php index 871fef84f..686a9cb73 100644 --- a/library/vendor/Zend/Validate/File/ImageSize.php +++ b/library/vendor/Zend/Validate/File/ImageSize.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validator for the image size of a image file @@ -140,7 +139,6 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract } } } else if (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception ('Invalid options to validator provided'); } @@ -205,7 +203,6 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract { 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}"); } @@ -213,7 +210,6 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract 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}"); } @@ -242,7 +238,6 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract { 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}"); } @@ -250,7 +245,6 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract 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}"); } @@ -308,7 +302,6 @@ class Zend_Validate_File_ImageSize extends Zend_Validate_Abstract 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/vendor/Zend/Validate/File/IsCompressed.php b/library/vendor/Zend/Validate/File/IsCompressed.php index ce59423bd..99023536a 100644 --- a/library/vendor/Zend/Validate/File/IsCompressed.php +++ b/library/vendor/Zend/Validate/File/IsCompressed.php @@ -22,7 +22,6 @@ /** * @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/vendor/Zend/Validate/File/IsImage.php b/library/vendor/Zend/Validate/File/IsImage.php index 09a6e42ab..a87f1a6a7 100644 --- a/library/vendor/Zend/Validate/File/IsImage.php +++ b/library/vendor/Zend/Validate/File/IsImage.php @@ -22,7 +22,6 @@ /** * @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/vendor/Zend/Validate/File/Md5.php b/library/vendor/Zend/Validate/File/Md5.php index bfe0b6046..1205a2638 100644 --- a/library/vendor/Zend/Validate/File/Md5.php +++ b/library/vendor/Zend/Validate/File/Md5.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_File_Hash */ -require_once 'Zend/Validate/File/Hash.php'; /** * Validator for the md5 hash of given files @@ -73,7 +72,6 @@ class Zend_Validate_File_Md5 extends Zend_Validate_File_Hash } elseif (is_scalar($options)) { $options = array('hash1' => $options); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -160,7 +158,6 @@ class Zend_Validate_File_Md5 extends Zend_Validate_File_Hash 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/vendor/Zend/Validate/File/MimeType.php b/library/vendor/Zend/Validate/File/MimeType.php index 874148836..407ec724f 100644 --- a/library/vendor/Zend/Validate/File/MimeType.php +++ b/library/vendor/Zend/Validate/File/MimeType.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validator for the mime type of a file @@ -136,7 +135,6 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract } 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"); } @@ -172,7 +170,6 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract !(@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 { @@ -209,10 +206,8 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract $this->_magicfile = null; } else if (!(class_exists('finfo', 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'); } else if (!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 +216,6 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract 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), null, @@ -328,7 +322,6 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract 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"); } @@ -377,7 +370,6 @@ class Zend_Validate_File_MimeType extends Zend_Validate_Abstract } // Is file readable ? - require_once 'Zend/Loader.php'; if (!Zend_Loader::isReadable($value)) { return $this->_throw($file, self::NOT_READABLE); } diff --git a/library/vendor/Zend/Validate/File/NotExists.php b/library/vendor/Zend/Validate/File/NotExists.php index bf58dce22..0599aa817 100644 --- a/library/vendor/Zend/Validate/File/NotExists.php +++ b/library/vendor/Zend/Validate/File/NotExists.php @@ -22,7 +22,6 @@ /** * @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/vendor/Zend/Validate/File/Sha1.php b/library/vendor/Zend/Validate/File/Sha1.php index e4076139b..04518076b 100644 --- a/library/vendor/Zend/Validate/File/Sha1.php +++ b/library/vendor/Zend/Validate/File/Sha1.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_File_Hash */ -require_once 'Zend/Validate/File/Hash.php'; /** * Validator for the sha1 hash of given files @@ -73,7 +72,6 @@ class Zend_Validate_File_Sha1 extends Zend_Validate_File_Hash } elseif (is_scalar($options)) { $options = array('hash1' => $options); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid options to validator provided'); } @@ -160,7 +158,6 @@ class Zend_Validate_File_Sha1 extends Zend_Validate_File_Hash 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/vendor/Zend/Validate/File/Size.php b/library/vendor/Zend/Validate/File/Size.php index bc9dea0d2..69034a975 100644 --- a/library/vendor/Zend/Validate/File/Size.php +++ b/library/vendor/Zend/Validate/File/Size.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validator for the maximum size of a file up to a max of 2GB @@ -108,7 +107,6 @@ class Zend_Validate_File_Size extends Zend_Validate_Abstract } elseif (is_string($options) || is_numeric($options)) { $options = array('max' => $options); } elseif (!is_array($options)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception ('Invalid options to validator provided'); } @@ -182,14 +180,12 @@ class Zend_Validate_File_Size extends Zend_Validate_Abstract 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"); } @@ -224,14 +220,12 @@ class Zend_Validate_File_Size extends Zend_Validate_Abstract 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"); } @@ -275,7 +269,6 @@ class Zend_Validate_File_Size extends Zend_Validate_Abstract 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/vendor/Zend/Validate/File/Upload.php b/library/vendor/Zend/Validate/File/Upload.php index 5eae76984..24a48d1ff 100644 --- a/library/vendor/Zend/Validate/File/Upload.php +++ b/library/vendor/Zend/Validate/File/Upload.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validator for the maximum size of a file up to a max of 2GB @@ -111,7 +110,6 @@ class Zend_Validate_File_Upload extends Zend_Validate_Abstract } 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/vendor/Zend/Validate/File/WordCount.php b/library/vendor/Zend/Validate/File/WordCount.php index 42c79a5bd..09b3fd1b0 100644 --- a/library/vendor/Zend/Validate/File/WordCount.php +++ b/library/vendor/Zend/Validate/File/WordCount.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_File_Count */ -require_once 'Zend/Validate/File/Count.php'; /** * Validator for counting all words in a file @@ -64,7 +63,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/vendor/Zend/Validate/Float.php b/library/vendor/Zend/Validate/Float.php index f0879a541..95b009741 100644 --- a/library/vendor/Zend/Validate/Float.php +++ b/library/vendor/Zend/Validate/Float.php @@ -22,12 +22,10 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @see Zend_Locale_Format */ -require_once 'Zend/Locale/Format.php'; /** * @category Zend @@ -70,7 +68,6 @@ class Zend_Validate_Float extends Zend_Validate_Abstract } if (empty($locale)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Locale')) { $locale = Zend_Registry::get('Zend_Locale'); } @@ -95,7 +92,6 @@ class Zend_Validate_Float extends Zend_Validate_Abstract */ public function setLocale($locale = null) { - require_once 'Zend/Locale.php'; $this->_locale = Zend_Locale::findLocale($locale); return $this; } diff --git a/library/vendor/Zend/Validate/GreaterThan.php b/library/vendor/Zend/Validate/GreaterThan.php index 5dd0579cd..ae71917e4 100644 --- a/library/vendor/Zend/Validate/GreaterThan.php +++ b/library/vendor/Zend/Validate/GreaterThan.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -72,7 +71,6 @@ class Zend_Validate_GreaterThan extends Zend_Validate_Abstract 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/vendor/Zend/Validate/Hex.php b/library/vendor/Zend/Validate/Hex.php index c6f780974..d8fcab2b8 100644 --- a/library/vendor/Zend/Validate/Hex.php +++ b/library/vendor/Zend/Validate/Hex.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/Hostname.php b/library/vendor/Zend/Validate/Hostname.php index 6554d2f29..afddd76ab 100644 --- a/library/vendor/Zend/Validate/Hostname.php +++ b/library/vendor/Zend/Validate/Hostname.php @@ -22,12 +22,10 @@ /** * @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 @@ -110,39 +108,57 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract /** * Array of valid top-level-domains * - * Version 2014112800, Last Updated Fri Nov 28 07:07:01 2014 UTC + * Version 2015091800, Last Updated Fri Sep 18 07:07:01 2015 UTC * * @see http://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain * @see http://www.iana.org/domains/root/db/ Official list of supported TLDs * @var array */ protected $_validTlds = array( + 'aaa', + 'abb', + 'abbott', 'abogado', 'ac', 'academy', + 'accenture', + 'accountant', 'accountants', + 'aco', 'active', 'actor', 'ad', + 'ads', + 'adult', 'ae', + 'aeg', 'aero', 'af', + 'afl', 'ag', 'agency', 'ai', + 'aig', 'airforce', + 'airtel', 'al', 'allfinanz', 'alsace', 'am', - 'an', + 'amica', + 'amsterdam', 'android', 'ao', + 'apartments', + 'app', 'aq', + 'aquarelle', 'ar', + 'aramco', 'archi', 'army', 'arpa', + 'arte', 'as', 'asia', 'associates', @@ -151,28 +167,44 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'au', 'auction', 'audio', + 'auto', 'autos', 'aw', 'ax', 'axa', 'az', + 'azure', 'ba', 'band', + 'bank', 'bar', + 'barcelona', + 'barclaycard', + 'barclays', 'bargains', + 'bauhaus', 'bayern', 'bb', + 'bbc', + 'bbva', + 'bcn', 'bd', 'be', 'beer', + 'bentley', 'berlin', 'best', + 'bet', 'bf', 'bg', 'bh', + 'bharti', 'bi', + 'bible', 'bid', 'bike', + 'bing', + 'bingo', 'bio', 'biz', 'bj', @@ -181,13 +213,23 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'bloomberg', 'blue', 'bm', + 'bms', 'bmw', 'bn', + 'bnl', 'bnpparibas', 'bo', + 'boats', + 'bom', + 'bond', 'boo', + 'boots', 'boutique', 'br', + 'bradesco', + 'bridgestone', + 'broker', + 'brother', 'brussels', 'bs', 'bt', @@ -203,35 +245,51 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'bzh', 'ca', 'cab', + 'cafe', 'cal', 'camera', 'camp', 'cancerresearch', + 'canon', 'capetown', 'capital', + 'car', 'caravan', 'cards', 'care', 'career', 'careers', + 'cars', + 'cartier', 'casa', 'cash', + 'casino', 'cat', 'catering', + 'cba', + 'cbn', 'cc', 'cd', + 'ceb', 'center', 'ceo', 'cern', 'cf', + 'cfa', + 'cfd', 'cg', 'ch', + 'chanel', 'channel', + 'chat', 'cheap', + 'chloe', 'christmas', 'chrome', 'church', 'ci', + 'cipriani', + 'cisco', 'citic', 'city', 'ck', @@ -241,7 +299,9 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'click', 'clinic', 'clothing', + 'cloud', 'club', + 'clubmed', 'cm', 'cn', 'co', @@ -251,6 +311,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'college', 'cologne', 'com', + 'commbank', 'community', 'company', 'computer', @@ -261,13 +322,18 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'cooking', 'cool', 'coop', + 'corsica', 'country', + 'coupons', + 'courses', 'cr', 'credit', 'creditcard', 'cricket', + 'crown', 'crs', 'cruises', + 'csc', 'cu', 'cuisinella', 'cv', @@ -275,19 +341,28 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'cx', 'cy', 'cymru', + 'cyou', 'cz', + 'dabur', 'dad', 'dance', + 'date', 'dating', + 'datsun', 'day', + 'dclk', 'de', 'deals', 'degree', 'delivery', + 'dell', + 'delta', 'democrat', 'dental', 'dentist', 'desi', + 'design', + 'dev', 'diamonds', 'diet', 'digital', @@ -299,10 +374,17 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'dm', 'dnp', 'do', + 'docs', + 'dog', + 'doha', 'domains', + 'doosan', + 'download', + 'drive', 'durban', 'dvag', 'dz', + 'earth', 'eat', 'ec', 'edu', @@ -315,39 +397,56 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'engineer', 'engineering', 'enterprises', + 'epson', 'equipment', 'er', + 'erni', 'es', 'esq', 'estate', 'et', 'eu', + 'eurovision', 'eus', 'events', 'everbank', 'exchange', 'expert', 'exposed', + 'express', + 'fage', 'fail', + 'faith', + 'family', + 'fan', + 'fans', 'farm', + 'fashion', 'feedback', 'fi', + 'film', + 'final', 'finance', 'financial', 'firmdale', 'fish', 'fishing', + 'fit', 'fitness', 'fj', 'fk', 'flights', 'florist', + 'flowers', 'flsmidth', 'fly', 'fm', 'fo', 'foo', + 'football', + 'forex', 'forsale', + 'forum', 'foundation', 'fr', 'frl', @@ -355,21 +454,29 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'fund', 'furniture', 'futbol', + 'fyi', 'ga', 'gal', 'gallery', + 'game', + 'garden', 'gb', 'gbiz', 'gd', + 'gdn', 'ge', + 'gea', 'gent', + 'genting', 'gf', 'gg', + 'ggee', 'gh', 'gi', 'gift', 'gifts', 'gives', + 'giving', 'gl', 'glass', 'gle', @@ -380,6 +487,11 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'gmo', 'gmx', 'gn', + 'gold', + 'goldpoint', + 'golf', + 'goo', + 'goog', 'google', 'gop', 'gov', @@ -390,44 +502,63 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'gratis', 'green', 'gripe', + 'group', 'gs', 'gt', 'gu', + 'gucci', + 'guge', 'guide', 'guitars', 'guru', 'gw', 'gy', 'hamburg', + 'hangout', 'haus', 'healthcare', 'help', 'here', + 'hermes', 'hiphop', + 'hitachi', 'hiv', 'hk', 'hm', 'hn', + 'hockey', 'holdings', 'holiday', + 'homedepot', 'homes', + 'honda', 'horse', 'host', 'hosting', + 'hoteles', + 'hotmail', 'house', 'how', 'hr', + 'hsbc', 'ht', 'hu', + 'hyundai', 'ibm', + 'icbc', + 'ice', + 'icu', 'id', 'ie', + 'ifm', + 'iinet', 'il', 'im', 'immo', 'immobilien', 'in', 'industries', + 'infiniti', 'info', 'ing', 'ink', @@ -437,72 +568,114 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'international', 'investments', 'io', + 'ipiranga', 'iq', 'ir', + 'irish', 'is', + 'ist', + 'istanbul', 'it', + 'itau', + 'iwc', + 'jaguar', + 'java', + 'jcb', 'je', 'jetzt', + 'jewelry', + 'jlc', + 'jll', 'jm', 'jo', 'jobs', 'joburg', 'jp', + 'jprs', 'juegos', 'kaufen', + 'kddi', 'ke', 'kg', 'kh', 'ki', + 'kia', 'kim', + 'kinder', 'kitchen', 'kiwi', 'km', 'kn', 'koeln', + 'komatsu', 'kp', 'kr', 'krd', 'kred', 'kw', 'ky', + 'kyoto', 'kz', 'la', 'lacaixa', + 'lancaster', 'land', + 'landrover', + 'lasalle', + 'lat', + 'latrobe', + 'law', 'lawyer', 'lb', 'lc', 'lds', 'lease', + 'leclerc', 'legal', + 'lexus', 'lgbt', 'li', + 'liaison', + 'lidl', 'life', 'lighting', 'limited', 'limo', + 'linde', 'link', + 'live', + 'lixil', 'lk', + 'loan', 'loans', + 'lol', 'london', + 'lotte', 'lotto', + 'love', 'lr', 'ls', 'lt', + 'ltd', 'ltda', 'lu', + 'lupin', 'luxe', 'luxury', 'lv', 'ly', 'ma', 'madrid', + 'maif', 'maison', + 'man', 'management', 'mango', 'market', 'marketing', + 'markets', + 'marriott', + 'mba', 'mc', 'md', 'me', @@ -511,100 +684,137 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'melbourne', 'meme', 'memorial', + 'men', 'menu', 'mg', 'mh', 'miami', + 'microsoft', 'mil', 'mini', 'mk', 'ml', 'mm', + 'mma', 'mn', 'mo', 'mobi', 'moda', 'moe', + 'moi', + 'mom', 'monash', 'money', + 'montblanc', 'mormon', 'mortgage', 'moscow', 'motorcycles', 'mov', + 'movie', + 'movistar', 'mp', 'mq', 'mr', 'ms', 'mt', + 'mtn', + 'mtpc', + 'mtr', 'mu', 'museum', + 'mutuelle', 'mv', 'mw', 'mx', 'my', 'mz', 'na', + 'nadex', 'nagoya', 'name', 'navy', 'nc', 'ne', + 'nec', 'net', + 'netbank', 'network', 'neustar', 'new', + 'news', 'nexus', 'nf', 'ng', 'ngo', 'nhk', 'ni', + 'nico', 'ninja', + 'nissan', 'nl', 'no', + 'nokia', 'np', 'nr', 'nra', 'nrw', + 'ntt', 'nu', 'nyc', 'nz', + 'obi', + 'office', 'okinawa', 'om', + 'omega', + 'one', 'ong', 'onl', + 'online', 'ooo', + 'oracle', + 'orange', 'org', 'organic', + 'osaka', 'otsuka', 'ovh', 'pa', + 'page', + 'panerai', 'paris', 'partners', 'parts', 'party', 'pe', + 'pet', 'pf', 'pg', 'ph', 'pharmacy', + 'philips', 'photo', 'photography', 'photos', 'physio', + 'piaget', 'pics', + 'pictet', 'pictures', 'pink', 'pizza', 'pk', 'pl', 'place', + 'play', 'plumbing', + 'plus', 'pm', 'pn', 'pohl', 'poker', + 'porn', 'post', 'pr', 'praxi', @@ -615,6 +825,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'prof', 'properties', 'property', + 'protection', 'ps', 'pt', 'pub', @@ -623,23 +834,29 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'qa', 'qpon', 'quebec', + 'racing', 're', 'realtor', + 'realty', 'recipes', 'red', + 'redstone', 'rehab', 'reise', 'reisen', 'reit', 'ren', + 'rent', 'rentals', 'repair', 'report', 'republican', 'rest', 'restaurant', + 'review', 'reviews', 'rich', + 'ricoh', 'rio', 'rip', 'ro', @@ -649,46 +866,88 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'rsvp', 'ru', 'ruhr', + 'run', 'rw', + 'rwe', 'ryukyu', 'sa', 'saarland', + 'sakura', + 'sale', + 'samsung', + 'sandvik', + 'sandvikcoromant', + 'sanofi', + 'sap', 'sarl', + 'saxo', 'sb', 'sc', 'sca', 'scb', 'schmidt', + 'scholarships', + 'school', 'schule', + 'schwarz', 'science', + 'scor', 'scot', 'sd', 'se', + 'seat', + 'security', + 'seek', + 'sener', 'services', + 'seven', + 'sew', + 'sex', 'sexy', 'sg', 'sh', 'shiksha', 'shoes', + 'show', + 'shriram', 'si', 'singles', + 'site', 'sj', 'sk', + 'ski', + 'sky', + 'skype', 'sl', 'sm', 'sn', + 'sncf', 'so', + 'soccer', 'social', 'software', 'sohu', 'solar', 'solutions', + 'sony', 'soy', 'space', 'spiegel', + 'spreadbetting', 'sr', + 'srl', 'st', + 'stada', + 'starhub', + 'statoil', + 'stc', + 'stcgroup', + 'stockholm', + 'studio', + 'study', + 'style', 'su', + 'sucks', 'supplies', 'supply', 'support', @@ -696,24 +955,38 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'surgery', 'suzuki', 'sv', + 'swatch', + 'swiss', 'sx', 'sy', 'sydney', 'systems', 'sz', 'taipei', + 'tatamotors', 'tatar', 'tattoo', 'tax', + 'taxi', 'tc', 'td', + 'team', + 'tech', 'technology', 'tel', + 'telefonica', + 'temasek', + 'tennis', 'tf', 'tg', 'th', + 'thd', + 'theater', + 'theatre', + 'tickets', 'tienda', 'tips', + 'tires', 'tirol', 'tj', 'tk', @@ -725,19 +998,25 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'tokyo', 'tools', 'top', + 'toray', + 'toshiba', + 'tours', 'town', + 'toyota', 'toys', - 'tp', 'tr', 'trade', + 'trading', 'training', 'travel', + 'trust', 'tt', 'tui', 'tv', 'tw', 'tz', 'ua', + 'ubs', 'ug', 'uk', 'university', @@ -757,8 +1036,14 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'vg', 'vi', 'viajes', + 'video', 'villas', + 'vin', + 'virgin', 'vision', + 'vista', + 'vistaprint', + 'viva', 'vlaanderen', 'vn', 'vodka', @@ -768,17 +1053,22 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'voyage', 'vu', 'wales', + 'walter', 'wang', 'watch', 'webcam', 'website', 'wed', 'wedding', + 'weir', 'wf', 'whoswho', 'wien', 'wiki', 'williamhill', + 'win', + 'windows', + 'wine', 'wme', 'work', 'works', @@ -786,10 +1076,17 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'ws', 'wtc', 'wtf', + 'xbox', + 'xerox', + 'xin', + 'xn--11b4c3d', 'xn--1qqw23a', + 'xn--30rr7y', 'xn--3bst00m', 'xn--3ds443g', 'xn--3e0b707e', + 'xn--3pxu8k', + 'xn--42c2d9a', 'xn--45brj9c', 'xn--45q11c', 'xn--4gbrim', @@ -802,32 +1099,47 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract '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', @@ -835,46 +1147,60 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract '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', '测试', 'परीक्षा', @@ -1043,7 +1369,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract 'CL' => array(1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'), 'CN' => 'Hostname/Cn.php', 'COM' => 'Hostname/Com.php', - 'DE' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'), + 'DE' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťßţŧŭůűũųūŵŷźžż]{1,63}$/iu'), 'DK' => array(1 => '/^[\x{002d}0-9a-zäéöüæøå]{1,63}$/iu'), 'ES' => array(1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'), 'EU' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu', @@ -1459,7 +1785,7 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract $check = 0; foreach ($domainParts as $domainPart) { // If some domain part is empty (i.e. zend..com), it's invalid - if (empty($domainPart)) { + if (empty($domainPart) && $domainPart !== '0') { $this->_error(self::INVALID_HOSTNAME); return false; } diff --git a/library/vendor/Zend/Validate/Iban.php b/library/vendor/Zend/Validate/Iban.php index e19c1a8d0..f01005be4 100644 --- a/library/vendor/Zend/Validate/Iban.php +++ b/library/vendor/Zend/Validate/Iban.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * Validates IBAN Numbers (International Bank Account Numbers) @@ -107,7 +106,7 @@ class Zend_Validate_Iban extends Zend_Validate_Abstract 'MC' => '/^MC[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}$/', 'MD' => '/^MD[0-9]{2}[A-Z0-9]{20}$/', 'ME' => '/^ME[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}$/', - 'MK' => '/^MK[0-9]{2}[A-Z]{3}[A-Z0-9]{10}[0-9]{2}$/', + 'MK' => '/^MK[0-9]{2}[0-9]{3}[A-Z0-9]{10}[0-9]{2}$/', 'MR' => '/^MR13[0-9]{5}[0-9]{5}[0-9]{11}[0-9]{2}$/', 'MU' => '/^MU[0-9]{2}[A-Z]{4}[0-9]{2}[0-9]{2}[0-9]{12}[0-9]{3}[A-Z]{2}$/', 'MT' => '/^MT[0-9]{2}[A-Z]{4}[0-9]{5}[A-Z0-9]{18}$/', @@ -149,7 +148,6 @@ class Zend_Validate_Iban extends Zend_Validate_Abstract } if (empty($locale)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Locale')) { $locale = Zend_Registry::get('Zend_Locale'); } @@ -181,10 +179,8 @@ class Zend_Validate_Iban extends Zend_Validate_Abstract public function setLocale($locale = null) { if ($locale !== false) { - 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/vendor/Zend/Validate/Identical.php b/library/vendor/Zend/Validate/Identical.php index 97f3b8cce..6afa0ebaa 100644 --- a/library/vendor/Zend/Validate/Identical.php +++ b/library/vendor/Zend/Validate/Identical.php @@ -20,7 +20,6 @@ */ /** @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend diff --git a/library/vendor/Zend/Validate/InArray.php b/library/vendor/Zend/Validate/InArray.php index 3f3ec243a..9a9a353f7 100644 --- a/library/vendor/Zend/Validate/InArray.php +++ b/library/vendor/Zend/Validate/InArray.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -73,7 +72,6 @@ class Zend_Validate_InArray extends Zend_Validate_Abstract if ($options instanceof Zend_Config) { $options = $options->toArray(); } else if (!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/vendor/Zend/Validate/Int.php b/library/vendor/Zend/Validate/Int.php index 1bcf31dba..75ec6cdce 100644 --- a/library/vendor/Zend/Validate/Int.php +++ b/library/vendor/Zend/Validate/Int.php @@ -22,12 +22,10 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @see Zend_Locale_Format */ -require_once 'Zend/Locale/Format.php'; /** * @category Zend @@ -70,7 +68,6 @@ class Zend_Validate_Int extends Zend_Validate_Abstract } if (empty($locale)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Locale')) { $locale = Zend_Registry::get('Zend_Locale'); } @@ -97,7 +94,6 @@ class Zend_Validate_Int extends Zend_Validate_Abstract */ public function setLocale($locale = null) { - require_once 'Zend/Locale.php'; $this->_locale = Zend_Locale::findLocale($locale); return $this; } diff --git a/library/vendor/Zend/Validate/Ip.php b/library/vendor/Zend/Validate/Ip.php index ede95e92c..1195ec796 100644 --- a/library/vendor/Zend/Validate/Ip.php +++ b/library/vendor/Zend/Validate/Ip.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -104,7 +103,6 @@ class Zend_Validate_Ip extends Zend_Validate_Abstract } 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/vendor/Zend/Validate/Isbn.php b/library/vendor/Zend/Validate/Isbn.php index 86c0c5c49..f2cff4f20 100644 --- a/library/vendor/Zend/Validate/Isbn.php +++ b/library/vendor/Zend/Validate/Isbn.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -78,7 +77,6 @@ class Zend_Validate_Isbn extends Zend_Validate_Abstract /** * @see Zend_Validate_Exception */ - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid options provided.'); } @@ -226,7 +224,6 @@ class Zend_Validate_Isbn extends Zend_Validate_Abstract /** * @see Zend_Validate_Exception */ - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid ISBN separator.'); } @@ -258,7 +255,6 @@ class Zend_Validate_Isbn extends Zend_Validate_Abstract /** * @see Zend_Validate_Exception */ - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('Invalid ISBN type'); } diff --git a/library/vendor/Zend/Validate/Ldap/Dn.php b/library/vendor/Zend/Validate/Ldap/Dn.php deleted file mode 100644 index 3033cec1e..000000000 --- a/library/vendor/Zend/Validate/Ldap/Dn.php +++ /dev/null @@ -1,65 +0,0 @@ - 'DN is malformed', - ); - - /** - * Defined by Zend_Validate_Interface. - * - * Returns true if and only if $value is a valid DN. - * - * @param string $value The value to be validated. - * - * @return boolean - */ - public function isValid($value) - { - $valid = Zend_Ldap_Dn::checkDn($value); - if ($valid === false) { - $this->_error(self::MALFORMED); - return false; - } - return true; - } -} diff --git a/library/vendor/Zend/Validate/LessThan.php b/library/vendor/Zend/Validate/LessThan.php index 41c28115b..6c1244bd1 100644 --- a/library/vendor/Zend/Validate/LessThan.php +++ b/library/vendor/Zend/Validate/LessThan.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -71,7 +70,6 @@ class Zend_Validate_LessThan extends Zend_Validate_Abstract 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/vendor/Zend/Validate/NotEmpty.php b/library/vendor/Zend/Validate/NotEmpty.php index 1bb3ceb82..7b70e687f 100644 --- a/library/vendor/Zend/Validate/NotEmpty.php +++ b/library/vendor/Zend/Validate/NotEmpty.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -139,7 +138,6 @@ class Zend_Validate_NotEmpty extends Zend_Validate_Abstract } 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/vendor/Zend/Validate/PostCode.php b/library/vendor/Zend/Validate/PostCode.php index 7f00d04db..0ae7b0316 100644 --- a/library/vendor/Zend/Validate/PostCode.php +++ b/library/vendor/Zend/Validate/PostCode.php @@ -22,12 +22,10 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @see Zend_Locale_Format */ -require_once 'Zend/Locale/Format.php'; /** * @category Zend @@ -78,7 +76,6 @@ class Zend_Validate_PostCode extends Zend_Validate_Abstract } if (empty($options)) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Locale')) { $this->setLocale(Zend_Registry::get('Zend_Locale')); } @@ -98,7 +95,6 @@ class Zend_Validate_PostCode extends Zend_Validate_Abstract $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,12 +119,10 @@ class Zend_Validate_PostCode extends Zend_Validate_Abstract */ 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(); if (empty($region)) { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("Unable to detect a region for the locale '$locale'"); } @@ -139,7 +133,6 @@ class Zend_Validate_PostCode extends Zend_Validate_Abstract ); 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()}'"); } @@ -167,7 +160,6 @@ class Zend_Validate_PostCode extends Zend_Validate_Abstract 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/vendor/Zend/Validate/Regex.php b/library/vendor/Zend/Validate/Regex.php index 5b4360a22..533efc009 100644 --- a/library/vendor/Zend/Validate/Regex.php +++ b/library/vendor/Zend/Validate/Regex.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -75,7 +74,6 @@ class Zend_Validate_Regex extends Zend_Validate_Abstract if (array_key_exists('pattern', $pattern)) { $pattern = $pattern['pattern']; } else { - require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception("Missing option 'pattern'"); } } @@ -106,7 +104,6 @@ class Zend_Validate_Regex extends Zend_Validate_Abstract $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/vendor/Zend/Validate/Sitemap/Changefreq.php b/library/vendor/Zend/Validate/Sitemap/Changefreq.php index b9f653f43..972f3552e 100644 --- a/library/vendor/Zend/Validate/Sitemap/Changefreq.php +++ b/library/vendor/Zend/Validate/Sitemap/Changefreq.php @@ -23,7 +23,6 @@ /** * @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/vendor/Zend/Validate/Sitemap/Lastmod.php b/library/vendor/Zend/Validate/Sitemap/Lastmod.php index 1e81828f1..e813e5ab2 100644 --- a/library/vendor/Zend/Validate/Sitemap/Lastmod.php +++ b/library/vendor/Zend/Validate/Sitemap/Lastmod.php @@ -23,7 +23,6 @@ /** * @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/vendor/Zend/Validate/Sitemap/Loc.php b/library/vendor/Zend/Validate/Sitemap/Loc.php index 24c78ed8a..84a16bc49 100644 --- a/library/vendor/Zend/Validate/Sitemap/Loc.php +++ b/library/vendor/Zend/Validate/Sitemap/Loc.php @@ -23,12 +23,10 @@ /** * @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/vendor/Zend/Validate/Sitemap/Priority.php b/library/vendor/Zend/Validate/Sitemap/Priority.php index 0f85f0997..abb0ced01 100644 --- a/library/vendor/Zend/Validate/Sitemap/Priority.php +++ b/library/vendor/Zend/Validate/Sitemap/Priority.php @@ -23,7 +23,6 @@ /** * @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/vendor/Zend/Validate/StringLength.php b/library/vendor/Zend/Validate/StringLength.php index b562c42fd..22f988792 100644 --- a/library/vendor/Zend/Validate/StringLength.php +++ b/library/vendor/Zend/Validate/StringLength.php @@ -22,7 +22,6 @@ /** * @see Zend_Validate_Abstract */ -require_once 'Zend/Validate/Abstract.php'; /** * @category Zend @@ -136,7 +135,6 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract /** * @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"); } @@ -169,7 +167,6 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract /** * @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"); } else { @@ -203,12 +200,16 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract ? iconv_get_encoding('internal_encoding') : ini_get('default_charset'); if (PHP_VERSION_ID < 50600) { - $result = iconv_set_encoding('internal_encoding', $encoding); + if ($encoding) { + $result = iconv_set_encoding('internal_encoding', $encoding); + } else { + $result = false; + } } else { - $result = ini_set('default_charset', $encoding); + ini_set('default_charset', $encoding); + $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!'); } @@ -218,7 +219,6 @@ class Zend_Validate_StringLength extends Zend_Validate_Abstract ini_set('default_charset', $orig); } } - $this->_encoding = $encoding; return $this; } diff --git a/library/vendor/Zend/Version.php b/library/vendor/Zend/Version.php deleted file mode 100644 index e6567dde3..000000000 --- a/library/vendor/Zend/Version.php +++ /dev/null @@ -1,81 +0,0 @@ -_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'); } } diff --git a/library/vendor/Zend/View/Abstract.php b/library/vendor/Zend/View/Abstract.php index ffcefee19..edb577d04 100644 --- a/library/vendor/Zend/View/Abstract.php +++ b/library/vendor/Zend/View/Abstract.php @@ -20,13 +20,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. @@ -309,7 +306,6 @@ abstract class Zend_View_Abstract implements Zend_View_Interface return; } - 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; @@ -473,7 +469,6 @@ abstract class Zend_View_Abstract implements Zend_View_Interface { $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); throw $e; @@ -493,7 +488,6 @@ abstract class Zend_View_Abstract implements Zend_View_Interface { $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); throw $e; @@ -581,7 +575,6 @@ abstract class Zend_View_Abstract implements Zend_View_Interface 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); throw $e; @@ -589,7 +582,6 @@ abstract class Zend_View_Abstract implements Zend_View_Interface 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' ); @@ -802,7 +794,6 @@ abstract class Zend_View_Abstract implements Zend_View_Interface 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); throw $e; @@ -819,13 +810,11 @@ abstract class Zend_View_Abstract implements Zend_View_Interface $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); throw $e; @@ -962,14 +951,12 @@ abstract class Zend_View_Abstract implements Zend_View_Interface 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); throw $e; } if (0 == count($this->_path['script'])) { - 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); throw $e; @@ -981,7 +968,6 @@ abstract class Zend_View_Abstract implements Zend_View_Interface } } - require_once 'Zend/View/Exception.php'; $message = "script '$name' not found in path (" . implode(PATH_SEPARATOR, $this->_path['script']) . ")"; diff --git a/library/vendor/Zend/View/Exception.php b/library/vendor/Zend/View/Exception.php index 93078bcf8..87685b894 100644 --- a/library/vendor/Zend/View/Exception.php +++ b/library/vendor/Zend/View/Exception.php @@ -23,7 +23,6 @@ /** * Zend_Exception */ -require_once 'Zend/Exception.php'; /** diff --git a/library/vendor/Zend/View/Helper/Abstract.php b/library/vendor/Zend/View/Helper/Abstract.php index da481bbe3..0946bc34a 100644 --- a/library/vendor/Zend/View/Helper/Abstract.php +++ b/library/vendor/Zend/View/Helper/Abstract.php @@ -23,7 +23,6 @@ /** * @see Zend_View_Helper_Interface */ -require_once 'Zend/View/Helper/Interface.php'; /** * @category Zend diff --git a/library/vendor/Zend/View/Helper/Action.php b/library/vendor/Zend/View/Helper/Action.php index a4b83af58..5020a4754 100644 --- a/library/vendor/Zend/View/Helper/Action.php +++ b/library/vendor/Zend/View/Helper/Action.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for rendering output of a controller action @@ -65,7 +64,6 @@ class Zend_View_Helper_Action extends Zend_View_Helper_Abstract $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); throw $e; @@ -75,7 +73,6 @@ class Zend_View_Helper_Action extends Zend_View_Helper_Abstract $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); throw $e; diff --git a/library/vendor/Zend/View/Helper/BaseUrl.php b/library/vendor/Zend/View/Helper/BaseUrl.php index 8af36bbdd..48f8049d8 100644 --- a/library/vendor/Zend/View/Helper/BaseUrl.php +++ b/library/vendor/Zend/View/Helper/BaseUrl.php @@ -21,7 +21,6 @@ */ /** @see Zend_View_Helper_Abstract */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for retrieving the BaseUrl @@ -82,7 +81,6 @@ class Zend_View_Helper_BaseUrl extends Zend_View_Helper_Abstract { 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/vendor/Zend/View/Helper/Currency.php b/library/vendor/Zend/View/Helper/Currency.php deleted file mode 100644 index 592185f71..000000000 --- a/library/vendor/Zend/View/Helper/Currency.php +++ /dev/null @@ -1,120 +0,0 @@ -setCurrency($currency); - } - - /** - * Output a formatted currency - * - * @param integer|float $value Currency value to output - * @param string|Zend_Locale|array $currency OPTIONAL Currency to use for - * this call - * @return string Formatted currency - */ - public function currency($value = null, $currency = null) - { - if ($value === null) { - return $this; - } - - if (is_string($currency) || ($currency instanceof Zend_Locale)) { - require_once 'Zend/Locale.php'; - if (Zend_Locale::isLocale($currency)) { - $currency = array('locale' => $currency); - } - } - - if (is_string($currency)) { - $currency = array('currency' => $currency); - } - - if (is_array($currency)) { - return $this->_currency->toCurrency($value, $currency); - } - - return $this->_currency->toCurrency($value); - } - - /** - * Sets a currency to use - * - * @param Zend_Currency|String|Zend_Locale $currency Currency to use - * @throws Zend_View_Exception When no or a false currency was set - * @return Zend_View_Helper_Currency - */ - public function setCurrency($currency = null) - { - if (!$currency instanceof Zend_Currency) { - require_once 'Zend/Currency.php'; - $currency = new Zend_Currency($currency); - } - $this->_currency = $currency; - - return $this; - } - - /** - * Retrieve currency object - * - * @return Zend_Currency|null - */ - public function getCurrency() - { - return $this->_currency; - } -} diff --git a/library/vendor/Zend/View/Helper/DeclareVars.php b/library/vendor/Zend/View/Helper/DeclareVars.php index 4663d4a41..a6c0fcf69 100644 --- a/library/vendor/Zend/View/Helper/DeclareVars.php +++ b/library/vendor/Zend/View/Helper/DeclareVars.php @@ -21,7 +21,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/vendor/Zend/View/Helper/Doctype.php b/library/vendor/Zend/View/Helper/Doctype.php index ca63b4dea..866b19377 100644 --- a/library/vendor/Zend/View/Helper/Doctype.php +++ b/library/vendor/Zend/View/Helper/Doctype.php @@ -21,10 +21,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 @@ -132,7 +130,6 @@ class Zend_View_Helper_Doctype extends Zend_View_Helper_Abstract break; default: if (substr($doctype, 0, 9) != 'setView($this->view); throw $e; diff --git a/library/vendor/Zend/View/Helper/Fieldset.php b/library/vendor/Zend/View/Helper/Fieldset.php index fce37b934..54567821d 100644 --- a/library/vendor/Zend/View/Helper/Fieldset.php +++ b/library/vendor/Zend/View/Helper/Fieldset.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_FormElement */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper for rendering fieldsets diff --git a/library/vendor/Zend/View/Helper/Form.php b/library/vendor/Zend/View/Helper/Form.php index 514bdd901..87811d456 100644 --- a/library/vendor/Zend/View/Helper/Form.php +++ b/library/vendor/Zend/View/Helper/Form.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_FormElement */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper for rendering HTML forms diff --git a/library/vendor/Zend/View/Helper/FormButton.php b/library/vendor/Zend/View/Helper/FormButton.php index abdd9f8f3..312952ead 100644 --- a/library/vendor/Zend/View/Helper/FormButton.php +++ b/library/vendor/Zend/View/Helper/FormButton.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormCheckbox.php b/library/vendor/Zend/View/Helper/FormCheckbox.php index fd6f4ae5b..4acf3cb4e 100644 --- a/library/vendor/Zend/View/Helper/FormCheckbox.php +++ b/library/vendor/Zend/View/Helper/FormCheckbox.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormElement.php b/library/vendor/Zend/View/Helper/FormElement.php index 8c1373b38..25f77b5c5 100644 --- a/library/vendor/Zend/View/Helper/FormElement.php +++ b/library/vendor/Zend/View/Helper/FormElement.php @@ -23,7 +23,6 @@ /** * @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. @@ -66,7 +65,6 @@ abstract class Zend_View_Helper_FormElement extends Zend_View_Helper_HtmlElement } 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); throw $e; diff --git a/library/vendor/Zend/View/Helper/FormErrors.php b/library/vendor/Zend/View/Helper/FormErrors.php index 4e092b115..b57d851a2 100644 --- a/library/vendor/Zend/View/Helper/FormErrors.php +++ b/library/vendor/Zend/View/Helper/FormErrors.php @@ -23,7 +23,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormFile.php b/library/vendor/Zend/View/Helper/FormFile.php index 1ea7bfc85..24a37dbcd 100644 --- a/library/vendor/Zend/View/Helper/FormFile.php +++ b/library/vendor/Zend/View/Helper/FormFile.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormHidden.php b/library/vendor/Zend/View/Helper/FormHidden.php index fbd2b7396..36c9c9b8d 100644 --- a/library/vendor/Zend/View/Helper/FormHidden.php +++ b/library/vendor/Zend/View/Helper/FormHidden.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormImage.php b/library/vendor/Zend/View/Helper/FormImage.php index be3daa3d0..31d654593 100644 --- a/library/vendor/Zend/View/Helper/FormImage.php +++ b/library/vendor/Zend/View/Helper/FormImage.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormLabel.php b/library/vendor/Zend/View/Helper/FormLabel.php index f4e034f9b..8b5fa71f2 100644 --- a/library/vendor/Zend/View/Helper/FormLabel.php +++ b/library/vendor/Zend/View/Helper/FormLabel.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_FormElement **/ -require_once 'Zend/View/Helper/FormElement.php'; /** * Form label helper diff --git a/library/vendor/Zend/View/Helper/FormMultiCheckbox.php b/library/vendor/Zend/View/Helper/FormMultiCheckbox.php index 49386cc45..3147369df 100644 --- a/library/vendor/Zend/View/Helper/FormMultiCheckbox.php +++ b/library/vendor/Zend/View/Helper/FormMultiCheckbox.php @@ -22,7 +22,6 @@ /** Zend_View_Helper_FormRadio */ -require_once 'Zend/View/Helper/FormRadio.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormNote.php b/library/vendor/Zend/View/Helper/FormNote.php index e051fdcc3..adeb411b1 100644 --- a/library/vendor/Zend/View/Helper/FormNote.php +++ b/library/vendor/Zend/View/Helper/FormNote.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormPassword.php b/library/vendor/Zend/View/Helper/FormPassword.php index cb42c4b75..3cd880d69 100644 --- a/library/vendor/Zend/View/Helper/FormPassword.php +++ b/library/vendor/Zend/View/Helper/FormPassword.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormRadio.php b/library/vendor/Zend/View/Helper/FormRadio.php index fa26a076b..b67c0d637 100644 --- a/library/vendor/Zend/View/Helper/FormRadio.php +++ b/library/vendor/Zend/View/Helper/FormRadio.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** @@ -124,7 +123,6 @@ class Zend_View_Helper_FormRadio extends Zend_View_Helper_FormElement $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/vendor/Zend/View/Helper/FormReset.php b/library/vendor/Zend/View/Helper/FormReset.php index a4e62826d..d6276f63d 100644 --- a/library/vendor/Zend/View/Helper/FormReset.php +++ b/library/vendor/Zend/View/Helper/FormReset.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormSelect.php b/library/vendor/Zend/View/Helper/FormSelect.php index 8654f3d0e..82709b159 100644 --- a/library/vendor/Zend/View/Helper/FormSelect.php +++ b/library/vendor/Zend/View/Helper/FormSelect.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormSubmit.php b/library/vendor/Zend/View/Helper/FormSubmit.php index 72223e203..959feb18b 100644 --- a/library/vendor/Zend/View/Helper/FormSubmit.php +++ b/library/vendor/Zend/View/Helper/FormSubmit.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormText.php b/library/vendor/Zend/View/Helper/FormText.php index 9b9f58135..8b2dbd912 100644 --- a/library/vendor/Zend/View/Helper/FormText.php +++ b/library/vendor/Zend/View/Helper/FormText.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/FormTextarea.php b/library/vendor/Zend/View/Helper/FormTextarea.php index c384fc4da..7fa844216 100644 --- a/library/vendor/Zend/View/Helper/FormTextarea.php +++ b/library/vendor/Zend/View/Helper/FormTextarea.php @@ -24,7 +24,6 @@ /** * Abstract class for extension */ -require_once 'Zend/View/Helper/FormElement.php'; /** diff --git a/library/vendor/Zend/View/Helper/Gravatar.php b/library/vendor/Zend/View/Helper/Gravatar.php index dab1f799f..1afc4cb11 100644 --- a/library/vendor/Zend/View/Helper/Gravatar.php +++ b/library/vendor/Zend/View/Helper/Gravatar.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_HtmlElement */ -require_once 'Zend/View/Helper/HtmlElement.php'; /** * Helper for retrieving avatars from gravatar.com @@ -194,7 +193,6 @@ class Zend_View_Helper_Gravatar extends Zend_View_Helper_HtmlElement $this->_options['rating'] = $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/vendor/Zend/View/Helper/HeadLink.php b/library/vendor/Zend/View/Helper/HeadLink.php index 61bf0a29d..1a15d177d 100644 --- a/library/vendor/Zend/View/Helper/HeadLink.php +++ b/library/vendor/Zend/View/Helper/HeadLink.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Standalone */ -require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Zend_Layout_View_Helper_HeadLink @@ -159,7 +158,6 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S } 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); throw $e; @@ -217,7 +215,6 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; @@ -236,7 +233,6 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S public function offsetSet($index, $value) { 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); throw $e; @@ -254,7 +250,6 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; @@ -272,7 +267,6 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; @@ -430,7 +424,6 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; diff --git a/library/vendor/Zend/View/Helper/HeadMeta.php b/library/vendor/Zend/View/Helper/HeadMeta.php index de58edd5d..bb112559f 100644 --- a/library/vendor/Zend/View/Helper/HeadMeta.php +++ b/library/vendor/Zend/View/Helper/HeadMeta.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Standalone */ -require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Zend_Layout_View_Helper_HeadMeta @@ -114,7 +113,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; @@ -158,7 +156,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S } 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); throw $e; @@ -241,7 +238,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; @@ -261,7 +257,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S public function offsetSet($index, $value) { 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); throw $e; @@ -280,7 +275,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S public function offsetUnset($index) { 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); throw $e; @@ -299,7 +293,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; @@ -318,7 +311,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; @@ -346,7 +338,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S 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); throw $e; @@ -357,7 +348,6 @@ class Zend_View_Helper_HeadMeta extends Zend_View_Helper_Placeholder_Container_S 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/vendor/Zend/View/Helper/HeadScript.php b/library/vendor/Zend/View/Helper/HeadScript.php index 062bed1b0..95a036577 100644 --- a/library/vendor/Zend/View/Helper/HeadScript.php +++ b/library/vendor/Zend/View/Helper/HeadScript.php @@ -21,7 +21,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 @@ -150,7 +149,6 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container public function captureStart($captureType = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $type = 'text/javascript', $attrs = array()) { 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); throw $e; @@ -212,7 +210,6 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container { 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); throw $e; @@ -226,7 +223,6 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container 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); throw $e; @@ -318,7 +314,6 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container 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); throw $e; @@ -336,7 +331,6 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container 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); throw $e; @@ -354,7 +348,6 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container 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); throw $e; @@ -373,7 +366,6 @@ class Zend_View_Helper_HeadScript extends Zend_View_Helper_Placeholder_Container public function offsetSet($index, $value) { 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); throw $e; diff --git a/library/vendor/Zend/View/Helper/HeadStyle.php b/library/vendor/Zend/View/Helper/HeadStyle.php index fc571bc9e..933490166 100644 --- a/library/vendor/Zend/View/Helper/HeadStyle.php +++ b/library/vendor/Zend/View/Helper/HeadStyle.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Standalone */ -require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Helper for setting and retrieving stylesheets @@ -150,7 +149,6 @@ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_ } 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); throw $e; @@ -204,7 +202,6 @@ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_ 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); throw $e; @@ -223,7 +220,6 @@ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_ public function offsetSet($index, $value) { 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); throw $e; @@ -241,7 +237,6 @@ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_ 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); throw $e; @@ -259,7 +254,6 @@ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_ 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); throw $e; @@ -278,7 +272,6 @@ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_ 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); throw $e; diff --git a/library/vendor/Zend/View/Helper/HeadTitle.php b/library/vendor/Zend/View/Helper/HeadTitle.php index 8f3d9d0db..77aef2669 100644 --- a/library/vendor/Zend/View/Helper/HeadTitle.php +++ b/library/vendor/Zend/View/Helper/HeadTitle.php @@ -21,7 +21,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 @@ -100,7 +99,6 @@ class Zend_View_Helper_HeadTitle extends Zend_View_Helper_Placeholder_Container_ 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 @@ class Zend_View_Helper_HeadTitle extends Zend_View_Helper_Placeholder_Container_ } 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); throw $e; @@ -150,7 +147,6 @@ class Zend_View_Helper_HeadTitle extends Zend_View_Helper_Placeholder_Container_ public function getTranslator() { if (null === $this->_translator) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Translate')) { $this->setTranslator(Zend_Registry::get('Zend_Translate')); } diff --git a/library/vendor/Zend/View/Helper/HtmlElement.php b/library/vendor/Zend/View/Helper/HtmlElement.php index 263fcd32d..212afbd61 100644 --- a/library/vendor/Zend/View/Helper/HtmlElement.php +++ b/library/vendor/Zend/View/Helper/HtmlElement.php @@ -23,7 +23,6 @@ /** * @see Zend_View_Helper_Abstract */ -require_once 'Zend/View/Helper/Abstract.php'; /** * @category Zend @@ -117,7 +116,6 @@ abstract class Zend_View_Helper_HtmlElement extends Zend_View_Helper_Abstract // 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/vendor/Zend/View/Helper/HtmlFlash.php b/library/vendor/Zend/View/Helper/HtmlFlash.php index 3edcf1afc..b33ad5143 100644 --- a/library/vendor/Zend/View/Helper/HtmlFlash.php +++ b/library/vendor/Zend/View/Helper/HtmlFlash.php @@ -23,7 +23,6 @@ /** * @see Zend_View_Helper_HtmlObject */ -require_once 'Zend/View/Helper/HtmlObject.php'; /** * @category Zend diff --git a/library/vendor/Zend/View/Helper/HtmlList.php b/library/vendor/Zend/View/Helper/HtmlList.php index 471ade480..e080eb1f3 100644 --- a/library/vendor/Zend/View/Helper/HtmlList.php +++ b/library/vendor/Zend/View/Helper/HtmlList.php @@ -24,7 +24,6 @@ /** * Zend_View_Helper_FormELement */ -require_once 'Zend/View/Helper/FormElement.php'; /** * Helper for ordered and unordered lists @@ -50,7 +49,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); throw $e; diff --git a/library/vendor/Zend/View/Helper/HtmlObject.php b/library/vendor/Zend/View/Helper/HtmlObject.php index 1eddfea5e..a5a4e227c 100644 --- a/library/vendor/Zend/View/Helper/HtmlObject.php +++ b/library/vendor/Zend/View/Helper/HtmlObject.php @@ -23,7 +23,6 @@ /** * @see Zend_View_Helper_HtmlElement */ -require_once 'Zend/View/Helper/HtmlElement.php'; /** * @category Zend diff --git a/library/vendor/Zend/View/Helper/HtmlPage.php b/library/vendor/Zend/View/Helper/HtmlPage.php index e7b8b0f20..2a2265cc8 100644 --- a/library/vendor/Zend/View/Helper/HtmlPage.php +++ b/library/vendor/Zend/View/Helper/HtmlPage.php @@ -23,7 +23,6 @@ /** * @see Zend_View_Helper_HtmlObject */ -require_once 'Zend/View/Helper/HtmlObject.php'; /** * @category Zend diff --git a/library/vendor/Zend/View/Helper/HtmlQuicktime.php b/library/vendor/Zend/View/Helper/HtmlQuicktime.php index 6c200dbce..f09452d3c 100644 --- a/library/vendor/Zend/View/Helper/HtmlQuicktime.php +++ b/library/vendor/Zend/View/Helper/HtmlQuicktime.php @@ -23,7 +23,6 @@ /** * @see Zend_View_Helper_HtmlObject */ -require_once 'Zend/View/Helper/HtmlObject.php'; /** * @category Zend diff --git a/library/vendor/Zend/View/Helper/InlineScript.php b/library/vendor/Zend/View/Helper/InlineScript.php index 978c6b812..555a2f460 100644 --- a/library/vendor/Zend/View/Helper/InlineScript.php +++ b/library/vendor/Zend/View/Helper/InlineScript.php @@ -21,7 +21,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/vendor/Zend/View/Helper/Json.php b/library/vendor/Zend/View/Helper/Json.php index 61b21ec93..62bf07900 100644 --- a/library/vendor/Zend/View/Helper/Json.php +++ b/library/vendor/Zend/View/Helper/Json.php @@ -21,13 +21,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 @@ -76,7 +73,6 @@ class Zend_View_Helper_Json extends Zend_View_Helper_Abstract $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/vendor/Zend/View/Helper/Layout.php b/library/vendor/Zend/View/Helper/Layout.php index 286a9e38e..a83bf0660 100644 --- a/library/vendor/Zend/View/Helper/Layout.php +++ b/library/vendor/Zend/View/Helper/Layout.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * View helper for retrieving layout object @@ -44,7 +43,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/vendor/Zend/View/Helper/Navigation.php b/library/vendor/Zend/View/Helper/Navigation.php deleted file mode 100644 index 2e82ef6a2..000000000 --- a/library/vendor/Zend/View/Helper/Navigation.php +++ /dev/null @@ -1,350 +0,0 @@ -setContainer($container); - } - - return $this; - } - - /** - * Magic overload: Proxy to other navigation helpers or the container - * - * Examples of usage from a view script or layout: - * - * // proxy to Menu helper and render container: - * echo $this->navigation()->menu(); - * - * // proxy to Breadcrumbs helper and set indentation: - * $this->navigation()->breadcrumbs()->setIndent(8); - * - * // proxy to container and find all pages with 'blog' route: - * $blogPages = $this->navigation()->findAllByRoute('blog'); - * - * - * @param string $method helper name or method name in - * container - * @param array $arguments [optional] arguments to pass - * @return mixed returns what the proxied call returns - * @throws Zend_View_Exception if proxying to a helper, and the - * helper is not an instance of the - * interface specified in - * {@link findHelper()} - * @throws Zend_Navigation_Exception if method does not exist in container - */ - public function __call($method, array $arguments = array()) - { - // check if call should proxy to another helper - if ($helper = $this->findHelper($method, false)) { - return call_user_func_array(array($helper, $method), $arguments); - } - - // default behaviour: proxy call to container - return parent::__call($method, $arguments); - } - - /** - * Returns the helper matching $proxy - * - * The helper must implement the interface - * {@link Zend_View_Helper_Navigation_Helper}. - * - * @param string $proxy helper name - * @param bool $strict [optional] whether - * exceptions should be - * thrown if something goes - * wrong. Default is true. - * @return Zend_View_Helper_Navigation_Helper helper instance - * @throws Zend_Loader_PluginLoader_Exception if $strict is true and - * helper cannot be found - * @throws Zend_View_Exception if $strict is true and - * helper does not implement - * the specified interface - */ - public function findHelper($proxy, $strict = true) - { - if (isset($this->_helpers[$proxy])) { - return $this->_helpers[$proxy]; - } - - if (!$this->view->getPluginLoader('helper')->getPaths(self::NS)) { - // Add navigation helper path at the beginning - $paths = $this->view->getHelperPaths(); - $this->view->setHelperPath(null); - - $this->view->addHelperPath( - str_replace('_', '/', self::NS), - self::NS); - - foreach ($paths as $ns => $path) { - $this->view->addHelperPath($path, $ns); - } - } - - if ($strict) { - $helper = $this->view->getHelper($proxy); - } else { - try { - $helper = $this->view->getHelper($proxy); - } catch (Zend_Loader_PluginLoader_Exception $e) { - return null; - } - } - - 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', - get_class($helper))); - $e->setView($this->view); - throw $e; - } - - return null; - } - - $this->_inject($helper); - $this->_helpers[$proxy] = $helper; - - return $helper; - } - - /** - * Injects container, ACL, and translator to the given $helper if this - * helper is configured to do so - * - * @param Zend_View_Helper_Navigation_Helper $helper helper instance - * @return void - */ - protected function _inject(Zend_View_Helper_Navigation_Helper $helper) - { - if ($this->getInjectContainer() && !$helper->hasContainer()) { - $helper->setContainer($this->getContainer()); - } - - if ($this->getInjectAcl()) { - if (!$helper->hasAcl()) { - $helper->setAcl($this->getAcl()); - } - if (!$helper->hasRole()) { - $helper->setRole($this->getRole()); - } - } - - if ($this->getInjectTranslator() && !$helper->hasTranslator()) { - $helper->setTranslator($this->getTranslator()); - } - } - - // Accessors: - - /** - * Sets the default proxy to use in {@link render()} - * - * @param string $proxy default proxy - * @return Zend_View_Helper_Navigation fluent interface, returns self - */ - public function setDefaultProxy($proxy) - { - $this->_defaultProxy = (string) $proxy; - return $this; - } - - /** - * Returns the default proxy to use in {@link render()} - * - * @return string the default proxy to use in {@link render()} - */ - public function getDefaultProxy() - { - return $this->_defaultProxy; - } - - /** - * Sets whether container should be injected when proxying - * - * @param bool $injectContainer [optional] whether container should - * be injected when proxying. Default - * is true. - * @return Zend_View_Helper_Navigation fluent interface, returns self - */ - public function setInjectContainer($injectContainer = true) - { - $this->_injectContainer = (bool) $injectContainer; - return $this; - } - - /** - * Returns whether container should be injected when proxying - * - * @return bool whether container should be injected when proxying - */ - public function getInjectContainer() - { - return $this->_injectContainer; - } - - /** - * Sets whether ACL should be injected when proxying - * - * @param bool $injectAcl [optional] whether ACL should be - * injected when proxying. Default is - * true. - * @return Zend_View_Helper_Navigation fluent interface, returns self - */ - public function setInjectAcl($injectAcl = true) - { - $this->_injectAcl = (bool) $injectAcl; - return $this; - } - - /** - * Returns whether ACL should be injected when proxying - * - * @return bool whether ACL should be injected when proxying - */ - public function getInjectAcl() - { - return $this->_injectAcl; - } - - /** - * Sets whether translator should be injected when proxying - * - * @param bool $injectTranslator [optional] whether translator should - * be injected when proxying. Default - * is true. - * @return Zend_View_Helper_Navigation fluent interface, returns self - */ - public function setInjectTranslator($injectTranslator = true) - { - $this->_injectTranslator = (bool) $injectTranslator; - return $this; - } - - /** - * Returns whether translator should be injected when proxying - * - * @return bool whether translator should be injected when proxying - */ - public function getInjectTranslator() - { - return $this->_injectTranslator; - } - - // Zend_View_Helper_Navigation_Helper: - - /** - * Renders helper - * - * @param Zend_Navigation_Container $container [optional] container to - * render. Default is to - * render the container - * registered in the helper. - * @return string helper output - * @throws Zend_Loader_PluginLoader_Exception if helper cannot be found - * @throws Zend_View_Exception if helper doesn't implement - * the interface specified in - * {@link findHelper()} - */ - public function render(Zend_Navigation_Container $container = null) - { - $helper = $this->findHelper($this->getDefaultProxy()); - return $helper->render($container); - } -} diff --git a/library/vendor/Zend/View/Helper/Navigation/Breadcrumbs.php b/library/vendor/Zend/View/Helper/Navigation/Breadcrumbs.php deleted file mode 100644 index 10755c3df..000000000 --- a/library/vendor/Zend/View/Helper/Navigation/Breadcrumbs.php +++ /dev/null @@ -1,331 +0,0 @@ -setContainer($container); - } - - return $this; - } - - // Accessors: - - /** - * Sets breadcrumb separator - * - * @param string $separator separator string - * @return Zend_View_Helper_Navigation_Breadcrumbs fluent interface, - * returns self - */ - public function setSeparator($separator) - { - if (is_string($separator)) { - $this->_separator = $separator; - } - - return $this; - } - - /** - * Returns breadcrumb separator - * - * @return string breadcrumb separator - */ - public function getSeparator() - { - return $this->_separator; - } - - /** - * Sets whether last page in breadcrumbs should be hyperlinked - * - * @param bool $linkLast whether last page should - * be hyperlinked - * @return Zend_View_Helper_Navigation_Breadcrumbs fluent interface, - * returns self - */ - public function setLinkLast($linkLast) - { - $this->_linkLast = (bool) $linkLast; - return $this; - } - - /** - * Returns whether last page in breadcrumbs should be hyperlinked - * - * @return bool whether last page in breadcrumbs should be hyperlinked - */ - public function getLinkLast() - { - return $this->_linkLast; - } - - /** - * Sets which partial view script to use for rendering menu - * - * @param string|array $partial partial view script or - * null. If an array is - * given, it is expected to - * contain two values; - * the partial view script - * to use, and the module - * where the script can be - * found. - * @return Zend_View_Helper_Navigation_Breadcrumbs fluent interface, - * returns self - */ - public function setPartial($partial) - { - if (null === $partial || is_string($partial) || is_array($partial)) { - $this->_partial = $partial; - } - - return $this; - } - - /** - * Returns partial view script to use for rendering menu - * - * @return string|array|null - */ - public function getPartial() - { - return $this->_partial; - } - - // Render methods: - - /** - * Renders breadcrumbs by chaining 'a' elements with the separator - * registered in the helper - * - * @param Zend_Navigation_Container $container [optional] container to - * render. Default is to - * render the container - * registered in the helper. - * @return string helper output - */ - public function renderStraight(Zend_Navigation_Container $container = null) - { - if (null === $container) { - $container = $this->getContainer(); - } - - // find deepest active - if (!$active = $this->findActive($container)) { - return ''; - } - - $active = $active['page']; - - // put the deepest active page last in breadcrumbs - if ($this->getLinkLast()) { - $html = $this->htmlify($active); - } else { - $html = $active->getLabel(); - if ($this->getUseTranslator() && $t = $this->getTranslator()) { - $html = $t->translate($html); - } - $html = $this->view->escape($html); - } - - // walk back to root - while ($parent = $active->getParent()) { - if ($parent instanceof Zend_Navigation_Page) { - // prepend crumb to html - $html = $this->htmlify($parent) - . $this->getSeparator() - . $html; - } - - if ($parent === $container) { - // at the root of the given container - break; - } - - $active = $parent; - } - - return strlen($html) ? $this->getIndent() . $html : ''; - } - - /** - * Renders the given $container by invoking the partial view helper - * - * The container will simply be passed on as a model to the view script, - * so in the script it will be available in $this->container. - * - * @param Zend_Navigation_Container $container [optional] container to - * pass to view script. - * Default is to use the - * container registered in the - * helper. - * @param string|array $partial [optional] partial view - * script to use. Default is - * to use the partial - * registered in the helper. - * If an array is given, it is - * expected to contain two - * values; the partial view - * script to use, and the - * module where the script can - * be found. - * @return string helper output - */ - public function renderPartial(Zend_Navigation_Container $container = null, - $partial = null) - { - if (null === $container) { - $container = $this->getContainer(); - } - - if (null === $partial) { - $partial = $this->getPartial(); - } - - if (empty($partial)) { - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception( - 'Unable to render menu: No partial view script provided' - ); - $e->setView($this->view); - throw $e; - } - - // put breadcrumb pages in model - $model = array('pages' => array()); - if ($active = $this->findActive($container)) { - $active = $active['page']; - $model['pages'][] = $active; - while ($parent = $active->getParent()) { - if ($parent instanceof Zend_Navigation_Page) { - $model['pages'][] = $parent; - } else { - break; - } - - if ($parent === $container) { - // break if at the root of the given container - break; - } - - $active = $parent; - } - $model['pages'] = array_reverse($model['pages']); - } - - 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 ' - . 'script and module where script can be found' - ); - $e->setView($this->view); - throw $e; - } - - return $this->view->partial($partial[0], $partial[1], $model); - } - - return $this->view->partial($partial, null, $model); - } - - // Zend_View_Helper_Navigation_Helper: - - /** - * Renders helper - * - * Implements {@link Zend_View_Helper_Navigation_Helper::render()}. - * - * @param Zend_Navigation_Container $container [optional] container to - * render. Default is to - * render the container - * registered in the helper. - * @return string helper output - */ - public function render(Zend_Navigation_Container $container = null) - { - if ($partial = $this->getPartial()) { - return $this->renderPartial($container, $partial); - } else { - return $this->renderStraight($container); - } - } -} diff --git a/library/vendor/Zend/View/Helper/Navigation/Helper.php b/library/vendor/Zend/View/Helper/Navigation/Helper.php deleted file mode 100644 index e7d587816..000000000 --- a/library/vendor/Zend/View/Helper/Navigation/Helper.php +++ /dev/null @@ -1,212 +0,0 @@ -_container = $container; - return $this; - } - - /** - * Returns the navigation container helper operates on by default - * - * Implements {@link Zend_View_Helper_Navigation_Interface::getContainer()}. - * - * If a helper is not explicitly set in this helper instance by calling - * {@link setContainer()} or by passing it through the helper entry point, - * this method will look in {@link Zend_Registry} for a container by using - * the key 'Zend_Navigation'. - * - * If no container is set, and nothing is found in Zend_Registry, a new - * container will be instantiated and stored in the helper. - * - * @return Zend_Navigation_Container navigation container - */ - public function getContainer() - { - if (null === $this->_container) { - // try to fetch from registry first - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered('Zend_Navigation')) { - $nav = Zend_Registry::get('Zend_Navigation'); - if ($nav instanceof Zend_Navigation_Container) { - return $this->_container = $nav; - } - } - - // nothing found in registry, create new container - require_once 'Zend/Navigation.php'; - $this->_container = new Zend_Navigation(); - } - - return $this->_container; - } - - /** - * Sets the minimum depth a page must have to be included when rendering - * - * @param int $minDepth [optional] minimum - * depth. Default is - * null, which sets - * no minimum depth. - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setMinDepth($minDepth = null) - { - if (null === $minDepth || is_int($minDepth)) { - $this->_minDepth = $minDepth; - } else { - $this->_minDepth = (int) $minDepth; - } - return $this; - } - - /** - * Returns minimum depth a page must have to be included when rendering - * - * @return int|null minimum depth or null - */ - public function getMinDepth() - { - if (!is_int($this->_minDepth) || $this->_minDepth < 0) { - return 0; - } - return $this->_minDepth; - } - - /** - * Sets the maximum depth a page can have to be included when rendering - * - * @param int $maxDepth [optional] maximum - * depth. Default is - * null, which sets no - * maximum depth. - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setMaxDepth($maxDepth = null) - { - if (null === $maxDepth || is_int($maxDepth)) { - $this->_maxDepth = $maxDepth; - } else { - $this->_maxDepth = (int) $maxDepth; - } - return $this; - } - - /** - * Returns maximum depth a page can have to be included when rendering - * - * @return int|null maximum depth or null - */ - public function getMaxDepth() - { - return $this->_maxDepth; - } - - /** - * Set the indentation string for using in {@link render()}, optionally a - * number of spaces to indent with - * - * @param string|int $indent indentation string or - * number of spaces - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setIndent($indent) - { - $this->_indent = $this->_getWhitespace($indent); - return $this; - } - - /** - * Returns indentation (format output is respected) - * - * @return string indentation string or an empty string - */ - public function getIndent() - { - if (false === $this->getFormatOutput()) { - return ''; - } - - return $this->_indent; - } - - /** - * Returns the EOL character (format output is respected) - * - * @see self::EOL - * @see getFormatOutput() - * - * @return string standard EOL charater or an empty string - */ - public function getEOL() - { - if (false === $this->getFormatOutput()) { - return ''; - } - - return self::EOL; - } - - /** - * Sets whether HTML/XML output should be formatted - * - * @param bool $formatOutput [optional] whether output - * should be formatted. Default - * is true. - * - * @return Zend_View_Helper_Navigation_Sitemap fluent interface, returns - * self - */ - public function setFormatOutput($formatOutput = true) - { - $this->_formatOutput = (bool)$formatOutput; - - return $this; - } - - /** - * Returns whether HTML/XML output should be formatted - * - * @return bool whether HTML/XML output should be formatted - */ - public function getFormatOutput() - { - return $this->_formatOutput; - } - - /** - * Sets prefix for IDs when they are normalized - * - * @param string $prefix Prefix for IDs - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self - */ - public function setPrefixForId($prefix) - { - if (is_string($prefix)) { - $this->_prefixForId = trim($prefix); - } - - return $this; - } - - /** - * Returns prefix for IDs when they are normalized - * - * @return string Prefix for - */ - public function getPrefixForId() - { - if (null === $this->_prefixForId) { - $prefix = get_class($this); - $this->_prefixForId = strtolower( - trim(substr($prefix, strrpos($prefix, '_')), '_') - ) . '-'; - } - - return $this->_prefixForId; - } - - /** - * Skip the current prefix for IDs when they are normalized - * - * @param bool $flag - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, returns self - */ - public function skipPrefixForId($flag = true) - { - $this->_skipPrefixForId = (bool) $flag; - return $this; - } - - /** - * Sets translator to use in helper - * - * Implements {@link Zend_View_Helper_Navigation_Helper::setTranslator()}. - * - * @param mixed $translator [optional] translator. - * Expects an object of - * type - * {@link Zend_Translate_Adapter} - * or {@link Zend_Translate}, - * or null. Default is - * null, which sets no - * translator. - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setTranslator($translator = null) - { - if (null == $translator || - $translator instanceof Zend_Translate_Adapter) { - $this->_translator = $translator; - } elseif ($translator instanceof Zend_Translate) { - $this->_translator = $translator->getAdapter(); - } - - return $this; - } - - /** - * Returns translator used in helper - * - * Implements {@link Zend_View_Helper_Navigation_Helper::getTranslator()}. - * - * @return Zend_Translate_Adapter|null translator or null - */ - public function getTranslator() - { - if (null === $this->_translator) { - require_once 'Zend/Registry.php'; - if (Zend_Registry::isRegistered('Zend_Translate')) { - $this->setTranslator(Zend_Registry::get('Zend_Translate')); - } - } - - return $this->_translator; - } - - /** - * Sets ACL to use when iterating pages - * - * Implements {@link Zend_View_Helper_Navigation_Helper::setAcl()}. - * - * @param Zend_Acl $acl [optional] ACL object. - * Default is null. - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setAcl(Zend_Acl $acl = null) - { - $this->_acl = $acl; - return $this; - } - - /** - * Returns ACL or null if it isn't set using {@link setAcl()} or - * {@link setDefaultAcl()} - * - * Implements {@link Zend_View_Helper_Navigation_Helper::getAcl()}. - * - * @return Zend_Acl|null ACL object or null - */ - public function getAcl() - { - if ($this->_acl === null && self::$_defaultAcl !== null) { - return self::$_defaultAcl; - } - - return $this->_acl; - } - - /** - * Sets ACL role(s) to use when iterating pages - * - * Implements {@link Zend_View_Helper_Navigation_Helper::setRole()}. - * - * @param mixed $role [optional] role to - * set. Expects a string, - * an instance of type - * {@link Zend_Acl_Role_Interface}, - * or null. Default is - * null, which will set - * no role. - * @throws Zend_View_Exception if $role is invalid - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setRole($role = null) - { - if (null === $role || is_string($role) || - $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', - gettype($role) - )); - $e->setView($this->view); - throw $e; - } - - return $this; - } - - /** - * Returns ACL role to use when iterating pages, or null if it isn't set - * using {@link setRole()} or {@link setDefaultRole()} - * - * Implements {@link Zend_View_Helper_Navigation_Helper::getRole()}. - * - * @return string|Zend_Acl_Role_Interface|null role or null - */ - public function getRole() - { - if ($this->_role === null && self::$_defaultRole !== null) { - return self::$_defaultRole; - } - - return $this->_role; - } - - /** - * Sets whether ACL should be used - * - * Implements {@link Zend_View_Helper_Navigation_Helper::setUseAcl()}. - * - * @param bool $useAcl [optional] whether ACL - * should be used. - * Default is true. - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setUseAcl($useAcl = true) - { - $this->_useAcl = (bool) $useAcl; - return $this; - } - - /** - * Returns whether ACL should be used - * - * Implements {@link Zend_View_Helper_Navigation_Helper::getUseAcl()}. - * - * @return bool whether ACL should be used - */ - public function getUseAcl() - { - return $this->_useAcl; - } - - /** - * Return renderInvisible flag - * - * @return bool - */ - public function getRenderInvisible() - { - return $this->_renderInvisible; - } - - /** - * Render invisible items? - * - * @param bool $renderInvisible [optional] boolean flag - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface - * returns self - */ - public function setRenderInvisible($renderInvisible = true) - { - $this->_renderInvisible = (bool) $renderInvisible; - return $this; - } - - /** - * Sets whether translator should be used - * - * Implements {@link Zend_View_Helper_Navigation_Helper::setUseTranslator()}. - * - * @param bool $useTranslator [optional] whether - * translator should be - * used. Default is true. - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setUseTranslator($useTranslator = true) - { - $this->_useTranslator = (bool) $useTranslator; - return $this; - } - - /** - * Returns whether translator should be used - * - * Implements {@link Zend_View_Helper_Navigation_Helper::getUseTranslator()}. - * - * @return bool whether translator should be used - */ - public function getUseTranslator() - { - return $this->_useTranslator; - } - - // Magic overloads: - - /** - * Magic overload: Proxy calls to the navigation container - * - * @param string $method method name in container - * @param array $arguments [optional] arguments to pass - * @return mixed returns what the container returns - * @throws Zend_Navigation_Exception if method does not exist in container - */ - public function __call($method, array $arguments = array()) - { - return call_user_func_array( - array($this->getContainer(), $method), - $arguments); - } - - /** - * Magic overload: Proxy to {@link render()}. - * - * This method will trigger an E_USER_ERROR if rendering the helper causes - * an exception to be thrown. - * - * Implements {@link Zend_View_Helper_Navigation_Helper::__toString()}. - * - * @return string - */ - public function __toString() - { - try { - return $this->render(); - } catch (Exception $e) { - $msg = get_class($e) . ': ' . $e->getMessage(); - trigger_error($msg, E_USER_ERROR); - return ''; - } - } - - // Public methods: - - /** - * Finds the deepest active page in the given container - * - * @param Zend_Navigation_Container $container container to search - * @param int|null $minDepth [optional] minimum depth - * required for page to be - * valid. Default is to use - * {@link getMinDepth()}. A - * null value means no minimum - * depth required. - * @param int|null $minDepth [optional] maximum depth - * a page can have to be - * valid. Default is to use - * {@link getMaxDepth()}. A - * null value means no maximum - * depth required. - * @return array an associative array with - * the values 'depth' and - * 'page', or an empty array - * if not found - */ - public function findActive(Zend_Navigation_Container $container, - $minDepth = null, - $maxDepth = -1) - { - if (!is_int($minDepth)) { - $minDepth = $this->getMinDepth(); - } - if ((!is_int($maxDepth) || $maxDepth < 0) && null !== $maxDepth) { - $maxDepth = $this->getMaxDepth(); - } - - $found = null; - $foundDepth = -1; - $iterator = new RecursiveIteratorIterator($container, - RecursiveIteratorIterator::CHILD_FIRST); - - foreach ($iterator as $page) { - $currDepth = $iterator->getDepth(); - if ($currDepth < $minDepth || !$this->accept($page)) { - // page is not accepted - continue; - } - - if ($page->isActive(false) && $currDepth > $foundDepth) { - // found an active page at a deeper level than before - $found = $page; - $foundDepth = $currDepth; - } - } - - if (is_int($maxDepth) && $foundDepth > $maxDepth) { - while ($foundDepth > $maxDepth) { - if (--$foundDepth < $minDepth) { - $found = null; - break; - } - - $found = $found->getParent(); - if (!$found instanceof Zend_Navigation_Page) { - $found = null; - break; - } - } - } - - if ($found) { - return array('page' => $found, 'depth' => $foundDepth); - } else { - return array(); - } - } - - /** - * Checks if the helper has a container - * - * Implements {@link Zend_View_Helper_Navigation_Helper::hasContainer()}. - * - * @return bool whether the helper has a container or not - */ - public function hasContainer() - { - return null !== $this->_container; - } - - /** - * Checks if the helper has an ACL instance - * - * Implements {@link Zend_View_Helper_Navigation_Helper::hasAcl()}. - * - * @return bool whether the helper has a an ACL instance or not - */ - public function hasAcl() - { - return null !== $this->_acl; - } - - /** - * Checks if the helper has an ACL role - * - * Implements {@link Zend_View_Helper_Navigation_Helper::hasRole()}. - * - * @return bool whether the helper has a an ACL role or not - */ - public function hasRole() - { - return null !== $this->_role; - } - - /** - * Checks if the helper has a translator - * - * Implements {@link Zend_View_Helper_Navigation_Helper::hasTranslator()}. - * - * @return bool whether the helper has a translator or not - */ - public function hasTranslator() - { - return null !== $this->_translator; - } - - /** - * Returns an HTML string containing an 'a' element for the given page - * - * @param Zend_Navigation_Page $page page to generate HTML for - * @return string HTML string for the given page - */ - public function htmlify(Zend_Navigation_Page $page) - { - // get label and title for translating - $label = $page->getLabel(); - $title = $page->getTitle(); - - if ($this->getUseTranslator() && $t = $this->getTranslator()) { - if (is_string($label) && !empty($label)) { - $label = $t->translate($label); - } - if (is_string($title) && !empty($title)) { - $title = $t->translate($title); - } - } - - // get attribs for anchor element - $attribs = array_merge( - array( - 'id' => $page->getId(), - 'title' => $title, - 'class' => $page->getClass(), - 'href' => $page->getHref(), - 'target' => $page->getTarget() - ), - $page->getCustomHtmlAttribs() - ); - - return '_htmlAttribs($attribs) . '>' - . $this->view->escape($label) - . ''; - } - - // Iterator filter methods: - - /** - * Determines whether a page should be accepted when iterating - * - * Rules: - * - If a page is not visible it is not accepted, unless RenderInvisible has - * been set to true. - * - If helper has no ACL, page is accepted - * - If helper has ACL, but no role, page is not accepted - * - If helper has ACL and role: - * - Page is accepted if it has no resource or privilege - * - Page is accepted if ACL allows page's resource or privilege - * - If page is accepted by the rules above and $recursive is true, the page - * will not be accepted if it is the descendant of a non-accepted page. - * - * @param Zend_Navigation_Page $page page to check - * @param bool $recursive [optional] if true, page will not - * be accepted if it is the - * descendant of a page that is not - * accepted. Default is true. - * @return bool whether page should be accepted - */ - public function accept(Zend_Navigation_Page $page, $recursive = true) - { - // accept by default - $accept = true; - - if (!$page->isVisible(false) && !$this->getRenderInvisible()) { - // don't accept invisible pages - $accept = false; - } elseif ($this->getUseAcl() && !$this->_acceptAcl($page)) { - // acl is not amused - $accept = false; - } - - if ($accept && $recursive) { - $parent = $page->getParent(); - if ($parent instanceof Zend_Navigation_Page) { - $accept = $this->accept($parent, true); - } - } - - return $accept; - } - - /** - * Determines whether a page should be accepted by ACL when iterating - * - * Rules: - * - If helper has no ACL, page is accepted - * - If page has a resource or privilege defined, page is accepted - * if the ACL allows access to it using the helper's role - * - If page has no resource or privilege, page is accepted - * - * @param Zend_Navigation_Page $page page to check - * @return bool whether page is accepted by ACL - */ - protected function _acceptAcl(Zend_Navigation_Page $page) - { - if (!$acl = $this->getAcl()) { - // no acl registered means don't use acl - return true; - } - - $role = $this->getRole(); - $resource = $page->getResource(); - $privilege = $page->getPrivilege(); - - if ($resource || $privilege) { - // determine using helper role and page resource/privilege - return $acl->isAllowed($role, $resource, $privilege); - } - - return true; - } - - // Util methods: - - /** - * Retrieve whitespace representation of $indent - * - * @param int|string $indent - * @return string - */ - protected function _getWhitespace($indent) - { - if (is_int($indent)) { - $indent = str_repeat(' ', $indent); - } - - return (string) $indent; - } - - /** - * Converts an associative array to a string of tag attributes. - * - * Overloads {@link Zend_View_Helper_HtmlElement::_htmlAttribs()}. - * - * @param array $attribs an array where each key-value pair is converted - * to an attribute name and value - * @return string an attribute string - */ - protected function _htmlAttribs($attribs) - { - // filter out null values and empty string values - foreach ($attribs as $key => $value) { - if ($value === null || (is_string($value) && !strlen($value))) { - unset($attribs[$key]); - } - } - - return parent::_htmlAttribs($attribs); - } - - /** - * Normalize an ID - * - * Extends {@link Zend_View_Helper_HtmlElement::_normalizeId()}. - * - * @param string $value ID - * @return string Normalized ID - */ - protected function _normalizeId($value) - { - if (false === $this->_skipPrefixForId) { - $prefix = $this->getPrefixForId(); - - if (strlen($prefix)) { - return $prefix . $value; - } - } - - return parent::_normalizeId($value); - } - - // Static methods: - - /** - * Sets default ACL to use if another ACL is not explicitly set - * - * @param Zend_Acl $acl [optional] ACL object. Default is null, which - * sets no ACL object. - * @return void - */ - public static function setDefaultAcl(Zend_Acl $acl = null) - { - self::$_defaultAcl = $acl; - } - - /** - * Sets default ACL role(s) to use when iterating pages if not explicitly - * set later with {@link setRole()} - * - * @param mixed $role [optional] role to set. Expects null, - * string, or an instance of - * {@link Zend_Acl_Role_Interface}. - * Default is null, which sets no default - * role. - * @throws Zend_View_Exception if role is invalid - * @return void - */ - public static function setDefaultRole($role = null) - { - if (null === $role || - is_string($role) || - $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/vendor/Zend/View/Helper/Navigation/Links.php b/library/vendor/Zend/View/Helper/Navigation/Links.php deleted file mode 100644 index 5d05c1008..000000000 --- a/library/vendor/Zend/View/Helper/Navigation/Links.php +++ /dev/null @@ -1,783 +0,0 @@ - elements - * - * @category Zend - * @package Zend_View - * @subpackage Helper - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_View_Helper_Navigation_Links - extends Zend_View_Helper_Navigation_HelperAbstract -{ - /**#@+ - * Constants used for specifying which link types to find and render - * - * @var int - */ - const RENDER_ALTERNATE = 0x0001; - const RENDER_STYLESHEET = 0x0002; - const RENDER_START = 0x0004; - const RENDER_NEXT = 0x0008; - const RENDER_PREV = 0x0010; - const RENDER_CONTENTS = 0x0020; - const RENDER_INDEX = 0x0040; - const RENDER_GLOSSARY = 0x0080; - const RENDER_COPYRIGHT = 0x0100; - const RENDER_CHAPTER = 0x0200; - const RENDER_SECTION = 0x0400; - const RENDER_SUBSECTION = 0x0800; - const RENDER_APPENDIX = 0x1000; - const RENDER_HELP = 0x2000; - const RENDER_BOOKMARK = 0x4000; - const RENDER_CUSTOM = 0x8000; - const RENDER_ALL = 0xffff; - /**#@+**/ - - /** - * Maps render constants to W3C link types - * - * @var array - */ - protected static $_RELATIONS = array( - self::RENDER_ALTERNATE => 'alternate', - self::RENDER_STYLESHEET => 'stylesheet', - self::RENDER_START => 'start', - self::RENDER_NEXT => 'next', - self::RENDER_PREV => 'prev', - self::RENDER_CONTENTS => 'contents', - self::RENDER_INDEX => 'index', - self::RENDER_GLOSSARY => 'glossary', - self::RENDER_COPYRIGHT => 'copyright', - self::RENDER_CHAPTER => 'chapter', - self::RENDER_SECTION => 'section', - self::RENDER_SUBSECTION => 'subsection', - self::RENDER_APPENDIX => 'appendix', - self::RENDER_HELP => 'help', - self::RENDER_BOOKMARK => 'bookmark' - ); - - /** - * The helper's render flag - * - * @see render() - * @see setRenderFlag() - * @var int - */ - protected $_renderFlag = self::RENDER_ALL; - - /** - * Root container - * - * Used for preventing methods to traverse above the container given to - * the {@link render()} method. - * - * @see _findRoot() - * - * @var Zend_Navigation_Container - */ - protected $_root; - - /** - * View helper entry point: - * Retrieves helper and optionally sets container to operate on - * - * @param Zend_Navigation_Container $container [optional] container to - * operate on - * @return Zend_View_Helper_Navigation_Links fluent interface, returns - * self - */ - public function links(Zend_Navigation_Container $container = null) - { - if (null !== $container) { - $this->setContainer($container); - } - - return $this; - } - - /** - * Magic overload: Proxy calls to {@link findRelation()} or container - * - * Examples of finder calls: - * - * // METHOD // SAME AS - * $h->findRelNext($page); // $h->findRelation($page, 'rel', 'next') - * $h->findRevSection($page); // $h->findRelation($page, 'rev', 'section'); - * $h->findRelFoo($page); // $h->findRelation($page, 'rel', 'foo'); - * - * - * @param string $method method name - * @param array $arguments method arguments - * @throws Zend_Navigation_Exception if method does not exist in container - */ - public function __call($method, array $arguments = array()) - { - if (@preg_match('/find(Rel|Rev)(.+)/', $method, $match)) { - return $this->findRelation($arguments[0], - strtolower($match[1]), - strtolower($match[2])); - } - - return parent::__call($method, $arguments); - } - - // Accessors: - - /** - * Sets the helper's render flag - * - * The helper uses the bitwise '&' operator against the hex values of the - * render constants. This means that the flag can is "bitwised" value of - * the render constants. Examples: - * - * // render all links except glossary - * $flag = Zend_View_Helper_Navigation_Links:RENDER_ALL ^ - * Zend_View_Helper_Navigation_Links:RENDER_GLOSSARY; - * $helper->setRenderFlag($flag); - * - * // render only chapters and sections - * $flag = Zend_View_Helper_Navigation_Links:RENDER_CHAPTER | - * Zend_View_Helper_Navigation_Links:RENDER_SECTION; - * $helper->setRenderFlag($flag); - * - * // render only relations that are not native W3C relations - * $helper->setRenderFlag(Zend_View_Helper_Navigation_Links:RENDER_CUSTOM); - * - * // render all relations (default) - * $helper->setRenderFlag(Zend_View_Helper_Navigation_Links:RENDER_ALL); - * - * - * Note that custom relations can also be rendered directly using the - * {@link renderLink()} method. - * - * @param int $renderFlag render flag - * @return Zend_View_Helper_Navigation_Links fluent interface, returns self - */ - public function setRenderFlag($renderFlag) - { - $this->_renderFlag = (int) $renderFlag; - return $this; - } - - /** - * Returns the helper's render flag - * - * @return int render flag - */ - public function getRenderFlag() - { - return $this->_renderFlag; - } - - // Finder methods: - - /** - * Finds all relations (forward and reverse) for the given $page - * - * The form of the returned array: - * - * // $page denotes an instance of Zend_Navigation_Page - * $returned = array( - * 'rel' => array( - * 'alternate' => array($page, $page, $page), - * 'start' => array($page), - * 'next' => array($page), - * 'prev' => array($page), - * 'canonical' => array($page) - * ), - * 'rev' => array( - * 'section' => array($page) - * ) - * ); - * - * - * @param Zend_Navigation_Page $page page to find links for - * @return array related pages - */ - public function findAllRelations(Zend_Navigation_Page $page, - $flag = null) - { - if (!is_int($flag)) { - $flag = self::RENDER_ALL; - } - - $result = array('rel' => array(), 'rev' => array()); - $native = array_values(self::$_RELATIONS); - - foreach (array_keys($result) as $rel) { - $meth = 'getDefined' . ucfirst($rel); - $types = array_merge($native, array_diff($page->$meth(), $native)); - - foreach ($types as $type) { - if (!$relFlag = array_search($type, self::$_RELATIONS)) { - $relFlag = self::RENDER_CUSTOM; - } - if (!($flag & $relFlag)) { - continue; - } - if ($found = $this->findRelation($page, $rel, $type)) { - if (!is_array($found)) { - $found = array($found); - } - $result[$rel][$type] = $found; - } - } - } - - return $result; - } - - /** - * Finds relations of the given $rel=$type from $page - * - * This method will first look for relations in the page instance, then - * by searching the root container if nothing was found in the page. - * - * @param Zend_Navigation_Page $page page to find relations for - * @param string $rel relation, "rel" or "rev" - * @param string $type link type, e.g. 'start', 'next' - * @return Zend_Navigaiton_Page|array|null page(s), or null if not found - * @throws Zend_View_Exception if $rel is not "rel" or "rev" - */ - public function findRelation(Zend_Navigation_Page $page, $rel, $type) - { - if (!in_array($rel, array('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)); - $e->setView($this->view); - throw $e; - } - - if (!$result = $this->_findFromProperty($page, $rel, $type)) { - $result = $this->_findFromSearch($page, $rel, $type); - } - - return $result; - } - - /** - * Finds relations of given $type for $page by checking if the - * relation is specified as a property of $page - * - * @param Zend_Navigation_Page $page page to find relations for - * @param string $rel relation, 'rel' or 'rev' - * @param string $type link type, e.g. 'start', 'next' - * @return Zend_Navigation_Page|array|null page(s), or null if not found - */ - protected function _findFromProperty(Zend_Navigation_Page $page, $rel, $type) - { - $method = 'get' . ucfirst($rel); - if ($result = $page->$method($type)) { - if ($result = $this->_convertToPages($result)) { - if (!is_array($result)) { - $result = array($result); - } - - foreach ($result as $key => $page) { - if (!$this->accept($page)) { - unset($result[$key]); - } - } - - return count($result) == 1 ? $result[0] : $result; - } - } - - return null; - } - - /** - * Finds relations of given $rel=$type for $page by using the helper to - * search for the relation in the root container - * - * @param Zend_Navigation_Page $page page to find relations for - * @param string $rel relation, 'rel' or 'rev' - * @param string $type link type, e.g. 'start', 'next', etc - * @return array|null array of pages, or null if not found - */ - protected function _findFromSearch(Zend_Navigation_Page $page, $rel, $type) - { - $found = null; - - $method = 'search' . ucfirst($rel) . ucfirst($type); - if (method_exists($this, $method)) { - $found = $this->$method($page); - } - - return $found; - } - - // Search methods: - - /** - * Searches the root container for the forward 'start' relation of the given - * $page - * - * From {@link http://www.w3.org/TR/html4/types.html#type-links}: - * Refers to the first document in a collection of documents. This link type - * tells search engines which document is considered by the author to be the - * starting point of the collection. - * - * @param Zend_Navigation_Page $page page to find relation for - * @return Zend_Navigation_Page|null page or null - */ - public function searchRelStart(Zend_Navigation_Page $page) - { - $found = $this->_findRoot($page); - if (!$found instanceof Zend_Navigation_Page) { - $found->rewind(); - $found = $found->current(); - } - - if ($found === $page || !$this->accept($found)) { - $found = null; - } - - return $found; - } - - /** - * Searches the root container for the forward 'next' relation of the given - * $page - * - * From {@link http://www.w3.org/TR/html4/types.html#type-links}: - * Refers to the next document in a linear sequence of documents. User - * agents may choose to preload the "next" document, to reduce the perceived - * load time. - * - * @param Zend_Navigation_Page $page page to find relation for - * @return Zend_Navigation_Page|null page(s) or null - */ - public function searchRelNext(Zend_Navigation_Page $page) - { - $found = null; - $break = false; - $iterator = new RecursiveIteratorIterator($this->_findRoot($page), - RecursiveIteratorIterator::SELF_FIRST); - foreach ($iterator as $intermediate) { - if ($intermediate === $page) { - // current page; break at next accepted page - $break = true; - continue; - } - - if ($break && $this->accept($intermediate)) { - $found = $intermediate; - break; - } - } - - return $found; - } - - /** - * Searches the root container for the forward 'prev' relation of the given - * $page - * - * From {@link http://www.w3.org/TR/html4/types.html#type-links}: - * Refers to the previous document in an ordered series of documents. Some - * user agents also support the synonym "Previous". - * - * @param Zend_Navigation_Page $page page to find relation for - * @return Zend_Navigation_Page|null page or null - */ - public function searchRelPrev(Zend_Navigation_Page $page) - { - $found = null; - $prev = null; - $iterator = new RecursiveIteratorIterator( - $this->_findRoot($page), - RecursiveIteratorIterator::SELF_FIRST); - foreach ($iterator as $intermediate) { - if (!$this->accept($intermediate)) { - continue; - } - if ($intermediate === $page) { - $found = $prev; - break; - } - - $prev = $intermediate; - } - - return $found; - } - - /** - * Searches the root container for forward 'chapter' relations of the given - * $page - * - * From {@link http://www.w3.org/TR/html4/types.html#type-links}: - * Refers to a document serving as a chapter in a collection of documents. - * - * @param Zend_Navigation_Page $page page to find relation for - * @return Zend_Navigation_Page|array|null page(s) or null - */ - public function searchRelChapter(Zend_Navigation_Page $page) - { - $found = array(); - - // find first level of pages - $root = $this->_findRoot($page); - - // find start page(s) - $start = $this->findRelation($page, 'rel', 'start'); - if (!is_array($start)) { - $start = array($start); - } - - foreach ($root as $chapter) { - // exclude self and start page from chapters - if ($chapter !== $page && - !in_array($chapter, $start) && - $this->accept($chapter)) { - $found[] = $chapter; - } - } - - switch (count($found)) { - case 0: - return null; - case 1: - return $found[0]; - default: - return $found; - } - } - - /** - * Searches the root container for forward 'section' relations of the given - * $page - * - * From {@link http://www.w3.org/TR/html4/types.html#type-links}: - * Refers to a document serving as a section in a collection of documents. - * - * @param Zend_Navigation_Page $page page to find relation for - * @return Zend_Navigation_Page|array|null page(s) or null - */ - public function searchRelSection(Zend_Navigation_Page $page) - { - $found = array(); - - // check if given page has pages and is a chapter page - if ($page->hasPages() && $this->_findRoot($page)->hasPage($page)) { - foreach ($page as $section) { - if ($this->accept($section)) { - $found[] = $section; - } - } - } - - switch (count($found)) { - case 0: - return null; - case 1: - return $found[0]; - default: - return $found; - } - } - - /** - * Searches the root container for forward 'subsection' relations of the - * given $page - * - * From {@link http://www.w3.org/TR/html4/types.html#type-links}: - * Refers to a document serving as a subsection in a collection of - * documents. - * - * @param Zend_Navigation_Page $page page to find relation for - * @return Zend_Navigation_Page|array|null page(s) or null - */ - public function searchRelSubsection(Zend_Navigation_Page $page) - { - $found = array(); - - if ($page->hasPages()) { - // given page has child pages, loop chapters - foreach ($this->_findRoot($page) as $chapter) { - // is page a section? - if ($chapter->hasPage($page)) { - foreach ($page as $subsection) { - if ($this->accept($subsection)) { - $found[] = $subsection; - } - } - } - } - } - - switch (count($found)) { - case 0: - return null; - case 1: - return $found[0]; - default: - return $found; - } - } - - /** - * Searches the root container for the reverse 'section' relation of the - * given $page - * - * From {@link http://www.w3.org/TR/html4/types.html#type-links}: - * Refers to a document serving as a section in a collection of documents. - * - * @param Zend_Navigation_Page $page page to find relation for - * @return Zend_Navigation_Page|null page(s) or null - */ - public function searchRevSection(Zend_Navigation_Page $page) - { - $found = null; - - if ($parent = $page->getParent()) { - if ($parent instanceof Zend_Navigation_Page && - $this->_findRoot($page)->hasPage($parent)) { - $found = $parent; - } - } - - return $found; - } - - /** - * Searches the root container for the reverse 'section' relation of the - * given $page - * - * From {@link http://www.w3.org/TR/html4/types.html#type-links}: - * Refers to a document serving as a subsection in a collection of - * documents. - * - * @param Zend_Navigation_Page $page page to find relation for - * @return Zend_Navigation_Page|null page(s) or null - */ - public function searchRevSubsection(Zend_Navigation_Page $page) - { - $found = null; - - if ($parent = $page->getParent()) { - if ($parent instanceof Zend_Navigation_Page) { - $root = $this->_findRoot($page); - foreach ($root as $chapter) { - if ($chapter->hasPage($parent)) { - $found = $parent; - break; - } - } - } - } - - return $found; - } - - // Util methods: - - /** - * Returns the root container of the given page - * - * When rendering a container, the render method still store the given - * container as the root container, and unset it when done rendering. This - * makes sure finder methods will not traverse above the container given - * to the render method. - * - * @param Zend_Navigaiton_Page $page page to find root for - * @return Zend_Navigation_Container the root container of the given page - */ - protected function _findRoot(Zend_Navigation_Page $page) - { - if ($this->_root) { - return $this->_root; - } - - $root = $page; - - while ($parent = $page->getParent()) { - $root = $parent; - if ($parent instanceof Zend_Navigation_Page) { - $page = $parent; - } else { - break; - } - } - - return $root; - } - - /** - * Converts a $mixed value to an array of pages - * - * @param mixed $mixed mixed value to get page(s) from - * @param bool $recursive whether $value should be looped - * if it is an array or a config - * @return Zend_Navigation_Page|array|null empty if unable to convert - */ - protected function _convertToPages($mixed, $recursive = true) - { - if (is_object($mixed)) { - if ($mixed instanceof Zend_Navigation_Page) { - // value is a page instance; return directly - return $mixed; - } elseif ($mixed instanceof Zend_Navigation_Container) { - // value is a container; return pages in it - $pages = array(); - foreach ($mixed as $page) { - $pages[] = $page; - } - return $pages; - } elseif ($mixed instanceof Zend_Config) { - // convert config object to array and extract - return $this->_convertToPages($mixed->toArray(), $recursive); - } - } elseif (is_string($mixed)) { - // value is a string; make an URI page - return Zend_Navigation_Page::factory(array( - 'type' => 'uri', - 'uri' => $mixed - )); - } elseif (is_array($mixed) && !empty($mixed)) { - if ($recursive && is_numeric(key($mixed))) { - // first key is numeric; assume several pages - $pages = array(); - foreach ($mixed as $value) { - if ($value = $this->_convertToPages($value, false)) { - $pages[] = $value; - } - } - return $pages; - } else { - // pass array to factory directly - try { - $page = Zend_Navigation_Page::factory($mixed); - return $page; - } catch (Exception $e) { - } - } - } - - // nothing found - return null; - } - - // Render methods: - - /** - * Renders the given $page as a link element, with $attrib = $relation - * - * @param Zend_Navigation_Page $page the page to render the link for - * @param string $attrib the attribute to use for $type, - * either 'rel' or 'rev' - * @param string $relation relation type, muse be one of; - * alternate, appendix, bookmark, - * chapter, contents, copyright, - * glossary, help, home, index, next, - * prev, section, start, stylesheet, - * subsection - * @return string rendered link element - * @throws Zend_View_Exception if $attrib is invalid - */ - public function renderLink(Zend_Navigation_Page $page, $attrib, $relation) - { - if (!in_array($attrib, array('rel', 'rev'))) { - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception(sprintf( - 'Invalid relation attribute "%s", must be "rel" or "rev"', - $attrib)); - $e->setView($this->view); - throw $e; - } - - if (!$href = $page->getHref()) { - return ''; - } - - // TODO: add more attribs - // http://www.w3.org/TR/html401/struct/links.html#h-12.2 - $attribs = array( - $attrib => $relation, - 'href' => $href, - 'title' => $page->getLabel() - ); - - return '_htmlAttribs($attribs) . - $this->getClosingBracket(); - } - - // Zend_View_Helper_Navigation_Helper: - - /** - * Renders helper - * - * Implements {@link Zend_View_Helper_Navigation_Helper::render()}. - * - * @param Zend_Navigation_Container $container [optional] container to - * render. Default is to - * render the container - * registered in the helper. - * @return string helper output - */ - public function render(Zend_Navigation_Container $container = null) - { - if (null === $container) { - $container = $this->getContainer(); - } - - if ($active = $this->findActive($container)) { - $active = $active['page']; - } else { - // no active page - return ''; - } - - $output = ''; - $indent = $this->getIndent(); - $this->_root = $container; - - $result = $this->findAllRelations($active, $this->getRenderFlag()); - foreach ($result as $attrib => $types) { - foreach ($types as $relation => $pages) { - foreach ($pages as $page) { - if ($r = $this->renderLink($page, $attrib, $relation)) { - $output .= $indent . $r . $this->getEOL(); - } - } - } - } - - $this->_root = null; - - // return output (trim last newline by spec) - return strlen($output) ? rtrim($output, self::EOL) : ''; - } -} diff --git a/library/vendor/Zend/View/Helper/Navigation/Menu.php b/library/vendor/Zend/View/Helper/Navigation/Menu.php deleted file mode 100644 index da3faee84..000000000 --- a/library/vendor/Zend/View/Helper/Navigation/Menu.php +++ /dev/null @@ -1,1099 +0,0 @@ -setContainer($container); - } - - return $this; - } - - // Accessors: - - /** - * Sets CSS class to use for the first 'ul' element when rendering - * - * @param string $ulClass CSS class to set - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setUlClass($ulClass) - { - if (is_string($ulClass)) { - $this->_ulClass = $ulClass; - } - - return $this; - } - - /** - * Returns CSS class to use for the first 'ul' element when rendering - * - * @return string CSS class - */ - public function getUlClass() - { - return $this->_ulClass; - } - - /** - * Sets unique identifier (id) to use for the first 'ul' element when - * rendering - * - * @param string|null $ulId Unique identifier (id) to set - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setUlId($ulId) - { - if (is_string($ulId)) { - $this->_ulId = $ulId; - } - - return $this; - } - - /** - * Returns unique identifier (id) to use for the first 'ul' element when - * rendering - * - * @return string|null Unique identifier (id); Default is 'null' - */ - public function getUlId() - { - return $this->_ulId; - } - - /** - * Sets CSS class to use for the active elements when rendering - * - * @param string $activeClass CSS class to set - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setActiveClass($activeClass) - { - if (is_string($activeClass)) { - $this->_activeClass = $activeClass; - } - - return $this; - } - - /** - * Returns CSS class to use for the active elements when rendering - * - * @return string CSS class - */ - public function getActiveClass() - { - return $this->_activeClass; - } - - /** - * Sets CSS class to use for the parent li elements when rendering - * - * @param string $parentClass CSS class to set to parents - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setParentClass($parentClass) - { - if (is_string($parentClass)) { - $this->_parentClass = $parentClass; - } - - return $this; - } - - /** - * Returns CSS class to use for the parent lie elements when rendering - * - * @return string CSS class - */ - public function getParentClass() - { - return $this->_parentClass; - } - - /** - * Enables/disables rendering of parent class to the li element - * - * @param bool $flag [optional] render with parent - * class. Default is true. - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setRenderParentClass($flag = true) - { - $this->_renderParentClass = (bool) $flag; - return $this; - } - - /** - * Returns flag indicating whether parent class should be rendered to the li - * element - * - * @return bool whether parent class should be rendered - */ - public function getRenderParentClass() - { - return $this->_renderParentClass; - } - - /** - * Sets a flag indicating whether only active branch should be rendered - * - * @param bool $flag [optional] render only active - * branch. Default is true. - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setOnlyActiveBranch($flag = true) - { - $this->_onlyActiveBranch = (bool) $flag; - return $this; - } - - /** - * Returns a flag indicating whether only active branch should be rendered - * - * By default, this value is false, meaning the entire menu will be - * be rendered. - * - * @return bool whether only active branch should be rendered - */ - public function getOnlyActiveBranch() - { - return $this->_onlyActiveBranch; - } - - /** - * Sets a flag indicating whether to expand all sibling nodes of the active branch - * - * @param bool $flag [optional] expand all siblings of - * nodes in the active branch. Default is true. - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setExpandSiblingNodesOfActiveBranch($flag = true) - { - $this->_expandSiblingNodesOfActiveBranch = (bool) $flag; - return $this; - } - - /** - * Returns a flag indicating whether to expand all sibling nodes of the active branch - * - * By default, this value is false, meaning the entire menu will be - * be rendered. - * - * @return bool whether siblings of nodes in the active branch should be expanded - */ - public function getExpandSiblingNodesOfActiveBranch() - { - return $this->_expandSiblingNodesOfActiveBranch; - } - - /** - * Enables/disables rendering of parents when only rendering active branch - * - * See {@link setOnlyActiveBranch()} for more information. - * - * @param bool $flag [optional] render parents when - * rendering active branch. - * Default is true. - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setRenderParents($flag = true) - { - $this->_renderParents = (bool) $flag; - return $this; - } - - /** - * Returns flag indicating whether parents should be rendered when rendering - * only the active branch - * - * By default, this value is true. - * - * @return bool whether parents should be rendered - */ - public function getRenderParents() - { - return $this->_renderParents; - } - - /** - * Sets which partial view script to use for rendering menu - * - * @param string|array $partial partial view script or null. If - * an array is given, it is - * expected to contain two values; - * the partial view script to use, - * and the module where the script - * can be found. - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function setPartial($partial) - { - if (null === $partial || is_string($partial) || is_array($partial)) { - $this->_partial = $partial; - } - - return $this; - } - - /** - * Returns partial view script to use for rendering menu - * - * @return string|array|null - */ - public function getPartial() - { - return $this->_partial; - } - - /** - * Adds CSS class from page to li element - * - * Before: - * - *
  • - * Bar - *
  • - *
    - * - * After: - * - *
  • - * Bar - *
  • - *
    - * - * @param bool $flag [optional] adds CSS class from - * page to li element - * - * @return Zend_View_Helper_Navigation_Menu fluent interface, returns self - */ - public function addPageClassToLi($flag = true) - { - $this->_addPageClassToLi = (bool) $flag; - - return $this; - } - - /** - * Returns a flag indicating whether the CSS class from page to be added to - * li element - * - * @return bool - */ - public function getAddPageClassToLi() - { - return $this->_addPageClassToLi; - } - - /** - * Set the inner indentation string for using in {@link render()}, optionally - * a number of spaces to indent with - * - * @param string|int $indent indentation string or - * number of spaces - * @return Zend_View_Helper_Navigation_HelperAbstract fluent interface, - * returns self - */ - public function setInnerIndent($indent) - { - $this->_innerIndent = $this->_getWhitespace($indent); - - return $this; - } - - /** - * Returns inner indentation (format output is respected) - * - * @see getFormatOutput() - * - * @return string indentation string or an empty string - */ - public function getInnerIndent() - { - if (false === $this->getFormatOutput()) { - return ''; - } - - return $this->_innerIndent; - } - - // Public methods: - - /** - * Returns an HTML string containing an 'a' element for the given page if - * the page's href is not empty, and a 'span' element if it is empty - * - * Overrides {@link Zend_View_Helper_Navigation_Abstract::htmlify()}. - * - * @param Zend_Navigation_Page $page page to generate HTML for - * @return string HTML string for the given page - */ - public function htmlify(Zend_Navigation_Page $page) - { - // get label and title for translating - $label = $page->getLabel(); - $title = $page->getTitle(); - - // translate label and title? - if ($this->getUseTranslator() && $t = $this->getTranslator()) { - if (is_string($label) && !empty($label)) { - $label = $t->translate($label); - } - if (is_string($title) && !empty($title)) { - $title = $t->translate($title); - } - } - - // get attribs for element - $attribs = array( - 'id' => $page->getId(), - 'title' => $title, - ); - - if (false === $this->getAddPageClassToLi()) { - $attribs['class'] = $page->getClass(); - } - - // does page have a href? - if ($href = $page->getHref()) { - $element = 'a'; - $attribs['href'] = $href; - $attribs['target'] = $page->getTarget(); - $attribs['accesskey'] = $page->getAccessKey(); - } else { - $element = 'span'; - } - - // Add custom HTML attributes - $attribs = array_merge($attribs, $page->getCustomHtmlAttribs()); - - return '<' . $element . $this->_htmlAttribs($attribs) . '>' - . $this->view->escape($label) - . ''; - } - - /** - * Normalizes given render options - * - * @param array $options [optional] options to normalize - * @return array normalized options - */ - protected function _normalizeOptions(array $options = array()) - { - // Ident - if (isset($options['indent'])) { - $options['indent'] = $this->_getWhitespace($options['indent']); - } else { - $options['indent'] = $this->getIndent(); - } - - // Inner ident - if (isset($options['innerIndent'])) { - $options['innerIndent'] = - $this->_getWhitespace($options['innerIndent']); - } else { - $options['innerIndent'] = $this->getInnerIndent(); - } - - // UL class - if (isset($options['ulClass']) && $options['ulClass'] !== null) { - $options['ulClass'] = (string) $options['ulClass']; - } else { - $options['ulClass'] = $this->getUlClass(); - } - - // UL id - if (isset($options['ulId']) && $options['ulId'] !== null) { - $options['ulId'] = (string) $options['ulId']; - } else { - $options['ulId'] = $this->getUlId(); - } - - // Active class - if (isset($options['activeClass']) && $options['activeClass'] !== null - ) { - $options['activeClass'] = (string) $options['activeClass']; - } else { - $options['activeClass'] = $this->getActiveClass(); - } - - // Parent class - if (isset($options['parentClass']) && $options['parentClass'] !== null) { - $options['parentClass'] = (string) $options['parentClass']; - } else { - $options['parentClass'] = $this->getParentClass(); - } - - // Minimum depth - if (array_key_exists('minDepth', $options)) { - if (null !== $options['minDepth']) { - $options['minDepth'] = (int) $options['minDepth']; - } - } else { - $options['minDepth'] = $this->getMinDepth(); - } - - if ($options['minDepth'] < 0 || $options['minDepth'] === null) { - $options['minDepth'] = 0; - } - - // Maximum depth - if (array_key_exists('maxDepth', $options)) { - if (null !== $options['maxDepth']) { - $options['maxDepth'] = (int) $options['maxDepth']; - } - } else { - $options['maxDepth'] = $this->getMaxDepth(); - } - - // Only active branch - if (!isset($options['onlyActiveBranch'])) { - $options['onlyActiveBranch'] = $this->getOnlyActiveBranch(); - } - - // Expand sibling nodes of active branch - if (!isset($options['expandSiblingNodesOfActiveBranch'])) { - $options['expandSiblingNodesOfActiveBranch'] = $this->getExpandSiblingNodesOfActiveBranch(); - } - - // Render parents? - if (!isset($options['renderParents'])) { - $options['renderParents'] = $this->getRenderParents(); - } - - // Render parent class? - if (!isset($options['renderParentClass'])) { - $options['renderParentClass'] = $this->getRenderParentClass(); - } - - // Add page CSS class to LI element - if (!isset($options['addPageClassToLi'])) { - $options['addPageClassToLi'] = $this->getAddPageClassToLi(); - } - - return $options; - } - - // Render methods: - - /** - * Renders the deepest active menu within [$minDepth, $maxDeth], (called - * from {@link renderMenu()}) - * - * @param Zend_Navigation_Container $container container to render - * @param string $ulClass CSS class for first UL - * @param string $indent initial indentation - * @param string $innerIndent inner indentation - * @param int|null $minDepth minimum depth - * @param int|null $maxDepth maximum depth - * @param string|null $ulId unique identifier (id) - * for first UL - * @param bool $addPageClassToLi adds CSS class from - * page to li element - * @param string|null $activeClass CSS class for active - * element - * @param string $parentClass CSS class for parent - * li's - * @param bool $renderParentClass Render parent class? - * @return string rendered menu (HTML) - */ - protected function _renderDeepestMenu(Zend_Navigation_Container $container, - $ulClass, - $indent, - $innerIndent, - $minDepth, - $maxDepth, - $ulId, - $addPageClassToLi, - $activeClass, - $parentClass, - $renderParentClass) - { - if (!$active = $this->findActive($container, $minDepth - 1, $maxDepth)) { - return ''; - } - - // special case if active page is one below minDepth - if ($active['depth'] < $minDepth) { - if (!$active['page']->hasPages()) { - return ''; - } - } else if (!$active['page']->hasPages()) { - // found pages has no children; render siblings - $active['page'] = $active['page']->getParent(); - } else if (is_int($maxDepth) && $active['depth'] + 1 > $maxDepth) { - // children are below max depth; render siblings - $active['page'] = $active['page']->getParent(); - } - - $attribs = array( - 'class' => $ulClass, - 'id' => $ulId, - ); - - // We don't need a prefix for the menu ID (backup) - $skipValue = $this->_skipPrefixForId; - $this->skipPrefixForId(); - - $html = $indent . '_htmlAttribs($attribs) - . '>' - . $this->getEOL(); - - // Reset prefix for IDs - $this->_skipPrefixForId = $skipValue; - - foreach ($active['page'] as $subPage) { - if (!$this->accept($subPage)) { - continue; - } - - $liClass = ''; - if ($subPage->isActive(true) && $addPageClassToLi) { - $liClass = $this->_htmlAttribs( - array('class' => $activeClass . ' ' . $subPage->getClass()) - ); - } else if ($subPage->isActive(true)) { - $liClass = $this->_htmlAttribs(array('class' => $activeClass)); - } else if ($addPageClassToLi) { - $liClass = $this->_htmlAttribs( - array('class' => $subPage->getClass()) - ); - } - $html .= $indent . $innerIndent . '' . $this->getEOL(); - $html .= $indent . str_repeat($innerIndent, 2) . $this->htmlify($subPage) - . $this->getEOL(); - $html .= $indent . $innerIndent . '' . $this->getEOL(); - } - - $html .= $indent . ''; - - return $html; - } - - /** - * Renders a normal menu (called from {@link renderMenu()}) - * - * @param Zend_Navigation_Container $container container to render - * @param string $ulClass CSS class for first UL - * @param string $indent initial indentation - * @param string $innerIndent inner indentation - * @param int|null $minDepth minimum depth - * @param int|null $maxDepth maximum depth - * @param bool $onlyActive render only active branch? - * @param bool $expandSibs render siblings of active - * branch nodes? - * @param string|null $ulId unique identifier (id) - * for first UL - * @param bool $addPageClassToLi adds CSS class from - * page to li element - * @param string|null $activeClass CSS class for active - * element - * @param string $parentClass CSS class for parent - * li's - * @param bool $renderParentClass Render parent class? - * @return string rendered menu (HTML) - */ - protected function _renderMenu(Zend_Navigation_Container $container, - $ulClass, - $indent, - $innerIndent, - $minDepth, - $maxDepth, - $onlyActive, - $expandSibs, - $ulId, - $addPageClassToLi, - $activeClass, - $parentClass, - $renderParentClass) - { - $html = ''; - - // find deepest active - if ($found = $this->findActive($container, $minDepth, $maxDepth)) { - $foundPage = $found['page']; - $foundDepth = $found['depth']; - } else { - $foundPage = null; - } - - // create iterator - $iterator = new RecursiveIteratorIterator($container, - RecursiveIteratorIterator::SELF_FIRST); - if (is_int($maxDepth)) { - $iterator->setMaxDepth($maxDepth); - } - - // iterate container - $prevDepth = -1; - foreach ($iterator as $page) { - $depth = $iterator->getDepth(); - $isActive = $page->isActive(true); - if ($depth < $minDepth || !$this->accept($page)) { - // page is below minDepth or not accepted by acl/visibilty - continue; - } else if ($expandSibs && $depth > $minDepth) { - // page is not active itself, but might be in the active branch - $accept = false; - if ($foundPage) { - if ($foundPage->hasPage($page)) { - // accept if page is a direct child of the active page - $accept = true; - } else if ($page->getParent()->isActive(true)) { - // page is a sibling of the active branch... - $accept = true; - } - } - if (!$isActive && !$accept) { - continue; - } - } else if ($onlyActive && !$isActive) { - // page is not active itself, but might be in the active branch - $accept = false; - if ($foundPage) { - if ($foundPage->hasPage($page)) { - // accept if page is a direct child of the active page - $accept = true; - } else if ($foundPage->getParent()->hasPage($page)) { - // page is a sibling of the active page... - if (!$foundPage->hasPages() || - is_int($maxDepth) && $foundDepth + 1 > $maxDepth) { - // accept if active page has no children, or the - // children are too deep to be rendered - $accept = true; - } - } - } - - if (!$accept) { - continue; - } - } - - // make sure indentation is correct - $depth -= $minDepth; - $myIndent = $indent . str_repeat($innerIndent, $depth * 2); - - if ($depth > $prevDepth) { - $attribs = array(); - - // start new ul tag - if (0 == $depth) { - $attribs = array( - 'class' => $ulClass, - 'id' => $ulId, - ); - } - - // We don't need a prefix for the menu ID (backup) - $skipValue = $this->_skipPrefixForId; - $this->skipPrefixForId(); - - $html .= $myIndent . '_htmlAttribs($attribs) - . '>' - . $this->getEOL(); - - // Reset prefix for IDs - $this->_skipPrefixForId = $skipValue; - } else if ($prevDepth > $depth) { - // close li/ul tags until we're at current depth - for ($i = $prevDepth; $i > $depth; $i--) { - $ind = $indent . str_repeat($innerIndent, $i * 2); - $html .= $ind . $innerIndent . '' . $this->getEOL(); - $html .= $ind . '' . $this->getEOL(); - } - // close previous li tag - $html .= $myIndent . $innerIndent . '' . $this->getEOL(); - } else { - // close previous li tag - $html .= $myIndent . $innerIndent . '' . $this->getEOL(); - } - - // render li tag and page - $liClasses = array(); - // Is page active? - if ($isActive) { - $liClasses[] = $activeClass; - } - // Add CSS class from page to LI? - if ($addPageClassToLi) { - $liClasses[] = $page->getClass(); - } - // Add CSS class for parents to LI? - if ($renderParentClass && $page->hasChildren()) { - // Check max depth - if ((is_int($maxDepth) && ($depth + 1 < $maxDepth)) - || !is_int($maxDepth) - ) { - $liClasses[] = $parentClass; - } - } - - $html .= $myIndent . $innerIndent . '_htmlAttribs(array('class' => implode(' ', $liClasses))) - . '>' . $this->getEOL() - . $myIndent . str_repeat($innerIndent, 2) - . $this->htmlify($page) - . $this->getEOL(); - - // store as previous depth for next iteration - $prevDepth = $depth; - } - - if ($html) { - // done iterating container; close open ul/li tags - for ($i = $prevDepth+1; $i > 0; $i--) { - $myIndent = $indent . str_repeat($innerIndent . $innerIndent, $i - 1); - $html .= $myIndent . $innerIndent . '' . $this->getEOL() - . $myIndent . '' . $this->getEOL(); - } - $html = rtrim($html, $this->getEOL()); - } - - return $html; - } - - /** - * Renders helper - * - * Renders a HTML 'ul' for the given $container. If $container is not given, - * the container registered in the helper will be used. - * - * Available $options: - * - * - * @param Zend_Navigation_Container $container [optional] container to - * create menu from. Default - * is to use the container - * retrieved from - * {@link getContainer()}. - * @param array $options [optional] options for - * controlling rendering - * @return string rendered menu - */ - public function renderMenu(Zend_Navigation_Container $container = null, - array $options = array()) - { - if (null === $container) { - $container = $this->getContainer(); - } - - $options = $this->_normalizeOptions($options); - - if ($options['onlyActiveBranch'] && !$options['renderParents']) { - $html = $this->_renderDeepestMenu( - $container, - $options['ulClass'], - $options['indent'], - $options['innerIndent'], - $options['minDepth'], - $options['maxDepth'], - $options['ulId'], - $options['addPageClassToLi'], - $options['activeClass'], - $options['parentClass'], - $options['renderParentClass'] - ); - } else { - $html = $this->_renderMenu( - $container, - $options['ulClass'], - $options['indent'], - $options['innerIndent'], - $options['minDepth'], - $options['maxDepth'], - $options['onlyActiveBranch'], - $options['expandSiblingNodesOfActiveBranch'], - $options['ulId'], - $options['addPageClassToLi'], - $options['activeClass'], - $options['parentClass'], - $options['renderParentClass'] - ); - } - - return $html; - } - - /** - * Renders the inner-most sub menu for the active page in the $container - * - * This is a convenience method which is equivalent to the following call: - * - * renderMenu($container, array( - * 'indent' => $indent, - * 'ulClass' => $ulClass, - * 'minDepth' => null, - * 'maxDepth' => null, - * 'onlyActiveBranch' => true, - * 'renderParents' => false - * )); - * - * - * @param Zend_Navigation_Container $container [optional] container to - * render. Default is to render - * the container registered in - * the helper. - * @param string|null $ulClass [optional] CSS class to - * use for UL element. Default - * is to use the value from - * {@link getUlClass()}. - * @param string|int $indent [optional] indentation as - * a string or number of - * spaces. Default is to use - * the value retrieved from - * {@link getIndent()}. - * @param string|null $ulId [optional] Unique identifier - * (id) use for UL element - * @param bool $addPageClassToLi adds CSS class from - * page to li element - * @param string|int $innerIndent [optional] inner - * indentation as a string - * or number of spaces. - * Default is to use the - * {@link getInnerIndent()}. - * @return string rendered content - */ - public function renderSubMenu(Zend_Navigation_Container $container = null, - $ulClass = null, - $indent = null, - $ulId = null, - $addPageClassToLi = false, - $innerIndent = null) - { - return $this->renderMenu($container, array( - 'indent' => $indent, - 'innerIndent' => $innerIndent, - 'ulClass' => $ulClass, - 'minDepth' => null, - 'maxDepth' => null, - 'onlyActiveBranch' => true, - 'renderParents' => false, - 'ulId' => $ulId, - 'addPageClassToLi' => $addPageClassToLi, - )); - } - - /** - * Renders the given $container by invoking the partial view helper - * - * The container will simply be passed on as a model to the view script - * as-is, and will be available in the partial script as 'container', e.g. - * echo 'Number of pages: ', count($this->container);. - * - * @param Zend_Navigation_Container $container [optional] container to - * pass to view script. Default - * is to use the container - * registered in the helper. - * @param string|array $partial [optional] partial view - * script to use. Default is to - * use the partial registered - * in the helper. If an array - * is given, it is expected to - * contain two values; the - * partial view script to use, - * and the module where the - * script can be found. - * @return string helper output - * - * @throws Zend_View_Exception When no partial script is set - */ - public function renderPartial(Zend_Navigation_Container $container = null, - $partial = null) - { - if (null === $container) { - $container = $this->getContainer(); - } - - if (null === $partial) { - $partial = $this->getPartial(); - } - - if (empty($partial)) { - require_once 'Zend/View/Exception.php'; - $e = new Zend_View_Exception( - 'Unable to render menu: No partial view script provided' - ); - $e->setView($this->view); - throw $e; - } - - $model = array( - 'container' => $container - ); - - 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 ' - . 'script and module where script can be found' - ); - $e->setView($this->view); - throw $e; - } - - return $this->view->partial($partial[0], $partial[1], $model); - } - - return $this->view->partial($partial, null, $model); - } - - // Zend_View_Helper_Navigation_Helper: - - /** - * Renders menu - * - * Implements {@link Zend_View_Helper_Navigation_Helper::render()}. - * - * If a partial view is registered in the helper, the menu will be rendered - * using the given partial script. If no partial is registered, the menu - * will be rendered as an 'ul' element by the helper's internal method. - * - * @see renderPartial() - * @see renderMenu() - * - * @param Zend_Navigation_Container $container [optional] container to - * render. Default is to - * render the container - * registered in the helper. - * @return string helper output - */ - public function render(Zend_Navigation_Container $container = null) - { - if ($partial = $this->getPartial()) { - return $this->renderPartial($container, $partial); - } else { - return $this->renderMenu($container); - } - } -} diff --git a/library/vendor/Zend/View/Helper/Navigation/Sitemap.php b/library/vendor/Zend/View/Helper/Navigation/Sitemap.php deleted file mode 100644 index b93808a2c..000000000 --- a/library/vendor/Zend/View/Helper/Navigation/Sitemap.php +++ /dev/null @@ -1,444 +0,0 @@ - tag - * - * @var string - */ - const SITEMAP_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9'; - - /** - * Schema URL - * - * @var string - */ - const SITEMAP_XSD = 'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'; - - /** - * Whether the XML declaration should be included in XML output - * - * @var bool - */ - protected $_useXmlDeclaration = true; - - /** - * Whether sitemap should be validated using Zend_Validate_Sitemap_* - * - * @var bool - */ - protected $_useSitemapValidators = true; - - /** - * Whether sitemap should be schema validated when generated - * - * @var bool - */ - protected $_useSchemaValidation = false; - - /** - * Server url - * - * @var string - */ - protected $_serverUrl; - - /** - * View helper entry point: - * Retrieves helper and optionally sets container to operate on - * - * @param Zend_Navigation_Container $container [optional] container to - * operate on - * @return Zend_View_Helper_Navigation_Sitemap fluent interface, returns - * self - */ - public function sitemap(Zend_Navigation_Container $container = null) - { - if (null !== $container) { - $this->setContainer($container); - } - - return $this; - } - - // Accessors: - - /** - * Sets whether the XML declaration should be used in output - * - * @param bool $useXmlDecl whether XML delcaration - * should be rendered - * @return Zend_View_Helper_Navigation_Sitemap fluent interface, returns - * self - */ - public function setUseXmlDeclaration($useXmlDecl) - { - $this->_useXmlDeclaration = (bool) $useXmlDecl; - return $this; - } - - /** - * Returns whether the XML declaration should be used in output - * - * @return bool whether the XML declaration should be used in output - */ - public function getUseXmlDeclaration() - { - return $this->_useXmlDeclaration; - } - - /** - * Sets whether sitemap should be validated using Zend_Validate_Sitemap_* - * - * @param bool $useSitemapValidators whether sitemap validators - * should be used - * @return Zend_View_Helper_Navigation_Sitemap fluent interface, returns - * self - */ - public function setUseSitemapValidators($useSitemapValidators) - { - $this->_useSitemapValidators = (bool) $useSitemapValidators; - return $this; - } - - /** - * Returns whether sitemap should be validated using Zend_Validate_Sitemap_* - * - * @return bool whether sitemap should be validated using validators - */ - public function getUseSitemapValidators() - { - return $this->_useSitemapValidators; - } - - /** - * Sets whether sitemap should be schema validated when generated - * - * @param bool $schemaValidation whether sitemap should - * validated using XSD Schema - * @return Zend_View_Helper_Navigation_Sitemap fluent interface, returns - * self - */ - public function setUseSchemaValidation($schemaValidation) - { - $this->_useSchemaValidation = (bool) $schemaValidation; - return $this; - } - - /** - * Returns true if sitemap should be schema validated when generated - * - * @return bool - */ - public function getUseSchemaValidation() - { - return $this->_useSchemaValidation; - } - - /** - * Sets server url (scheme and host-related stuff without request URI) - * - * E.g. http://www.example.com - * - * @param string $serverUrl server URL to set (only - * scheme and host) - * @throws Zend_Uri_Exception if invalid server URL - * @return Zend_View_Helper_Navigation_Sitemap fluent interface, returns - * self - */ - public function setServerUrl($serverUrl) - { - require_once 'Zend/Uri.php'; - $uri = Zend_Uri::factory($serverUrl); - $uri->setFragment(''); - $uri->setPath(''); - $uri->setQuery(''); - - 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)); - $e->setView($this->view); - throw $e; - } - - return $this; - } - - /** - * Returns server URL - * - * @return string server URL - */ - public function getServerUrl() - { - if (!isset($this->_serverUrl)) { - $this->_serverUrl = $this->view->serverUrl(); - } - - return $this->_serverUrl; - } - - // Helper methods: - - /** - * Escapes string for XML usage - * - * @param string $string string to escape - * @return string escaped string - */ - protected function _xmlEscape($string) - { - $enc = 'UTF-8'; - if ($this->view instanceof Zend_View_Interface - && method_exists($this->view, 'getEncoding') - ) { - $enc = $this->view->getEncoding(); - } - - // do not encode existing HTML entities - return htmlspecialchars($string, ENT_QUOTES, $enc, false); - } - - // Public methods: - - /** - * Returns an escaped absolute URL for the given page - * - * @param Zend_Navigation_Page $page page to get URL from - * @return string - */ - public function url(Zend_Navigation_Page $page) - { - $href = $page->getHref(); - - if (!isset($href{0})) { - // no href - return ''; - } elseif ($href{0} == '/') { - // href is relative to root; use serverUrl helper - $url = $this->getServerUrl() . $href; - } elseif (preg_match('/^[a-z]+:/im', (string) $href)) { - // scheme is given in href; assume absolute URL already - $url = (string) $href; - } else { - // href is relative to current document; use url helpers - $url = $this->getServerUrl() - . rtrim($this->view->url(), '/') . '/' - . $href; - } - - return $this->_xmlEscape($url); - } - - /** - * Returns a DOMDocument containing the Sitemap XML for the given container - * - * @param Zend_Navigation_Container $container [optional] container to get - * breadcrumbs from, defaults - * to what is registered in the - * helper - * @return DOMDocument DOM representation of the - * container - * @throws Zend_View_Exception if schema validation is on - * and the sitemap is invalid - * according to the sitemap - * schema, or if sitemap - * validators are used and the - * loc element fails validation - */ - public function getDomSitemap(Zend_Navigation_Container $container = null) - { - if (null === $container) { - $container = $this->getContainer(); - } - - // 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(); - $changefreqValidator = new Zend_Validate_Sitemap_Changefreq(); - $priorityValidator = new Zend_Validate_Sitemap_Priority(); - } - - // create document - $dom = new DOMDocument('1.0', 'UTF-8'); - $dom->formatOutput = $this->getFormatOutput(); - - // ...and urlset (root) element - $urlSet = $dom->createElementNS(self::SITEMAP_NS, 'urlset'); - $dom->appendChild($urlSet); - - // create iterator - $iterator = new RecursiveIteratorIterator($container, - RecursiveIteratorIterator::SELF_FIRST); - - $maxDepth = $this->getMaxDepth(); - if (is_int($maxDepth)) { - $iterator->setMaxDepth($maxDepth); - } - $minDepth = $this->getMinDepth(); - if (!is_int($minDepth) || $minDepth < 0) { - $minDepth = 0; - } - - // iterate container - foreach ($iterator as $page) { - if ($iterator->getDepth() < $minDepth || !$this->accept($page)) { - // page should not be included - continue; - } - - // get absolute url from page - if (!$url = $this->url($page)) { - // skip page if it has no url (rare case) - continue; - } - - // create url node for this page - $urlNode = $dom->createElementNS(self::SITEMAP_NS, 'url'); - $urlSet->appendChild($urlNode); - - 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)); - $e->setView($this->view); - throw $e; - } - - // put url in 'loc' element - $urlNode->appendChild($dom->createElementNS(self::SITEMAP_NS, - 'loc', $url)); - - // add 'lastmod' element if a valid lastmod is set in page - if (isset($page->lastmod)) { - $lastmod = strtotime((string) $page->lastmod); - - // prevent 1970-01-01... - if ($lastmod !== false) { - $lastmod = date('c', $lastmod); - } - - if (!$this->getUseSitemapValidators() || - $lastmodValidator->isValid($lastmod)) { - $urlNode->appendChild( - $dom->createElementNS(self::SITEMAP_NS, 'lastmod', - $lastmod) - ); - } - } - - // add 'changefreq' element if a valid changefreq is set in page - if (isset($page->changefreq)) { - $changefreq = $page->changefreq; - if (!$this->getUseSitemapValidators() || - $changefreqValidator->isValid($changefreq)) { - $urlNode->appendChild( - $dom->createElementNS(self::SITEMAP_NS, 'changefreq', - $changefreq) - ); - } - } - - // add 'priority' element if a valid priority is set in page - if (isset($page->priority)) { - $priority = $page->priority; - if (!$this->getUseSitemapValidators() || - $priorityValidator->isValid($priority)) { - $urlNode->appendChild( - $dom->createElementNS(self::SITEMAP_NS, 'priority', - $priority) - ); - } - } - } - - // 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)); - $e->setView($this->view); - throw $e; - } - } - - return $dom; - } - - // Zend_View_Helper_Navigation_Helper: - - /** - * Renders helper - * - * Implements {@link Zend_View_Helper_Navigation_Helper::render()}. - * - * @param Zend_Navigation_Container $container [optional] container to - * render. Default is to - * render the container - * registered in the helper. - * @return string helper output - */ - public function render(Zend_Navigation_Container $container = null) - { - $dom = $this->getDomSitemap($container); - - $xml = $this->getUseXmlDeclaration() ? - $dom->saveXML() : - $dom->saveXML($dom->documentElement); - - return rtrim($xml, self::EOL); - } -} diff --git a/library/vendor/Zend/View/Helper/PaginationControl.php b/library/vendor/Zend/View/Helper/PaginationControl.php index 6f5929a22..b47496331 100644 --- a/library/vendor/Zend/View/Helper/PaginationControl.php +++ b/library/vendor/Zend/View/Helper/PaginationControl.php @@ -94,7 +94,6 @@ class Zend_View_Helper_PaginationControl /** * @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); @@ -107,7 +106,6 @@ class Zend_View_Helper_PaginationControl /** * @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); throw $e; @@ -127,7 +125,6 @@ class Zend_View_Helper_PaginationControl /** * @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); throw $e; diff --git a/library/vendor/Zend/View/Helper/Partial.php b/library/vendor/Zend/View/Helper/Partial.php index 733f563b9..787db9cac 100644 --- a/library/vendor/Zend/View/Helper/Partial.php +++ b/library/vendor/Zend/View/Helper/Partial.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Helper for rendering a template fragment in its own variable scope. @@ -76,10 +75,8 @@ class Zend_View_Helper_Partial extends Zend_View_Helper_Abstract } if ((null !== $module) && is_string($module)) { - 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); throw $e; diff --git a/library/vendor/Zend/View/Helper/Partial/Exception.php b/library/vendor/Zend/View/Helper/Partial/Exception.php index 9355fd352..5cd850a3d 100644 --- a/library/vendor/Zend/View/Helper/Partial/Exception.php +++ b/library/vendor/Zend/View/Helper/Partial/Exception.php @@ -22,7 +22,6 @@ /** Zend_View_Exception */ -require_once 'Zend/View/Exception.php'; /** diff --git a/library/vendor/Zend/View/Helper/PartialLoop.php b/library/vendor/Zend/View/Helper/PartialLoop.php index 4f90da191..12125b453 100644 --- a/library/vendor/Zend/View/Helper/PartialLoop.php +++ b/library/vendor/Zend/View/Helper/PartialLoop.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_Partial */ -require_once 'Zend/View/Helper/Partial.php'; /** * Helper for rendering a template fragment in its own variable scope; iterates @@ -70,7 +69,6 @@ class Zend_View_Helper_PartialLoop extends Zend_View_Helper_Partial && (!$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); throw $e; diff --git a/library/vendor/Zend/View/Helper/Placeholder.php b/library/vendor/Zend/View/Helper/Placeholder.php index c726b401d..3ca47ade4 100644 --- a/library/vendor/Zend/View/Helper/Placeholder.php +++ b/library/vendor/Zend/View/Helper/Placeholder.php @@ -21,10 +21,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/vendor/Zend/View/Helper/Placeholder/Container.php b/library/vendor/Zend/View/Helper/Placeholder/Container.php index 10e706d3b..c30025ab9 100644 --- a/library/vendor/Zend/View/Helper/Placeholder/Container.php +++ b/library/vendor/Zend/View/Helper/Placeholder/Container.php @@ -21,7 +21,6 @@ */ /** Zend_View_Helper_Placeholder_Container_Abstract */ -require_once 'Zend/View/Helper/Placeholder/Container/Abstract.php'; /** * Container for placeholder values diff --git a/library/vendor/Zend/View/Helper/Placeholder/Container/Abstract.php b/library/vendor/Zend/View/Helper/Placeholder/Container/Abstract.php index 0f9cbab47..d015c1d09 100644 --- a/library/vendor/Zend/View/Helper/Placeholder/Container/Abstract.php +++ b/library/vendor/Zend/View/Helper/Placeholder/Container/Abstract.php @@ -260,7 +260,6 @@ abstract class Zend_View_Helper_Placeholder_Container_Abstract extends ArrayObje 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); throw $e; diff --git a/library/vendor/Zend/View/Helper/Placeholder/Container/Exception.php b/library/vendor/Zend/View/Helper/Placeholder/Container/Exception.php index da15f6e74..aceb769d1 100644 --- a/library/vendor/Zend/View/Helper/Placeholder/Container/Exception.php +++ b/library/vendor/Zend/View/Helper/Placeholder/Container/Exception.php @@ -22,7 +22,6 @@ /** Zend_View_Exception */ -require_once 'Zend/View/Exception.php'; /** diff --git a/library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php b/library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php index deeca4de3..c452f0319 100644 --- a/library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php +++ b/library/vendor/Zend/View/Helper/Placeholder/Container/Standalone.php @@ -21,10 +21,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 @@ -230,7 +228,6 @@ abstract class Zend_View_Helper_Placeholder_Container_Standalone extends Zend_Vi return $return; } - require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Method "' . $method . '" does not exist'); $e->setView($this->view); throw $e; diff --git a/library/vendor/Zend/View/Helper/Placeholder/Registry.php b/library/vendor/Zend/View/Helper/Placeholder/Registry.php index b4a10c8c8..111604c1f 100644 --- a/library/vendor/Zend/View/Helper/Placeholder/Registry.php +++ b/library/vendor/Zend/View/Helper/Placeholder/Registry.php @@ -21,13 +21,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 @@ -160,13 +157,11 @@ class Zend_View_Helper_Placeholder_Registry public function setContainerClass($name) { if (!class_exists($name)) { - require_once 'Zend/Loader.php'; Zend_Loader::loadClass($name); } $reflection = new ReflectionClass($name); if (!$reflection->isSubclassOf(new ReflectionClass('Zend_View_Helper_Placeholder_Container_Abstract'))) { - 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); throw $e; diff --git a/library/vendor/Zend/View/Helper/Placeholder/Registry/Exception.php b/library/vendor/Zend/View/Helper/Placeholder/Registry/Exception.php index 6bffa198a..42d7a2883 100644 --- a/library/vendor/Zend/View/Helper/Placeholder/Registry/Exception.php +++ b/library/vendor/Zend/View/Helper/Placeholder/Registry/Exception.php @@ -22,7 +22,6 @@ /** Zend_View_Exception */ -require_once 'Zend/View/Exception.php'; /** diff --git a/library/vendor/Zend/View/Helper/RenderToPlaceholder.php b/library/vendor/Zend/View/Helper/RenderToPlaceholder.php index fd2d3e1ef..1d1118662 100644 --- a/library/vendor/Zend/View/Helper/RenderToPlaceholder.php +++ b/library/vendor/Zend/View/Helper/RenderToPlaceholder.php @@ -21,7 +21,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/vendor/Zend/View/Helper/Translate.php b/library/vendor/Zend/View/Helper/Translate.php index f66a560b0..8a7d916fe 100644 --- a/library/vendor/Zend/View/Helper/Translate.php +++ b/library/vendor/Zend/View/Helper/Translate.php @@ -21,10 +21,8 @@ */ /** Zend_Locale */ -require_once 'Zend/Locale.php'; /** Zend_View_Helper_Abstract.php */ -require_once 'Zend/View/Helper/Abstract.php'; /** * Translation view helper @@ -112,7 +110,6 @@ class Zend_View_Helper_Translate extends Zend_View_Helper_Abstract } else if ($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); throw $e; @@ -129,7 +126,6 @@ class Zend_View_Helper_Translate extends Zend_View_Helper_Abstract public function getTranslator() { if ($this->_translator === null) { - require_once 'Zend/Registry.php'; if (Zend_Registry::isRegistered('Zend_Translate')) { $this->setTranslator(Zend_Registry::get('Zend_Translate')); } @@ -149,7 +145,6 @@ class Zend_View_Helper_Translate extends Zend_View_Helper_Abstract { $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); throw $e; @@ -169,7 +164,6 @@ class Zend_View_Helper_Translate extends Zend_View_Helper_Abstract { $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); throw $e; diff --git a/library/vendor/Zend/View/Helper/Url.php b/library/vendor/Zend/View/Helper/Url.php index fbf7b690e..3ed84ca57 100644 --- a/library/vendor/Zend/View/Helper/Url.php +++ b/library/vendor/Zend/View/Helper/Url.php @@ -21,7 +21,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/vendor/Zend/View/Helper/UserAgent.php b/library/vendor/Zend/View/Helper/UserAgent.php deleted file mode 100644 index 708ccda65..000000000 --- a/library/vendor/Zend/View/Helper/UserAgent.php +++ /dev/null @@ -1,83 +0,0 @@ -setUserAgent($userAgent); - } - return $this->getUserAgent(); - } - - /** - * Set UserAgent instance - * - * @param Zend_Http_UserAgent $userAgent - * @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) { - require_once 'Zend/Http/UserAgent.php'; - $this->setUserAgent(new Zend_Http_UserAgent()); - } - return $this->_userAgent; - } -} diff --git a/library/vendor/Zend/Wildfire/Channel/HttpHeaders.php b/library/vendor/Zend/Wildfire/Channel/HttpHeaders.php deleted file mode 100644 index 383808948..000000000 --- a/library/vendor/Zend/Wildfire/Channel/HttpHeaders.php +++ /dev/null @@ -1,343 +0,0 @@ -_protocols[$uri])) { - $this->_protocols[$uri] = $this->_initProtocol($uri); - } - - $this->_registerControllerPlugin(); - - return $this->_protocols[$uri]; - } - - /** - * Initialize a new protocol - * - * @param string $uri The URI for the protocol to be initialized - * @return object Returns the new initialized protocol instance - * @throws Zend_Wildfire_Exception - */ - protected function _initProtocol($uri) - { - switch ($uri) { - case Zend_Wildfire_Protocol_JsonStream::PROTOCOL_URI; - return new Zend_Wildfire_Protocol_JsonStream(); - } - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Tyring to initialize unknown protocol for URI "'.$uri.'".'); - } - - - /** - * Flush all data from all protocols and send all data to response headers. - * - * @return boolean Returns TRUE if data was flushed - */ - public function flush() - { - if (!$this->_protocols || !$this->isReady()) { - return false; - } - - foreach ( $this->_protocols as $protocol ) { - - $payload = $protocol->getPayload($this); - - if ($payload) { - foreach( $payload as $message ) { - - $this->getResponse()->setHeader(self::$_headerPrefix.$message[0], - $message[1], true); - } - } - } - return true; - } - - /** - * Set the index of the plugin in the controller dispatch loop plugin stack - * - * @param integer $index The index of the plugin in the stack - * @return integer The previous index. - */ - public static function setControllerPluginStackIndex($index) - { - $previous = self::$_controllerPluginStackIndex; - self::$_controllerPluginStackIndex = $index; - return $previous; - } - - /** - * Register this object as a controller plugin. - * - * @return void - */ - protected function _registerControllerPlugin() - { - $controller = Zend_Controller_Front::getInstance(); - if (!$controller->hasPlugin(get_class($this))) { - $controller->registerPlugin($this, self::$_controllerPluginStackIndex); - } - } - - - /* - * Zend_Wildfire_Channel_Interface - */ - - /** - * Determine if channel is ready. - * - * The channel is ready as long as the request and response objects are initialized, - * can send headers and the FirePHP header exists in the User-Agent. - * - * If the header does not exist in the User-Agent, no appropriate client - * is making this request and the messages should not be sent. - * - * A timing issue arises when messages are logged before the request/response - * objects are initialized. In this case we do not yet know if the client - * will be able to accept the messages. If we consequently indicate that - * the channel is not ready, these messages will be dropped which is in - * most cases not the intended behaviour. The intent is to send them at the - * end of the request when the request/response objects will be available - * for sure. - * - * If the request/response objects are not yet initialized we assume if messages are - * logged, the client will be able to receive them. As soon as the request/response - * objects are availoable and a message is logged this assumption is challenged. - * If the client cannot accept the messages any further messages are dropped - * and messages sent prior are kept but discarded when the channel is finally - * flushed at the end of the request. - * - * When the channel is flushed the $forceCheckRequest option is used to force - * a check of the request/response objects. This is the last verification to ensure - * messages are only sent when the client can accept them. - * - * @param boolean $forceCheckRequest OPTIONAL Set to TRUE if the request must be checked - * @return boolean Returns TRUE if channel is ready. - */ - public function isReady($forceCheckRequest=false) - { - if (!$forceCheckRequest - && !$this->_request - && !$this->_response - ) { - return true; - } - - if (!($this->getRequest() instanceof Zend_Controller_Request_Http)) { - return false; - } - - return ($this->getResponse()->canSendHeaders() - && (preg_match_all( - '/\s?FirePHP\/([\.\d]*)\s?/si', - $this->getRequest()->getHeader('User-Agent'), - $m - ) || - (($header = $this->getRequest()->getHeader('X-FirePHP-Version')) - && preg_match_all('/^([\.\d]*)$/si', $header, $m) - )) - ); - } - - - /* - * Zend_Controller_Plugin_Abstract - */ - - /** - * Flush messages to headers as late as possible but before headers have been sent. - * - * @return void - */ - public function dispatchLoopShutdown() - { - $this->flush(); - } - - /** - * Get the request object - * - * @return Zend_Controller_Request_Abstract - * @throws Zend_Wildfire_Exception - */ - public function getRequest() - { - if (!$this->_request) { - $controller = Zend_Controller_Front::getInstance(); - $this->setRequest($controller->getRequest()); - } - if (!$this->_request) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Request objects not initialized.'); - } - return $this->_request; - } - - /** - * Get the response object - * - * @return Zend_Controller_Response_Abstract - * @throws Zend_Wildfire_Exception - */ - public function getResponse() - { - if (!$this->_response) { - $response = Zend_Controller_Front::getInstance()->getResponse(); - if ($response) { - $this->setResponse($response); - } - } - if (!$this->_response) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Response objects not initialized.'); - } - return $this->_response; - } -} diff --git a/library/vendor/Zend/Wildfire/Channel/Interface.php b/library/vendor/Zend/Wildfire/Channel/Interface.php deleted file mode 100644 index fccec351c..000000000 --- a/library/vendor/Zend/Wildfire/Channel/Interface.php +++ /dev/null @@ -1,38 +0,0 @@ - 1, /* The offset in the trace which identifies the source of the message */ - 'maxTraceDepth' => 99, /* Maximum depth for stack traces */ - 'maxObjectDepth' => 10, /* The maximum depth to traverse objects when encoding */ - 'maxArrayDepth' => 20, /* The maximum depth to traverse nested arrays when encoding */ - 'includeLineNumbers' => true /* Whether to include line and file info for each message */ - ); - - /** - * Filters used to exclude object members when encoding - * @var array - */ - protected $_objectFilters = array(); - - /** - * A stack of objects used during encoding to detect recursion - * @var array - */ - protected $_objectStack = array(); - - /** - * Create singleton instance. - * - * @param string $class OPTIONAL Subclass of Zend_Wildfire_Plugin_FirePhp - * @return Zend_Wildfire_Plugin_FirePhp Returns the singleton Zend_Wildfire_Plugin_FirePhp instance - * @throws Zend_Wildfire_Exception - */ - public static function init($class = null) - { - if (self::$_instance !== null) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Singleton instance of Zend_Wildfire_Plugin_FirePhp already exists!'); - } - if ($class !== null) { - if (!is_string($class)) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Third argument is not a class string'); - } - - if (!class_exists($class)) { - require_once 'Zend/Loader.php'; - Zend_Loader::loadClass($class); - } - self::$_instance = new $class(); - if (!self::$_instance instanceof Zend_Wildfire_Plugin_FirePhp) { - self::$_instance = null; - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Invalid class to third argument. Must be subclass of Zend_Wildfire_Plugin_FirePhp.'); - } - } else { - self::$_instance = new self(); - } - - return self::$_instance; - } - - /** - * Constructor - * @return void - */ - protected function __construct() - { - $this->_channel = Zend_Wildfire_Channel_HttpHeaders::getInstance(); - $this->_channel->getProtocol(self::PROTOCOL_URI)->registerPlugin($this); - } - - /** - * Get or create singleton instance - * - * @param bool $skipCreate True if an instance should not be created - * @return Zend_Wildfire_Plugin_FirePhp - */ - public static function getInstance($skipCreate=false) - { - if (self::$_instance===null && $skipCreate!==true) { - return self::init(); - } - return self::$_instance; - } - - /** - * Destroys the singleton instance - * - * Primarily used for testing. - * - * @return void - */ - public static function destroyInstance() - { - self::$_instance = null; - } - - /** - * Enable or disable sending of messages to user-agent. - * If disabled all headers to be sent will be removed. - * - * @param boolean $enabled Set to TRUE to enable sending of messages. - * @return boolean The previous value. - */ - public function setEnabled($enabled) - { - $previous = $this->_enabled; - $this->_enabled = $enabled; - if (!$this->_enabled) { - $this->_messages = array(); - $this->_channel->getProtocol(self::PROTOCOL_URI)->clearMessages($this); - } - return $previous; - } - - /** - * Determine if logging to user-agent is enabled. - * - * @return boolean Returns TRUE if logging is enabled. - */ - public function getEnabled() - { - return $this->_enabled; - } - - /** - * Set a single option - * - * @param string $key The name of the option - * @param mixed $value The value of the option - * @return mixed The previous value of the option - */ - public function setOption($key, $value) - { - if (!array_key_exists($key,$this->_options)) { - throw new Zend_Wildfire_Exception('Option with name "'.$key.'" does not exist!'); - } - $previous = $this->_options[$key]; - $this->_options[$key] = $value; - return $previous; - } - - /** - * Retrieve a single option - * - * @param string $key The name of the option - * @return mixed The value of the option - */ - public function getOption($key) - { - if (!array_key_exists($key,$this->_options)) { - throw new Zend_Wildfire_Exception('Option with name "'.$key.'" does not exist!'); - } - return $this->_options[$key]; - } - - /** - * Retrieve all options - * - * @return array All options - */ - public function getOptions() - { - return $this->_options; - } - - /** - * Specify a filter to be used when encoding an object - * - * Filters are used to exclude object members. - * - * @param string $Class The class name of the object - * @param array $Filter An array of members to exclude - * @return void - */ - public function setObjectFilter($class, $filter) { - $this->_objectFilters[$class] = $filter; - } - - /** - * Starts a group in the Firebug Console - * - * @param string $title The title of the group - * @param array $options OPTIONAL Setting 'Collapsed' to true will initialize group collapsed instead of expanded - * @return TRUE if the group instruction was added to the response headers or buffered. - */ - public static function group($title, $options=array()) - { - return self::send(null, $title, self::GROUP_START, $options); - } - - /** - * Ends a group in the Firebug Console - * - * @return TRUE if the group instruction was added to the response headers or buffered. - */ - public static function groupEnd() - { - return self::send(null, null, self::GROUP_END); - } - - /** - * Logs variables to the Firebug Console - * via HTTP response headers and the FirePHP Firefox Extension. - * - * @param mixed $var The variable to log. - * @param string $label OPTIONAL Label to prepend to the log event. - * @param string $style OPTIONAL Style of the log event. - * @param array $options OPTIONAL Options to change how messages are processed and sent - * @return boolean Returns TRUE if the variable was added to the response headers or buffered. - * @throws Zend_Wildfire_Exception - */ - public static function send($var, $label=null, $style=null, $options=array()) - { - $firephp = self::getInstance(); - - if (!$firephp->getEnabled()) { - return false; - } - - if ($var instanceof Zend_Wildfire_Plugin_FirePhp_Message) { - - if ($var->getBuffered()) { - if (!in_array($var, self::$_instance->_messages)) { - self::$_instance->_messages[] = $var; - } - return true; - } - - if ($var->getDestroy()) { - return false; - } - - $style = $var->getStyle(); - $label = $var->getLabel(); - $options = $var->getOptions(); - $var = $var->getMessage(); - } - - if (!self::$_instance->_channel->isReady()) { - return false; - } - - foreach ($options as $name => $value) { - if ($value===null) { - unset($options[$name]); - } - } - $options = array_merge($firephp->getOptions(), $options); - - $trace = null; - - $skipFinalEncode = false; - - $meta = array(); - $meta['Type'] = $style; - - if ($var instanceof Exception) { - - $eTrace = $var->getTrace(); - $eTrace = array_splice($eTrace, 0, $options['maxTraceDepth']); - - $var = array('Class'=>get_class($var), - 'Message'=>$var->getMessage(), - 'File'=>$var->getFile(), - 'Line'=>$var->getLine(), - 'Type'=>'throw', - 'Trace'=>$firephp->_encodeTrace($eTrace)); - - $meta['Type'] = self::EXCEPTION; - - $skipFinalEncode = true; - - } else - if ($meta['Type']==self::TRACE) { - - if (!$label && $var) { - $label = $var; - $var = null; - } - - if (!$trace) { - $trace = $firephp->_getStackTrace(array_merge($options, - array('maxTraceDepth'=>$options['maxTraceDepth']+1))); - } - - $var = array('Class'=>$trace[0]['class'], - 'Type'=>$trace[0]['type'], - 'Function'=>$trace[0]['function'], - 'Message'=>$label, - 'File'=>isset($trace[0]['file'])?$trace[0]['file']:'', - 'Line'=>isset($trace[0]['line'])?$trace[0]['line']:'', - 'Args'=>isset($trace[0]['args'])?$firephp->_encodeObject($trace[0]['args']):'', - 'Trace'=>$firephp->_encodeTrace(array_splice($trace,1))); - - $skipFinalEncode = true; - - } else - if ($meta['Type']==self::TABLE) { - - $var = $firephp->_encodeTable($var); - - $skipFinalEncode = true; - - } else { - if ($meta['Type']===null) { - $meta['Type'] = self::LOG; - } - } - - if ($label!=null) { - $meta['Label'] = $label; - } - - switch ($meta['Type']) { - case self::LOG: - case self::INFO: - case self::WARN: - case self::ERROR: - case self::EXCEPTION: - case self::TRACE: - case self::TABLE: - case self::DUMP: - case self::GROUP_START: - case self::GROUP_END: - break; - default: - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Log style "'.$meta['Type'].'" not recognized!'); - break; - } - - if ($meta['Type'] != self::DUMP && $options['includeLineNumbers']) { - if (!isset($meta['File']) || !isset($meta['Line'])) { - - if (!$trace) { - $trace = $firephp->_getStackTrace(array_merge($options, - array('maxTraceDepth'=>$options['maxTraceDepth']+1))); - } - - $meta['File'] = isset($trace[0]['file'])?$trace[0]['file']:''; - $meta['Line'] = isset($trace[0]['line'])?$trace[0]['line']:''; - - } - } else { - unset($meta['File']); - unset($meta['Line']); - } - - if ($meta['Type'] == self::GROUP_START) { - if (isset($options['Collapsed'])) { - $meta['Collapsed'] = ($options['Collapsed'])?'true':'false'; - } - } - - if ($meta['Type'] == self::DUMP) { - - return $firephp->_recordMessage(self::STRUCTURE_URI_DUMP, - array('key'=>$meta['Label'], - 'data'=>$var), - $skipFinalEncode); - - } else { - - return $firephp->_recordMessage(self::STRUCTURE_URI_FIREBUGCONSOLE, - array('data'=>$var, - 'meta'=>$meta), - $skipFinalEncode); - } - } - - /** - * Gets a stack trace - * - * @param array $options Options to change how the stack trace is returned - * @return array The stack trace - */ - protected function _getStackTrace($options) - { - $trace = debug_backtrace(); - - $trace = array_splice($trace, $options['traceOffset']); - - if (!count($trace)) { - return $trace; - } - - if (isset($options['fixZendLogOffsetIfApplicable']) && $options['fixZendLogOffsetIfApplicable']) { - if (count($trace) >=3 && - isset($trace[0]['file']) && substr($trace[0]['file'], -7, 7)=='Log.php' && - isset($trace[1]['function']) && $trace[1]['function']=='__call') { - - $trace = array_splice($trace, 2); - } - } - - return array_splice($trace, 0, $options['maxTraceDepth']); - } - - /** - * Record a message with the given data in the given structure - * - * @param string $structure The structure to be used for the data - * @param array $data The data to be recorded - * @param boolean $skipEncode TRUE if variable encoding should be skipped - * @return boolean Returns TRUE if message was recorded - * @throws Zend_Wildfire_Exception - */ - protected function _recordMessage($structure, $data, $skipEncode=false) - { - switch($structure) { - - case self::STRUCTURE_URI_DUMP: - - if (!isset($data['key'])) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('You must supply a key.'); - } - if (!array_key_exists('data',$data)) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('You must supply data.'); - } - - $value = $data['data']; - if (!$skipEncode) { - $value = $this->_encodeObject($data['data']); - } - - return $this->_channel->getProtocol(self::PROTOCOL_URI)-> - recordMessage($this, - $structure, - array($data['key']=>$value)); - - case self::STRUCTURE_URI_FIREBUGCONSOLE: - - if (!isset($data['meta']) || - !is_array($data['meta']) || - !array_key_exists('Type',$data['meta'])) { - - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('You must supply a "Type" in the meta information.'); - } - if (!array_key_exists('data',$data)) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('You must supply data.'); - } - - $value = $data['data']; - if (!$skipEncode) { - $value = $this->_encodeObject($data['data']); - } - - return $this->_channel->getProtocol(self::PROTOCOL_URI)-> - recordMessage($this, - $structure, - array($data['meta'], - $value)); - - default: - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Structure of name "'.$structure.'" is not recognized.'); - break; - } - return false; - } - - /** - * Encodes a table by encoding each row and column with _encodeObject() - * - * @param array $Table The table to be encoded - * @return array - */ - protected function _encodeTable($table) - { - if (!$table) { - return $table; - } - for ($i=0 ; $i_encodeObject($table[$i][$j]); - } - } - } - return $table; - } - - /** - * Encodes a trace by encoding all "args" with _encodeObject() - * - * @param array $Trace The trace to be encoded - * @return array The encoded trace - */ - protected function _encodeTrace($trace) - { - if (!$trace) { - return $trace; - } - for ($i=0 ; $i_encodeObject($trace[$i]['args']); - } - } - return $trace; - } - - /** - * Encode an object by generating an array containing all object members. - * - * All private and protected members are included. Some meta info about - * the object class is added. - * - * @param mixed $object The object/array/value to be encoded - * @return array The encoded object - */ - protected function _encodeObject($object, $objectDepth = 1, $arrayDepth = 1) - { - $return = array(); - - if (is_resource($object)) { - - return '** '.(string)$object.' **'; - - } else - if (is_object($object)) { - - if ($objectDepth > $this->_options['maxObjectDepth']) { - return '** Max Object Depth ('.$this->_options['maxObjectDepth'].') **'; - } - - foreach ($this->_objectStack as $refVal) { - if ($refVal === $object) { - return '** Recursion ('.get_class($object).') **'; - } - } - array_push($this->_objectStack, $object); - - $return['__className'] = $class = get_class($object); - - $reflectionClass = new ReflectionClass($class); - $properties = array(); - foreach ( $reflectionClass->getProperties() as $property) { - $properties[$property->getName()] = $property; - } - - $members = (array)$object; - - foreach ($properties as $just_name => $property) { - - $name = $raw_name = $just_name; - - if ($property->isStatic()) { - $name = 'static:'.$name; - } - if ($property->isPublic()) { - $name = 'public:'.$name; - } else - if ($property->isPrivate()) { - $name = 'private:'.$name; - $raw_name = "\0".$class."\0".$raw_name; - } else - if ($property->isProtected()) { - $name = 'protected:'.$name; - $raw_name = "\0".'*'."\0".$raw_name; - } - - if (!(isset($this->_objectFilters[$class]) - && is_array($this->_objectFilters[$class]) - && in_array($just_name,$this->_objectFilters[$class]))) { - - if (array_key_exists($raw_name,$members) - && !$property->isStatic()) { - - $return[$name] = $this->_encodeObject($members[$raw_name], $objectDepth + 1, 1); - - } else { - if (method_exists($property,'setAccessible')) { - $property->setAccessible(true); - $return[$name] = $this->_encodeObject($property->getValue($object), $objectDepth + 1, 1); - } else - if ($property->isPublic()) { - $return[$name] = $this->_encodeObject($property->getValue($object), $objectDepth + 1, 1); - } else { - $return[$name] = '** Need PHP 5.3 to get value **'; - } - } - } else { - $return[$name] = '** Excluded by Filter **'; - } - } - - // Include all members that are not defined in the class - // but exist in the object - foreach($members as $just_name => $value) { - - $name = $raw_name = $just_name; - - if ($name{0} == "\0") { - $parts = explode("\0", $name); - $name = $parts[2]; - } - if (!isset($properties[$name])) { - $name = 'undeclared:'.$name; - - if (!(isset($this->objectFilters[$class]) - && is_array($this->objectFilters[$class]) - && in_array($just_name,$this->objectFilters[$class]))) { - - $return[$name] = $this->_encodeObject($value, $objectDepth + 1, 1); - } else { - $return[$name] = '** Excluded by Filter **'; - } - } - } - - array_pop($this->_objectStack); - - } elseif (is_array($object)) { - - if ($arrayDepth > $this->_options['maxArrayDepth']) { - return '** Max Array Depth ('.$this->_options['maxArrayDepth'].') **'; - } - - foreach ($object as $key => $val) { - - // Encoding the $GLOBALS PHP array causes an infinite loop - // if the recursion is not reset here as it contains - // a reference to itself. This is the only way I have come up - // with to stop infinite recursion in this case. - if ($key=='GLOBALS' - && is_array($val) - && array_key_exists('GLOBALS',$val)) { - - $val['GLOBALS'] = '** Recursion (GLOBALS) **'; - } - $return[$key] = $this->_encodeObject($val, 1, $arrayDepth + 1); - } - } else { - return $object; - } - return $return; - } - - /* - * Zend_Wildfire_Plugin_Interface - */ - - /** - * Get the unique indentifier for this plugin. - * - * @return string Returns the URI of the plugin. - */ - public function getUri() - { - return self::PLUGIN_URI; - } - - /** - * Flush any buffered data. - * - * @param string $protocolUri The URI of the protocol that should be flushed to - * @return void - */ - public function flushMessages($protocolUri) - { - if (!$this->_messages || $protocolUri!=self::PROTOCOL_URI) { - return; - } - - foreach( $this->_messages as $message ) { - if (!$message->getDestroy()) { - $this->send($message->getMessage(), - $message->getLabel(), - $message->getStyle(), - $message->getOptions()); - } - } - - $this->_messages = array(); - } -} diff --git a/library/vendor/Zend/Wildfire/Plugin/FirePhp/Message.php b/library/vendor/Zend/Wildfire/Plugin/FirePhp/Message.php deleted file mode 100644 index 78e98005a..000000000 --- a/library/vendor/Zend/Wildfire/Plugin/FirePhp/Message.php +++ /dev/null @@ -1,246 +0,0 @@ - null, /* The offset in the trace which identifies the source of the message */ - 'includeLineNumbers' => null /* Whether to include line and file info for this message */ - ); - - /** - * Creates a new message with the given style and message - * - * @param string $style Style of the message. - * @param mixed $message The message - * @return void - */ - function __construct($style, $message) - { - $this->_style = $style; - $this->_message = $message; - $this->_ruid = md5(microtime().mt_rand()); - } - - /** - * Set the label of the message - * - * @param string $label The label to be set - * @return void - */ - public function setLabel($label) - { - $this->_label = $label; - } - - /** - * Get the label of the message - * - * @return string The label of the message - */ - public function getLabel() - { - return $this->_label; - } - - /** - * Enable or disable message buffering - * - * If a message is buffered it can be updated for the duration of the - * request and is only flushed at the end of the request. - * - * @param boolean $buffered TRUE to enable buffering FALSE otherwise - * @return boolean Returns previous buffering value - */ - public function setBuffered($buffered) - { - $previous = $this->_buffered; - $this->_buffered = $buffered; - return $previous; - } - - /** - * Determine if buffering is enabled or disabled - * - * @return boolean Returns TRUE if buffering is enabled, FALSE otherwise. - */ - public function getBuffered() - { - return $this->_buffered; - } - - /** - * Destroy the message to prevent delivery - * - * @param boolean $destroy TRUE to destroy FALSE otherwise - * @return boolean Returns previous destroy value - */ - public function setDestroy($destroy) - { - $previous = $this->_destroy; - $this->_destroy = $destroy; - return $previous; - } - - /** - * Determine if message should be destroyed - * - * @return boolean Returns TRUE if message should be destroyed, FALSE otherwise. - */ - public function getDestroy() - { - return $this->_destroy; - } - - /** - * Set the style of the message - * - * @return void - */ - public function setStyle($style) - { - $this->_style = $style; - } - - /** - * Get the style of the message - * - * @return string The style of the message - */ - public function getStyle() - { - return $this->_style; - } - - /** - * Set the actual message to be sent in its final format. - * - * @return void - */ - public function setMessage($message) - { - $this->_message = $message; - } - - /** - * Get the actual message to be sent in its final format. - * - * @return mixed Returns the message to be sent. - */ - public function getMessage() - { - return $this->_message; - } - - /** - * Set a single option - * - * @param string $key The name of the option - * @param mixed $value The value of the option - * @return mixed The previous value of the option - */ - public function setOption($key, $value) - { - if(!array_key_exists($key,$this->_options)) { - throw new Zend_Wildfire_Exception('Option with name "'.$key.'" does not exist!'); - } - $previous = $this->_options[$key]; - $this->_options[$key] = $value; - return $previous; - } - - /** - * Retrieve a single option - * - * @param string $key The name of the option - * @return mixed The value of the option - */ - public function getOption($key) - { - if(!array_key_exists($key,$this->_options)) { - throw new Zend_Wildfire_Exception('Option with name "'.$key.'" does not exist!'); - } - return $this->_options[$key]; - } - - /** - * Retrieve all options - * - * @return array All options - */ - public function getOptions() - { - return $this->_options; - } -} - diff --git a/library/vendor/Zend/Wildfire/Plugin/FirePhp/TableMessage.php b/library/vendor/Zend/Wildfire/Plugin/FirePhp/TableMessage.php deleted file mode 100644 index c4366df8d..000000000 --- a/library/vendor/Zend/Wildfire/Plugin/FirePhp/TableMessage.php +++ /dev/null @@ -1,165 +0,0 @@ -setLabel($label); - } - - /** - * Set the table header - * - * @param array $header The header columns - * @return void - */ - public function setHeader($header) - { - $this->_header = $header; - } - - /** - * Append a row to the end of the table. - * - * @param array $row An array of column values representing a row. - * @return void - */ - public function addRow($row) - { - $this->_rows[] = $row; - } - - /** - * Get the actual message to be sent in its final format. - * - * @return mixed Returns the message to be sent. - */ - public function getMessage() - { - $table = $this->_rows; - if($this->_header) { - array_unshift($table,$this->_header); - } - return $table; - } - - /** - * Returns the row at the given index - * - * @param integer $index The index of the row - * @return array Returns the row - * @throws Zend_Wildfire_Exception - */ - public function getRowAt($index) - { - $count = $this->getRowCount(); - - if($index < 0 || $index > $count-1) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Row index('.$index.') out of bounds('.$count.')!'); - } - - return $this->_rows[$index]; - } - - /** - * Sets the row on the given index to a new row - * - * @param integer $index The index of the row - * @param array $row The new data for the row - * @throws Zend_Wildfire_Exception - */ - public function setRowAt($index, $row) - { - $count = $this->getRowCount(); - - if($index < 0 || $index > $count-1) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Row index('.$index.') out of bounds('.$count.')!'); - } - - $this->_rows[$index] = $row; - } - - /** - * Returns the number of rows - * - * @return integer - */ - public function getRowCount() - { - return count($this->_rows); - } - - /** - * Returns the last row of the table - * - * @return array Returns the last row - * @throws Zend_Wildfire_Exception - */ - public function getLastRow() - { - $count = $this->getRowCount(); - - if($count==0) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Cannot get last row as no rows exist!'); - } - - return $this->_rows[$count-1]; - } -} diff --git a/library/vendor/Zend/Wildfire/Plugin/Interface.php b/library/vendor/Zend/Wildfire/Plugin/Interface.php deleted file mode 100644 index 2943ca8e8..000000000 --- a/library/vendor/Zend/Wildfire/Plugin/Interface.php +++ /dev/null @@ -1,48 +0,0 @@ -_plugins)) { - return false; - } - $this->_plugins[] = $plugin; - return true; - } - - /** - * Record a message with the given data in the given structure - * - * @param Zend_Wildfire_Plugin_Interface $plugin The plugin recording the message - * @param string $structure The structure to be used for the data - * @param array $data The data to be recorded - * @return boolean Returns TRUE if message was recorded - */ - public function recordMessage(Zend_Wildfire_Plugin_Interface $plugin, $structure, $data) - { - if(!isset($this->_messages[$structure])) { - $this->_messages[$structure] = array(); - } - - $uri = $plugin->getUri(); - - if(!isset($this->_messages[$structure][$uri])) { - $this->_messages[$structure][$uri] = array(); - } - - $this->_messages[$structure][$uri][] = $this->_encode($data); - return true; - } - - /** - * Remove all qued messages - * - * @param Zend_Wildfire_Plugin_Interface $plugin The plugin for which to clear messages - * @return boolean Returns TRUE if messages were present - */ - public function clearMessages(Zend_Wildfire_Plugin_Interface $plugin) - { - $uri = $plugin->getUri(); - - $present = false; - foreach ($this->_messages as $structure => $messages) { - - if(!isset($this->_messages[$structure][$uri])) { - continue; - } - - $present = true; - - unset($this->_messages[$structure][$uri]); - - if (!$this->_messages[$structure]) { - unset($this->_messages[$structure]); - } - } - return $present; - } - - /** - * Get all qued messages - * - * @return mixed Returns qued messages or FALSE if no messages are qued - */ - public function getMessages() - { - if (!$this->_messages) { - return false; - } - return $this->_messages; - } - - /** - * Use the JSON encoding scheme for the value specified - * - * @param mixed $value The value to be encoded - * @return string The encoded value - */ - protected function _encode($value) - { - return Zend_Json::encode($value, true, array('silenceCyclicalExceptions'=>true)); - } - - /** - * Retrieves all formatted data ready to be sent by the channel. - * - * @param Zend_Wildfire_Channel_Interface $channel The instance of the channel that will be transmitting the data - * @return mixed Returns the data to be sent by the channel. - * @throws Zend_Wildfire_Exception - */ - public function getPayload(Zend_Wildfire_Channel_Interface $channel) - { - if (!$channel instanceof Zend_Wildfire_Channel_HttpHeaders) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('The '.get_class($channel).' channel is not supported by the '.get_class($this).' protocol.'); - } - - if ($this->_plugins) { - foreach ($this->_plugins as $plugin) { - $plugin->flushMessages(self::PROTOCOL_URI); - } - } - - if (!$this->_messages) { - return false; - } - - $protocol_index = 1; - $structure_index = 1; - $plugin_index = 1; - $message_index = 1; - - $payload = array(); - - $payload[] = array('Protocol-'.$protocol_index, self::PROTOCOL_URI); - - foreach ($this->_messages as $structure_uri => $plugin_messages ) { - - $payload[] = array($protocol_index.'-Structure-'.$structure_index, $structure_uri); - - foreach ($plugin_messages as $plugin_uri => $messages ) { - - $payload[] = array($protocol_index.'-Plugin-'.$plugin_index, $plugin_uri); - - foreach ($messages as $message) { - - $parts = explode("\n",chunk_split($message, 5000, "\n")); - - for ($i=0 ; $i2) { - $msg = (($i==0)?strlen($message):'') - . '|' . $part . '|' - . (($i 99999) { - require_once 'Zend/Wildfire/Exception.php'; - throw new Zend_Wildfire_Exception('Maximum number (99,999) of messages reached!'); - } - } - } - } - $plugin_index++; - } - $structure_index++; - } - - return $payload; - } - -} - diff --git a/library/vendor/Zend/Xml/Exception.php b/library/vendor/Zend/Xml/Exception.php index b58c24951..3d12d820a 100644 --- a/library/vendor/Zend/Xml/Exception.php +++ b/library/vendor/Zend/Xml/Exception.php @@ -23,7 +23,6 @@ /** * @see Zend_Exception */ -require_once 'Zend/Exception.php'; /** diff --git a/library/vendor/Zend/Xml/Security.php b/library/vendor/Zend/Xml/Security.php index d95d4f81e..321e1e63a 100644 --- a/library/vendor/Zend/Xml/Security.php +++ b/library/vendor/Zend/Xml/Security.php @@ -108,7 +108,6 @@ class Zend_Xml_Security foreach ($dom->childNodes as $child) { if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) { if ($child->entities->length > 0) { - require_once 'Exception.php'; throw new Zend_Xml_Exception(self::ENTITY_DETECT); } } @@ -142,7 +141,6 @@ class Zend_Xml_Security public static function scanFile($file, DOMDocument $dom = null) { if (!file_exists($file)) { - require_once 'Exception.php'; throw new Zend_Xml_Exception( "The file $file specified doesn't exist" ); diff --git a/library/vendor/Zend/XmlRpc/Client.php b/library/vendor/Zend/XmlRpc/Client.php deleted file mode 100644 index 4c298cd71..000000000 --- a/library/vendor/Zend/XmlRpc/Client.php +++ /dev/null @@ -1,403 +0,0 @@ -_httpClient = new Zend_Http_Client(); - } else { - $this->_httpClient = $httpClient; - } - - $this->_introspector = new Zend_XmlRpc_Client_ServerIntrospection($this); - $this->_serverAddress = $server; - } - - - /** - * Sets the HTTP client object to use for connecting the XML-RPC server. - * - * @param Zend_Http_Client $httpClient - * @return Zend_Http_Client - */ - public function setHttpClient(Zend_Http_Client $httpClient) - { - return $this->_httpClient = $httpClient; - } - - - /** - * Gets the HTTP client object. - * - * @return Zend_Http_Client - */ - public function getHttpClient() - { - return $this->_httpClient; - } - - - /** - * Sets the object used to introspect remote servers - * - * @param Zend_XmlRpc_Client_ServerIntrospection - * @return Zend_XmlRpc_Client_ServerIntrospection - */ - public function setIntrospector(Zend_XmlRpc_Client_ServerIntrospection $introspector) - { - return $this->_introspector = $introspector; - } - - - /** - * Gets the introspection object. - * - * @return Zend_XmlRpc_Client_ServerIntrospection - */ - public function getIntrospector() - { - return $this->_introspector; - } - - - /** - * The request of the last method call - * - * @return Zend_XmlRpc_Request - */ - public function getLastRequest() - { - return $this->_lastRequest; - } - - - /** - * The response received from the last method call - * - * @return Zend_XmlRpc_Response - */ - public function getLastResponse() - { - return $this->_lastResponse; - } - - - /** - * Returns a proxy object for more convenient method calls - * - * @param string $namespace Namespace to proxy or empty string for none - * @return Zend_XmlRpc_Client_ServerProxy - */ - public function getProxy($namespace = '') - { - if (empty($this->_proxyCache[$namespace])) { - $proxy = new Zend_XmlRpc_Client_ServerProxy($this, $namespace); - $this->_proxyCache[$namespace] = $proxy; - } - return $this->_proxyCache[$namespace]; - } - - /** - * Set skip system lookup flag - * - * @param bool $flag - * @return Zend_XmlRpc_Client - */ - public function setSkipSystemLookup($flag = true) - { - $this->_skipSystemLookup = (bool) $flag; - return $this; - } - - /** - * Skip system lookup when determining if parameter should be array or struct? - * - * @return bool - */ - public function skipSystemLookup() - { - return $this->_skipSystemLookup; - } - - /** - * Perform an XML-RPC request and return a response. - * - * @param Zend_XmlRpc_Request $request - * @param null|Zend_XmlRpc_Response $response - * @return void - * @throws Zend_XmlRpc_Client_HttpException - */ - public function doRequest($request, $response = null) - { - $this->_lastRequest = $request; - - if (PHP_VERSION_ID < 50600) { - iconv_set_encoding('input_encoding', 'UTF-8'); - iconv_set_encoding('output_encoding', 'UTF-8'); - iconv_set_encoding('internal_encoding', 'UTF-8'); - } else { - ini_set('input_encoding', 'UTF-8'); - ini_set('output_encoding', 'UTF-8'); - ini_set('default_charset', 'UTF-8'); - } - - $http = $this->getHttpClient(); - if($http->getUri() === null) { - $http->setUri($this->_serverAddress); - } - - $http->setHeaders(array( - 'Content-Type: text/xml; charset=utf-8', - 'Accept: text/xml', - )); - - if ($http->getHeader('user-agent') === null) { - $http->setHeaders(array('User-Agent: Zend_XmlRpc_Client')); - } - - $xml = $this->_lastRequest->__toString(); - $http->setRawData($xml); - $httpResponse = $http->request(Zend_Http_Client::POST); - - if (! $httpResponse->isSuccessful()) { - /** - * Exception thrown when an HTTP error occurs - * @see Zend_XmlRpc_Client_HttpException - */ - require_once 'Zend/XmlRpc/Client/HttpException.php'; - throw new Zend_XmlRpc_Client_HttpException( - $httpResponse->getMessage(), - $httpResponse->getStatus()); - } - - if ($response === null) { - $response = new Zend_XmlRpc_Response(); - } - $this->_lastResponse = $response; - $this->_lastResponse->loadXml(trim($httpResponse->getBody())); - } - - /** - * Send an XML-RPC request to the service (for a specific method) - * - * @param string $method Name of the method we want to call - * @param array $params Array of parameters for the method - * @return mixed - * @throws Zend_XmlRpc_Client_FaultException - */ - public function call($method, $params=array()) - { - if (!$this->skipSystemLookup() && ('system.' != substr($method, 0, 7))) { - // Ensure empty array/struct params are cast correctly - // If system.* methods are not available, bypass. (ZF-2978) - $success = true; - try { - $signatures = $this->getIntrospector()->getMethodSignature($method); - } catch (Zend_XmlRpc_Exception $e) { - $success = false; - } - if ($success) { - $validTypes = array( - Zend_XmlRpc_Value::XMLRPC_TYPE_ARRAY, - Zend_XmlRpc_Value::XMLRPC_TYPE_BASE64, - Zend_XmlRpc_Value::XMLRPC_TYPE_BOOLEAN, - Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME, - Zend_XmlRpc_Value::XMLRPC_TYPE_DOUBLE, - Zend_XmlRpc_Value::XMLRPC_TYPE_I4, - Zend_XmlRpc_Value::XMLRPC_TYPE_INTEGER, - Zend_XmlRpc_Value::XMLRPC_TYPE_NIL, - Zend_XmlRpc_Value::XMLRPC_TYPE_STRING, - Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT, - ); - - if (!is_array($params)) { - $params = array($params); - } - - foreach ($params as $key => $param) - { - if ($param instanceof Zend_XmlRpc_Value) { - continue; - } - - if (count($signatures) > 1) { - $type = Zend_XmlRpc_Value::getXmlRpcTypeByValue($param); - foreach ($signatures as $signature) { - if (!is_array($signature)) { - continue; - } - if (isset($signature['parameters'][$key])) { - if ($signature['parameters'][$key] == $type) { - break; - } - } - } - } elseif (isset($signatures[0]['parameters'][$key])) { - $type = $signatures[0]['parameters'][$key]; - } else { - $type = null; - } - - if (empty($type) || !in_array($type, $validTypes)) { - $type = Zend_XmlRpc_Value::AUTO_DETECT_TYPE; - } - - $params[$key] = Zend_XmlRpc_Value::getXmlRpcValue($param, $type); - } - } - } - - $request = $this->_createRequest($method, $params); - - $this->doRequest($request); - - if ($this->_lastResponse->isFault()) { - $fault = $this->_lastResponse->getFault(); - /** - * Exception thrown when an XML-RPC fault is returned - * @see Zend_XmlRpc_Client_FaultException - */ - require_once 'Zend/XmlRpc/Client/FaultException.php'; - throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), - $fault->getCode()); - } - - return $this->_lastResponse->getReturnValue(); - } - - /** - * Create request object - * - * @return Zend_XmlRpc_Request - */ - protected function _createRequest($method, $params) - { - return new Zend_XmlRpc_Request($method, $params); - } -} diff --git a/library/vendor/Zend/XmlRpc/Client/Exception.php b/library/vendor/Zend/XmlRpc/Client/Exception.php deleted file mode 100644 index d82601da6..000000000 --- a/library/vendor/Zend/XmlRpc/Client/Exception.php +++ /dev/null @@ -1,40 +0,0 @@ -_system = $client->getProxy('system'); - } - - /** - * Returns the signature for each method on the server, - * autodetecting whether system.multicall() is supported and - * using it if so. - * - * @return array - */ - public function getSignatureForEachMethod() - { - $methods = $this->listMethods(); - - require_once 'Zend/XmlRpc/Client/FaultException.php'; - try { - $signatures = $this->getSignatureForEachMethodByMulticall($methods); - } catch (Zend_XmlRpc_Client_FaultException $e) { - // degrade to looping - } - - if (empty($signatures)) { - $signatures = $this->getSignatureForEachMethodByLooping($methods); - } - - return $signatures; - } - - /** - * Attempt to get the method signatures in one request via system.multicall(). - * This is a boxcar feature of XML-RPC and is found on fewer servers. However, - * can significantly improve performance if present. - * - * @param array $methods - * @return array array(array(return, param, param, param...)) - */ - public function getSignatureForEachMethodByMulticall($methods = null) - { - if ($methods === null) { - $methods = $this->listMethods(); - } - - $multicallParams = array(); - foreach ($methods as $method) { - $multicallParams[] = array('methodName' => 'system.methodSignature', - 'params' => array($method)); - } - - $serverSignatures = $this->_system->multicall($multicallParams); - - if (! is_array($serverSignatures)) { - $type = gettype($serverSignatures); - $error = "Multicall return is malformed. Expected array, got $type"; - require_once 'Zend/XmlRpc/Client/IntrospectException.php'; - throw new Zend_XmlRpc_Client_IntrospectException($error); - } - - if (count($serverSignatures) != count($methods)) { - $error = 'Bad number of signatures received from multicall'; - require_once 'Zend/XmlRpc/Client/IntrospectException.php'; - throw new Zend_XmlRpc_Client_IntrospectException($error); - } - - // Create a new signatures array with the methods name as keys and the signature as value - $signatures = array(); - foreach ($serverSignatures as $i => $signature) { - $signatures[$methods[$i]] = $signature; - } - - return $signatures; - } - - /** - * Get the method signatures for every method by - * successively calling system.methodSignature - * - * @param array $methods - * @return array - */ - public function getSignatureForEachMethodByLooping($methods = null) - { - if ($methods === null) { - $methods = $this->listMethods(); - } - - $signatures = array(); - foreach ($methods as $method) { - $signatures[$method] = $this->getMethodSignature($method); - } - - return $signatures; - } - - /** - * Call system.methodSignature() for the given method - * - * @param array $method - * @return array array(array(return, param, param, param...)) - */ - public function getMethodSignature($method) - { - $signature = $this->_system->methodSignature($method); - if (!is_array($signature)) { - $error = 'Invalid signature for method "' . $method . '"'; - require_once 'Zend/XmlRpc/Client/IntrospectException.php'; - throw new Zend_XmlRpc_Client_IntrospectException($error); - } - return $signature; - } - - /** - * Call system.listMethods() - * - * @param array $method - * @return array array(method, method, method...) - */ - public function listMethods() - { - return $this->_system->listMethods(); - } - -} diff --git a/library/vendor/Zend/XmlRpc/Client/ServerProxy.php b/library/vendor/Zend/XmlRpc/Client/ServerProxy.php deleted file mode 100644 index 516619773..000000000 --- a/library/vendor/Zend/XmlRpc/Client/ServerProxy.php +++ /dev/null @@ -1,95 +0,0 @@ -foo->bar->baz()". - * - * @category Zend - * @package Zend_XmlRpc - * @subpackage Client - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_XmlRpc_Client_ServerProxy -{ - /** - * @var Zend_XmlRpc_Client - */ - private $_client = null; - - /** - * @var string - */ - private $_namespace = ''; - - - /** - * @var array of Zend_XmlRpc_Client_ServerProxy - */ - private $_cache = array(); - - - /** - * Class constructor - * - * @param string $namespace - * @param Zend_XmlRpc_Client $client - */ - public function __construct($client, $namespace = '') - { - $this->_namespace = $namespace; - $this->_client = $client; - } - - - /** - * Get the next successive namespace - * - * @param string $name - * @return Zend_XmlRpc_Client_ServerProxy - */ - public function __get($namespace) - { - $namespace = ltrim("$this->_namespace.$namespace", '.'); - if (!isset($this->_cache[$namespace])) { - $this->_cache[$namespace] = new $this($this->_client, $namespace); - } - return $this->_cache[$namespace]; - } - - - /** - * Call a method in this namespace. - * - * @param string $methodN - * @param array $args - * @return mixed - */ - public function __call($method, $args) - { - $method = ltrim("$this->_namespace.$method", '.'); - return $this->_client->call($method, $args); - } -} diff --git a/library/vendor/Zend/XmlRpc/Exception.php b/library/vendor/Zend/XmlRpc/Exception.php deleted file mode 100644 index d3350515a..000000000 --- a/library/vendor/Zend/XmlRpc/Exception.php +++ /dev/null @@ -1,37 +0,0 @@ - messages - * @var array - */ - protected $_internal = array( - 404 => 'Unknown Error', - - // 610 - 619 reflection errors - 610 => 'Invalid method class', - 611 => 'Unable to attach function or callback; not callable', - 612 => 'Unable to load array; not an array', - 613 => 'One or more method records are corrupt or otherwise unusable', - - // 620 - 629 dispatch errors - 620 => 'Method does not exist', - 621 => 'Error instantiating class to invoke method', - 622 => 'Method missing implementation', - 623 => 'Calling parameters do not match signature', - - // 630 - 639 request errors - 630 => 'Unable to read request', - 631 => 'Failed to parse request', - 632 => 'Invalid request, no method passed; request must contain a \'methodName\' tag', - 633 => 'Param must contain a value', - 634 => 'Invalid method name', - 635 => 'Invalid XML provided to request', - 636 => 'Error creating xmlrpc value', - - // 640 - 649 system.* errors - 640 => 'Method does not exist', - - // 650 - 659 response errors - 650 => 'Invalid XML provided for response', - 651 => 'Failed to parse response', - 652 => 'Invalid response', - 653 => 'Invalid XMLRPC value in response', - ); - - /** - * Constructor - * - * @return Zend_XmlRpc_Fault - */ - public function __construct($code = 404, $message = '') - { - $this->setCode($code); - $code = $this->getCode(); - - if (empty($message) && isset($this->_internal[$code])) { - $message = $this->_internal[$code]; - } elseif (empty($message)) { - $message = 'Unknown error'; - } - $this->setMessage($message); - } - - /** - * Set the fault code - * - * @param int $code - * @return Zend_XmlRpc_Fault - */ - public function setCode($code) - { - $this->_code = (int) $code; - return $this; - } - - /** - * Return fault code - * - * @return int - */ - public function getCode() - { - return $this->_code; - } - - /** - * Retrieve fault message - * - * @param string - * @return Zend_XmlRpc_Fault - */ - public function setMessage($message) - { - $this->_message = (string) $message; - return $this; - } - - /** - * Retrieve fault message - * - * @return string - */ - public function getMessage() - { - return $this->_message; - } - - /** - * Set encoding to use in fault response - * - * @param string $encoding - * @return Zend_XmlRpc_Fault - */ - public function setEncoding($encoding) - { - $this->_encoding = $encoding; - Zend_XmlRpc_Value::setEncoding($encoding); - return $this; - } - - /** - * Retrieve current fault encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Load an XMLRPC fault from XML - * - * @param string $fault - * @return boolean Returns true if successfully loaded fault response, false - * if response was not a fault response - * @throws Zend_XmlRpc_Exception if no or faulty XML provided, or if fault - * response does not contain either code or message - */ - public function loadXml($fault) - { - if (!is_string($fault)) { - require_once 'Zend/XmlRpc/Exception.php'; - throw new Zend_XmlRpc_Exception('Invalid XML provided to fault'); - } - - try { - $xml = @new SimpleXMLElement($fault); - } catch (Exception $e) { - // Not valid XML - require_once 'Zend/XmlRpc/Exception.php'; - throw new Zend_XmlRpc_Exception('Failed to parse XML fault: ' . $e->getMessage(), 500, $e); - } - - // Check for fault - if (!$xml->fault) { - // Not a fault - return false; - } - - if (!$xml->fault->value->struct) { - // not a proper fault - require_once 'Zend/XmlRpc/Exception.php'; - throw new Zend_XmlRpc_Exception('Invalid fault structure', 500); - } - - $structXml = $xml->fault->value->asXML(); - $struct = Zend_XmlRpc_Value::getXmlRpcValue($structXml, Zend_XmlRpc_Value::XML_STRING); - $struct = $struct->getValue(); - - if (isset($struct['faultCode'])) { - $code = $struct['faultCode']; - } - if (isset($struct['faultString'])) { - $message = $struct['faultString']; - } - - if (empty($code) && empty($message)) { - require_once 'Zend/XmlRpc/Exception.php'; - throw new Zend_XmlRpc_Exception('Fault code and string required'); - } - - if (empty($code)) { - $code = '404'; - } - - if (empty($message)) { - if (isset($this->_internal[$code])) { - $message = $this->_internal[$code]; - } else { - $message = 'Unknown Error'; - } - } - - $this->setCode($code); - $this->setMessage($message); - - return true; - } - - /** - * Determine if an XML response is an XMLRPC fault - * - * @param string $xml - * @return boolean - */ - public static function isFault($xml) - { - $fault = new self(); - require_once 'Zend/XmlRpc/Exception.php'; - try { - $isFault = $fault->loadXml($xml); - } catch (Zend_XmlRpc_Exception $e) { - $isFault = false; - } - - return $isFault; - } - - /** - * Serialize fault to XML - * - * @return string - */ - public function saveXml() - { - // Create fault value - $faultStruct = array( - 'faultCode' => $this->getCode(), - 'faultString' => $this->getMessage() - ); - $value = Zend_XmlRpc_Value::getXmlRpcValue($faultStruct); - - $generator = Zend_XmlRpc_Value::getGenerator(); - $generator->openElement('methodResponse') - ->openElement('fault'); - $value->generateXml(); - $generator->closeElement('fault') - ->closeElement('methodResponse'); - - return $generator->flush(); - } - - /** - * Return XML fault response - * - * @return string - */ - public function __toString() - { - return $this->saveXML(); - } -} diff --git a/library/vendor/Zend/XmlRpc/Generator/DomDocument.php b/library/vendor/Zend/XmlRpc/Generator/DomDocument.php deleted file mode 100644 index 88bc05fa0..000000000 --- a/library/vendor/Zend/XmlRpc/Generator/DomDocument.php +++ /dev/null @@ -1,101 +0,0 @@ -_dom->createElement($name); - - $this->_currentElement = $this->_currentElement->appendChild($newElement); - } - - /** - * Write XML text data into the currently opened XML element - * - * @param string $text - */ - protected function _writeTextData($text) - { - $this->_currentElement->appendChild($this->_dom->createTextNode($text)); - } - - /** - * Close an previously opened XML element - * - * Resets $_currentElement to the next parent node in the hierarchy - * - * @param string $name - * @return void - */ - protected function _closeElement($name) - { - if (isset($this->_currentElement->parentNode)) { - $this->_currentElement = $this->_currentElement->parentNode; - } - } - - /** - * Save XML as a string - * - * @return string - */ - public function saveXml() - { - return $this->_dom->saveXml(); - } - - /** - * Initializes internal objects - * - * @return void - */ - protected function _init() - { - $this->_dom = new DOMDocument('1.0', $this->_encoding); - $this->_currentElement = $this->_dom; - } -} diff --git a/library/vendor/Zend/XmlRpc/Generator/GeneratorAbstract.php b/library/vendor/Zend/XmlRpc/Generator/GeneratorAbstract.php deleted file mode 100644 index 03afcd696..000000000 --- a/library/vendor/Zend/XmlRpc/Generator/GeneratorAbstract.php +++ /dev/null @@ -1,150 +0,0 @@ -_encoding = $encoding; - $this->_init(); - } - - /** - * Start XML element - * - * Method opens a new XML element with an element name and an optional value - * - * @param string $name XML tag name - * @param string $value Optional value of the XML tag - * @return Zend_XmlRpc_Generator_Abstract Fluent interface - */ - public function openElement($name, $value = null) - { - $this->_openElement($name); - if ($value !== null) { - $this->_writeTextData($value); - } - - return $this; - } - - /** - * End of an XML element - * - * Method marks the end of an XML element - * - * @param string $name XML tag name - * @return Zend_XmlRpc_Generator_Abstract Fluent interface - */ - public function closeElement($name) - { - $this->_closeElement($name); - - return $this; - } - - /** - * Return XML as a string - * - * @return string - */ - abstract public function saveXml(); - - /** - * Return encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Returns the XML as a string and flushes all internal buffers - * - * @return string - */ - public function flush() - { - $xml = $this->saveXml(); - $this->_init(); - return $xml; - } - - /** - * Returns XML without document declaration - * - * @return string - */ - public function __toString() - { - return $this->stripDeclaration($this->saveXml()); - } - - /** - * Removes XML declaration from a string - * - * @param string $xml - * @return string - */ - public function stripDeclaration($xml) - { - return preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $xml); - } - - /** - * Start XML element - * - * @param string $name XML element name - */ - abstract protected function _openElement($name); - - /** - * Write XML text data into the currently opened XML element - * - * @param string $text - */ - abstract protected function _writeTextData($text); - - /** - * End XML element - * - * @param string $name - */ - abstract protected function _closeElement($name); -} diff --git a/library/vendor/Zend/XmlRpc/Generator/XmlWriter.php b/library/vendor/Zend/XmlRpc/Generator/XmlWriter.php deleted file mode 100644 index a84e11d3b..000000000 --- a/library/vendor/Zend/XmlRpc/Generator/XmlWriter.php +++ /dev/null @@ -1,93 +0,0 @@ -_xmlWriter = new XMLWriter(); - $this->_xmlWriter->openMemory(); - $this->_xmlWriter->startDocument('1.0', $this->_encoding); - } - - - /** - * Open a new XML element - * - * @param string $name XML element name - * @return void - */ - protected function _openElement($name) - { - $this->_xmlWriter->startElement($name); - } - - /** - * Write XML text data into the currently opened XML element - * - * @param string $text XML text data - * @return void - */ - protected function _writeTextData($text) - { - $this->_xmlWriter->text($text); - } - - /** - * Close an previously opened XML element - * - * @param string $name - * @return void - */ - protected function _closeElement($name) - { - $this->_xmlWriter->endElement(); - - return $this; - } - - public function saveXml() - { - $xml = $this->_xmlWriter->flush(false); - return $xml; - } -} diff --git a/library/vendor/Zend/XmlRpc/Request.php b/library/vendor/Zend/XmlRpc/Request.php deleted file mode 100644 index 73bb9670a..000000000 --- a/library/vendor/Zend/XmlRpc/Request.php +++ /dev/null @@ -1,445 +0,0 @@ -setMethod($method); - } - - if ($params !== null) { - $this->setParams($params); - } - } - - - /** - * Set encoding to use in request - * - * @param string $encoding - * @return Zend_XmlRpc_Request - */ - public function setEncoding($encoding) - { - $this->_encoding = $encoding; - Zend_XmlRpc_Value::setEncoding($encoding); - return $this; - } - - /** - * Retrieve current request encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set method to call - * - * @param string $method - * @return boolean Returns true on success, false if method name is invalid - */ - public function setMethod($method) - { - if (!is_string($method) || !preg_match('/^[a-z0-9_.:\/]+$/i', $method)) { - $this->_fault = new Zend_XmlRpc_Fault(634, 'Invalid method name ("' . $method . '")'); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - $this->_method = $method; - return true; - } - - /** - * Retrieve call method - * - * @return string - */ - public function getMethod() - { - return $this->_method; - } - - /** - * Add a parameter to the parameter stack - * - * Adds a parameter to the parameter stack, associating it with the type - * $type if provided - * - * @param mixed $value - * @param string $type Optional; type hinting - * @return void - */ - public function addParam($value, $type = null) - { - $this->_params[] = $value; - if (null === $type) { - // Detect type if not provided explicitly - if ($value instanceof Zend_XmlRpc_Value) { - $type = $value->getType(); - } else { - $xmlRpcValue = Zend_XmlRpc_Value::getXmlRpcValue($value); - $type = $xmlRpcValue->getType(); - } - } - $this->_types[] = $type; - $this->_xmlRpcParams[] = array('value' => $value, 'type' => $type); - } - - /** - * Set the parameters array - * - * If called with a single, array value, that array is used to set the - * parameters stack. If called with multiple values or a single non-array - * value, the arguments are used to set the parameters stack. - * - * Best is to call with array of the format, in order to allow type hinting - * when creating the XMLRPC values for each parameter: - * - * $array = array( - * array( - * 'value' => $value, - * 'type' => $type - * )[, ... ] - * ); - * - * - * @access public - * @return void - */ - public function setParams() - { - $argc = func_num_args(); - $argv = func_get_args(); - if (0 == $argc) { - return; - } - - if ((1 == $argc) && is_array($argv[0])) { - $params = array(); - $types = array(); - $wellFormed = true; - foreach ($argv[0] as $arg) { - if (!is_array($arg) || !isset($arg['value'])) { - $wellFormed = false; - break; - } - $params[] = $arg['value']; - - if (!isset($arg['type'])) { - $xmlRpcValue = Zend_XmlRpc_Value::getXmlRpcValue($arg['value']); - $arg['type'] = $xmlRpcValue->getType(); - } - $types[] = $arg['type']; - } - if ($wellFormed) { - $this->_xmlRpcParams = $argv[0]; - $this->_params = $params; - $this->_types = $types; - } else { - $this->_params = $argv[0]; - $this->_types = array(); - $xmlRpcParams = array(); - foreach ($argv[0] as $arg) { - if ($arg instanceof Zend_XmlRpc_Value) { - $type = $arg->getType(); - } else { - $xmlRpcValue = Zend_XmlRpc_Value::getXmlRpcValue($arg); - $type = $xmlRpcValue->getType(); - } - $xmlRpcParams[] = array('value' => $arg, 'type' => $type); - $this->_types[] = $type; - } - $this->_xmlRpcParams = $xmlRpcParams; - } - return; - } - - $this->_params = $argv; - $this->_types = array(); - $xmlRpcParams = array(); - foreach ($argv as $arg) { - if ($arg instanceof Zend_XmlRpc_Value) { - $type = $arg->getType(); - } else { - $xmlRpcValue = Zend_XmlRpc_Value::getXmlRpcValue($arg); - $type = $xmlRpcValue->getType(); - } - $xmlRpcParams[] = array('value' => $arg, 'type' => $type); - $this->_types[] = $type; - } - $this->_xmlRpcParams = $xmlRpcParams; - } - - /** - * Retrieve the array of parameters - * - * @return array - */ - public function getParams() - { - return $this->_params; - } - - /** - * Return parameter types - * - * @return array - */ - public function getTypes() - { - return $this->_types; - } - - /** - * Load XML and parse into request components - * - * @param string $request - * @return boolean True on success, false if an error occurred. - */ - public function loadXml($request) - { - if (!is_string($request)) { - $this->_fault = new Zend_XmlRpc_Fault(635); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - try { - $xml = Zend_Xml_Security::scan($request); - } catch (Zend_Xml_Exception $e) { - // Not valid XML - $this->_fault = new Zend_XmlRpc_Fault(631); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - // Check for method name - if (empty($xml->methodName)) { - // Missing method name - $this->_fault = new Zend_XmlRpc_Fault(632); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - $this->_method = (string) $xml->methodName; - - // Check for parameters - if (!empty($xml->params)) { - $types = array(); - $argv = array(); - foreach ($xml->params->children() as $param) { - if (!isset($param->value)) { - $this->_fault = new Zend_XmlRpc_Fault(633); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - try { - $param = Zend_XmlRpc_Value::getXmlRpcValue($param->value, Zend_XmlRpc_Value::XML_STRING); - $types[] = $param->getType(); - $argv[] = $param->getValue(); - } catch (Exception $e) { - $this->_fault = new Zend_XmlRpc_Fault(636); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - } - - $this->_types = $types; - $this->_params = $argv; - } - - $this->_xml = $request; - - return true; - } - - /** - * Does the current request contain errors and should it return a fault - * response? - * - * @return boolean - */ - public function isFault() - { - return $this->_fault instanceof Zend_XmlRpc_Fault; - } - - /** - * Retrieve the fault response, if any - * - * @return null|Zend_XmlRpc_Fault - */ - public function getFault() - { - return $this->_fault; - } - - /** - * Retrieve method parameters as XMLRPC values - * - * @return array - */ - protected function _getXmlRpcParams() - { - $params = array(); - if (is_array($this->_xmlRpcParams)) { - foreach ($this->_xmlRpcParams as $param) { - $value = $param['value']; - $type = isset($param['type']) ? $param['type'] : Zend_XmlRpc_Value::AUTO_DETECT_TYPE; - - if (!$value instanceof Zend_XmlRpc_Value) { - $value = Zend_XmlRpc_Value::getXmlRpcValue($value, $type); - } - $params[] = $value; - } - } - - return $params; - } - - /** - * Create XML request - * - * @return string - */ - public function saveXml() - { - $args = $this->_getXmlRpcParams(); - $method = $this->getMethod(); - - $generator = Zend_XmlRpc_Value::getGenerator(); - $generator->openElement('methodCall') - ->openElement('methodName', $method) - ->closeElement('methodName'); - - if (is_array($args) && count($args)) { - $generator->openElement('params'); - - foreach ($args as $arg) { - $generator->openElement('param'); - $arg->generateXml(); - $generator->closeElement('param'); - } - $generator->closeElement('params'); - } - $generator->closeElement('methodCall'); - - return $generator->flush(); - } - - /** - * Return XML request - * - * @return string - */ - public function __toString() - { - return $this->saveXML(); - } -} diff --git a/library/vendor/Zend/XmlRpc/Request/Http.php b/library/vendor/Zend/XmlRpc/Request/Http.php deleted file mode 100644 index df058a1a8..000000000 --- a/library/vendor/Zend/XmlRpc/Request/Http.php +++ /dev/null @@ -1,124 +0,0 @@ -_fault = new Zend_XmlRpc_Fault(630); - return; - } - - $this->_xml = $xml; - - $this->loadXml($xml); - } - - /** - * Retrieve the raw XML request - * - * @return string - */ - public function getRawRequest() - { - return $this->_xml; - } - - /** - * Get headers - * - * Gets all headers as key => value pairs and returns them. - * - * @return array - */ - public function getHeaders() - { - if (null === $this->_headers) { - $this->_headers = array(); - foreach ($_SERVER as $key => $value) { - if ('HTTP_' == substr($key, 0, 5)) { - $header = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5))))); - $this->_headers[$header] = $value; - } - } - } - - return $this->_headers; - } - - /** - * Retrieve the full HTTP request, including headers and XML - * - * @return string - */ - public function getFullRequest() - { - $request = ''; - foreach ($this->getHeaders() as $key => $value) { - $request .= $key . ': ' . $value . "\n"; - } - - $request .= $this->_xml; - - return $request; - } -} diff --git a/library/vendor/Zend/XmlRpc/Request/Stdin.php b/library/vendor/Zend/XmlRpc/Request/Stdin.php deleted file mode 100644 index d6bb539e1..000000000 --- a/library/vendor/Zend/XmlRpc/Request/Stdin.php +++ /dev/null @@ -1,84 +0,0 @@ -_fault = new Zend_XmlRpc_Server_Exception(630); - return; - } - - $xml = ''; - while (!feof($fh)) { - $xml .= fgets($fh); - } - fclose($fh); - - $this->_xml = $xml; - - $this->loadXml($xml); - } - - /** - * Retrieve the raw XML request - * - * @return string - */ - public function getRawRequest() - { - return $this->_xml; - } -} diff --git a/library/vendor/Zend/XmlRpc/Response.php b/library/vendor/Zend/XmlRpc/Response.php deleted file mode 100644 index be5a6cbb4..000000000 --- a/library/vendor/Zend/XmlRpc/Response.php +++ /dev/null @@ -1,255 +0,0 @@ -setReturnValue($return, $type); - } - - /** - * Set encoding to use in response - * - * @param string $encoding - * @return Zend_XmlRpc_Response - */ - public function setEncoding($encoding) - { - $this->_encoding = $encoding; - Zend_XmlRpc_Value::setEncoding($encoding); - return $this; - } - - /** - * Retrieve current response encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Set the return value - * - * Sets the return value, with optional type hinting if provided. - * - * @param mixed $value - * @param string $type - * @return void - */ - public function setReturnValue($value, $type = null) - { - $this->_return = $value; - $this->_type = (string) $type; - } - - /** - * Retrieve the return value - * - * @return mixed - */ - public function getReturnValue() - { - return $this->_return; - } - - /** - * Retrieve the XMLRPC value for the return value - * - * @return Zend_XmlRpc_Value - */ - protected function _getXmlRpcReturn() - { - return Zend_XmlRpc_Value::getXmlRpcValue($this->_return); - } - - /** - * Is the response a fault response? - * - * @return boolean - */ - public function isFault() - { - return $this->_fault instanceof Zend_XmlRpc_Fault; - } - - /** - * Returns the fault, if any. - * - * @return null|Zend_XmlRpc_Fault - */ - public function getFault() - { - return $this->_fault; - } - - /** - * Load a response from an XML response - * - * Attempts to load a response from an XMLRPC response, autodetecting if it - * is a fault response. - * - * @param string $response - * @return boolean True if a valid XMLRPC response, false if a fault - * response or invalid input - */ - public function loadXml($response) - { - if (!is_string($response)) { - $this->_fault = new Zend_XmlRpc_Fault(650); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - try { - $xml = Zend_Xml_Security::scan($response); - } catch (Zend_Xml_Exception $e) { - // Not valid XML - $this->_fault = new Zend_XmlRpc_Fault(651); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - if (!empty($xml->fault)) { - // fault response - $this->_fault = new Zend_XmlRpc_Fault(); - $this->_fault->setEncoding($this->getEncoding()); - $this->_fault->loadXml($response); - return false; - } - - if (empty($xml->params)) { - // Invalid response - $this->_fault = new Zend_XmlRpc_Fault(652); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - try { - if (!isset($xml->params) || !isset($xml->params->param) || !isset($xml->params->param->value)) { - require_once 'Zend/XmlRpc/Value/Exception.php'; - throw new Zend_XmlRpc_Value_Exception('Missing XML-RPC value in XML'); - } - $valueXml = $xml->params->param->value->asXML(); - $value = Zend_XmlRpc_Value::getXmlRpcValue($valueXml, Zend_XmlRpc_Value::XML_STRING); - } catch (Zend_XmlRpc_Value_Exception $e) { - $this->_fault = new Zend_XmlRpc_Fault(653); - $this->_fault->setEncoding($this->getEncoding()); - return false; - } - - $this->setReturnValue($value->getValue()); - return true; - } - - /** - * Return response as XML - * - * @return string - */ - public function saveXml() - { - $value = $this->_getXmlRpcReturn(); - $generator = Zend_XmlRpc_Value::getGenerator(); - $generator->openElement('methodResponse') - ->openElement('params') - ->openElement('param'); - $value->generateXml(); - $generator->closeElement('param') - ->closeElement('params') - ->closeElement('methodResponse'); - - return $generator->flush(); - } - - /** - * Return XML response - * - * @return string - */ - public function __toString() - { - return $this->saveXML(); - } -} diff --git a/library/vendor/Zend/XmlRpc/Response/Http.php b/library/vendor/Zend/XmlRpc/Response/Http.php deleted file mode 100644 index 5bc246ba6..000000000 --- a/library/vendor/Zend/XmlRpc/Response/Http.php +++ /dev/null @@ -1,51 +0,0 @@ -getEncoding())); - } - - return parent::__toString(); - } -} diff --git a/library/vendor/Zend/XmlRpc/Server.php b/library/vendor/Zend/XmlRpc/Server.php deleted file mode 100644 index 1c747084b..000000000 --- a/library/vendor/Zend/XmlRpc/Server.php +++ /dev/null @@ -1,615 +0,0 @@ - - * require_once 'Zend/XmlRpc/Server.php'; - * require_once 'Zend/XmlRpc/Server/Cache.php'; - * require_once 'Zend/XmlRpc/Server/Fault.php'; - * require_once 'My/Exception.php'; - * require_once 'My/Fault/Observer.php'; - * - * // Instantiate server - * $server = new Zend_XmlRpc_Server(); - * - * // Allow some exceptions to report as fault responses: - * Zend_XmlRpc_Server_Fault::attachFaultException('My_Exception'); - * Zend_XmlRpc_Server_Fault::attachObserver('My_Fault_Observer'); - * - * // Get or build dispatch table: - * if (!Zend_XmlRpc_Server_Cache::get($filename, $server)) { - * require_once 'Some/Service/Class.php'; - * require_once 'Another/Service/Class.php'; - * - * // Attach Some_Service_Class in 'some' namespace - * $server->setClass('Some_Service_Class', 'some'); - * - * // Attach Another_Service_Class in 'another' namespace - * $server->setClass('Another_Service_Class', 'another'); - * - * // Create dispatch table cache file - * Zend_XmlRpc_Server_Cache::save($filename, $server); - * } - * - * $response = $server->handle(); - * echo $response; - * - * - * @category Zend - * @package Zend_XmlRpc - * @subpackage Server - * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - */ -class Zend_XmlRpc_Server extends Zend_Server_Abstract -{ - /** - * Character encoding - * @var string - */ - protected $_encoding = 'UTF-8'; - - /** - * Request processed - * @var null|Zend_XmlRpc_Request - */ - protected $_request = null; - - /** - * Class to use for responses; defaults to {@link Zend_XmlRpc_Response_Http} - * @var string - */ - protected $_responseClass = 'Zend_XmlRpc_Response_Http'; - - /** - * Dispatch table of name => method pairs - * @var Zend_Server_Definition - */ - protected $_table; - - /** - * PHP types => XML-RPC types - * @var array - */ - protected $_typeMap = array( - 'i4' => 'i4', - 'int' => 'int', - 'integer' => 'int', - 'Zend_Crypt_Math_BigInteger' => 'i8', - 'i8' => 'i8', - 'ex:i8' => 'i8', - 'double' => 'double', - 'float' => 'double', - 'real' => 'double', - 'boolean' => 'boolean', - 'bool' => 'boolean', - 'true' => 'boolean', - 'false' => 'boolean', - 'string' => 'string', - 'str' => 'string', - 'base64' => 'base64', - 'dateTime.iso8601' => 'dateTime.iso8601', - 'date' => 'dateTime.iso8601', - 'time' => 'dateTime.iso8601', - 'time' => 'dateTime.iso8601', - 'Zend_Date' => 'dateTime.iso8601', - 'DateTime' => 'dateTime.iso8601', - 'array' => 'array', - 'struct' => 'struct', - 'null' => 'nil', - 'nil' => 'nil', - 'ex:nil' => 'nil', - 'void' => 'void', - 'mixed' => 'struct', - ); - - /** - * Send arguments to all methods or just constructor? - * - * @var bool - */ - protected $_sendArgumentsToAllMethods = true; - - /** - * Constructor - * - * Creates system.* methods. - * - * @return void - */ - public function __construct() - { - $this->_table = new Zend_Server_Definition(); - $this->_registerSystemMethods(); - } - - /** - * Proxy calls to system object - * - * @param string $method - * @param array $params - * @return mixed - * @throws Zend_XmlRpc_Server_Exception - */ - public function __call($method, $params) - { - $system = $this->getSystem(); - if (!method_exists($system, $method)) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Unknown instance method called on server: ' . $method); - } - return call_user_func_array(array($system, $method), $params); - } - - /** - * Attach a callback as an XMLRPC method - * - * Attaches a callback as an XMLRPC method, prefixing the XMLRPC method name - * with $namespace, if provided. Reflection is done on the callback's - * docblock to create the methodHelp for the XMLRPC method. - * - * Additional arguments to pass to the function at dispatch may be passed; - * any arguments following the namespace will be aggregated and passed at - * dispatch time. - * - * @param string|array $function Valid callback - * @param string $namespace Optional namespace prefix - * @return void - * @throws Zend_XmlRpc_Server_Exception - */ - public function addFunction($function, $namespace = '') - { - if (!is_string($function) && !is_array($function)) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Unable to attach function; invalid', 611); - } - - $argv = null; - if (2 < func_num_args()) { - $argv = func_get_args(); - $argv = array_slice($argv, 2); - } - - $function = (array) $function; - foreach ($function as $func) { - if (!is_string($func) || !function_exists($func)) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Unable to attach function; invalid', 611); - } - $reflection = Zend_Server_Reflection::reflectFunction($func, $argv, $namespace); - $this->_buildSignature($reflection); - } - } - - /** - * Attach class methods as XMLRPC method handlers - * - * $class may be either a class name or an object. Reflection is done on the - * class or object to determine the available public methods, and each is - * attached to the server as an available method; if a $namespace has been - * provided, that namespace is used to prefix the XMLRPC method names. - * - * Any additional arguments beyond $namespace will be passed to a method at - * invocation. - * - * @param string|object $class - * @param string $namespace Optional - * @param mixed $argv Optional arguments to pass to methods - * @return void - * @throws Zend_XmlRpc_Server_Exception on invalid input - */ - public function setClass($class, $namespace = '', $argv = null) - { - if (is_string($class) && !class_exists($class)) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Invalid method class', 610); - } - - $args = null; - if (2 < func_num_args()) { - $args = func_get_args(); - $args = array_slice($args, 2); - } - - $dispatchable = Zend_Server_Reflection::reflectClass($class, $args, $namespace); - foreach ($dispatchable->getMethods() as $reflection) { - $this->_buildSignature($reflection, $class); - } - } - - /** - * Raise an xmlrpc server fault - * - * @param string|Exception $fault - * @param int $code - * @return Zend_XmlRpc_Server_Fault - */ - public function fault($fault = null, $code = 404) - { - if (!$fault instanceof Exception) { - $fault = (string) $fault; - if (empty($fault)) { - $fault = 'Unknown Error'; - } - require_once 'Zend/XmlRpc/Server/Exception.php'; - $fault = new Zend_XmlRpc_Server_Exception($fault, $code); - } - - return Zend_XmlRpc_Server_Fault::getInstance($fault); - } - - /** - * Handle an xmlrpc call - * - * @param Zend_XmlRpc_Request $request Optional - * @return Zend_XmlRpc_Response|Zend_XmlRpc_Fault - */ - public function handle($request = false) - { - // Get request - if ((!$request || !$request instanceof Zend_XmlRpc_Request) - && (null === ($request = $this->getRequest())) - ) { - require_once 'Zend/XmlRpc/Request/Http.php'; - $request = new Zend_XmlRpc_Request_Http(); - $request->setEncoding($this->getEncoding()); - } - - $this->setRequest($request); - - if ($request->isFault()) { - $response = $request->getFault(); - } else { - try { - $response = $this->_handle($request); - } catch (Exception $e) { - $response = $this->fault($e); - } - } - - // Set output encoding - $response->setEncoding($this->getEncoding()); - - return $response; - } - - /** - * Load methods as returned from {@link getFunctions} - * - * Typically, you will not use this method; it will be called using the - * results pulled from {@link Zend_XmlRpc_Server_Cache::get()}. - * - * @param array|Zend_Server_Definition $definition - * @return void - * @throws Zend_XmlRpc_Server_Exception on invalid input - */ - public function loadFunctions($definition) - { - if (!is_array($definition) && (!$definition instanceof Zend_Server_Definition)) { - if (is_object($definition)) { - $type = get_class($definition); - } else { - $type = gettype($definition); - } - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Unable to load server definition; must be an array or Zend_Server_Definition, received ' . $type, 612); - } - - $this->_table->clearMethods(); - $this->_registerSystemMethods(); - - if ($definition instanceof Zend_Server_Definition) { - $definition = $definition->getMethods(); - } - - foreach ($definition as $key => $method) { - if ('system.' == substr($key, 0, 7)) { - continue; - } - $this->_table->addMethod($method, $key); - } - } - - /** - * Set encoding - * - * @param string $encoding - * @return Zend_XmlRpc_Server - */ - public function setEncoding($encoding) - { - $this->_encoding = $encoding; - Zend_XmlRpc_Value::setEncoding($encoding); - return $this; - } - - /** - * Retrieve current encoding - * - * @return string - */ - public function getEncoding() - { - return $this->_encoding; - } - - /** - * Do nothing; persistence is handled via {@link Zend_XmlRpc_Server_Cache} - * - * @param mixed $mode - * @return void - */ - public function setPersistence($mode) - { - } - - /** - * Set the request object - * - * @param string|Zend_XmlRpc_Request $request - * @return Zend_XmlRpc_Server - * @throws Zend_XmlRpc_Server_Exception on invalid request class or object - */ - public function setRequest($request) - { - if (is_string($request) && class_exists($request)) { - $request = new $request(); - if (!$request instanceof Zend_XmlRpc_Request) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Invalid request class'); - } - $request->setEncoding($this->getEncoding()); - } elseif (!$request instanceof Zend_XmlRpc_Request) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Invalid request object'); - } - - $this->_request = $request; - return $this; - } - - /** - * Return currently registered request object - * - * @return null|Zend_XmlRpc_Request - */ - public function getRequest() - { - return $this->_request; - } - - /** - * Set the class to use for the response - * - * @param string $class - * @return boolean True if class was set, false if not - */ - public function setResponseClass($class) - { - if (!class_exists($class) or - ($c = new ReflectionClass($class) and !$c->isSubclassOf('Zend_XmlRpc_Response'))) { - - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Invalid response class'); - } - $this->_responseClass = $class; - return true; - } - - /** - * Retrieve current response class - * - * @return string - */ - public function getResponseClass() - { - return $this->_responseClass; - } - - /** - * Retrieve dispatch table - * - * @return array - */ - public function getDispatchTable() - { - return $this->_table; - } - - /** - * Returns a list of registered methods - * - * Returns an array of dispatchables (Zend_Server_Reflection_Function, - * _Method, and _Class items). - * - * @return array - */ - public function getFunctions() - { - return $this->_table->toArray(); - } - - /** - * Retrieve system object - * - * @return Zend_XmlRpc_Server_System - */ - public function getSystem() - { - return $this->_system; - } - - /** - * Send arguments to all methods? - * - * If setClass() is used to add classes to the server, this flag defined - * how to handle arguments. If set to true, all methods including constructor - * will receive the arguments. If set to false, only constructor will receive the - * arguments - */ - public function sendArgumentsToAllMethods($flag = null) - { - if ($flag === null) { - return $this->_sendArgumentsToAllMethods; - } - - $this->_sendArgumentsToAllMethods = (bool)$flag; - return $this; - } - - /** - * Map PHP type to XML-RPC type - * - * @param string $type - * @return string - */ - protected function _fixType($type) - { - if (isset($this->_typeMap[$type])) { - return $this->_typeMap[$type]; - } - return 'void'; - } - - /** - * Handle an xmlrpc call (actual work) - * - * @param Zend_XmlRpc_Request $request - * @return Zend_XmlRpc_Response - * @throws Zend_XmlRpcServer_Exception|Exception - * Zend_XmlRpcServer_Exceptions are thrown for internal errors; otherwise, - * any other exception may be thrown by the callback - */ - protected function _handle(Zend_XmlRpc_Request $request) - { - $method = $request->getMethod(); - - // Check for valid method - if (!$this->_table->hasMethod($method)) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 620); - } - - $info = $this->_table->getMethod($method); - $params = $request->getParams(); - $argv = $info->getInvokeArguments(); - if (0 < count($argv) and $this->sendArgumentsToAllMethods()) { - $params = array_merge($params, $argv); - } - - // Check calling parameters against signatures - $matched = false; - $sigCalled = $request->getTypes(); - - $sigLength = count($sigCalled); - $paramsLen = count($params); - if ($sigLength < $paramsLen) { - for ($i = $sigLength; $i < $paramsLen; ++$i) { - $xmlRpcValue = Zend_XmlRpc_Value::getXmlRpcValue($params[$i]); - $sigCalled[] = $xmlRpcValue->getType(); - } - } - - $signatures = $info->getPrototypes(); - foreach ($signatures as $signature) { - $sigParams = $signature->getParameters(); - if ($sigCalled === $sigParams) { - $matched = true; - break; - } - } - if (!$matched) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Calling parameters do not match signature', 623); - } - - $return = $this->_dispatch($info, $params); - $responseClass = $this->getResponseClass(); - return new $responseClass($return); - } - - /** - * Register system methods with the server - * - * @return void - */ - protected function _registerSystemMethods() - { - $system = new Zend_XmlRpc_Server_System($this); - $this->_system = $system; - $this->setClass($system, 'system'); - } -} diff --git a/library/vendor/Zend/XmlRpc/Server/Cache.php b/library/vendor/Zend/XmlRpc/Server/Cache.php deleted file mode 100644 index 7c52902b6..000000000 --- a/library/vendor/Zend/XmlRpc/Server/Cache.php +++ /dev/null @@ -1,46 +0,0 @@ - true); - - /** - * @var array Array of fault observers - */ - protected static $_observers = array(); - - /** - * Constructor - * - * @param Exception $e - * @return Zend_XmlRpc_Server_Fault - */ - public function __construct(Exception $e) - { - $this->_exception = $e; - $code = 404; - $message = 'Unknown error'; - $exceptionClass = get_class($e); - - foreach (array_keys(self::$_faultExceptionClasses) as $class) { - if ($e instanceof $class) { - $code = $e->getCode(); - $message = $e->getMessage(); - break; - } - } - - parent::__construct($code, $message); - - // Notify exception observers, if present - if (!empty(self::$_observers)) { - foreach (array_keys(self::$_observers) as $observer) { - call_user_func(array($observer, 'observe'), $this); - } - } - } - - /** - * Return Zend_XmlRpc_Server_Fault instance - * - * @param Exception $e - * @return Zend_XmlRpc_Server_Fault - */ - public static function getInstance(Exception $e) - { - return new self($e); - } - - /** - * Attach valid exceptions that can be used to define xmlrpc faults - * - * @param string|array $classes Class name or array of class names - * @return void - */ - public static function attachFaultException($classes) - { - if (!is_array($classes)) { - $classes = (array) $classes; - } - - foreach ($classes as $class) { - if (is_string($class) && class_exists($class)) { - self::$_faultExceptionClasses[$class] = true; - } - } - } - - /** - * Detach fault exception classes - * - * @param string|array $classes Class name or array of class names - * @return void - */ - public static function detachFaultException($classes) - { - if (!is_array($classes)) { - $classes = (array) $classes; - } - - foreach ($classes as $class) { - if (is_string($class) && isset(self::$_faultExceptionClasses[$class])) { - unset(self::$_faultExceptionClasses[$class]); - } - } - } - - /** - * Attach an observer class - * - * Allows observation of xmlrpc server faults, thus allowing logging or mail - * notification of fault responses on the xmlrpc server. - * - * Expects a valid class name; that class must have a public static method - * 'observe' that accepts an exception as its sole argument. - * - * @param string $class - * @return boolean - */ - public static function attachObserver($class) - { - if (!is_string($class) - || !class_exists($class) - || !is_callable(array($class, 'observe'))) - { - return false; - } - - if (!isset(self::$_observers[$class])) { - self::$_observers[$class] = true; - } - - return true; - } - - /** - * Detach an observer - * - * @param string $class - * @return boolean - */ - public static function detachObserver($class) - { - if (!isset(self::$_observers[$class])) { - return false; - } - - unset(self::$_observers[$class]); - return true; - } - - /** - * Retrieve the exception - * - * @access public - * @return Exception - */ - public function getException() - { - return $this->_exception; - } -} diff --git a/library/vendor/Zend/XmlRpc/Server/System.php b/library/vendor/Zend/XmlRpc/Server/System.php deleted file mode 100644 index 340eb1cd7..000000000 --- a/library/vendor/Zend/XmlRpc/Server/System.php +++ /dev/null @@ -1,162 +0,0 @@ -_server = $server; - } - - /** - * List all available XMLRPC methods - * - * Returns an array of methods. - * - * @return array - */ - public function listMethods() - { - $table = $this->_server->getDispatchTable()->getMethods(); - return array_keys($table); - } - - /** - * Display help message for an XMLRPC method - * - * @param string $method - * @return string - */ - public function methodHelp($method) - { - $table = $this->_server->getDispatchTable(); - if (!$table->hasMethod($method)) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 640); - } - - return $table->getMethod($method)->getMethodHelp(); - } - - /** - * Return a method signature - * - * @param string $method - * @return array - */ - public function methodSignature($method) - { - $table = $this->_server->getDispatchTable(); - if (!$table->hasMethod($method)) { - require_once 'Zend/XmlRpc/Server/Exception.php'; - throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 640); - } - $method = $table->getMethod($method)->toArray(); - return $method['prototypes']; - } - - /** - * Multicall - boxcar feature of XML-RPC for calling multiple methods - * in a single request. - * - * Expects a an array of structs representing method calls, each element - * having the keys: - * - methodName - * - params - * - * Returns an array of responses, one for each method called, with the value - * returned by the method. If an error occurs for a given method, returns a - * struct with a fault response. - * - * @see http://www.xmlrpc.com/discuss/msgReader$1208 - * @param array $methods - * @return array - */ - public function multicall($methods) - { - $responses = array(); - foreach ($methods as $method) { - $fault = false; - if (!is_array($method)) { - $fault = $this->_server->fault('system.multicall expects each method to be a struct', 601); - } elseif (!isset($method['methodName'])) { - $fault = $this->_server->fault('Missing methodName: ' . var_export($methods, 1), 602); - } elseif (!isset($method['params'])) { - $fault = $this->_server->fault('Missing params', 603); - } elseif (!is_array($method['params'])) { - $fault = $this->_server->fault('Params must be an array', 604); - } else { - if ('system.multicall' == $method['methodName']) { - // don't allow recursive calls to multicall - $fault = $this->_server->fault('Recursive system.multicall forbidden', 605); - } - } - - if (!$fault) { - try { - $request = new Zend_XmlRpc_Request(); - $request->setMethod($method['methodName']); - $request->setParams($method['params']); - $response = $this->_server->handle($request); - if ($response instanceof Zend_XmlRpc_Fault - || $response->isFault() - ) { - $fault = $response; - } else { - $responses[] = $response->getReturnValue(); - } - } catch (Exception $e) { - $fault = $this->_server->fault($e); - } - } - - if ($fault) { - $responses[] = array( - 'faultCode' => $fault->getCode(), - 'faultString' => $fault->getMessage() - ); - } - } - - return $responses; - } -} diff --git a/library/vendor/Zend/XmlRpc/Value.php b/library/vendor/Zend/XmlRpc/Value.php deleted file mode 100644 index 6b2244996..000000000 --- a/library/vendor/Zend/XmlRpc/Value.php +++ /dev/null @@ -1,525 +0,0 @@ -_type; - } - - /** - * Get XML generator instance - * - * @return Zend_XmlRpc_Generator_GeneratorAbstract - */ - public static function getGenerator() - { - if (!self::$_generator) { - if (extension_loaded('xmlwriter')) { - require_once 'Zend/XmlRpc/Generator/XmlWriter.php'; - self::$_generator = new Zend_XmlRpc_Generator_XmlWriter(); - } else { - require_once 'Zend/XmlRpc/Generator/DomDocument.php'; - self::$_generator = new Zend_XmlRpc_Generator_DomDocument(); - } - } - - return self::$_generator; - } - - /** - * Sets XML generator instance - * - * @param Zend_XmlRpc_Generator_GeneratorAbstract $generator - * @return void - */ - public static function setGenerator(Zend_XmlRpc_Generator_GeneratorAbstract $generator) - { - self::$_generator = $generator; - } - - /** - * Changes the encoding of the generator - * - * @param string $encoding - * @return void - */ - public static function setEncoding($encoding) - { - $generator = self::getGenerator(); - $newGenerator = new $generator($encoding); - self::setGenerator($newGenerator); - } - - /** - * Return the value of this object, convert the XML-RPC native value into a PHP variable - * - * @return mixed - */ - abstract public function getValue(); - - - /** - * Return the XML code that represent a native MXL-RPC value - * - * @return string - */ - public function saveXml() - { - if (!$this->_xml) { - $this->generateXml(); - $this->_xml = (string) $this->getGenerator(); - } - return $this->_xml; - } - - /** - * Generate XML code that represent a native XML/RPC value - * - * @return void - */ - public function generateXml() - { - $this->_generateXml(); - } - - /** - * Creates a Zend_XmlRpc_Value* object, representing a native XML-RPC value - * A XmlRpcValue object can be created in 3 ways: - * 1. Autodetecting the native type out of a PHP variable - * (if $type is not set or equal to Zend_XmlRpc_Value::AUTO_DETECT_TYPE) - * 2. By specifing the native type ($type is one of the Zend_XmlRpc_Value::XMLRPC_TYPE_* constants) - * 3. From a XML string ($type is set to Zend_XmlRpc_Value::XML_STRING) - * - * By default the value type is autodetected according to it's PHP type - * - * @param mixed $value - * @param Zend_XmlRpc_Value::constant $type - * - * @return Zend_XmlRpc_Value - * @static - */ - public static function getXmlRpcValue($value, $type = self::AUTO_DETECT_TYPE) - { - switch ($type) { - case self::AUTO_DETECT_TYPE: - // Auto detect the XML-RPC native type from the PHP type of $value - return self::_phpVarToNativeXmlRpc($value); - - case self::XML_STRING: - // Parse the XML string given in $value and get the XML-RPC value in it - return self::_xmlStringToNativeXmlRpc($value); - - case self::XMLRPC_TYPE_I4: - // fall through to the next case - case self::XMLRPC_TYPE_INTEGER: - require_once 'Zend/XmlRpc/Value/Integer.php'; - return new Zend_XmlRpc_Value_Integer($value); - - case self::XMLRPC_TYPE_I8: - // fall through to the next case - case self::XMLRPC_TYPE_APACHEI8: - require_once 'Zend/XmlRpc/Value/BigInteger.php'; - return new Zend_XmlRpc_Value_BigInteger($value); - - case self::XMLRPC_TYPE_DOUBLE: - require_once 'Zend/XmlRpc/Value/Double.php'; - return new Zend_XmlRpc_Value_Double($value); - - case self::XMLRPC_TYPE_BOOLEAN: - require_once 'Zend/XmlRpc/Value/Boolean.php'; - return new Zend_XmlRpc_Value_Boolean($value); - - case self::XMLRPC_TYPE_STRING: - require_once 'Zend/XmlRpc/Value/String.php'; - return new Zend_XmlRpc_Value_String($value); - - case self::XMLRPC_TYPE_BASE64: - require_once 'Zend/XmlRpc/Value/Base64.php'; - return new Zend_XmlRpc_Value_Base64($value); - - case self::XMLRPC_TYPE_NIL: - // fall through to the next case - case self::XMLRPC_TYPE_APACHENIL: - require_once 'Zend/XmlRpc/Value/Nil.php'; - return new Zend_XmlRpc_Value_Nil(); - - case self::XMLRPC_TYPE_DATETIME: - require_once 'Zend/XmlRpc/Value/DateTime.php'; - return new Zend_XmlRpc_Value_DateTime($value); - - case self::XMLRPC_TYPE_ARRAY: - require_once 'Zend/XmlRpc/Value/Array.php'; - return new Zend_XmlRpc_Value_Array($value); - - case self::XMLRPC_TYPE_STRUCT: - require_once 'Zend/XmlRpc/Value/Struct.php'; - return new Zend_XmlRpc_Value_Struct($value); - - default: - require_once 'Zend/XmlRpc/Value/Exception.php'; - throw new Zend_XmlRpc_Value_Exception('Given type is not a '. __CLASS__ .' constant'); - } - } - - /** - * Get XML-RPC type for a PHP native variable - * - * @static - * @param mixed $value - * @return string - */ - public static function getXmlRpcTypeByValue($value) - { - if (is_object($value)) { - if ($value instanceof Zend_XmlRpc_Value) { - return $value->getType(); - } elseif (($value instanceof Zend_Date) || ($value instanceof DateTime)) { - return self::XMLRPC_TYPE_DATETIME; - } - return self::getXmlRpcTypeByValue(get_object_vars($value)); - } elseif (is_array($value)) { - if (!empty($value) && is_array($value) && (array_keys($value) !== range(0, count($value) - 1))) { - return self::XMLRPC_TYPE_STRUCT; - } - return self::XMLRPC_TYPE_ARRAY; - } elseif (is_int($value)) { - return ($value > PHP_INT_MAX) ? self::XMLRPC_TYPE_I8 : self::XMLRPC_TYPE_INTEGER; - } elseif (is_double($value)) { - return self::XMLRPC_TYPE_DOUBLE; - } elseif (is_bool($value)) { - return self::XMLRPC_TYPE_BOOLEAN; - } elseif (is_null($value)) { - return self::XMLRPC_TYPE_NIL; - } elseif (is_string($value)) { - return self::XMLRPC_TYPE_STRING; - } - throw new Zend_XmlRpc_Value_Exception(sprintf( - 'No matching XMLRPC type found for php type %s.', - gettype($value) - )); - } - - /** - * Transform a PHP native variable into a XML-RPC native value - * - * @param mixed $value The PHP variable for convertion - * - * @return Zend_XmlRpc_Value - * @static - */ - protected static function _phpVarToNativeXmlRpc($value) - { - // @see http://framework.zend.com/issues/browse/ZF-8623 - if (is_object($value)) { - if ($value instanceof Zend_XmlRpc_Value) { - return $value; - } - if ($value instanceof Zend_Crypt_Math_BigInteger) { - require_once 'Zend/XmlRpc/Value/Exception.php'; - throw new Zend_XmlRpc_Value_Exception( - 'Using Zend_Crypt_Math_BigInteger to get an ' . - 'instance of Zend_XmlRpc_Value_BigInteger is not ' . - 'available anymore.' - ); - } - } - - switch (self::getXmlRpcTypeByValue($value)) - { - case self::XMLRPC_TYPE_DATETIME: - require_once 'Zend/XmlRpc/Value/DateTime.php'; - return new Zend_XmlRpc_Value_DateTime($value); - - case self::XMLRPC_TYPE_ARRAY: - require_once 'Zend/XmlRpc/Value/Array.php'; - return new Zend_XmlRpc_Value_Array($value); - - case self::XMLRPC_TYPE_STRUCT: - require_once 'Zend/XmlRpc/Value/Struct.php'; - return new Zend_XmlRpc_Value_Struct($value); - - case self::XMLRPC_TYPE_INTEGER: - require_once 'Zend/XmlRpc/Value/Integer.php'; - return new Zend_XmlRpc_Value_Integer($value); - - case self::XMLRPC_TYPE_DOUBLE: - require_once 'Zend/XmlRpc/Value/Double.php'; - return new Zend_XmlRpc_Value_Double($value); - - case self::XMLRPC_TYPE_BOOLEAN: - require_once 'Zend/XmlRpc/Value/Boolean.php'; - return new Zend_XmlRpc_Value_Boolean($value); - - case self::XMLRPC_TYPE_NIL: - require_once 'Zend/XmlRpc/Value/Nil.php'; - return new Zend_XmlRpc_Value_Nil; - - case self::XMLRPC_TYPE_STRING: - // Fall through to the next case - default: - // If type isn't identified (or identified as string), it treated as string - require_once 'Zend/XmlRpc/Value/String.php'; - return new Zend_XmlRpc_Value_String($value); - } - } - - - /** - * Transform an XML string into a XML-RPC native value - * - * @param string|SimpleXMLElement $xml A SimpleXMLElement object represent the XML string - * It can be also a valid XML string for convertion - * - * @return Zend_XmlRpc_Value - * @static - */ - protected static function _xmlStringToNativeXmlRpc($xml) - { - self::_createSimpleXMLElement($xml); - - self::_extractTypeAndValue($xml, $type, $value); - - switch ($type) { - // All valid and known XML-RPC native values - case self::XMLRPC_TYPE_I4: - // Fall through to the next case - case self::XMLRPC_TYPE_INTEGER: - require_once 'Zend/XmlRpc/Value/Integer.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_Integer($value); - break; - case self::XMLRPC_TYPE_APACHEI8: - // Fall through to the next case - case self::XMLRPC_TYPE_I8: - require_once 'Zend/XmlRpc/Value/BigInteger.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_BigInteger($value); - break; - case self::XMLRPC_TYPE_DOUBLE: - require_once 'Zend/XmlRpc/Value/Double.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_Double($value); - break; - case self::XMLRPC_TYPE_BOOLEAN: - require_once 'Zend/XmlRpc/Value/Boolean.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_Boolean($value); - break; - case self::XMLRPC_TYPE_STRING: - require_once 'Zend/XmlRpc/Value/String.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_String($value); - break; - case self::XMLRPC_TYPE_DATETIME: // The value should already be in a iso8601 format - require_once 'Zend/XmlRpc/Value/DateTime.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_DateTime($value); - break; - case self::XMLRPC_TYPE_BASE64: // The value should already be base64 encoded - require_once 'Zend/XmlRpc/Value/Base64.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_Base64($value, true); - break; - case self::XMLRPC_TYPE_NIL: - // Fall through to the next case - case self::XMLRPC_TYPE_APACHENIL: - // The value should always be NULL - require_once 'Zend/XmlRpc/Value/Nil.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_Nil(); - break; - case self::XMLRPC_TYPE_ARRAY: - // PHP 5.2.4 introduced a regression in how empty($xml->value) - // returns; need to look for the item specifically - $data = null; - foreach ($value->children() as $key => $value) { - if ('data' == $key) { - $data = $value; - break; - } - } - - if (null === $data) { - require_once 'Zend/XmlRpc/Value/Exception.php'; - throw new Zend_XmlRpc_Value_Exception('Invalid XML for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type: ARRAY tag must contain DATA tag'); - } - $values = array(); - // Parse all the elements of the array from the XML string - // (simple xml element) to Zend_XmlRpc_Value objects - foreach ($data->value as $element) { - $values[] = self::_xmlStringToNativeXmlRpc($element); - } - require_once 'Zend/XmlRpc/Value/Array.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_Array($values); - break; - case self::XMLRPC_TYPE_STRUCT: - $values = array(); - // Parse all the memebers of the struct from the XML string - // (simple xml element) to Zend_XmlRpc_Value objects - foreach ($value->member as $member) { - // @todo? If a member doesn't have a tag, we don't add it to the struct - // Maybe we want to throw an exception here ? - if (!isset($member->value) or !isset($member->name)) { - continue; - //throw new Zend_XmlRpc_Value_Exception('Member of the '. self::XMLRPC_TYPE_STRUCT .' XML-RPC native type must contain a VALUE tag'); - } - $values[(string)$member->name] = self::_xmlStringToNativeXmlRpc($member->value); - } - require_once 'Zend/XmlRpc/Value/Struct.php'; - $xmlrpcValue = new Zend_XmlRpc_Value_Struct($values); - break; - default: - require_once 'Zend/XmlRpc/Value/Exception.php'; - throw new Zend_XmlRpc_Value_Exception('Value type \''. $type .'\' parsed from the XML string is not a known XML-RPC native type'); - break; - } - $xmlrpcValue->_setXML($xml->asXML()); - - return $xmlrpcValue; - } - - protected static function _createSimpleXMLElement(&$xml) - { - if ($xml instanceof SimpleXMLElement) { - return; - } - - try { - $xml = new SimpleXMLElement($xml); - } catch (Exception $e) { - // The given string is not a valid XML - require_once 'Zend/XmlRpc/Value/Exception.php'; - throw new Zend_XmlRpc_Value_Exception('Failed to create XML-RPC value from XML string: ' . $e->getMessage(), $e->getCode(), $e); - } - } - - /** - * Extract XML/RPC type and value from SimpleXMLElement object - * - * @param SimpleXMLElement $xml - * @param string &$type Type bind variable - * @param string &$value Value bind variable - * @return void - */ - protected static function _extractTypeAndValue(SimpleXMLElement $xml, &$type, &$value) - { - list($type, $value) = each($xml); - - if (!$type and $value === null) { - $namespaces = array('ex' => 'http://ws.apache.org/xmlrpc/namespaces/extensions'); - foreach ($namespaces as $namespaceName => $namespaceUri) { - $namespaceXml = $xml->children($namespaceUri); - list($type, $value) = each($namespaceXml); - if ($type !== null) { - $type = $namespaceName . ':' . $type; - break; - } - } - } - - //if there is a child element, try to parse type for it - if (!$type && $value instanceof SimpleXMLElement) { - self::_extractTypeAndValue($value->children(), $type, $value); - } - - // If no type was specified, the default is string - if (!$type) { - $type = self::XMLRPC_TYPE_STRING; - if (preg_match('#^.*$#', $xml->asXML())) { - $value = str_replace(array('', ''), '', $xml->asXML()); - } - } - } - - /** - * @param string $xml - * @return void - */ - protected function _setXML($xml) - { - $this->_xml = $this->getGenerator()->stripDeclaration($xml); - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/Array.php b/library/vendor/Zend/XmlRpc/Value/Array.php deleted file mode 100644 index 60f68b296..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Array.php +++ /dev/null @@ -1,73 +0,0 @@ -_type = self::XMLRPC_TYPE_ARRAY; - parent::__construct($value); - } - - - /** - * Generate the XML code that represent an array native MXL-RPC value - * - * @return void - */ - protected function _generateXml() - { - $generator = $this->getGenerator(); - $generator->openElement('value') - ->openElement('array') - ->openElement('data'); - - if (is_array($this->_value)) { - foreach ($this->_value as $val) { - $val->generateXml(); - } - } - $generator->closeElement('data') - ->closeElement('array') - ->closeElement('value'); - } -} - diff --git a/library/vendor/Zend/XmlRpc/Value/Base64.php b/library/vendor/Zend/XmlRpc/Value/Base64.php deleted file mode 100644 index eee61bae5..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Base64.php +++ /dev/null @@ -1,68 +0,0 @@ -_type = self::XMLRPC_TYPE_BASE64; - - $value = (string)$value; // Make sure this value is string - if (!$alreadyEncoded) { - $value = base64_encode($value); // We encode it in base64 - } - $this->_value = $value; - } - - /** - * Return the value of this object, convert the XML-RPC native base64 value into a PHP string - * We return this value decoded (a normal string) - * - * @return string - */ - public function getValue() - { - return base64_decode($this->_value); - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/BigInteger.php b/library/vendor/Zend/XmlRpc/Value/BigInteger.php deleted file mode 100644 index b636a5814..000000000 --- a/library/vendor/Zend/XmlRpc/Value/BigInteger.php +++ /dev/null @@ -1,58 +0,0 @@ -_value = $integer->init($value); - $this->_type = self::XMLRPC_TYPE_I8; - } - - /** - * Return bigint value - * - * @return string - */ - public function getValue() - { - return $this->_value; - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/Boolean.php b/library/vendor/Zend/XmlRpc/Value/Boolean.php deleted file mode 100644 index 1a91872ca..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Boolean.php +++ /dev/null @@ -1,63 +0,0 @@ -_type = self::XMLRPC_TYPE_BOOLEAN; - // Make sure the value is boolean and then convert it into a integer - // The double convertion is because a bug in the ZendOptimizer in PHP version 5.0.4 - $this->_value = (int)(bool)$value; - } - - /** - * Return the value of this object, convert the XML-RPC native boolean value into a PHP boolean - * - * @return bool - */ - public function getValue() - { - return (bool)$this->_value; - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/Collection.php b/library/vendor/Zend/XmlRpc/Value/Collection.php deleted file mode 100644 index 2ef9a9a3d..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Collection.php +++ /dev/null @@ -1,73 +0,0 @@ - $value) { - // If the elements of the given array are not Zend_XmlRpc_Value objects, - // we need to convert them as such (using auto-detection from PHP value) - if (!$value instanceof parent) { - $value = self::getXmlRpcValue($value, self::AUTO_DETECT_TYPE); - } - $this->_value[$key] = $value; - } - } - - - /** - * Return the value of this object, convert the XML-RPC native collection values into a PHP array - * - * @return arary - */ - public function getValue() - { - $values = (array)$this->_value; - foreach ($values as $key => $value) { - /* @var $value Zend_XmlRpc_Value */ - $values[$key] = $value->getValue(); - } - return $values; - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/DateTime.php b/library/vendor/Zend/XmlRpc/Value/DateTime.php deleted file mode 100644 index 18d9991dc..000000000 --- a/library/vendor/Zend/XmlRpc/Value/DateTime.php +++ /dev/null @@ -1,91 +0,0 @@ -_type = self::XMLRPC_TYPE_DATETIME; - - if ($value instanceof Zend_Date) { - $this->_value = $value->toString($this->_isoFormatString); - } elseif ($value instanceof DateTime) { - $this->_value = $value->format($this->_phpFormatString); - } elseif (is_numeric($value)) { // The value is numeric, we make sure it is an integer - $this->_value = date($this->_phpFormatString, (int)$value); - } else { - $timestamp = new DateTime($value); - if ($timestamp === false) { // cannot convert the value to a timestamp - require_once 'Zend/XmlRpc/Value/Exception.php'; - throw new Zend_XmlRpc_Value_Exception('Cannot convert given value \''. $value .'\' to a timestamp'); - } - - $this->_value = $timestamp->format($this->_phpFormatString); // Convert the timestamp to iso8601 format - } - } - - /** - * Return the value of this object as iso8601 dateTime value - * - * @return int As a Unix timestamp - */ - public function getValue() - { - return $this->_value; - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/Double.php b/library/vendor/Zend/XmlRpc/Value/Double.php deleted file mode 100644 index 6251879f0..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Double.php +++ /dev/null @@ -1,62 +0,0 @@ -_type = self::XMLRPC_TYPE_DOUBLE; - $precision = (int)ini_get('precision'); - $formatString = '%1.' . $precision . 'F'; - $this->_value = rtrim(sprintf($formatString, (float)$value), '0'); - } - - /** - * Return the value of this object, convert the XML-RPC native double value into a PHP float - * - * @return float - */ - public function getValue() - { - return (float)$this->_value; - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/Exception.php b/library/vendor/Zend/XmlRpc/Value/Exception.php deleted file mode 100644 index 3a18f28e7..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Exception.php +++ /dev/null @@ -1,39 +0,0 @@ - PHP_INT_MAX) { - require_once 'Zend/XmlRpc/Value/Exception.php'; - throw new Zend_XmlRpc_Value_Exception('Overlong integer given'); - } - - $this->_type = self::XMLRPC_TYPE_INTEGER; - $this->_value = (int)$value; // Make sure this value is integer - } - - /** - * Return the value of this object, convert the XML-RPC native integer value into a PHP integer - * - * @return int - */ - public function getValue() - { - return $this->_value; - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/Nil.php b/library/vendor/Zend/XmlRpc/Value/Nil.php deleted file mode 100644 index 67305d0d8..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Nil.php +++ /dev/null @@ -1,60 +0,0 @@ -_type = self::XMLRPC_TYPE_NIL; - $this->_value = null; - } - - /** - * Return the value of this object, convert the XML-RPC native nill value into a PHP NULL - * - * @return null - */ - public function getValue() - { - return null; - } -} - diff --git a/library/vendor/Zend/XmlRpc/Value/Scalar.php b/library/vendor/Zend/XmlRpc/Value/Scalar.php deleted file mode 100644 index 86397d209..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Scalar.php +++ /dev/null @@ -1,53 +0,0 @@ -getGenerator(); - - $generator->openElement('value') - ->openElement($this->_type, $this->_value) - ->closeElement($this->_type) - ->closeElement('value'); - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/String.php b/library/vendor/Zend/XmlRpc/Value/String.php deleted file mode 100644 index 37ac5b832..000000000 --- a/library/vendor/Zend/XmlRpc/Value/String.php +++ /dev/null @@ -1,60 +0,0 @@ -_type = self::XMLRPC_TYPE_STRING; - - // Make sure this value is string and all XML characters are encoded - $this->_value = (string)$value; - } - - /** - * Return the value of this object, convert the XML-RPC native string value into a PHP string - * - * @return string - */ - public function getValue() - { - return (string)$this->_value; - } -} diff --git a/library/vendor/Zend/XmlRpc/Value/Struct.php b/library/vendor/Zend/XmlRpc/Value/Struct.php deleted file mode 100644 index 5272eb508..000000000 --- a/library/vendor/Zend/XmlRpc/Value/Struct.php +++ /dev/null @@ -1,75 +0,0 @@ -_type = self::XMLRPC_TYPE_STRUCT; - parent::__construct($value); - } - - - /** - * Generate the XML code that represent struct native MXL-RPC value - * - * @return void - */ - protected function _generateXML() - { - $generator = $this->getGenerator(); - $generator->openElement('value') - ->openElement('struct'); - - if (is_array($this->_value)) { - foreach ($this->_value as $name => $val) { - /* @var $val Zend_XmlRpc_Value */ - $generator->openElement('member') - ->openElement('name', $name) - ->closeElement('name'); - $val->generateXml(); - $generator->closeElement('member'); - } - } - $generator->closeElement('struct') - ->closeElement('value'); - } -}